[PATCH] drivers: serial: Remove code that binds devices pre-reloc

Mark Kettenis kettenis at openbsd.org
Mon Feb 21 22:17:58 CET 2022

The serial_check_stdout() has code to bind devices that are not
marked to be bound before relocation. This code had a known bug
in the past and should not be needed if targets correctly mark
these devices as bound before relocation in the device tree or
mark the appropriate device drivers using the DM_FLAG_PRE_RELOC

Note that this commit will break many targets. Those targets will
have need to have the appropriate serial device marked to be bound
before relocation to make them work again.

Signed-off-by: Mark Kettenis <kettenis at openbsd.org>

Note: this is defenitely not material for 2022.04. I'm not even sure
if this is a good idea. But if this does get accepted, it is probably
wise for it to go onto the next branch to give maintainers enough time
to fix any fallout.

 drivers/serial/serial-uclass.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index f30f352bd7..0da5fde429 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -60,17 +60,6 @@ static int serial_check_stdout(const void *blob, struct udevice **devp)
 	if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, devp))
 		return 0;
-	/*
-	 * If the console is not marked to be bound before relocation, bind it
-	 * anyway.
-	 */
-	if (node > 0 && !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
-					devp, NULL, false)) {
-		if (device_get_uclass_id(*devp) == UCLASS_SERIAL &&
-		    !device_probe(*devp))
-			return 0;
-	}
 	return -ENODEV;

More information about the U-Boot mailing list