mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards
@ 2022-06-28  8:04 Alexander Shiyan
  2022-06-28  8:23 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2022-06-28  8:04 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

Signed-off-by: Alexander Shiyan <eagle.alexander923@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards
  2022-06-28  8:04 [PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards Alexander Shiyan
@ 2022-06-28  8:23 ` Ahmad Fatoum
  2022-06-29  7:15   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2022-06-28  8:23 UTC (permalink / raw)
  To: Alexander Shiyan, barebox

On 28.06.22 10:04, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> -	if (!IS_ENABLED(CONFIG_OFDEVICE))
> +	if (!IS_ENABLED(CONFIG_OFDEVICE) || !np)

Nitpick:

  struct device_node *np = dev_of_node(dev);

  if (!np)

is equivalent, but a bit less verbose.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards
  2022-06-28  8:23 ` Ahmad Fatoum
@ 2022-06-29  7:15   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-06-29  7:15 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Alexander Shiyan, barebox

On Tue, Jun 28, 2022 at 10:23:01AM +0200, Ahmad Fatoum wrote:
> On 28.06.22 10:04, Alexander Shiyan wrote:
> > Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> > -	if (!IS_ENABLED(CONFIG_OFDEVICE))
> > +	if (!IS_ENABLED(CONFIG_OFDEVICE) || !np)
> 
> Nitpick:
> 
>   struct device_node *np = dev_of_node(dev);
> 
>   if (!np)
> 
> is equivalent, but a bit less verbose.

Applied with this change, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-29  7:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28  8:04 [PATCH] serial: ns16550: Reuse 48MHz default clock definition for non-DT OMAP boards Alexander Shiyan
2022-06-28  8:23 ` Ahmad Fatoum
2022-06-29  7:15   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox