[PATCH 17/18] ARM: stm32mp: ddrctrl: add deep-probe support

Marco Felsch m.felsch at pengutronix.de
Mon Sep 28 11:50:40 EDT 2020


In case of deep-probe we have to ensure that the memory device is
available after the mem_initcall().

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 arch/arm/mach-stm32mp/ddrctrl.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/ddrctrl.c b/arch/arm/mach-stm32mp/ddrctrl.c
index 962d4c0d52..c108bbee1e 100644
--- a/arch/arm/mach-stm32mp/ddrctrl.c
+++ b/arch/arm/mach-stm32mp/ddrctrl.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <deep-probe.h>
 #include <init.h>
 #include <mach/stm32.h>
 #include <mach/ddr_regs.h>
@@ -150,6 +151,18 @@ static struct driver_d stm32mp1_ddr_driver = {
 
 static int stm32mp1_ddr_init(void)
 {
-	return platform_driver_register(&stm32mp1_ddr_driver);
+	struct device_d *dev;
+	int ret;
+
+	ret = platform_driver_register(&stm32mp1_ddr_driver);
+	if (ret)
+		return ret;
+
+	dev = of_device_create_on_demand_by_dev_id(of_get_root_node(),
+						   stm32mp1_ddr_dt_ids);
+	if (IS_ERR(dev))
+		return PTR_ERR(dev);
+
+	return 0;
 }
 mem_initcall(stm32mp1_ddr_init);
-- 
2.20.1




More information about the barebox mailing list