All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/10] dm: imx: serial: support device tree
Date: Mon, 25 Jul 2016 23:22:24 -0700	[thread overview]
Message-ID: <20160726062233.7656-2-stefan@agner.ch> (raw)
In-Reply-To: <20160726062233.7656-1-stefan@agner.ch>

From: Stefan Agner <stefan.agner@toradex.com>

Support instatiation through device tree. Also parse the fsl,dte-mode
property to determine whether DTE mode shall be used.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
---
The kernel uses fsl,imx21-uart as "base" compatible, should we follow
that?

 doc/device-tree-bindings/serial/mxc-serial.txt |  8 ++++++++
 drivers/serial/serial_mxc.c                    | 28 ++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 doc/device-tree-bindings/serial/mxc-serial.txt

diff --git a/doc/device-tree-bindings/serial/mxc-serial.txt b/doc/device-tree-bindings/serial/mxc-serial.txt
new file mode 100644
index 0000000..ede92a4
--- /dev/null
+++ b/doc/device-tree-bindings/serial/mxc-serial.txt
@@ -0,0 +1,8 @@
+NXP i.MX (MXC) UART
+
+Required properties:
+- compatible: must be "fsl,imx7d-uart"
+- reg: start address and size of the registers
+
+Optional properties:
+- fsl,dte-mode: use DTE mode
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 1960bbc..bd850d7 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -108,6 +108,8 @@
 #define  UTS_RXFULL	 (1<<3)	 /* RxFIFO full */
 #define  UTS_SOFTRST	 (1<<0)	 /* Software reset */
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifndef CONFIG_DM_SERIAL
 
 #ifndef CONFIG_MXC_UART_BASE
@@ -135,8 +137,6 @@
 #define UBRC  0xac /* Baud Rate Count Register */
 #define UTS   0xb4 /* UART Test Register (mx31) */
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define TXTL  2 /* reset default */
 #define RXTL  1 /* reset default */
 #define RFDIV 4 /* divide input clock by 2 */
@@ -348,9 +348,33 @@ static const struct dm_serial_ops mxc_serial_ops = {
 	.setbrg = mxc_serial_setbrg,
 };
 
+static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct mxc_serial_platdata *plat = dev->platdata;
+	fdt_addr_t addr;
+
+	addr = dev_get_addr(dev);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->reg = (struct mxc_uart *)addr;
+
+	plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+					"fsl,dte-mode");
+	return 0;
+}
+
+static const struct udevice_id mxc_serial_ids[] = {
+	{ .compatible = "fsl,imx7d-uart" },
+	{ }
+};
+
 U_BOOT_DRIVER(serial_mxc) = {
 	.name	= "serial_mxc",
 	.id	= UCLASS_SERIAL,
+	.of_match = mxc_serial_ids,
+	.ofdata_to_platdata = mxc_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct mxc_serial_platdata),
 	.probe = mxc_serial_probe,
 	.ops	= &mxc_serial_ops,
 	.flags = DM_FLAG_PRE_RELOC,
-- 
2.9.0

  reply	other threads:[~2016-07-26  6:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  6:22 [U-Boot] [PATCH 00/10] mx7: add dt support for Colibri iMX7S/iMX7D Stefan Agner
2016-07-26  6:22 ` Stefan Agner [this message]
2016-08-01  1:01   ` [U-Boot] [PATCH 01/10] dm: imx: serial: support device tree Simon Glass
2016-08-02  5:33     ` Stefan Agner
2016-08-26 14:10   ` Stefano Babic
2016-08-29  0:00     ` Stefan Agner
2016-10-04 13:02       ` Stefano Babic
2016-10-05 21:58         ` Stefan Agner
2016-10-06  7:25           ` Stefano Babic
2016-07-26  6:22 ` [U-Boot] [PATCH 02/10] pinctrl: imx: do not announce driver initialization Stefan Agner
2016-08-01  1:01   ` Simon Glass
2016-07-26  6:22 ` [U-Boot] [PATCH 03/10] arm: dts: imx7: add pinctrl defines Stefan Agner
2016-07-26  6:35   ` Wolfgang Denk
2016-07-26  6:22 ` [U-Boot] [PATCH 04/10] arm: dts: imx7: add basic i.MX 7/Colibri iMX7 device tree Stefan Agner
2016-08-01  1:01   ` Simon Glass
2016-07-26  6:22 ` [U-Boot] [PATCH 05/10] colibri_imx7: remove legancy I2C support Stefan Agner
2016-07-26  6:22 ` [U-Boot] [PATCH 06/10] colibri_imx7: remove legancy UART platform data Stefan Agner
2016-07-26  6:22 ` [U-Boot] [PATCH 07/10] power: pmic: add Ricoh RN5T567 PMIC support Stefan Agner
2016-08-01  1:01   ` Simon Glass
2016-07-26  6:22 ` [U-Boot] [PATCH 08/10] arm: dts: imx7: add Ricoh RN5T567 PMIC node Stefan Agner
2016-07-26  6:22 ` [U-Boot] [PATCH 09/10] colibri_imx7: use Ricoh RN5T567 to reboot the board Stefan Agner
2016-07-26  6:22 ` [U-Boot] [PATCH 10/10] configs: enable device tree for Colibri iMX7 Stefan Agner
2016-08-26 13:25 ` [U-Boot] [PATCH 00/10] mx7: add dt support for Colibri iMX7S/iMX7D Stefano Babic
2016-10-03 19:59   ` Stefan Agner
2016-10-04  8:07     ` Stefano Babic

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=20160726062233.7656-2-stefan@agner.ch \
    --to=stefan@agner.ch \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.