u-boot/arch/arm/cpu
Patrick Delaunay 91558c8153 arm: armv7: add us timer for bootstage
solve issue when bootstage is used with armV7 generic timer
first call of timer_get_boot_us() use the function get_timer()
before timer initialization (arch.timer_rate_hz = 0)
=> div by 0

Commit-notes

When I activate bootstage on ARMV7 architecture with platform
using the generic armv7 timer defined in file
./arch/arm/cpu/armv7m/timer.c

I have a issue because gd->arch.timer_rate_hz = 0

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 first bootstage fucntion is called
before timer_init and this function use the timer function.

For me it is a error in the generic init sequence :
mark_bootstage is called before timer_init.

static init_fnc_t init_sequence_f[] = {
....
    arch_cpu_init_dm,
    mark_bootstage,        /* need timer, go after init dm */
...
#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
        defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \
        defined(CONFIG_SPARC)
    timer_init,        /* initialize timer */
#endif
.......

To solve the issue for all the paltform, we can move timer_init()
call just before mark_bootstage() in this array...

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....)

=> This patch solve issue only in timer armv7
   get_boot_us() can be called everytime without div by 0 issue
   (gd->arch.timer_rate_hz is not used)

END

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2016-12-09 08:39:10 -05:00
..
arm11 ARM: Move SYS_CACHELINE_SIZE over to Kconfig 2016-08-26 17:04:46 -04:00
arm720t ARM: ARM720t: remove empty asm/arch/hardware.h 2015-04-23 08:52:27 -04:00
arm920t arch, board: squash lines for immediate return 2016-09-23 17:53:53 -04:00
arm926ejs treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
arm946es arm: Allow skipping of low-level init with I-cache on 2016-06-12 23:49:38 +02:00
arm1136 treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
arm1176 arm: add save_boot_params for ARM1176 2016-11-21 14:07:31 -05:00
armv7 arm: armv7: add us timer for bootstage 2016-12-09 08:39:10 -05:00
armv7m stm32: Add SDRAM support for stm32f746 discovery board 2016-07-14 18:22:43 -04:00
armv8 armv8: QSPI: Add AHB bus 16MB+ size support 2016-12-05 08:32:43 -08:00
pxa ARM: Move SYS_CACHELINE_SIZE over to Kconfig 2016-08-26 17:04:46 -04:00
sa1100 arch, board: squash lines for immediate return 2016-09-23 17:53:53 -04:00
Makefile Various Makefiles: Add SPDX-License-Identifier tags 2015-11-10 09:19:52 -05:00
u-boot-spl.lds spl: arm: Make sure to include all of the u_boot_list entries 2016-03-16 15:27:55 -04:00
u-boot.lds ARM: create .secure_stack section only for PSCI 2016-10-14 16:18:34 -04:00