[PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards

Alexander Shiyan eagle.alexander923 at gmail.com
Tue Jun 28 01:04:14 PDT 2022


Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
---
 arch/arm/mach-omap/omap_devices.c | 8 +-------
 drivers/serial/serial_ns16550.c   | 8 ++++----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap/omap_devices.c b/arch/arm/mach-omap/omap_devices.c
index beae59f74d..022616ba54 100644
--- a/arch/arm/mach-omap/omap_devices.c
+++ b/arch/arm/mach-omap/omap_devices.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #include <driver.h>
-#include <platform_data/serial-ns16550.h>
 #include <asm/armlinux.h>
 
 #include <mach/omap3-devices.h>
@@ -16,15 +15,10 @@ void omap_add_sram0(resource_size_t base, resource_size_t size)
 	add_mem_device("sram0", base, size, IORESOURCE_MEM_WRITEABLE);
 }
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,      /* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 struct device_d *omap_add_uart(int id, unsigned long base)
 {
 	return add_generic_device("omap-uart", id, NULL, base, 1024,
-				  IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat);
+				  IORESOURCE_MEM | IORESOURCE_MEM_8BIT, NULL);
 }
 
 #if defined(CONFIG_DRIVER_VIDEO_OMAP)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 07f951e535..5998065c56 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -313,7 +313,7 @@ static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
 	u32 offset;
 	u32 width = 1;
 
-	if (!IS_ENABLED(CONFIG_OFDEVICE))
+	if (!IS_ENABLED(CONFIG_OFDEVICE) || !np)
 		return;
 
 	of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
@@ -368,7 +368,7 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 	.linux_earlycon_name = "omap8250",
 };
 
-static __maybe_unused struct ns16550_drvdata am43xx_drvdata = {
+static __maybe_unused struct ns16550_drvdata omap_clk48m_drvdata = {
 	.init_port = ns16550_omap_init_port,
 	.linux_console_name = "ttyO",
 	.clk_default = 48000000,
@@ -561,7 +561,7 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
 		.data = &omap_drvdata,
 	}, {
 		.compatible = "ti,am4372-uart",
-		.data = &am43xx_drvdata,
+		.data = &omap_clk48m_drvdata,
 	},
 #endif
 #if IS_ENABLED(CONFIG_MACH_MIPS_XBURST)
@@ -584,7 +584,7 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
 static __maybe_unused struct platform_device_id ns16550_serial_ids[] = {
 	{
 		.name = "omap-uart",
-		.driver_data = (unsigned long)&omap_drvdata,
+		.driver_data = (unsigned long)&omap_clk48m_drvdata,
 	}, {
 		/* sentinel */
 	},

base-commit: 18767e06f63166a0f1db0292ffaff5347c138d54
-- 
2.32.0




More information about the barebox mailing list