mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms
@ 2022-06-07 10:03 Alexander Shiyan
  2022-06-07 10:03 ` [PATCH 2/2] serial: ns16550: Remove redundant driver data for generic ns16550 variants Alexander Shiyan
  2022-06-09  7:26 ` [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Shiyan @ 2022-06-07 10:03 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

Adding compatibility for AM437X platforms.
Since the serial node is not populated with a clock node,
let's add an additional driver variable to set the default clock speed.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/serial/serial_ns16550.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index f93a89ab95..fb6af42e00 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -42,8 +42,9 @@ struct ns16550_priv {
 };
 
 struct ns16550_drvdata {
-        void (*init_port)(struct console_device *cdev);
-        const char *linux_console_name;
+	void (*init_port)(struct console_device *cdev);
+	const char *linux_console_name;
+	unsigned int clk_default;
 };
 
 static inline struct ns16550_priv *to_ns16550_priv(struct console_device *cdev)
@@ -362,6 +363,12 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 	.linux_console_name = "ttyO",
 };
 
+static __maybe_unused struct ns16550_drvdata am43xx_drvdata = {
+	.init_port = ns16550_omap_init_port,
+	.linux_console_name = "ttyO",
+	.clk_default = 48000000,
+};
+
 static __maybe_unused struct ns16550_drvdata jz_drvdata = {
 	.init_port = ns16550_jz_init_port,
 };
@@ -472,6 +479,9 @@ static int ns16550_probe(struct device_d *dev)
 	else
 		ns16550_probe_dt(dev, priv);
 
+	if (devtype->clk_default && !priv->plat.clock)
+		priv->plat.clock = devtype->clk_default;
+
 	if (!priv->plat.clock) {
 		priv->clk = clk_get(dev, NULL);
 		if (IS_ERR(priv->clk)) {
@@ -537,6 +547,9 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
 	}, {
 		.compatible = "ti,omap4-uart",
 		.data = &omap_drvdata,
+	}, {
+		.compatible = "ti,am4372-uart",
+		.data = &am43xx_drvdata,
 	},
 #endif
 #if IS_ENABLED(CONFIG_MACH_MIPS_XBURST)
-- 
2.32.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 2/2] serial: ns16550: Remove redundant driver data for generic ns16550 variants
  2022-06-07 10:03 [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Alexander Shiyan
@ 2022-06-07 10:03 ` Alexander Shiyan
  2022-06-09  7:26 ` [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2022-06-07 10:03 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

This data is already set in probe() if the driver data is NULL.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/serial/serial_ns16550.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index fb6af42e00..6ba87a2544 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -526,16 +526,12 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
 		.data = &ns16450_drvdata,
 	}, {
 		.compatible = "ns16550a",
-		.data = &ns16550_drvdata,
 	}, {
 		.compatible = "snps,dw-apb-uart",
-		.data = &ns16550_drvdata,
 	}, {
 		.compatible = "marvell,armada-38x-uart",
-		.data = &ns16550_drvdata,
 	}, {
 		.compatible = "nvidia,tegra20-uart",
-		.data = &ns16550_drvdata,
 	},
 #if IS_ENABLED(CONFIG_ARCH_OMAP)
 	{
-- 
2.32.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms
  2022-06-07 10:03 [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Alexander Shiyan
  2022-06-07 10:03 ` [PATCH 2/2] serial: ns16550: Remove redundant driver data for generic ns16550 variants Alexander Shiyan
@ 2022-06-09  7:26 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-06-09  7:26 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Tue, Jun 07, 2022 at 01:03:36PM +0300, Alexander Shiyan wrote:
> Adding compatibility for AM437X platforms.
> Since the serial node is not populated with a clock node,
> let's add an additional driver variable to set the default clock speed.
> 
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> ---
>  drivers/serial/serial_ns16550.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
> index f93a89ab95..fb6af42e00 100644
> --- a/drivers/serial/serial_ns16550.c
> +++ b/drivers/serial/serial_ns16550.c
> @@ -42,8 +42,9 @@ struct ns16550_priv {
>  };
>  
>  struct ns16550_drvdata {
> -        void (*init_port)(struct console_device *cdev);
> -        const char *linux_console_name;
> +	void (*init_port)(struct console_device *cdev);
> +	const char *linux_console_name;
> +	unsigned int clk_default;
>  };
>  
>  static inline struct ns16550_priv *to_ns16550_priv(struct console_device *cdev)
> @@ -362,6 +363,12 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
>  	.linux_console_name = "ttyO",
>  };
>  
> +static __maybe_unused struct ns16550_drvdata am43xx_drvdata = {
> +	.init_port = ns16550_omap_init_port,
> +	.linux_console_name = "ttyO",
> +	.clk_default = 48000000,
> +};
> +
>  static __maybe_unused struct ns16550_drvdata jz_drvdata = {
>  	.init_port = ns16550_jz_init_port,
>  };
> @@ -472,6 +479,9 @@ static int ns16550_probe(struct device_d *dev)
>  	else
>  		ns16550_probe_dt(dev, priv);
>  
> +	if (devtype->clk_default && !priv->plat.clock)
> +		priv->plat.clock = devtype->clk_default;
> +
>  	if (!priv->plat.clock) {
>  		priv->clk = clk_get(dev, NULL);
>  		if (IS_ERR(priv->clk)) {
> @@ -537,6 +547,9 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
>  	}, {
>  		.compatible = "ti,omap4-uart",
>  		.data = &omap_drvdata,
> +	}, {
> +		.compatible = "ti,am4372-uart",
> +		.data = &am43xx_drvdata,
>  	},
>  #endif
>  #if IS_ENABLED(CONFIG_MACH_MIPS_XBURST)
> -- 
> 2.32.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 10:03 [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Alexander Shiyan
2022-06-07 10:03 ` [PATCH 2/2] serial: ns16550: Remove redundant driver data for generic ns16550 variants Alexander Shiyan
2022-06-09  7:26 ` [PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms Sascha Hauer

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