Skip to contentSkip to conversation

serial: ns16550: Adding compatibility for the AM437X platforms

PATCH Applied Alexander Shiyan 2 participants 3 messages Jun 7, 2022 – Jun 9, 2022

lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/serial/serial_ns16550.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/serial/serial_ns16550.c +15 -2
index f93a89ab95..fb6af42e00 100644
@@ -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)
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/2 serial: ns16550: Remove redundant driver data for generic ns16550 variants

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

---
 drivers/serial/serial_ns16550.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/serial/serial_ns16550.c +0 -4
index fb6af42e00..6ba87a2544 100644
@@ -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)
 	{
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Alexander Shiyan
Quoted 8 lines · 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.

---
 drivers/serial/serial_ns16550.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

Quoted 59 lines
drivers/serial/serial_ns16550.c +15 -2
index f93a89ab95..fb6af42e00 100644
@@ -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)
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox