mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 18:34:42 +00:00
serial: serial_pl01x: Implement .getinfo() for PL01
When ACPI is enabled on arm it will use the getinfo function to fill the SPCR ACPI table. Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Moritz Fischer <moritzf@google.com>
This commit is contained in:
parent
d016abb47f
commit
ea37e5064e
3 changed files with 31 additions and 2 deletions
|
@ -936,11 +936,15 @@ int bootflow_cmdline_auto(struct bootflow *bflow, const char *arg)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
if (!strcmp("earlycon", arg)) {
|
if (!strcmp("earlycon", arg) && info.type == SERIAL_CHIP_16550_COMPATIBLE) {
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"uart8250,mmio32,%#lx,%dn8", info.addr,
|
"uart8250,mmio32,%#lx,%dn8", info.addr,
|
||||||
info.baudrate);
|
info.baudrate);
|
||||||
} else if (!strcmp("console", arg)) {
|
} else if (!strcmp("earlycon", arg) && info.type == SERIAL_CHIP_PL01X) {
|
||||||
|
snprintf(buf, sizeof(buf),
|
||||||
|
"pl011,mmio32,%#lx,%dn8", info.addr,
|
||||||
|
info.baudrate);
|
||||||
|
} else if (!strcmp("console", arg) && info.type == SERIAL_CHIP_16550_COMPATIBLE) {
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"ttyS0,%dn8", info.baudrate);
|
"ttyS0,%dn8", info.baudrate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
|
#include <spl.h>
|
||||||
#include <dm/device_compat.h>
|
#include <dm/device_compat.h>
|
||||||
#include <dm/platform_data/serial_pl01x.h>
|
#include <dm/platform_data/serial_pl01x.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
@ -272,6 +273,28 @@ __weak struct serial_device *default_serial_console(void)
|
||||||
return &pl01x_serial_drv;
|
return &pl01x_serial_drv;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
static int pl01x_serial_getinfo(struct udevice *dev,
|
||||||
|
struct serial_device_info *info)
|
||||||
|
{
|
||||||
|
struct pl01x_serial_plat *plat = dev_get_plat(dev);
|
||||||
|
|
||||||
|
/* save code size */
|
||||||
|
if (!not_xpl())
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
info->type = SERIAL_CHIP_PL01X;
|
||||||
|
info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
|
||||||
|
info->addr = plat->base;
|
||||||
|
info->size = 0x1000;
|
||||||
|
info->reg_width = 4;
|
||||||
|
info->reg_shift = 2;
|
||||||
|
info->reg_offset = 0;
|
||||||
|
info->clock = plat->clock;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
|
int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
|
||||||
{
|
{
|
||||||
struct pl01x_serial_plat *plat = dev_get_plat(dev);
|
struct pl01x_serial_plat *plat = dev_get_plat(dev);
|
||||||
|
@ -341,6 +364,7 @@ static const struct dm_serial_ops pl01x_serial_ops = {
|
||||||
.pending = pl01x_serial_pending,
|
.pending = pl01x_serial_pending,
|
||||||
.getc = pl01x_serial_getc,
|
.getc = pl01x_serial_getc,
|
||||||
.setbrg = pl01x_serial_setbrg,
|
.setbrg = pl01x_serial_setbrg,
|
||||||
|
.getinfo = pl01x_serial_getinfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||||
|
|
|
@ -124,6 +124,7 @@ enum serial_stop {
|
||||||
enum serial_chip_type {
|
enum serial_chip_type {
|
||||||
SERIAL_CHIP_UNKNOWN = -1,
|
SERIAL_CHIP_UNKNOWN = -1,
|
||||||
SERIAL_CHIP_16550_COMPATIBLE,
|
SERIAL_CHIP_16550_COMPATIBLE,
|
||||||
|
SERIAL_CHIP_PL01X,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum adr_space_type {
|
enum adr_space_type {
|
||||||
|
|
Loading…
Add table
Reference in a new issue