////////////////////////////////////////////////////////////////////// // This is the entry point for the Download Mode. // // Inputs: Fuses (platformsettings) which contain info about which port to use // and the TIM which can contain port overrides. // Outputs: Returns a pointer to the next image which we will transfer control to. // // It mainly functions as following: // 1) Download the description file and determine if we have a // TIM or FBF download // 2) Download all the TIM or FBF images // 3) If UPLOAD, we continue with booting. ////////////////////////////////////////////////////////////////////// pIMAGE_INFO_3_4_0 DownloadModeMain( pFUSE_SET pFuses, pTIM pTIM_h, OPERATING_MODE_T BootMode ) { pIMAGE_INFO_3_4_0 pBootImageInfo = NULL; // Download the description file. Depending on its identifier, select // TIMDownload or FBFDownload. Download all the images and return a // pointer to the next image which we will transfer control to. pBootImageInfo = DetermineModeAndDownload( pFuses, pTIM_h ); // At this point, the images have been downloaded and burnt to flash. // Also note that the last image downloaded is still in ddr. Upon // return from this routine, that image will be copied to its base // location and executed. // If UPLOAD, we continue with booting. if( !isDownload ) { if (ResetUE != 0) { if (ResetDelay != 0) Delay(1000 * 1000 * ResetDelay); PlatformSetForceUSBEnumFlag(); do_wdt_reset(); } else { #if I2C && !AUTO_BOOTUP //if ((!battery_connect) && (!external_power)) if (((ONKey_pressed == 1) || (Jig_status == 7)) || ((Jig_status == 6) && ((battery_connect == 1) || (external_power == 1)))) serial_outstr("Allow to boot up\n"); else { serial_outstr("Not allow to boot up\n"); /*xyl del*/ //battery_process_step2(); } #endif #if ZIMI_PB05 PB05_charging_loop(); #endif // After the upload, we continue with regular boot mode. pBootImageInfo = BootModeMain( pTIM_h, BootMode, pFuses ); } } return pBootImageInfo; }
static int do_fobm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long cmd = 'b'<<24 | 'o'<<16 | 'o'<<8 | 't'; udelay(10); unsigned int rtc_clk = *(unsigned int *) (APBC_BASE_ADDR + APBC_RTC_CLK_RST); *(unsigned int *) (APBC_BASE_ADDR + APBC_RTC_CLK_RST) = (rtc_clk | 0x83) & ~(1<<2); do { __raw_writel(cmd, REG_RTC_BR0); } while (__raw_readl(REG_RTC_BR0) != cmd); udelay(10); printf("fobm %x",REG_RTC_BR0); do_wdt_reset(); return 0; }
void mmp_arch_reset(char mode, const char *cmd) { int count = 10; static unsigned char data; if ((!cpu_is_pxa910()) && (!cpu_is_pxa168()) && (!cpu_is_pxa988()) && (!cpu_is_pxa986()) && (!cpu_is_pxa1088())) return; printk("%s (%c)\n", __func__, mode); switch (mode) { case 's': /* Jump into ROM at address 0 */ cpu_reset(0); break; case 'w': default: #if defined(CONFIG_MFD_D2199) if (is_panic) { /* dump buck1 voltage */ d2199_extern_reg_read(D2199_BUCK2PH_BUCK1_REG, &data); pr_info("buck1 voltage: 0x%x\n", data); d2199_extern_reg_write(D2199_BUCK2PH_BUCK1_REG, 0xd8); /* double check */ d2199_extern_reg_read(D2199_BUCK2PH_BUCK1_REG, &data); pr_info("buck1 voltage: 0x%x\n", data); } #endif while(count--) { flush_cache_all(); outer_flush_all(); do_wdt_reset(cmd); mdelay(1000); printk("Watchdog fail...retry\n"); } break; } }
////////////////////////////////////////////////////////////////////// // This is the entry point for the Boot Mode. // // Inputs: Current TIM pointer, BootMode(SINGLE or DUAL) // Outputs: Returns the next image that we will transfer the control to. // // It mainly functions as following depending on the BOOT MODE: // 1) SINGLE TIM BOOT MODE: // a) Configures the Flashes and Initializes the Flash Management // b) Loads (and validates) all the images using a loop. // c) If TRUSTED, provisions the platform before finishing // d) Returns the next image that we will transfer the control to. // 2) DUAL TIM BOOT MODE: // a) Configures the Flashes and Initializes the Flash Management // b) Loads (and validates) the second TIM. // c) Configures the Flashes and Initializes the Flash Management // using the new TIM. // d) Loads (and validates) all the images using a loop. // e) If TRUSTED, provisions the platform before finishing // f) Returns the next image that we will transfer the control to. ////////////////////////////////////////////////////////////////////// pIMAGE_INFO_3_4_0 BootModeMain(pTIM pTIM_h, OPERATING_MODE_T BootMode, pFUSE_SET pFuses) { UINT_T Retval = NoError; pIMAGE_INFO_3_4_0 pBootImageInfo = NULL; UINT_T FlashNumber = 0; // Determine the Flash that will be used to store the downloaded images. FlashNumber = (pTIM_h->pConsTIM->FlashInfo.BootFlashSign) & 0xFF; Retval = Configure_Flashes (FlashNumber, BOOT_FLASH); if( Retval != NoError) FatalError(Retval); //turn on the flash management InitializeFM(LEGACY_METHOD, BOOT_FLASH); // Fall through to SINGLE TIM Mode. // Remember in both SINGLE and DUAL TIM Modes, we need to // go through the SINGLE TIM Mode branch at the end. #if ZIMI_PB05 UINT16_T vbat_mv; extern PowerUPType_t powerup; extern int isTempDetect; if(powerup == PowerUP_ONKEY) { UINT8_T m_boot; if(isTempDetect) { UINT8_T mm = check_BootONKey(10, 0); if(mm == 0) { serial_outstr("zimi# check onkey 10ms failed\n"); System_poweroff(); } bqTempDetect(); //here delay 500ms m_boot = check_BootONKey(1000, 0); } else m_boot = check_BootONKey(1, 1); if(m_boot == 0) { serial_outstr("zimi# check 3s onkey failed\n"); System_poweroff(); } } #if ZIMI_LED_MODE GetBatInstantVolt(&vbat_mv,USB_NotConnect); UINT8_T m_temp = IIC_read(0x07) & 0xff; if(3500<vbat_mv && vbat_mv<4050) { m_temp |= 0x20; IIC_write(0x07,m_temp); Delay_us(300*1000); GetBatInstantVolt(&vbat_mv,USB_NotConnect); m_temp &= ~0x20; IIC_write(0x07,m_temp); } else { GetBatInstantVolt(&vbat_mv,USB_NotConnect); } *(VUINT_T *)ZIMI_BATVOL_INIT_FLAG_ADDR = vbat_mv; if(vbat_mv<3600) { serial_outstr("zimi# bat led low\n"); LED_BAT_R_ON(); } else if(vbat_mv<3750) { serial_outstr("zimi# bat led middle\n"); LED_BAT_R_ON(); LED_BAT_G_ON(); } else { serial_outstr("zimi# bat led high\n"); LED_BAT_G_ON(); } #else #if 0 //case: big/small system led: all green extern PowerUPType_t powerup; if(powerup != PowerUP_USB) { LED_WIFI_G_ON(); LED_BAT_G_ON(); LED_LTE_G_ON(); } else //xyl USB mode, we light BAT led only according to VBAT { if(vbat_mv<3650) { serial_outstr("zimi# bat led low\n"); LED_BAT_R_ON(); } else if(vbat_mv<3950) { serial_outstr("zimi# bat led middle\n"); LED_BAT_R_ON(); LED_BAT_G_ON(); } else { serial_outstr("zimi# bat led high\n"); LED_BAT_G_ON(); } } #endif #endif #endif #if TR069_SUPPORT Retval = firmware_upgrade(pTIM_h); serial_outstr("TR069 return\n"); serial_outnum(Retval); serial_outstr("\n"); if (Retval == NoError) { PlatformSetTR069Flag(); do_wdt_reset(); } else #endif { #if SILENT_RESET if (PlatformCheckSilentReset()) pBootImageInfo = LoadSilentImages(pTIM_h); else #endif #if BACKUP_IMAGE if (back_image_key || upgrade_failed_flag || (PlatformCheckBackupImagesFlag() == 0x4D494E53)) pBootImageInfo = LoadBackupImages(pTIM_h); else #endif pBootImageInfo = LoadAllImages(pTIM_h); } return pBootImageInfo; }