static boot_reason_t platform_boot_status(void) { #if defined (MTK_KERNEL_POWER_OFF_CHARGING) ulong begin = get_timer(0); do { if (rtc_boot_check()) { print("%s RTC boot!\n", MOD); return BR_RTC; } if(!kpoc_flag) break; } while (get_timer(begin) < 1000 && kpoc_flag); #else if (rtc_boot_check()) { print("%s RTC boot!\n", MOD); return BR_RTC; } #endif if (mtk_wdt_boot_check() == WDT_NORMAL_REBOOT) { print("%s WDT normal boot!\n", MOD); return BR_WDT; } else if (mtk_wdt_boot_check() == WDT_BY_PASS_PWK_REBOOT){ print("%s WDT reboot bypass power key!\n", MOD); return BR_WDT_BY_PASS_PWK; } #if !CFG_FPGA_PLATFORM /* check power key */ if (mtk_detect_key(8)) { print("%s Power key boot!\n", MOD); rtc_mark_bypass_pwrkey(); return BR_POWER_KEY; } #endif #ifndef CFG_EVB_PLATFORM if (usb_accessory_in()) { print("%s USB/charger boot!\n", MOD); return BR_USB; } #ifdef RTC_2SEC_REBOOT_ENABLE //need to unlock rtc PROT //check after rtc_boot_check() initial finish. if (rtc_2sec_reboot_check()) { print("%s 2sec reboot!\n", MOD); return BR_2SEC_REBOOT; } #endif //#ifdef RTC_2SEC_REBOOT_ENABLE print("%s Unknown boot!\n", MOD); pl_power_off(); /* should nerver be reached */ #endif print("%s Power key boot!\n", MOD); return BR_POWER_KEY; }
BOOL is_force_boot(void) { if (rtc_boot_check(true)) { printf("[%s] Bypass Kernel Power off charging mode and enter Alarm Boot\n", __func__); return TRUE; } else if (meta_mode_check()) { printf("[%s] Bypass Kernel Power off charging mode and enter Meta Boot\n", __func__); return TRUE; } #ifdef RTC_2SEC_REBOOT_ENABLE else if (pmic_detect_powerkey() || mtk_wdt_boot_check()==WDT_BY_PASS_PWK_REBOOT || rtc_2sec_boot_check_kpoc() == RTC_2SEC_BOOT_NORMAL) #else else if (pmic_detect_powerkey() || mtk_wdt_boot_check()==WDT_BY_PASS_PWK_REBOOT) #endif { printf("[%s] Bypass Kernel Power off charging mode and enter Normal Boot\n", __func__); g_boot_mode = NORMAL_BOOT; return TRUE; } return FALSE; }
void mt65xx_bat_init(void) { kal_int32 bat_vol; // Low Battery Safety Booting #if defined(SWCHR_POWER_PATH) bat_vol = get_i_sense_volt(1); #else bat_vol = get_bat_sense_volt(1); #endif pchr_turn_on_charging(KAL_TRUE); dprintf(CRITICAL, "[mt65xx_bat_init] check VBAT=%d mV with %d mV\n", bat_vol, BATTERY_LOWVOL_THRESOLD); if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && (mt6325_upmu_get_pwrkey_deb()==0) ) { dprintf(CRITICAL, "[mt65xx_bat_init] KPOC+PWRKEY => change boot mode\n"); g_boot_reason_change = true; } rtc_boot_check(false); #ifndef MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION #ifndef MTK_BATLOWV_NO_PANEL_ON_EARLY if (bat_vol < BATTERY_LOWVOL_THRESOLD) #else if (is_low_battery(bat_vol)) #endif { if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && upmu_is_chr_det() == KAL_TRUE) { dprintf(CRITICAL, "[%s] Kernel Low Battery Power Off Charging Mode\n", __func__); g_boot_mode = LOW_POWER_OFF_CHARGING_BOOT; #if defined(SWCHR_POWER_PATH) check_bat_protect_status(); #endif return; } else { dprintf(CRITICAL, "[BATTERY] battery voltage(%dmV) <= CLV ! Can not Boot Linux Kernel !! \n\r",bat_vol); #ifndef NO_POWER_OFF mt6575_power_off(); #endif while(1) { dprintf(CRITICAL, "If you see the log, please check with RTC power off API\n\r"); } } } #endif return; }
void mt65xx_bat_init(void) { kal_int32 bat_vol; // Low Battery Safety Booting bat_vol = get_bat_sense_volt(1); #ifdef MTK_BQ24196_SUPPORT bat_vol = get_i_sense_volt(5); #endif dprintf(INFO, "[mt65xx_bat_init] check VBAT=%d mV with %d mV\n", bat_vol, BATTERY_LOWVOL_THRESOLD); pchr_turn_on_charging(); if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && (upmu_get_pwrkey_deb()==0) ) { dprintf(INFO, "[mt65xx_bat_init] KPOC+PWRKEY => change boot mode\n"); g_boot_reason_change = true; } rtc_boot_check(false); #ifndef MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION //if (bat_vol < BATTERY_LOWVOL_THRESOLD) if (is_low_battery(bat_vol)) { if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && upmu_is_chr_det() == KAL_TRUE) { dprintf(INFO, "[%s] Kernel Low Battery Power Off Charging Mode\n", __func__); g_boot_mode = LOW_POWER_OFF_CHARGING_BOOT; return; } else { dprintf(INFO, "[BATTERY] battery voltage(%dmV) <= CLV ! Can not Boot Linux Kernel !! \n\r",bat_vol); #ifndef NO_POWER_OFF mt6575_power_off(); #endif while(1) { dprintf(INFO, "If you see the log, please check with RTC power off API\n\r"); } } } #endif return; }
void platform_init(void) { dprintf(INFO, "platform_init()\n"); #ifdef LK_PROFILING unsigned int time_nand_emmc; unsigned int time_load_logo; unsigned int time_bat_init; unsigned int time_backlight; unsigned int time_show_logo; unsigned int time_boot_mode; unsigned int time_sw_env; unsigned int time_platform_init; time_platform_init = get_timer(0); time_nand_emmc = get_timer(0); #endif #ifdef MTK_EMMC_SUPPORT mmc_legacy_init(1); #else nand_init(); nand_driver_test(); #endif #ifdef LK_PROFILING printf("[PROFILE] ------- NAND/EMMC init takes %d ms -------- \n", get_timer(time_nand_emmc)); time_load_logo = get_timer(0); #endif mboot_common_load_logo((unsigned long)mt_get_logo_db_addr(), "logo"); dprintf(INFO, "Show BLACK_PICTURE\n"); mt_disp_fill_rect(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT, 0x0); mt_disp_power(TRUE); //<2012/11/14-Yuting Shih-[BU2SC00137502]Add for LOGO display. #if 1 mt_disp_show_boot_logo(); #else mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); mt_disp_power(1); //power on display related modules #endif //>2012/11/14-Yuting Shih-[BU2SC00137502]. #ifdef LK_PROFILING printf("[PROFILE] ------- load_logo takes %d ms -------- \n", get_timer(time_load_logo)); time_backlight = get_timer(0); #endif mt65xx_backlight_on(); #ifdef LK_PROFILING printf("[PROFILE] ------- backlight takes %d ms -------- \n", get_timer(time_backlight)); time_boot_mode = get_timer(0); #endif boot_mode_select(); #ifdef LK_PROFILING printf("[PROFILE] ------- boot mode select takes %d ms -------- \n", get_timer(time_boot_mode)); #endif /*Show download logo & message on screen */ if (g_boot_arg->boot_mode == DOWNLOAD_BOOT) { mt_disp_show_boot_logo(); video_printf(" => Downloading...\n"); mt65xx_backlight_on(); mtk_wdt_disable();//Disable wdt before jump to DA platform_uninit(); #ifdef HAVE_CACHE_PL310 l2_disable(); #endif arch_disable_cache(UCACHE); arch_disable_mmu(); jump_da(g_boot_arg->da_info.addr, g_boot_arg->da_info.arg1, g_boot_arg->da_info.arg2); } #ifdef LK_PROFILING time_bat_init = get_timer(0); #endif mt65xx_bat_init(); #ifdef LK_PROFILING printf("[PROFILE] ------- battery init takes %d ms -------- \n", get_timer(time_bat_init)); #endif /* NOTE: if define CFG_POWER_CHARGING, will rtc_boot_check() in mt65xx_bat_init() */ #ifndef CFG_POWER_CHARGING rtc_boot_check(false); #endif #ifdef LK_PROFILING time_show_logo = get_timer(0); #endif if ((g_boot_mode != ALARM_BOOT) && (g_boot_mode != FASTBOOT)) { printf("show log disable\n"); mt_disp_show_boot_logo(); printf("show log end\n"); } #ifdef LK_PROFILING printf("[PROFILE] ------- show logo takes %d ms -------- \n", get_timer(time_show_logo)); time_sw_env= get_timer(0); #endif sw_env(); #ifdef LK_PROFILING printf("[PROFILE] ------- sw_env takes %d ms -------- \n", get_timer(time_sw_env)); #endif #ifdef LK_PROFILING printf("[PROFILE] ------- platform_init takes %d ms -------- \n", get_timer(time_platform_init)); #endif }
void platform_init(void) { #ifdef LK_PROFILING unsigned int time_nand_emmc; unsigned int time_load_logo; unsigned int time_bat_init; unsigned int time_backlight; unsigned int time_show_logo; unsigned int time_boot_mode; unsigned int time_sw_env; unsigned int time_platform_init; unsigned int time_env; unsigned int time_disp_init; unsigned int time_security_init; unsigned int time_RTC_boot_Check; time_platform_init = get_timer(0); time_nand_emmc = get_timer(0); #endif dprintf(INFO, "platform_init()\n"); #ifdef DUMMY_AP dummy_ap_entry(); #endif #ifdef MTK_EMMC_SUPPORT mmc_legacy_init(1); #else #ifndef MACH_FPGA nand_init(); nand_driver_test(); #endif #endif #ifdef MTK_KERNEL_POWER_OFF_CHARGING if((g_boot_arg->boot_reason == BR_USB) && (upmu_is_chr_det() == KAL_FALSE)) { printf("[%s] Unplugged Charger/Usb between Pre-loader and Uboot in Kernel Charging Mode, Power Off \n", __func__); mt6575_power_off(); } #endif #ifdef LK_PROFILING printf("[PROFILE] ------- NAND/EMMC init takes %d ms -------- \n", get_timer(time_nand_emmc)); time_env = get_timer(0); #endif env_init(); print_env(); #ifdef LK_PROFILING dprintf(INFO,"[PROFILE] ------- ENV init takes %d ms -------- \n", (int)get_timer(time_env)); #endif #ifdef LK_PROFILING time_disp_init = get_timer(0); #endif //FIXME: Disable for MT6582 FPGA Ealry Porting #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode ==CMD_MODE) mt_disp_init((void *)g_fb_base); #endif #ifdef LK_PROFILING dprintf(INFO,"[PROFILE] ------- disp init takes %d ms -------- \n", (int)get_timer(time_disp_init)); #endif #ifdef LK_PROFILING time_load_logo = get_timer(0); #endif #ifdef CONFIG_CFB_CONSOLE //FIXME: Disable for MT6582 FPGA Ealry Porting #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP drv_video_init(); #endif #endif //#endif #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP mboot_common_load_logo((unsigned long)mt_get_logo_db_addr(), "logo"); dprintf(INFO, "Show BLACK_PICTURE\n"); #endif //FIXME: Disable for MT6582 FPGA Ealry Porting #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY if(!is_low_battery(0)) { #endif mt_disp_fill_rect(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT, 0x0); mt_disp_power(TRUE); mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); mt_disp_wait_idle(); mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); mt_disp_wait_idle(); mt_disp_power(1); //power on display related modules #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY } #endif #endif #ifdef LK_PROFILING printf("[PROFILE] ------- load_logo takes %d ms -------- \n", get_timer(time_load_logo)); time_backlight = get_timer(0); #endif /*for kpd pmic mode setting*/ set_kpd_pmic_mode(); //FIXME: Disable for MT6582 FPGA Ealry Porting //#ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY if(!is_low_battery(0)) { #endif /*some lcm panel need more time to start show picture*/ msleep(50); mt65xx_backlight_on(); #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY } #endif //#endif #ifdef LK_PROFILING printf("[PROFILE] ------- backlight takes %d ms -------- \n", get_timer(time_backlight)); time_boot_mode = get_timer(0); #endif boot_mode_select(); #ifdef LK_PROFILING printf("[PROFILE] ------- boot mode select takes %d ms -------- \n", get_timer(time_boot_mode)); #endif #ifdef MTK_SECURITY_SW_SUPPORT #ifdef LK_PROFILING time_security_init = get_timer(0); #endif /* initialize security library */ #ifdef MTK_EMMC_SUPPORT sec_func_init(1); #else sec_func_init(0); #endif #ifdef LK_PROFILING dprintf(INFO,"[PROFILE] ------- Security init takes %d ms -------- \n", (int)get_timer(time_security_init)); #endif #endif /*Show download logo & message on screen */ if (g_boot_arg->boot_mode == DOWNLOAD_BOOT) { printf("[LK] boot mode is DOWNLOAD_BOOT\n"); #ifdef MTK_SECURITY_SW_SUPPORT /* verify da before jumping to da*/ if (sec_usbdl_enabled()) { u8 *da_addr = (u8 *)g_boot_arg->da_info.addr; u32 da_len = g_boot_arg->da_info.len; u32 sig_len = g_boot_arg->da_info.sig_len; u8 *sig_addr = (unsigned char *)da_addr + (da_len - sig_len); if (da_len == 0 || sig_len == 0) { printf("[LK] da argument is invalid\n"); printf("da_addr = 0x%x\n", da_addr); printf("da_len = 0x%x\n", da_len); printf("sig_len = 0x%x\n", sig_len); } if (sec_usbdl_verify_da(da_addr, (da_len - sig_len), sig_addr, sig_len)) { /* da verify fail */ video_printf(" => Not authenticated tool, download stop...\n"); while(1); /* fix me, should not be infinite loop in lk */ } } else #endif { printf(" DA verification disabled...\n"); } mt_disp_show_boot_logo(); video_printf(" => Downloading...\n"); mt65xx_backlight_on(); mtk_wdt_disable();//Disable wdt before jump to DA platform_uninit(); #ifdef HAVE_CACHE_PL310 l2_disable(); #endif #ifdef ENABLE_L2_SHARING config_shared_SRAM_size(); #endif arch_disable_cache(UCACHE); arch_disable_mmu(); jump_da(g_boot_arg->da_info.addr, g_boot_arg->da_info.arg1, g_boot_arg->da_info.arg2); } #ifdef LK_PROFILING time_bat_init = get_timer(0); #endif mt65xx_bat_init(); #ifdef LK_PROFILING printf("[PROFILE] ------- battery init takes %d ms -------- \n", get_timer(time_bat_init)); #endif #ifndef CFG_POWER_CHARGING #ifdef LK_PROFILING time_RTC_boot_Check = get_timer(0); #endif /* NOTE: if define CFG_POWER_CHARGING, will rtc_boot_check() in mt65xx_bat_init() */ rtc_boot_check(false); #ifdef LK_PROFILING dprintf(INFO,"[PROFILE] ------- RTC boot check Init takes %d ms -------- \n", (int)get_timer(time_RTC_boot_Check)); #endif #endif #ifdef LK_PROFILING time_show_logo = get_timer(0); #endif #ifdef MTK_KERNEL_POWER_OFF_CHARGING if(kernel_charging_boot() == 1) { #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY CHARGER_TYPE CHR_Type_num = CHARGER_UNKNOWN; charging_get_charger_type(&CHR_Type_num); if ((g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) || ((CHR_Type_num != STANDARD_HOST) && (CHR_Type_num != NONSTANDARD_CHARGER))) { dprintf(INFO, "[PROFILE] ------- g_boot_mode = %d -------- \n", g_boot_mode); #endif mt_disp_power(TRUE); mt_disp_show_low_battery(); mt_disp_wait_idle(); mt65xx_leds_brightness_set(6, 110); #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY } #endif } else if(g_boot_mode != KERNEL_POWER_OFF_CHARGING_BOOT && g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) { #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT)) { mt_disp_show_boot_logo(); } #endif } #else #ifndef DISABLE_DISPLAY_IN_LK_FOR_82_BRINGUP if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT)) { mt_disp_show_boot_logo(); } #endif #endif #ifdef LK_PROFILING printf("[PROFILE] ------- show logo takes %d ms -------- \n", get_timer(time_show_logo)); time_sw_env= get_timer(0); #endif //sw_env(); #ifdef LK_PROFILING printf("[PROFILE] ------- sw_env takes %d ms -------- \n", get_timer(time_sw_env)); printf("[PROFILE] ------- platform_init takes %d ms -------- \n", get_timer(time_platform_init)); #endif }
//extern int BattVoltToTemp(int dwVolt); void mt65xx_bat_init(void) { kal_int32 bat_vol; kal_int32 bat_tempture; kal_int32 bat_temp; #ifdef MTK_IPO_POWERPATH_SUPPORT CHARGER_TYPE CHR_Type_num = CHARGER_UNKNOWN; #endif // Low Battery Safety Booting bat_vol = get_bat_sense_volt(1); bat_tempture = get_tbat_volt(1); bat_temp=BattVoltToTemp(bat_tempture); printf("the bat_vol is %d,the bat_tempture is %d,the bat_temp is %d\n",bat_vol,bat_tempture,bat_temp); #if defined(MTK_BQ24196_SUPPORT) ||defined(MTK_BQ24296_SUPPORT) bat_vol = get_i_sense_volt(5); #endif printf("[mt65xx_bat_init] check VBAT=%d mV with %d mV\n", bat_vol, BATTERY_LOWVOL_THRESOLD); pchr_turn_on_charging(); if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && (upmu_get_pwrkey_deb()==0) ) { printf("[mt65xx_bat_init] KPOC+PWRKEY => change boot mode\n"); g_boot_reason_change = true; } rtc_boot_check(false); #ifndef MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION //if (bat_vol < BATTERY_LOWVOL_THRESOLD) if (is_low_battery(bat_vol)) { if(g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT && upmu_is_chr_det() == KAL_TRUE) { printf("[%s] Kernel Low Battery Power Off Charging Mode\n", __func__); g_boot_mode = LOW_POWER_OFF_CHARGING_BOOT; return; } #ifdef BULMA_PROJECT else if((META_BOOT == g_boot_mode) ||(ADVMETA_BOOT == g_boot_mode)) { printf("Enter Meta Mode emw\n\r"); } #endif else { #ifdef MTK_IPO_POWERPATH_SUPPORT //boot linux kernel because of supporting powerpath and using standard AC charger if(upmu_is_chr_det() == KAL_TRUE) { charging_get_charger_type(&CHR_Type_num); if(STANDARD_CHARGER == CHR_Type_num) { return; } } #endif printf("[BATTERY] battery voltage(%dmV) <= CLV ! Can not Boot Linux Kernel !! \n\r",bat_vol); #ifndef NO_POWER_OFF mt6575_power_off(); #endif while(1) { printf("If you see the log, please check with RTC power off API\n\r"); } } } if(is_high_bat_tempature(bat_temp)) { printf("[BATTERY] battery tempature(%dmV) <= CLV ! Can not Boot Linux Kernel !! \n\r",bat_tempture); #ifndef NO_POWER_OFF mt6575_power_off(); #endif while(1) { printf("If you see the log, please check with RTC power off API\n\r"); } } #endif return; }
static boot_reason_t platform_boot_status(void) { #if defined (MTK_KERNEL_POWER_OFF_CHARGING) ulong begin = get_timer(0); do { if (rtc_boot_check()) { print("%s RTC boot!\n", MOD); return BR_RTC; } if(!kpoc_flag) break; } while (get_timer(begin) < 1000 && kpoc_flag); #else if (rtc_boot_check()) { print("%s RTC boot!\n", MOD); return BR_RTC; } #endif if (mtk_wdt_boot_check() == WDT_NORMAL_REBOOT) { print("%s WDT normal boot!\n", MOD); return BR_WDT; } else if (mtk_wdt_boot_check() == WDT_BY_PASS_PWK_REBOOT){ print("%s WDT reboot bypass power key!\n", MOD); return BR_WDT_BY_PASS_PWK; } #if !CFG_FPGA_PLATFORM #ifdef LENOVO_BOOT_TIME_DELAY /* check power key */ int iLoop=0; int iCheck_num=3; int iInterval=250; int iRet=0; for(iLoop=0; iLoop < iCheck_num; iLoop++ ) { iRet = mtk_detect_key(8); if(false == iRet ) break; mdelay(iInterval); } if (iRet) { print("%s Power key boot!\n", MOD); rtc_mark_bypass_pwrkey(); return BR_POWER_KEY; } #else /* check power key */ if (mtk_detect_key(8)) { print("%s Power key boot!\n", MOD); rtc_mark_bypass_pwrkey(); return BR_POWER_KEY; } #endif #endif #ifndef EVB_PLATFORM if (usb_accessory_in()) { print("%s USB/charger boot!\n", MOD); return BR_USB; } print("%s Unknown boot!\n", MOD); pl_power_off(); /* should nerver be reached */ #endif print("%s Power key boot!\n", MOD); return BR_POWER_KEY; }
void start_armboot (void) { init_fnc_t **init_fnc_ptr; char *s; ulong size; #if defined(CONFIG_VFD) || defined(CONFIG_LCD) unsigned long addr; #endif #ifdef CFG_UBOOT_PROFILING unsigned int time_start_armboot = get_timer(0); unsigned int time_init_sequence; unsigned int time_misc_init; unsigned int time_env; unsigned int time_nand; unsigned int time_bat; unsigned int time_show_logo; unsigned int time_backlight; unsigned int time_sw_env; #endif #ifdef CFG_UBOOT_PROFILING boot_time = get_timer(0); #endif /* Pointer is writable since we allocated a register for it */ gd = (gd_t*)(_armboot_start - CONFIG_SYS_MALLOC_LEN - sizeof(gd_t)); /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("": : :"memory"); memset ((void*)gd, 0, sizeof (gd_t)); gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); memset (gd->bd, 0, sizeof (bd_t)); monitor_flash_len = _bss_start - _armboot_start; #ifdef CFG_UBOOT_PROFILING time_init_sequence = get_timer(0); #endif for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { hang (); } } /* armboot_start is defined in the board-specific linker script */ mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN); #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- init_sequence takes %d ms -------- \n", get_timer(time_init_sequence)); #endif #ifndef CONFIG_SYS_NO_FLASH /* configure available FLASH banks */ display_flash_config (flash_init ()); #endif /* CONFIG_SYS_NO_FLASH */ #ifdef CONFIG_VFD #ifndef PAGE_SIZE #define PAGE_SIZE 4096 #endif /* * reserve memory for VFD display (always full pages) */ /* bss_end is defined in the board-specific linker script */ addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); size = vfd_setmem (addr); gd->fb_base = addr; #endif /* CONFIG_VFD */ #ifdef CONFIG_LCD #ifndef PAGE_SIZE #define PAGE_SIZE 4096 #endif /* * reserve memory for LCD display (always full pages) */ /* bss_end is defined in the board-specific linker script */ addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); size = lcd_setmem (addr); gd->fb_base = addr; #endif /* CONFIG_LCD */ #ifdef CONFIG_HAS_DATAFLASH AT91F_DataflashInit(); dataflash_print_info(); #endif #ifdef CFG_UBOOT_PROFILING time_env = get_timer(0); #endif /* initialize environment */ env_relocate (); #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- env relocate takes %d ms -------- \n", get_timer(time_env)); #endif #ifdef CONFIG_VFD /* must do this after the framebuffer is allocated */ drv_vfd_init(); #endif /* CONFIG_VFD */ /* IP Address */ //gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); stdio_init (); /* get the devices list going. */ #ifdef CONFIG_CMC_PU2 load_sernum_ethaddr (); #endif /* CONFIG_CMC_PU2 */ jumptable_init (); //console_init_r (); /* fully init console as a device */ //marked by hong-rong #if defined(CONFIG_CMD_NAND) #ifdef CFG_UBOOT_PROFILING time_nand= get_timer(0); #endif puts ("NAND: "); nand_init(); /* go init the NAND */ #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- nand init takes %d ms -------- \n", get_timer(time_nand)); #endif #endif #if defined(CONFIG_ARCH_MISC_INIT) /* miscellaneous arch dependent initialisations */ arch_misc_init (); #endif #ifdef CFG_UBOOT_PROFILING time_misc_init= get_timer(0); #endif #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r (); #endif #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- misc_init takes %d ms -------- \n", get_timer(time_misc_init)); #endif #ifdef CONFIG_GENERIC_MMC puts ("MMC: "); mmc_initialize (gd->bd); #endif #ifdef CFG_POWER_CHARGING #ifdef CFG_UBOOT_PROFILING time_bat= get_timer(0); #endif #if defined(MT6516) mt6516_bat_init(); #else mt65xx_bat_init(); #endif #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- battery init takes %d ms -------- \n", get_timer(time_bat)); #endif #else /* NOTE: if define CFG_POWER_CHARGING, will rtc_boot_check() in mt65xx_bat_init() */ rtc_boot_check(false); #endif #ifdef CFG_UBOOT_PROFILING time_show_logo= get_timer(0); #endif // Some driver refresh RAM data to LCM after sleeping out. // LCM must sleep out before backlight on. Or Users may see the mess data in LCM in a instance. mt65xx_disp_power(1); if(g_boot_mode != ALARM_BOOT) { mt65xx_disp_show_boot_logo(); } #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- show logo takes %d ms -------- \n", get_timer(time_show_logo)); #endif #ifdef CFG_UBOOT_PROFILING time_show_logo= get_timer(0); #endif #ifdef CFG_UBOOT_PROFILING time_backlight= get_timer(0); #endif mt65xx_backlight_on(); #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- backlight takes %d ms -------- \n", get_timer(time_backlight)); #endif #ifdef CFG_UBOOT_PROFILING time_sw_env= get_timer(0); #endif //***************** //* prepare mt65xx sw enviroment #if defined(MT6516) mt6516_sw_env(); #else mt65xx_sw_env(); #endif #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- sw_env takes %d ms -------- \n", get_timer(time_sw_env)); #endif #ifdef CFG_UBOOT_PROFILING printf("[PROFILE] ------- start_armboot takes %d ms -------- \n", get_timer(time_start_armboot)); #endif /* main_loop() can return to retry autoboot, if so just run it again */ for (;;) { main_loop (); } /* NOTREACHED - no way out of command loop except booting */ }