[PATCH 1/2] serial: ns16550: Adding compatibility for the AM437X platforms

Sascha Hauer sha at pengutronix.de
Thu Jun 9 00:26:26 PDT 2022


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



More information about the barebox mailing list