From: Simon Glass Date: Thu, 5 Mar 2015 19:25:16 +0000 (-0700) Subject: dm: Add a new CPU init function which can use driver model X-Git-Tag: KARO-TX6-2015-09-18~2787 X-Git-Url: https://git.kernelconcepts.de/?a=commitdiff_plain;h=18204bc213d47d9214a8c5191dfd18a6492005fc;p=karo-tx-uboot.git dm: Add a new CPU init function which can use driver model Since driver model is set up after arch_cpu_init(), that function cannot use drivers. Add a new arch_cpu_init_dm() function which is called immediately after driver model is ready, and can reference devices. This can be used to probe essential devices for the CPU. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- diff --git a/common/board_f.c b/common/board_f.c index cca854d4b1..b0b37afd65 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -830,6 +830,11 @@ __weak int reserve_arch(void) return 0; } +__weak int arch_cpu_init_dm(void) +{ + return 0; +} + static init_fnc_t init_sequence_f[] = { #ifdef CONFIG_SANDBOX setup_ram_buf, @@ -850,6 +855,7 @@ static init_fnc_t init_sequence_f[] = { fdtdec_check_fdt, #endif initf_dm, + arch_cpu_init_dm, #if defined(CONFIG_BOARD_EARLY_INIT_F) board_early_init_f, #endif diff --git a/include/common.h b/include/common.h index 10f55e7a88..ae5351081f 100644 --- a/include/common.h +++ b/include/common.h @@ -252,6 +252,17 @@ static inline int print_cpuinfo(void) int update_flash_size(int flash_size); int arch_early_init_r(void); +/** + * arch_cpu_init_dm() - init CPU after driver model is available + * + * This is called immediately after driver model is available before + * relocation. This is similar to arch_cpu_init() but is able to reference + * devices + * + * @return 0 if OK, -ve on error + */ +int arch_cpu_init_dm(void); + /** * Reserve all necessary stacks *