]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: Add a new CPU init function which can use driver model
authorSimon Glass <sjg@chromium.org>
Thu, 5 Mar 2015 19:25:16 +0000 (12:25 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 19:47:22 +0000 (21:47 +0200)
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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
common/board_f.c
include/common.h

index cca854d4b1aebba2e9df970c35ec53d9fee03603..b0b37afd65177adc6ba2ab5c73446b0fb402e598 100644 (file)
@@ -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
index 10f55e7a8864e10d7ef1dd9b2ea474421253dbf7..ae5351081f4183db10f49204394b697e8607a161 100644 (file)
@@ -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
  *