/*============================================================================*/ static void bldr_pre_process(void) { /* enter preloader safe mode */ platform_safe_mode(1, 5000); /* essential hardware initialization. e.g. timer, pll, uart... */ platform_pre_init(); print("\n%s Build Time: %s\n", MOD, BUILD_TIME); g_boot_mode = NORMAL_BOOT; /* hardware initialization */ platform_init(); #if CFG_UART_TOOL_HANDSHAKE /* init uart handshake for sending 'ready' to tool and receiving handshake * pattern from tool in the background and we'll see the pattern later. * this can reduce the handshake time. */ uart_handshake_init(); #endif part_init(); part_dump(); /* init security library */ sec_lib_init(); }
static void bldr_wait_forever(void) { /* prevent wdt timeout and clear usbdl flag */ mtk_wdt_disable(); platform_safe_mode(0, 0); print("bldr_wait_forever\n"); while(1); }
void platform_emergency_download(u32 timeout) { /* enter download mode */ print("%s emergency download mode(timeout: %ds).\n", MOD, timeout / 1000); platform_safe_mode(1, timeout); #if !CFG_FPGA_PLATFORM mtk_arch_reset(0); /* don't bypass power key */ #endif while(1); }
/*============================================================================*/ void bldr_jump(u32 addr, u32 arg1, u32 arg2) { platform_wdt_kick(); /* disable preloader safe mode */ platform_safe_mode(0, 0); print("\n%s jump to 0x%x\n", MOD, addr); print("%s <0x%x>=0x%x\n", MOD, addr, *(u32*)addr); print("%s <0x%x>=0x%x\n", MOD, addr + 4, *(u32*)(addr + 4)); jump(addr, arg1, arg2); }
/*============================================================================*/ void bldr_jump(u32 addr, u32 arg1, u32 arg2) { platform_wdt_kick(); /* disable preloader safe mode */ platform_safe_mode(0, 0); print("\n%s jump to 0x%x\n", MOD, addr); print("%s <0x%x>=0x%x\n", MOD, addr, *(u32*)addr); print("%s <0x%x>=0x%x\n", MOD, addr + 4, *(u32*)(addr + 4)); /* 2012/11/27 * Sten * Remove MT6589 MCI downsizer workaround start*/ *(volatile unsigned int*)(0x10001200) &= (~0x1); /* Remove MT6589 MCI downsizer workaround end*/ jump(addr, arg1, arg2); }
static void bldr_pre_process(void) { #if CFG_USB_AUTO_DETECT platform_usbdl_flag_check(); #endif #if CFG_EMERGENCY_DL_SUPPORT platform_safe_mode(1, CFG_EMERGENCY_DL_TIMEOUT_MS); #endif /* essential hardware initialization. e.g. timer, pll, uart... */ platform_pre_init(); print("\n%s Build Time: %s\n", MOD, BUILD_TIME); // config_DCC_Calin(); // dump_dcc_regs(); // disable_FBB_SW(); g_boot_mode = NORMAL_BOOT; /* hardware initialization */ platform_init(); #if CFG_UART_TOOL_HANDSHAKE /* init uart handshake for sending 'ready' to tool and receiving handshake * pattern from tool in the background and we'll see the pattern later. * this can reduce the handshake time. */ //#ifdef DUMMY_AP //FIXME uart_handshake_init(); //#endif #endif BOOTING_TIME_PROFILING_LOG("UART handshake init"); log_buf_ctrl(1); /* switch log buffer to dram */ part_init(); part_dump(); BOOTING_TIME_PROFILING_LOG("Part Init"); /* init security library */ sec_lib_init(); BOOTING_TIME_PROFILING_LOG("Sec lib init"); }
/*============================================================================*/ void bldr_jump(u32 addr, u32 arg1, u32 arg2) { platform_wdt_kick(); /* disable preloader safe mode */ platform_safe_mode(0, 0); apmcu_disable_dcache(); apmcu_dcache_clean_invalidate(); apmcu_dsb(); apmcu_icache_invalidate(); apmcu_disable_icache(); apmcu_isb(); apmcu_disable_smp(); print("\n%s jump to 0x%x\n", MOD, addr); print("%s <0x%x>=0x%x\n", MOD, addr, *(u32*)addr); print("%s <0x%x>=0x%x\n", MOD, addr + 4, *(u32*)(addr + 4)); jump(addr, arg1, arg2); }
void bldr_jump64(u32 addr, u32 arg1, u32 arg2) { platform_wdt_kick(); /* disable preloader safe mode */ platform_safe_mode(0, 0); print("\n%s jump to 0x%x\n", MOD, addr); print("%s <0x%x>=0x%x\n", MOD, addr, *(u32*)addr); print("%s <0x%x>=0x%x\n", MOD, addr + 4, *(u32*)(addr + 4)); #if CFG_ATF_SUPPORT trustzone_jump(addr, arg1, arg2); #else print("%s trustzone is not supported!\n", MOD); #if CFG_LOAD_SLT_AARCH64_KERNEL print("%s jump to 64 bit SLT kernel!\n", MOD); jumparch64_slt(); #endif #endif }
void platform_usb_auto_detect_flow() { print("USB DL Flag is %d when enter preloader \n",g_usbdl_flag); /*usb download flag haven't set */ if(g_usbdl_flag == 0){ /*set up usbdl flag*/ platform_safe_mode(1,CFG_USB_AUTO_DETECT_TIMEOUT_MS); print("Preloader going reset and trigger BROM usb auto detectiton!!\n"); /* WDT by pass powerkey reboot */ /* keep the previous status, pass it into reset function */ if (WDT_BY_PASS_PWK_REBOOT == mtk_wdt_boot_check()) mtk_arch_reset(1); else mtk_arch_reset(0); }else{ /*usb download flag have been set*/ } }
/*============================================================================*/ static void bldr_pre_process(void) { #ifdef PL_PROFILING u32 profiling_time; profiling_time = 0; #endif #if defined(CFG_USB_AUTO_DETECT) platform_usbdl_flag_check(); #endif /* enter preloader safe mode */ #if CFG_EMERGENCY_DL_SUPPORT platform_safe_mode(1, CFG_EMERGENCY_DL_TIMEOUT_MS); #endif /* essential hardware initialization. e.g. timer, pll, uart... */ platform_pre_init(); #ifdef PL_PROFILING printf("#T#total_preplf_init=%d\n", get_timer(0)); #endif print("\n%s Build Time: %s\n", MOD, BUILD_TIME); g_boot_mode = NORMAL_BOOT; #ifdef PL_PROFILING profiling_time = get_timer(0); #endif /* hardware initialization */ platform_init(); #ifdef PL_PROFILING printf("#T#total_plf_init=%d\n", get_timer(profiling_time)); #endif #if CFG_UART_TOOL_HANDSHAKE && (!defined(CFG_MEM_PRESERVED_MODE)) #ifdef PL_PROFILING profiling_time = get_timer(0); #endif /* init uart handshake for sending 'ready' to tool and receiving handshake * pattern from tool in the background and we'll see the pattern later. * this can reduce the handshake time. */ uart_handshake_init(); #ifdef PL_PROFILING printf("#T#UART_hdshk=%d\n", get_timer(profiling_time)); #endif #endif //#if CFG_UART_TOOL_HANDSHAKE && (!defined(CFG_MEM_PRESERVED_MODE)) #ifdef PL_PROFILING profiling_time = get_timer(0); #endif part_init(); part_dump(); #ifdef PL_PROFILING printf("#T#part_init+dump=%d\n", get_timer(profiling_time)); #endif #ifdef PL_PROFILING profiling_time = get_timer(0); #endif /* init security library */ sec_lib_init(); #ifdef PL_PROFILING printf("#T#sec_lib_init=%d\n", get_timer(profiling_time)); #endif }