void start_armboot (void) { init_fnc_t **init_fnc_ptr; uchar *buf; char boot_dev_name[8]; u32 si_type, omap4_rev; int len = 0; u8 val = SWITCH_OFF; image_type image; for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { hang (); } } image.image = 2; image.val =99; omap4_rev = omap_revision(); if (omap4_rev >= OMAP4460_ES1_0) { omap_temp_sensor_check(); if (omap4_rev == OMAP4470_ES1_0) { writel(((TSHUT_HIGH_ADC_CODE << 16) | TSHUT_COLD_ADC_CODE), CORE_TSHUT_THRESHOLD); MV1(WK(CONTROL_SPARE_RW) , (M1)); } si_type = omap4_silicon_type(); if (si_type == PROD_ID_1_SILICON_TYPE_HIGH_PERF) printf("OMAP4470: 1.5 GHz capable SOM\n"); else if (si_type == PROD_ID_1_SILICON_TYPE_STD_PERF) printf("OMAP4470: 1.3 GHz capable SOM\n"); } #ifdef CONFIG_USBBOOT_ERASER /* Erase mlo and poweroff */ mlo_erase(); #else #ifdef CONFIG_USBBOOT /*usb boot does not check power button */ printf("boot_device=0x%x boot_mode=0x%x\n", get_boot_device(), get_boot_mode()); printf("id_code=%08x\n", readl(CONTROL_ID_CODE)); #endif #ifdef CONFIG_USBOOT_MEMTEST /* the device will power off after the test */ mem_test(); /*power off PMIC */ printf("Memtest done, powering off!\n"); select_bus(CFG_I2C_BUS, CFG_I2C_SPEED); val = SWITCH_OFF; i2c_write(TWL6030_PMC_ID, PHOENIX_DEV_ON, 1, &val, 1); /* we should never get here */ hang(); #endif #ifdef START_LOADB_DOWNLOAD strcpy(boot_dev_name, "UART"); do_load_serial_bin (CFG_LOADADDR, 115200); #else buf = (uchar *) (CFG_LOADADDR - 0x120); image.data = (uchar *) (CFG_LOADADDR - 0x120); switch (get_boot_device()) { #ifdef CONFIG_USBBOOT case 0x45: printf("boot_dev=USB\n"); strcpy(boot_dev_name, "USB"); /* read data from usb and write to sdram */ if (usb_read_bootloader(&len) != 0) { hang(); } printf("usb read len=%d\n", len); break; #else case 0x03: strcpy(boot_dev_name, "ONENAND"); #if defined(CFG_ONENAND) for (i = ONENAND_START_BLOCK; i < ONENAND_END_BLOCK; i++) { if (!onenand_read_block(buf, i)) buf += ONENAND_BLOCK_SIZE; else goto error; } #endif break; case 0x02: default: strcpy(boot_dev_name, "NAND"); #if defined(CFG_NAND) for (i = NAND_UBOOT_START; i < NAND_UBOOT_END; i+= NAND_BLOCK_SIZE) { if (!nand_read_block(buf, i)) buf += NAND_BLOCK_SIZE; /* advance buf ptr */ } #endif break; case 0x05: strcpy(boot_dev_name, "MMC/SD1"); #if defined(CONFIG_MMC) if (mmc_read_bootloader(0) != 0) goto error; #endif break; case 0x06: strcpy(boot_dev_name, "EMMC"); #if defined(CONFIG_MMC) if (mmc_read_bootloader(1) != 0) goto error; #endif break; #endif /* CONFIG_USBBOOT */ }; #endif SEC_ENTRY_Std_Ppa_Call ( PPA_SERV_HAL_BN_CHK , 1 , &image ); if ( image.val == 0 ) { /* go run U-Boot and never return */ printf("Starting OS Bootloader from %s ...\n", boot_dev_name); ((init_fnc_t *)CFG_LOADADDR)(); } /* should never come here */ #if defined(CFG_ONENAND) || defined(CONFIG_MMC) error: #endif printf("Could not read bootloader!\n"); hang(); #endif /* CONFIG_USBBOOT_ERASER */ }
void start_armboot (void) { init_fnc_t **init_fnc_ptr; uchar *buf; char boot_dev_name[8]; u32 si_type, omap4_rev; for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { hang (); } } omap4_rev = omap_revision(); if (omap4_rev >= OMAP4460_ES1_0) { omap_temp_sensor_check(); if (omap4_rev == OMAP4470_ES1_0) { writel(((TSHUT_HIGH_ADC_CODE << 16) | TSHUT_COLD_ADC_CODE), CORE_TSHUT_THRESHOLD); MV1(WK(CONTROL_SPARE_RW) , (M1)); } si_type = omap4_silicon_type(); if (si_type == PROD_ID_1_SILICON_TYPE_HIGH_PERF) printf("OMAP4460: 1.5 GHz capable SOM\n"); else if (si_type == PROD_ID_1_SILICON_TYPE_STD_PERF) printf("OMAP4460: 1.2 GHz capable SOM\n"); } #ifdef START_LOADB_DOWNLOAD strcpy(boot_dev_name, "UART"); do_load_serial_bin (CFG_LOADADDR, 115200); #else buf = (uchar *) CFG_LOADADDR; switch (get_boot_device()) { case 0x03: strcpy(boot_dev_name, "ONENAND"); #if defined(CFG_ONENAND) for (i = ONENAND_START_BLOCK; i < ONENAND_END_BLOCK; i++) { if (!onenand_read_block(buf, i)) buf += ONENAND_BLOCK_SIZE; else goto error; } #endif break; case 0x02: default: strcpy(boot_dev_name, "NAND"); #if defined(CFG_NAND) for (i = NAND_UBOOT_START; i < NAND_UBOOT_END; i+= NAND_BLOCK_SIZE) { if (!nand_read_block(buf, i)) buf += NAND_BLOCK_SIZE; /* advance buf ptr */ } #endif break; case 0x05: strcpy(boot_dev_name, "MMC/SD1"); #if defined(CONFIG_MMC) if (mmc_read_bootloader(0) != 0) goto error; #endif break; case 0x06: strcpy(boot_dev_name, "EMMC"); #if defined(CONFIG_MMC) if (mmc_read_bootloader(1) != 0) goto error; #endif break; }; #endif /* go run U-Boot and never return */ printf("Starting OS Bootloader from %s ...\n", boot_dev_name); ((init_fnc_t *)CFG_LOADADDR)(); /* should never come here */ #if defined(CFG_ONENAND) || defined(CONFIG_MMC) error: #endif printf("Could not read bootloader!\n"); hang(); }