U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 5/7] serial: ns16550: Provide ->getinfo() implementation
Date: Tue, 20 Nov 2018 23:52:36 +0200	[thread overview]
Message-ID: <20181120215238.21551-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20181120215238.21551-1-andriy.shevchenko@linux.intel.com>

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

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

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index b51b56de9f..226c5daf50 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -334,6 +334,25 @@ 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->type = SERIAL_CHIP_16550_COMPATIBLE;
+#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
+	info->addr_space = SERIAL_ADDRESS_SPACE_IO;
+#else
+	info->addr_space = SERIAL_ADDRESS_SPACE_MEMORY;
+#endif
+	info->addr = plat->base;
+	info->reg_width = plat->reg_width;
+	info->reg_shift = plat->reg_shift;
+	info->reg_offset = plat->reg_offset;
+	return 0;
+}
+
 int ns16550_serial_probe(struct udevice *dev)
 {
 	struct NS16550 *const com_port = dev_get_priv(dev);
@@ -441,6 +460,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

  parent reply	other threads:[~2018-11-20 21:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 21:52 [U-Boot] [PATCH v3 0/7] ACPI: Generate SPCR table Andy Shevchenko
2018-11-20 21:52 ` [U-Boot] [PATCH v3 1/7] dm: serial: Add ->getconfig() callback Andy Shevchenko
2018-11-27  1:02   ` Simon Glass
2018-11-27 16:02     ` Andy Shevchenko
2018-12-03 16:18       ` Andy Shevchenko
2018-12-05 12:55       ` Simon Glass
2018-12-05 14:01         ` Andy Shevchenko
2018-12-05 15:58           ` Simon Glass
2018-12-05 23:11             ` sjg at google.com
2018-11-20 21:52 ` [U-Boot] [PATCH v3 2/7] dm: serial: Introduce ->getinfo() callback Andy Shevchenko
2018-12-05 12:55   ` Simon Glass
2018-12-05 23:11     ` sjg at google.com
2018-11-20 21:52 ` [U-Boot] [PATCH v3 3/7] serial: ns16550: Group reg_* members of ns16550_platdata Andy Shevchenko
2018-12-05 12:55   ` Simon Glass
2018-12-05 23:11     ` sjg at google.com
2018-11-20 21:52 ` [U-Boot] [PATCH v3 4/7] serial: ns16550: Read reg-io-width from device tree Andy Shevchenko
2018-12-05 12:55   ` Simon Glass
2018-12-05 23:11     ` sjg at google.com
2018-11-20 21:52 ` Andy Shevchenko [this message]
2018-12-05 12:55   ` [U-Boot] [PATCH v3 5/7] serial: ns16550: Provide ->getinfo() implementation Simon Glass
2018-12-05 23:11     ` sjg at google.com
2018-11-20 21:52 ` [U-Boot] [PATCH v3 6/7] x86: acpi: Add SPCR table description Andy Shevchenko
2018-12-05 23:11   ` sjg at google.com
2018-11-20 21:52 ` [U-Boot] [PATCH v3 7/7] x86: acpi: Generate SPCR table Andy Shevchenko
2018-12-05 12:55   ` Simon Glass
2018-12-05 23:11     ` sjg at google.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181120215238.21551-6-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox