summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-09-05 09:02:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-13 12:07:55 +0200
commit1c370d39a457e3b3908248ba9e54b3f01241c62c (patch)
treeeeddcffa83018a02f4650f11d81a4c249c6f99aa /drivers
parent18fdf99c91abbc91860512626a284aacb2c72531 (diff)
downloadbarebox-1c370d39a457e3b3908248ba9e54b3f01241c62c.tar.gz
barebox-1c370d39a457e3b3908248ba9e54b3f01241c62c.tar.xz
of: of_probe: create board's machine device at the earliest
We currently create devices for matching reserved memory entries and firmware before creating the machine device. In a deep probe system, the machine driver would be probed directly at registration and as such needs to be probed before other devices are created, so it can disable other devices if needed. Move the machine device registration to the top, so board drivers can disabled reserved memory entries and firmware if they need to. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905070208.538012-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/base.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9b32215740..ea2a88764b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2550,6 +2550,12 @@ int of_probe(void)
return -ENODEV;
/*
+ * We do this first thing, so board drivers can patch the device
+ * tree prior to device creation if needed.
+ */
+ of_platform_device_create_root(root_node);
+
+ /*
* Handle certain compatibles explicitly, since we don't want to create
* platform_devices for every node in /reserved-memory with a
* "compatible",
@@ -2561,8 +2567,6 @@ int of_probe(void)
if (node)
of_platform_populate(node, NULL, NULL);
- of_platform_device_create_root(root_node);
-
of_platform_populate(root_node, of_default_bus_match_table, NULL);
return 0;