Message ID | 1425583534-2238-5-git-send-email-sjg@chromium.org |
---|---|
State | Accepted |
Delegated to: | Simon Glass |
Headers | show |
On Fri, Mar 6, 2015 at 3:25 AM, Simon Glass <sjg@chromium.org> wrote: > 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> > --- > > Changes in v2: > - Add a new patch with a CPU init function which can use driver model > > common/board_f.c | 6 ++++++ > include/common.h | 11 +++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/common/board_f.c b/common/board_f.c > index 4d8b8a6..8bbece2 100644 > --- a/common/board_f.c > +++ b/common/board_f.c > @@ -787,6 +787,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, > @@ -807,6 +812,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 77c55c6..f9aaaa5 100644 > --- a/include/common.h > +++ b/include/common.h > @@ -253,6 +253,17 @@ 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 > * > * This is used in generic board init sequence in common/board_f.c. Each > -- Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
On 9 March 2015 at 03:02, Bin Meng <bmeng.cn@gmail.com> wrote: > On Fri, Mar 6, 2015 at 3:25 AM, Simon Glass <sjg@chromium.org> wrote: >> 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> >> --- >> >> Changes in v2: >> - Add a new patch with a CPU init function which can use driver model >> >> common/board_f.c | 6 ++++++ >> include/common.h | 11 +++++++++++ >> 2 files changed, 17 insertions(+) >> >> diff --git a/common/board_f.c b/common/board_f.c >> index 4d8b8a6..8bbece2 100644 >> --- a/common/board_f.c >> +++ b/common/board_f.c >> @@ -787,6 +787,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, >> @@ -807,6 +812,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 77c55c6..f9aaaa5 100644 >> --- a/include/common.h >> +++ b/include/common.h >> @@ -253,6 +253,17 @@ 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 >> * >> * This is used in generic board init sequence in common/board_f.c. Each >> -- > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Applied to u-boot-dm/next.
diff --git a/common/board_f.c b/common/board_f.c index 4d8b8a6..8bbece2 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -787,6 +787,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, @@ -807,6 +812,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 77c55c6..f9aaaa5 100644 --- a/include/common.h +++ b/include/common.h @@ -253,6 +253,17 @@ 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 * * This is used in generic board init sequence in common/board_f.c. Each
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> --- Changes in v2: - Add a new patch with a CPU init function which can use driver model common/board_f.c | 6 ++++++ include/common.h | 11 +++++++++++ 2 files changed, 17 insertions(+)