From: Angelo Dureghello <angelo@sysam.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/7] drivers: serial: mcfuart: add DT support
Date: Thu, 20 Sep 2018 23:07:51 +0200 [thread overview]
Message-ID: <20180920210755.22381-4-angelo@sysam.it> (raw)
In-Reply-To: <20180920210755.22381-1-angelo@sysam.it>
This patch adds devicetree support to the mcfuart.c driver.
Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---
drivers/serial/mcfuart.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 1371049de2..5896a19805 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -5,6 +5,9 @@
*
* Modified to add device model (DM) support
* (C) Copyright 2015 Angelo Dureghello <angelo@sysam.it>
+ *
+ * Modified to add fdt support
+ * (C) Copyright 2018 Angelo Dureghello <angelo@sysam.it>
*/
/*
@@ -212,6 +215,23 @@ static int coldfire_serial_pending(struct udevice *dev, bool input)
return 0;
}
+static int coldfire_ofdata_to_platdata(struct udevice *dev)
+{
+ struct coldfire_serial_platdata *plat = dev_get_platdata(dev);
+ fdt_addr_t addr_base;
+
+ addr_base = devfdt_get_addr(dev);
+ if (addr_base == FDT_ADDR_T_NONE)
+ return -ENODEV;
+
+ plat->base = (uint32_t)addr_base;
+
+ plat->port = dev->seq;
+ plat->baudrate = gd->baudrate;
+
+ return 0;
+}
+
static const struct dm_serial_ops coldfire_serial_ops = {
.putc = coldfire_serial_putc,
.pending = coldfire_serial_pending,
@@ -219,9 +239,17 @@ static const struct dm_serial_ops coldfire_serial_ops = {
.setbrg = coldfire_serial_setbrg,
};
+static const struct udevice_id coldfire_serial_ids[] = {
+ { .compatible = "fsl,mcf-uart" },
+ { }
+};
+
U_BOOT_DRIVER(serial_coldfire) = {
.name = "serial_coldfire",
.id = UCLASS_SERIAL,
+ .of_match = coldfire_serial_ids,
+ .ofdata_to_platdata = coldfire_ofdata_to_platdata,
+ .platdata_auto_alloc_size = sizeof(struct coldfire_serial_platdata),
.probe = coldfire_serial_probe,
.ops = &coldfire_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
--
2.19.0
next prev parent reply other threads:[~2018-09-20 21:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 21:07 [U-Boot] (no subject) Angelo Dureghello
2018-09-20 21:07 ` [U-Boot] [PATCH 1/7] m68k: add basic set of devicetrees Angelo Dureghello
2018-09-26 5:42 ` Simon Glass
2018-09-20 21:07 ` [U-Boot] [PATCH 2/7] drivers: spi: cf_spi: migrate to DM and DT Angelo Dureghello
2018-09-26 5:42 ` Simon Glass
2018-09-26 18:53 ` Angelo Dureghello
2018-09-27 13:41 ` Simon Glass
2018-09-27 17:20 ` Angelo Dureghello
2018-09-28 11:22 ` Angelo Dureghello
2018-10-02 11:21 ` Simon Glass
2018-09-20 21:07 ` Angelo Dureghello [this message]
2018-09-26 5:42 ` [U-Boot] [PATCH 3/7] drivers: serial: mcfuart: add DT support Simon Glass
2018-09-20 21:07 ` [U-Boot] [PATCH 4/7] drivers: serial: mcfuart: add Kconfig option Angelo Dureghello
2018-09-26 5:42 ` Simon Glass
2018-09-20 21:07 ` [U-Boot] [PATCH 5/7] m68k: architecture changes to support fdt Angelo Dureghello
2018-09-26 5:42 ` Simon Glass
2018-09-20 21:07 ` [U-Boot] [PATCH 6/7] m68k: add stmark2 fdt support Angelo Dureghello
2018-09-26 5:42 ` Simon Glass
2018-09-20 21:07 ` [U-Boot] [PATCH 7/7] board: stmark2: updates for DM and DT Angelo Dureghello
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=20180920210755.22381-4-angelo@sysam.it \
--to=angelo@sysam.it \
--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