diff mbox series

serial: mcfuart: fix uart port index

Message ID 20200229000132.618227-1-angelo.dureghello@timesys.com
State Accepted
Commit ce5e3ea7995269a49a530284af25cc8cc44bb37d
Headers show
Series serial: mcfuart: fix uart port index | expand

Commit Message

Angelo Dureghello Feb. 29, 2020, 12:01 a.m. UTC
From: Angelo Durgehello <angelo.dureghello at timesys.com>

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 at timesys.com>
---
 drivers/serial/mcfuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini March 13, 2020, 5:24 p.m. UTC | #1
On Sat, Feb 29, 2020 at 01:01:32AM +0100, Angelo Dureghello wrote:

> From: Angelo Durgehello <angelo.dureghello at timesys.com>
> 
> 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 at timesys.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 066e5a18d8..b599064b48 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -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;