]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial: mcfuart: fix uart port index
authorAngelo Durgehello <angelo.dureghello@timesys.com>
Sat, 29 Feb 2020 00:01:32 +0000 (01:01 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 13 Mar 2020 13:28:17 +0000 (09:28 -0400)
Actually, using dev->seq value before probe to deduce the current
serial port index leads to reading an invalid seq value (-1).
So, getting dev->seq at probe time.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
drivers/serial/mcfuart.c

index 066e5a18d8850c8604e8d7f1489e4595e7b20e03..b599064b48807403adf6e2ab53f42d277b754f45 100644 (file)
@@ -85,6 +85,8 @@ static int coldfire_serial_probe(struct udevice *dev)
 {
        struct coldfire_serial_platdata *plat = dev->platdata;
 
+       plat->port = dev->seq;
+
        return mcf_serial_init_common((uart_t *)plat->base,
                                                plat->port, plat->baudrate);
 }
@@ -148,8 +150,6 @@ static int coldfire_ofdata_to_platdata(struct udevice *dev)
                return -ENODEV;
 
        plat->base = (uint32_t)addr_base;
-
-       plat->port = dev->seq;
        plat->baudrate = gd->baudrate;
 
        return 0;