u-boot-brain/drivers/timer/Kconfig
Simon Glass 97d20f69f5 Enable CONFIG_TIMER_EARLY with bootstage
In initr_bootstage() we call bootstage_mark_name() which ends up calling
timer_get_us(). This call happens before initr_dm(), which inits driver
model.

On x86 we set gd->timer to NULL in the transition from board_init_f()
to board_init_r(). See board_init_f_r() for this assignment. So U-Boot
knows there is no timer available in the period immediately after
relocation.

On x86 the timer_get_us() call is implemented as calls to get_ticks() and
get_tbclk(). Both of these call dm_timer_init() to set up the timer, if
gd->timer is NULL and the early timer is not available.

However dm_timer_init() cannot succeed before initr_dm() is called.

So it seems that on x86 if we want to use CONFIG_BOOTSTAGE we must enable
CONFIG_TIMER_EARLY. Update the Kconfig to handle this.

Note: On most architectures we can rely on the pre-relocation memory still
being available, so that gd->timer pointers to a valid timer device and
everything works correctly. Admittedly this is not strictly correct since
the timer device is set up by pre-relocation U-Boot, but normally this is
fine. On x86 the 'CAR' (cache-as-RAM) memory used by pre-relocation U-Boot
disappears in board_init_f_r() and any attempt to access it will hang.
This is the reason why we must mark the timer as invalid when we get to
board_init_f_r().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2018-10-22 17:51:45 +08:00

154 lines
4.5 KiB
Plaintext

menu "Timer Support"
config TIMER
bool "Enable driver model for timer drivers"
depends on DM
help
Enable driver model for timer access. It uses the same API as
lib/time.c, but now implemented by the uclass. The first timer
will be used. The timer is usually a 32 bits free-running up
counter. There may be no real tick, and no timer interrupt.
config SPL_TIMER
bool "Enable driver model for timer drivers in SPL"
depends on TIMER && SPL
help
Enable support for timer drivers in SPL. These can be used to get
a timer value when in SPL, or perhaps for implementing a delay
function. This enables the drivers in drivers/timer as part of an
SPL build.
config TPL_TIMER
bool "Enable driver model for timer drivers in TPL"
depends on TIMER && TPL
help
Enable support for timer drivers in TPL. These can be used to get
a timer value when in TPL, or perhaps for implementing a delay
function. This enables the drivers in drivers/timer as part of an
TPL build.
config TIMER_EARLY
bool "Allow timer to be used early in U-Boot"
depends on TIMER
# initr_bootstage() requires a timer and is called before initr_dm()
# so only the early timer is available
default y if X86 && BOOTSTAGE
help
In some cases the timer must be accessible before driver model is
active. Examples include when using CONFIG_TRACE to trace U-Boot's
execution before driver model is set up. Enable this option to
use an early timer. These functions must be supported by your timer
driver: timer_early_get_count() and timer_early_get_rate().
config ALTERA_TIMER
bool "Altera timer support"
depends on TIMER
help
Select this to enable a timer for Altera devices. Please find
details on the "Embedded Peripherals IP User Guide" of Altera.
config ATMEL_PIT_TIMER
bool "Atmel periodic interval timer support"
depends on TIMER
help
Select this to enable a periodic interval timer for Atmel devices,
it is designed to offer maximum accuracy and efficient management,
even for systems with long response time.
config CADENCE_TTC_TIMER
bool "Cadence TTC (Triple Timer Counter)"
depends on TIMER
help
Enables support for the cadence ttc driver. This driver is present
on Xilinx Zynq and ZynqMP SoCs.
config DESIGNWARE_APB_TIMER
bool "Designware APB Timer"
depends on TIMER
help
Enables support for the Designware APB Timer driver. This timer is
present on Altera SoCFPGA SoCs.
config SANDBOX_TIMER
bool "Sandbox timer support"
depends on SANDBOX && TIMER
help
Select this to enable an emulated timer for sandbox. It gets
time from host os.
config X86_TSC_TIMER
bool "x86 Time-Stamp Counter (TSC) timer support"
depends on TIMER && X86
help
Select this to enable Time-Stamp Counter (TSC) timer for x86.
config OMAP_TIMER
bool "Omap timer support"
depends on TIMER
help
Select this to enable an timer for Omap devices.
config AST_TIMER
bool "Aspeed ast2400/ast2500 timer support"
depends on TIMER
default y if ARCH_ASPEED
help
Select this to enable timer for Aspeed ast2400/ast2500 devices.
This is a simple sys timer driver, it is compatible with lib/time.c,
but does not support any interrupts. Even though SoC has 8 hardware
counters, they are all treated as a single device by this driver.
This is mostly because they all share several registers which
makes it difficult to completely separate them.
config STI_TIMER
bool "STi timer support"
depends on TIMER
default y if ARCH_STI
help
Select this to enable a timer for STi devices.
config ARC_TIMER
bool "ARC timer support"
depends on TIMER && ARC && CLK
help
Select this to enable built-in ARC timers.
ARC cores may have up to 2 built-in timers: timer0 and timer1,
usually at least one of them exists. Either of them is supported
in U-Boot.
config AG101P_TIMER
bool "AG101P timer support"
depends on TIMER && NDS32
help
Select this to enable a timer for AG01P devices.
config ATCPIT100_TIMER
bool "ATCPIT100 timer support"
depends on TIMER
help
Select this to enable a ATCPIT100 timer which will be embeded
in AE3XX, AE250 boards.
config ROCKCHIP_TIMER
bool "Rockchip timer support"
depends on TIMER
help
Select this to enable support for the timer found on
Rockchip devices.
config STM32_TIMER
bool "STM32 timer support"
depends on TIMER
help
Select this to enable support for the timer found on
STM32 devices.
config MPC83XX_TIMER
bool "MPC83xx timer support"
depends on TIMER
help
Select this to enable support for the timer found on
devices based on the MPC83xx family of SoCs.
endmenu