
Hi,
I am trying to activate bootstage on ARMV7 architecture. My platform use the generic armv7 timer defined in file ./arch/arm/cpu/armv7m/timer.c:
For me the get_timer function should not used before timer_init (which initialize gd->arch.timer_rate_hz) at least for the ARMV7 timer.
But in the init sequence, the bootstage is called before timer_init and this function use the timer function.
For me it is a error in the init sequence : mark_bootstage is called before timer_init.
static init_fnc_t init_sequence_f[] = { #ifdef CONFIG_SANDBOX setup_ram_buf, #endif setup_mon_len, #ifdef CONFIG_OF_CONTROL fdtdec_setup, #endif #ifdef CONFIG_TRACE trace_early_init, #endif initf_malloc, initf_console_record, #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) /* TODO: can this go into arch_cpu_init()? */ probecpu, #endif #if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP) x86_fsp_init, #endif arch_cpu_init, /* basic arch cpu dependent setup */ initf_dm, arch_cpu_init_dm, * mark_bootstage, /* need timer, go after init dm */* #if defined(CONFIG_BOARD_EARLY_INIT_F) board_early_init_f, #endif /* TODO: can any of this go into arch_cpu_init()? */ #if defined(CONFIG_PPC) && !defined(CONFIG_8xx_CPUCLK_DEFAULT) get_clocks, /* get CPU and bus clocks (etc.) */ #if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \ && !defined(CONFIG_TQM885D) adjust_sdram_tbs_8xx, #endif /* TODO: can we rename this to timer_init()? */ init_timebase, #endif #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \ defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \ defined(CONFIG_SPARC) * timer_init, /* initialize timer */* #endif .......
I want to propose a patch to move timer_init call just before mark_bootstage
It should be ok for ARMV7 but I don't sure for other platform impacted - the other ARM platform or ARMV7 wich don't use generic timer - MIPS BLACKFIN NDS32 or SPARC
and I don't sure of impact for other function called (board_early_init_f for example)
can I propose my patch ? for all the platfrom or only for ARM ? or I need to move mark_bootstage after timer_init ?
PS: I can also solve the issue in timer armv7 but with less generic patch if my proposal is too dangerous
Best regards
Patrick