[U-Boot] [PATCH v2 3/5] serial: ns16550: Provide ->getinfo() implementation

Andy Shevchenko andriy.shevchenko at linux.intel.com
Thu Nov 15 17:58:52 UTC 2018


New callback will supply necessary information, for example,
to ACPI SPCR table.

Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
---
 drivers/serial/ns16550.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index b51b56de9f..698acbfb51 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -334,6 +334,19 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
 	return 0;
 }
 
+static int ns16550_serial_getinfo(struct udevice *dev, struct serial_device_info *info)
+{
+	struct NS16550 *const com_port = dev_get_priv(dev);
+	struct ns16550_platdata *plat = com_port->plat;
+
+	info->addr_space = 0;
+	info->reg_width = plat->reg_width * 8;
+	info->reg_shift = plat->reg_shift;
+	info->reg_offset = plat->reg_offset;
+	info->addr = plat->base;
+	return 0;
+}
+
 int ns16550_serial_probe(struct udevice *dev)
 {
 	struct NS16550 *const com_port = dev_get_priv(dev);
@@ -441,6 +454,7 @@ const struct dm_serial_ops ns16550_serial_ops = {
 	.pending = ns16550_serial_pending,
 	.getc = ns16550_serial_getc,
 	.setbrg = ns16550_serial_setbrg,
+	.getinfo = ns16550_serial_getinfo,
 };
 
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-- 
2.19.1



More information about the U-Boot mailing list