Commit 1ce60176799ae04d508b14e9caa7f3bd3a170f0f
Committed by
Tom Rini
1 parent
653ef91cba
Exists in
v2017.01-smarct4x
and in
48 other branches
dm: Set up driver model after relocation
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@chromium.org>
Showing 1 changed file with 33 additions and 0 deletions Side-by-side Diff
common/board_r.c
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #ifdef CONFIG_HAS_DATAFLASH |
19 | 19 | #include <dataflash.h> |
20 | 20 | #endif |
21 | +#include <dm.h> | |
21 | 22 | #include <environment.h> |
22 | 23 | #include <fdtdec.h> |
23 | 24 | #if defined(CONFIG_CMD_IDE) |
24 | 25 | |
... | ... | @@ -51,7 +52,9 @@ |
51 | 52 | #ifdef CONFIG_X86 |
52 | 53 | #include <asm/init_helpers.h> |
53 | 54 | #endif |
55 | +#include <dm/root.h> | |
54 | 56 | #include <linux/compiler.h> |
57 | +#include <linux/err.h> | |
55 | 58 | |
56 | 59 | DECLARE_GLOBAL_DATA_PTR; |
57 | 60 | |
... | ... | @@ -263,6 +266,33 @@ |
263 | 266 | return 0; |
264 | 267 | } |
265 | 268 | |
269 | +#ifdef CONFIG_DM | |
270 | +static int initr_dm(void) | |
271 | +{ | |
272 | + int ret; | |
273 | + | |
274 | + ret = dm_init(); | |
275 | + if (ret) { | |
276 | + debug("dm_init() failed: %d\n", ret); | |
277 | + return ret; | |
278 | + } | |
279 | + ret = dm_scan_platdata(); | |
280 | + if (ret) { | |
281 | + debug("dm_scan_platdata() failed: %d\n", ret); | |
282 | + return ret; | |
283 | + } | |
284 | +#ifdef CONFIG_OF_CONTROL | |
285 | + ret = dm_scan_fdt(gd->fdt_blob); | |
286 | + if (ret) { | |
287 | + debug("dm_scan_fdt() failed: %d\n", ret); | |
288 | + return ret; | |
289 | + } | |
290 | +#endif | |
291 | + | |
292 | + return 0; | |
293 | +} | |
294 | +#endif | |
295 | + | |
266 | 296 | __weak int power_init_board(void) |
267 | 297 | { |
268 | 298 | return 0; |
... | ... | @@ -761,6 +791,9 @@ |
761 | 791 | initr_barrier, |
762 | 792 | initr_malloc, |
763 | 793 | bootstage_relocate, |
794 | +#ifdef CONFIG_DM | |
795 | + initr_dm, | |
796 | +#endif | |
764 | 797 | #ifdef CONFIG_ARCH_EARLY_INIT_R |
765 | 798 | arch_early_init_r, |
766 | 799 | #endif |