[PATCH 12/18] of: base: move memory init from DT to initcall
Marco Felsch
m.felsch at pengutronix.de
Mon Sep 28 11:50:35 EDT 2020
From: Lucas Stach <dev at lynxeye.de>
Instead of calling it from of_probe, convert it to a initcall at
the appropriate level. This allows to move of_probe to later in
the init sequence while keeping the memory init at the same place,
which is important as many other drivers need the valid memory area
to be set up properly.
Signed-off-by: Lucas Stach <dev at lynxeye.de>
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
drivers/of/base.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6e2fb8b281..4f08c45e40 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2144,10 +2144,13 @@ const struct of_device_id of_default_bus_match_table[] = {
}
};
-static void of_probe_memory(void)
+static int of_probe_memory(void)
{
struct device_node *memory = root_node;
+ if (!IS_ENABLED(CONFIG_OFDEVICE))
+ return 0;
+
/* Parse all available node with "memory" device_type */
while (1) {
memory = of_find_node_by_type(memory, "memory");
@@ -2156,7 +2159,10 @@ static void of_probe_memory(void)
of_add_memory(memory, false);
}
+
+ return 0;
}
+mem_initcall(of_probe_memory);
static void of_platform_device_create_root(struct device_node *np)
{
@@ -2186,8 +2192,6 @@ int of_probe(void)
if (of_model)
barebox_set_model(of_model);
- of_probe_memory();
-
firmware = of_find_node_by_path("/firmware");
if (firmware)
of_platform_populate(firmware, NULL, NULL);
--
2.20.1
More information about the barebox
mailing list