[U-Boot] [PATCH v2 10/13] ns16550: unify serial_omap

Thomas Chou thomas at wytron.com.tw
Wed Nov 18 14:44:56 CET 2015


Unify serial_omap, and use the generic binding.

Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
Reviewed-by: Tom Rini <trini at konsulko.com>
---
 board/isee/igep00x0/igep00x0.c      |  2 +-
 board/lge/sniper/sniper.c           |  2 +-
 board/logicpd/omap3som/omap3logic.c |  2 +-
 board/logicpd/zoom1/zoom1.c         |  2 +-
 board/overo/overo.c                 |  2 +-
 board/quipos/cairo/cairo.c          |  2 +-
 board/ti/beagle/beagle.c            |  2 +-
 board/timll/devkit8000/devkit8000.c |  2 +-
 drivers/serial/Makefile             |  1 -
 drivers/serial/serial_omap.c        | 54 -------------------------------------
 include/configs/am43xx_evm.h        |  4 +--
 include/configs/cm_t43.h            |  2 +-
 include/configs/omap3_pandora.h     |  3 ++-
 include/configs/sniper.h            |  4 +--
 include/configs/ti_am335x_common.h  |  2 +-
 include/configs/ti_omap3_common.h   |  4 +--
 include/configs/ti_omap4_common.h   |  4 +--
 include/configs/ti_omap5_common.h   |  4 +--
 18 files changed, 22 insertions(+), 76 deletions(-)
 delete mode 100644 drivers/serial/serial_omap.c

diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 044c6d5..57b89e0 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -40,7 +40,7 @@ static const struct ns16550_platdata igep_serial = {
 };
 
 U_BOOT_DEVICE(igep_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&igep_serial
 };
 
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index 4eff01a..c818c9d 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -35,7 +35,7 @@ static const struct ns16550_platdata serial_omap_platdata = {
 };
 
 U_BOOT_DEVICE(sniper_serial) = {
-	.name = "serial_omap",
+	.name = "ns16550_serial",
 	.platdata = &serial_omap_platdata
 };
 
diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index babb0dc..fb89921 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -43,7 +43,7 @@ static const struct ns16550_platdata omap3logic_serial = {
 };
 
 U_BOOT_DEVICE(omap3logic_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&omap3logic_serial
 };
 
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index 0a3b55b..4040114 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -50,7 +50,7 @@ static const struct ns16550_platdata zoom1_serial = {
 };
 
 U_BOOT_DEVICE(zoom1_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&zoom1_serial
 };
 
diff --git a/board/overo/overo.c b/board/overo/overo.c
index 20cbec2..a38b959 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -74,7 +74,7 @@ static const struct ns16550_platdata overo_serial = {
 };
 
 U_BOOT_DEVICE(overo_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&overo_serial
 };
 
diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c
index b97a09a..21793e8 100644
--- a/board/quipos/cairo/cairo.c
+++ b/board/quipos/cairo/cairo.c
@@ -97,7 +97,7 @@ static const struct ns16550_platdata cairo_serial = {
 };
 
 U_BOOT_DEVICE(cairo_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&cairo_serial
 };
 
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 56e3cfe..ff317ef 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -79,7 +79,7 @@ static const struct ns16550_platdata beagle_serial = {
 };
 
 U_BOOT_DEVICE(beagle_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&beagle_serial
 };
 
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index a61cc14..1a447c7 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -52,7 +52,7 @@ static const struct ns16550_platdata devkit8000_serial = {
 };
 
 U_BOOT_DEVICE(devkit8000_uart) = {
-	"serial_omap",
+	"ns16550_serial",
 	&devkit8000_serial
 };
 
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 86ae50f..dd87147 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
 obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
-obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o
 obj-$(CONFIG_STM32_SERIAL) += serial_stm32.o
 
 ifndef CONFIG_SPL_BUILD
diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c
deleted file mode 100644
index 891cd7b..0000000
--- a/drivers/serial/serial_omap.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2014 Google, Inc
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <dm.h>
-#include <fdtdec.h>
-#include <ns16550.h>
-#include <serial.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define DEFAULT_CLK_SPEED 48000000 /* 48Mhz */
-
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-static const struct udevice_id omap_serial_ids[] = {
-	{ .compatible = "ti,omap2-uart" },
-	{ .compatible = "ti,omap3-uart" },
-	{ .compatible = "ti,omap4-uart" },
-	{ .compatible = "ti,am3352-uart" },
-	{ .compatible = "ti,am4372-uart" },
-	{ .compatible = "ti,dra742-uart" },
-	{ }
-};
-
-static int omap_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 = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-				     "clock-frequency", DEFAULT_CLK_SPEED);
-	plat->reg_shift = 2;
-
-	return 0;
-}
-#endif
-
-U_BOOT_DRIVER(serial_omap_ns16550) = {
-	.name	= "serial_omap",
-	.id	= UCLASS_SERIAL,
-	.of_match = of_match_ptr(omap_serial_ids),
-	.ofdata_to_platdata = of_match_ptr(omap_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,
-	.flags	= DM_FLAG_PRE_RELOC,
-};
diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index b02abd3..a962bf5 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -23,12 +23,12 @@
 
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_CLK		48000000
 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
 #define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_CLK		48000000
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #else
-#define CONFIG_OMAP_SERIAL
+#define CONFIG_NS16550_SERIAL
 #endif
 
 /* I2C Configuration */
diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h
index c4d3b94..e1019ff 100644
--- a/include/configs/cm_t43.h
+++ b/include/configs/cm_t43.h
@@ -18,7 +18,7 @@
 #include <asm/arch/omap.h>
 
 /* Serial support */
-#define CONFIG_OMAP_SERIAL
+#define CONFIG_NS16550_SERIAL
 #define CONFIG_DM_SERIAL
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h
index 4e93705..c15c699 100644
--- a/include/configs/omap3_pandora.h
+++ b/include/configs/omap3_pandora.h
@@ -49,7 +49,8 @@
 /*
  * NS16550 Configuration
  */
-#undef CONFIG_OMAP_SERIAL
+#undef CONFIG_NS16550_SERIAL
+#undef CONFIG_SYS_NS16550_CLK
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
diff --git a/include/configs/sniper.h b/include/configs/sniper.h
index f168e8f..34f7f6e 100644
--- a/include/configs/sniper.h
+++ b/include/configs/sniper.h
@@ -197,14 +197,14 @@
 
 
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_OMAP_SERIAL
+#define CONFIG_NS16550_SERIAL
 #else
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 #endif
 
 #define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
 #define CONFIG_CONS_INDEX		3
 #define CONFIG_SERIAL3			3
diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h
index 9697431..32348ab 100644
--- a/include/configs/ti_am335x_common.h
+++ b/include/configs/ti_am335x_common.h
@@ -20,7 +20,7 @@
 #define CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
 #ifndef CONFIG_SPL_BUILD
-# define CONFIG_OMAP_SERIAL
+# define CONFIG_NS16550_SERIAL
 #endif
 
 #include <asm/arch/omap.h>
diff --git a/include/configs/ti_omap3_common.h b/include/configs/ti_omap3_common.h
index e399a87..e749d5d 100644
--- a/include/configs/ti_omap3_common.h
+++ b/include/configs/ti_omap3_common.h
@@ -19,7 +19,7 @@
 #include <asm/arch/omap.h>
 
 #ifndef CONFIG_SPL_BUILD
-# define CONFIG_OMAP_SERIAL
+# define CONFIG_NS16550_SERIAL
 #endif
 
 /* Common ARM Erratas */
@@ -37,10 +37,10 @@
 /* NS16550 Configuration */
 #define V_NS16550_CLK			48000000	/* 48MHz (APLL96/2) */
 #define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 #ifdef CONFIG_SPL_BUILD
 # define CONFIG_SYS_NS16550_SERIAL
 # define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-# define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 #endif
 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600, \
 					115200}
diff --git a/include/configs/ti_omap4_common.h b/include/configs/ti_omap4_common.h
index 741f71f..0a03cd5 100644
--- a/include/configs/ti_omap4_common.h
+++ b/include/configs/ti_omap4_common.h
@@ -58,13 +58,13 @@
  * Hardware drivers
  */
 #define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_CLK		48000000
 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		48000000
 #define CONFIG_SYS_NS16550_COM3		UART3_BASE
 #else
-#define CONFIG_OMAP_SERIAL
+#define CONFIG_NS16550_SERIAL
 #endif
 #define CONFIG_CONS_INDEX		3
 
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 5acbc92..be1f4c1 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -51,12 +51,12 @@
  * Hardware drivers
  */
 #define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_CLK		48000000
 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		48000000
 #else
-#define CONFIG_OMAP_SERIAL
+#define CONFIG_NS16550_SERIAL
 #endif
 
 /*
-- 
2.5.0



More information about the U-Boot mailing list