tegra: Init clocks even when SPL did not run
At present early clock init happens in SPL. If SPL did not run (because for example U-Boot is chain-loaded from another boot loader) then the clocks are not set as U-Boot expects. Add a function to detect this and call the early clock init in U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
422f04b68f
commit
46864cc8e8
@ -288,6 +288,9 @@ void clock_init(void);
|
||||
/* Initialize the PLLs */
|
||||
void clock_early_init(void);
|
||||
|
||||
/* @return true if hardware indicates that clock_early_init() was called */
|
||||
bool clock_early_init_done(void);
|
||||
|
||||
/* Returns a pointer to the clock source register for a peripheral */
|
||||
u32 *get_periph_source_reg(enum periph_id periph_id);
|
||||
|
||||
|
@ -191,6 +191,9 @@ void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
if (!clock_early_init_done())
|
||||
clock_early_init();
|
||||
|
||||
#if defined(CONFIG_TEGRA_DISCONNECT_UDC_ON_BOOT)
|
||||
#define USBCMD_FS2 (1 << 15)
|
||||
{
|
||||
|
@ -825,3 +825,8 @@ int clock_external_output(int clk_id)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__weak bool clock_early_init_done(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -891,6 +891,24 @@ void clock_early_init(void)
|
||||
udelay(2);
|
||||
}
|
||||
|
||||
/*
|
||||
* clock_early_init_done - Check if clock_early_init() has been called
|
||||
*
|
||||
* Check a register that we set up to see if clock_early_init() has already
|
||||
* been called.
|
||||
*
|
||||
* @return true if clock_early_init() was called, false if not
|
||||
*/
|
||||
bool clock_early_init_done(void)
|
||||
{
|
||||
struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
|
||||
u32 val;
|
||||
|
||||
val = readl(&clkrst->crc_sclk_brst_pol);
|
||||
|
||||
return val == 0x20002222;
|
||||
}
|
||||
|
||||
void arch_timer_init(void)
|
||||
{
|
||||
struct sysctr_ctlr *sysctr = (struct sysctr_ctlr *)NV_PA_TSC_BASE;
|
||||
|
Loading…
Reference in New Issue
Block a user