[U-Boot] [RFC PATCH v2 07/14] dm: Set up driver model after relocation
Simon Glass
sjg at chromium.org
Tue May 7 21:42:03 CEST 2013
Make driver model available after relocation, by setting up data structures
and scanning for devices using compiled-in platform_data and (when available)
the device tree.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2: None
common/board_r.c | 33 +++++++++++++++++++++++++++++++++
common/dm/lists.c | 2 ++
common/dm/root.c | 2 ++
3 files changed, 37 insertions(+)
diff --git a/common/board_r.c b/common/board_r.c
index f801e41..de1768b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -34,6 +34,7 @@
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
+#include <dm.h>
#include <environment.h>
#include <fdtdec.h>
#if defined(CONFIG_CMD_IDE)
@@ -66,7 +67,9 @@
#ifdef CONFIG_X86
#include <asm/init_helpers.h>
#endif
+#include <dm/root.h>
#include <linux/compiler.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -269,6 +272,33 @@ static int initr_malloc(void)
return 0;
}
+#ifdef CONFIG_DM
+static int initr_dm(void)
+{
+ int ret;
+
+ ret = dm_init();
+ if (ret) {
+ debug("dm_init() failed: %d\n", ret);
+ return ret;
+ }
+ ret = dm_scan_platform_data();
+ if (ret) {
+ debug("dm_scan_platform_data() failed: %d\n", ret);
+ return ret;
+ }
+#ifdef CONFIG_OF_CONTROL
+ ret = dm_scan_fdt(gd->fdt_blob);
+ if (ret) {
+ debug("dm_scan_fdt() failed: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return 0;
+}
+#endif
+
__weak int power_init_board(void)
{
return 0;
@@ -765,6 +795,9 @@ init_fnc_t init_sequence_r[] = {
#endif
initr_barrier,
initr_malloc,
+#ifdef CONFIG_DM
+ initr_dm,
+#endif
#ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r,
#endif
diff --git a/common/dm/lists.c b/common/dm/lists.c
index 02bcb50..ec7825b 100644
--- a/common/dm/lists.c
+++ b/common/dm/lists.c
@@ -110,6 +110,7 @@ int lists_bind_drivers(struct device *parent)
return result;
}
+#ifdef CONFIG_OF_CONTROL
/**
* driver_check_compatible() - Check if a driver is compatible with this node
*
@@ -179,3 +180,4 @@ int lists_bind_fdt(struct device *parent, const void *blob, int offset)
return result;
}
+#endif
diff --git a/common/dm/root.c b/common/dm/root.c
index bba793a..b6733dd 100644
--- a/common/dm/root.c
+++ b/common/dm/root.c
@@ -92,6 +92,7 @@ int dm_scan_platform_data(void)
return 0;
}
+#ifdef CONFIG_OF_CONTROL
int dm_scan_fdt(const void *blob)
{
int offset = 0;
@@ -112,6 +113,7 @@ int dm_scan_fdt(const void *blob)
return ret;
}
+#endif
U_BOOT_DRIVER(root_driver) = {
.name = "root_driver",
--
1.8.2.1
More information about the U-Boot
mailing list