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 <michal.si...@amd.com>
---

 drivers/serial/serial_xuartlite.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/serial_xuartlite.c 
b/drivers/serial/serial_xuartlite.c
index 00155aba5eb2..6bfd0e085e87 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>
-- 
2.43.0

base-commit: 877984a9b68bac862cca6f2d8885947a48e6fd50

Reply via email to