[PATCH 4/6] ARM: i.MX6: skov: fix LVDS deep probe

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Dec 22 06:11:59 PST 2022


With deep probe, barebox will have registered most drivers by the time
it walks the device tree and will then keep probing devices on demand.

This simplifies the common case of devices having dependencies on each
other, but on the other hand expects board code to be deep probe aware.

The Skov board code already takes care to explicitly probe the GPIO
controllers it requires, but it also optionally enables and registers
devices that were initially disabled in the device tree.

It's paramount that devices are only registered _after_ the relevant
device tree parts are rewritten. This was currently not accounted for,
which led to LDB device being probed before its child lvds-channel node
was enabled: We thus ended up with a LDB device, what the driver
couldn't do anything with:

  mode_name: invalid:0 (type: enum)

Fixes: 31d2289da2f3 ("ARM: boards: skov-imx6: start using deep-probe")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/boards/skov-imx6/board.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/skov-imx6/board.c b/arch/arm/boards/skov-imx6/board.c
index 7ddc6e937b0b..8f4d7efe4278 100644
--- a/arch/arm/boards/skov-imx6/board.c
+++ b/arch/arm/boards/skov-imx6/board.c
@@ -474,14 +474,15 @@ static void skov_init_ldb(void)
 		return;
 	}
 
-	of_device_enable_and_register(ldb);
-
-	/* ... as well as its channel 0 */
+	/* First enable channel 0, prior to enabling parent */
 	chan = of_find_node_by_name_address(ldb, "lvds-channel at 0");
 	if (chan)
 		of_device_enable(chan);
 	else
 		dev_err(skov_priv->dev, "Cannot find \"lvds-channel at 0\" node\n");
+
+	/* Now probe will see the expected device tree */
+	of_device_enable_and_register(ldb);
 }
 
 /*
-- 
2.30.2




More information about the barebox mailing list