1
0
Fork 0

Try to set clocks before jumping to HAB failsafe

This is what the bare-metal SDK does
utp
Martin T. H. Sandsmark 2016-12-04 20:04:50 +01:00
parent 6e86f08d1c
commit 1bc287e726
1 changed files with 16 additions and 1 deletions

View File

@ -964,6 +964,21 @@ typedef void hab_rvt_failsafe_t(void);
#define HAB_RVT_FAILSAFE (*(uint32_t *) 0x000000BC)
#define hab_rvt_failsafe ((hab_rvt_failsafe_t *) HAB_RVT_FAILSAFE)
static void jump_to_failsafe(void)
{
/* Re-configure the clock gating like the ROM expects it */
struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
writel(0xF0C03F0F, &ccm->CCGR0);
writel(0xF0FC0000, &ccm->CCGR1);
writel(0xFC3FF00C, &ccm->CCGR2);
writel(0x3FF00000, &ccm->CCGR3);
writel(0x0000FF00, &ccm->CCGR4);
writel(0xF0033F0F, &ccm->CCGR5);
writel(0xFFFF0303, &ccm->CCGR6);
hab_rvt_failsafe(); /* This never returns, hopefully */
}
int board_init(void)
{
/* address of boot parameters */
@ -971,7 +986,7 @@ int board_init(void)
if (check_keypress() || check_gpio_keypress()) {
printf("Magic key press detected, launching USB download mode\n");
hab_rvt_failsafe(); /* This never returns, hopefully */
jump_to_failsafe();
}
setup_epdc();