summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorMichal Simek <[email protected]>2025-07-23 11:06:47 +0200
committerMichal Simek <[email protected]>2025-08-26 07:30:09 +0200
commit3a85a27e34624f1b0f08979ea914e0cadfcbf74d (patch)
tree289d48d189558860bd70d660e8921d7c56fa3445 /drivers/serial
parentd0e8a208f6f09c1719fe17b3208b5b239f42cf69 (diff)
serial: uartlite: Add support for OF_PLATDATA
The first change is to list DM_DRIVER_ALIAS for compatible string to be able to match the driver. Only xps one is listed because opb one is likely unused for quite a long time. The second change is to add dtplat structure to plat data and fill register base in probe. Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/b494dbad529e919d33977b8ea6e6dbcd14e78907.1753261604.git.michal.simek@amd.com
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_xuartlite.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 00155aba5eb..6bfd0e085e8 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -32,7 +32,11 @@ struct uartlite {
};
struct uartlite_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ struct dtd_serial_uartlite dtplat;
+#else
struct uartlite *regs;
+#endif
};
struct uartlite_priv {
@@ -94,9 +98,16 @@ static int uartlite_serial_probe(struct udevice *dev)
{
struct uartlite_plat *plat = dev_get_plat(dev);
struct uartlite_priv *priv = dev_get_priv(dev);
- struct uartlite *regs = plat->regs;
+ struct uartlite *regs;
int ret;
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ struct dtd_serial_uartlite *dtplat = &plat->dtplat;
+
+ regs = (struct uartlite *)dtplat->reg[0];
+#else
+ regs = plat->regs;
+#endif
priv->regs = regs;
uart_out32(&regs->control, 0);
@@ -112,6 +123,7 @@ static int uartlite_serial_probe(struct udevice *dev)
return 0;
}
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
static int uartlite_serial_of_to_plat(struct udevice *dev)
{
struct uartlite_plat *plat = dev_get_plat(dev);
@@ -120,6 +132,7 @@ static int uartlite_serial_of_to_plat(struct udevice *dev)
return 0;
}
+#endif
static const struct dm_serial_ops uartlite_serial_ops = {
.putc = uartlite_serial_putc,
@@ -137,13 +150,17 @@ U_BOOT_DRIVER(serial_uartlite) = {
.name = "serial_uartlite",
.id = UCLASS_SERIAL,
.of_match = uartlite_serial_ids,
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_to_plat = uartlite_serial_of_to_plat,
+#endif
.priv_auto = sizeof(struct uartlite_priv),
.plat_auto = sizeof(struct uartlite_plat),
.probe = uartlite_serial_probe,
.ops = &uartlite_serial_ops,
};
+DM_DRIVER_ALIAS(serial_uartlite, xlnx_xps_uartlite_1_00_a)
+
#ifdef CONFIG_DEBUG_UART_UARTLITE
#include <debug_uart.h>