[PATCH master v2 2/2] boards: qemu-virt: support older QEMU with /soc/flash

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jun 28 23:56:14 PDT 2023


Qemu versions differ in whether the flash is top-level or under the /soc
node. As we apply a state fixup to the Qemu-passed DT, we need to know
where the flash at. Easiest way is just to move it for older Qemus to
the new location.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - no change (besides renaming of_move_node -> of_reparent_node)
---
 common/boards/qemu-virt/board.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/boards/qemu-virt/board.c b/common/boards/qemu-virt/board.c
index 4c6df5e30252..91d852ed72d2 100644
--- a/common/boards/qemu-virt/board.c
+++ b/common/boards/qemu-virt/board.c
@@ -52,7 +52,7 @@ BAREBOX_DEEP_PROBE_ENABLE(virt_of_match);
  */
 static int virt_board_driver_init(void)
 {
-	struct device_node *root = of_get_root_node();
+	struct device_node *soc, *root = of_get_root_node();
 	struct device_node *overlay, *pubkey;
 	const struct of_device_id *id;
 	void (*init)(void);
@@ -66,6 +66,11 @@ static int virt_board_driver_init(void)
 		init();
 	}
 
+	/* Rename older QEMU's /soc/flash at X to /flash at X */
+	soc = of_get_child_by_name(root, "soc");
+	if (soc)
+		of_reparent_node(root, of_find_node_by_name(soc, "flash"));
+
 	overlay = of_unflatten_dtb(__dtbo_qemu_virt_flash_start, INT_MAX);
 	of_overlay_apply_tree(root, overlay);
 
-- 
2.39.2




More information about the barebox mailing list