From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 14/14] dm: tegra: Enable driver model for serial
Date: Thu, 4 Sep 2014 16:27:36 -0600 [thread overview]
Message-ID: <1409869656-29160-15-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1409869656-29160-1-git-send-email-sjg@chromium.org>
Use driver model for serial ports.
Since Tegra now uses driver model for serial, adjust the definition of
V_NS16550_CLK so that it is clear that this is only used for SPL.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v5: None
Changes in v4:
- Add a separate Tegra serial driver to deal with the clock issue
- Add new CONFIG_TEGRA_SERIAL option to enable dm driver
- Use hard-coded UART clock from Tegra configuration
Changes in v3:
- Add new patch to enable driver model for serial on tegra
- Add new patch to use V_NS16550_CLK only in SPL builds
Changes in v2: None
drivers/serial/Makefile | 1 +
drivers/serial/serial_tegra.c | 38 ++++++++++++++++++++++++++++++++++++++
include/configs/tegra-common.h | 9 ++++++++-
3 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 drivers/serial/serial_tegra.c
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 5ae6416..853a8c6 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
obj-$(CONFIG_MXS_AUART) += mxs_auart.o
obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
+obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_USB_TTY) += usbtty.o
diff --git a/drivers/serial/serial_tegra.c b/drivers/serial/serial_tegra.c
new file mode 100644
index 0000000..7eb70e1
--- /dev/null
+++ b/drivers/serial/serial_tegra.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <ns16550.h>
+#include <serial.h>
+
+static const struct udevice_id tegra_serial_ids[] = {
+ { .compatible = "nvidia,tegra20-uart" },
+ { }
+};
+
+static int tegra_serial_ofdata_to_platdata(struct udevice *dev)
+{
+ struct ns16550_platdata *plat = dev_get_platdata(dev);
+ int ret;
+
+ ret = ns16550_serial_ofdata_to_platdata(dev);
+ if (ret)
+ return ret;
+ plat->clock = V_NS16550_CLK;
+
+ return 0;
+}
+U_BOOT_DRIVER(serial_ns16550) = {
+ .name = "serial_tegra20",
+ .id = UCLASS_SERIAL,
+ .of_match = tegra_serial_ids,
+ .ofdata_to_platdata = tegra_serial_ofdata_to_platdata,
+ .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+ .priv_auto_alloc_size = sizeof(struct NS16550),
+ .probe = ns16550_serial_probe,
+ .ops = &ns16550_serial_ops,
+};
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index f1187f1..834b3d5 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -21,6 +21,9 @@
#define CONFIG_DM
#define CONFIG_CMD_DM
#define CONFIG_DM_GPIO
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_DM_SERIAL
+#endif
#define CONFIG_SYS_TIMER_RATE 1000000
#define CONFIG_SYS_TIMER_COUNTER NV_PA_TMRUS_BASE
@@ -46,10 +49,14 @@
/*
* NS16550 Configuration
*/
-#define CONFIG_SYS_NS16550
+#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE (-4)
#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK
+#else
+#define CONFIG_TEGRA_SERIAL
+#endif
+#define CONFIG_SYS_NS16550
/*
* Common HW configuration.
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-09-04 22:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 22:27 [U-Boot] [PATCH v5 0/14] Introduce driver model serial uclass Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 01/14] serial: Set up the 'priv' pointer when creating a serial device Simon Glass
2014-09-21 16:12 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 02/14] dm: fdt: Add a function to look up a chosen node Simon Glass
2014-09-21 16:13 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 03/14] dm: Adjust lists_bind_fdt() to return the bound device Simon Glass
2014-09-21 16:13 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 04/14] dm: Add a uclass for serial devices Simon Glass
2014-09-21 16:14 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 05/14] sandbox: Convert serial driver to use driver model Simon Glass
2014-09-21 16:14 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 06/14] sandbox: serial: Support a coloured console Simon Glass
2014-09-21 16:15 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 07/14] sandbox: dts: Add a serial console node Simon Glass
2014-09-21 16:15 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 08/14] dm: exynos: Mark exynos5 console as pre-reloc Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 09/14] dm: exynos: Move serial to driver model Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 10/14] dm: serial: Move baud rate calculation to ns16550.c Simon Glass
2014-09-21 16:16 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 11/14] dm: serial: Collect common baud rate code in ns16550 Simon Glass
2014-09-21 16:16 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 12/14] dm: serial: Add driver model support for ns16550 Simon Glass
2014-09-21 16:17 ` Simon Glass
2014-09-04 22:27 ` [U-Boot] [PATCH v5 13/14] tegra: dts: Add serial port details Simon Glass
2014-09-21 16:17 ` Simon Glass
2014-09-04 22:27 ` Simon Glass [this message]
2014-09-09 19:42 ` [U-Boot] [PATCH v5 14/14] dm: tegra: Enable driver model for serial Simon Glass
2014-09-15 13:54 ` Tom Rini
2014-09-15 14:48 ` Otavio Salvador
2014-09-21 16:19 ` Simon Glass
2014-09-05 20:49 ` [U-Boot] [PATCH v5 0/14] Introduce driver model serial uclass Simon Glass
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=1409869656-29160-15-git-send-email-sjg@chromium.org \
--to=sjg@chromium.org \
--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.