void target_init(void) { unsigned offset; struct flash_info *flash_info; int i; dprintf(INFO, "target_init()\n"); keys_init(); keypad_init(); ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) offset = BOARD_FLASH_OFFSET; for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; if ((len == 0) && (i == num_parts - 1)) len = flash_info->num_blocks - offset - ptn->start; ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { struct flash_info *flash_info; dprintf(INFO, "target_init()\n"); /* Initialize PMIC driver */ pmic.read = (pm8921_read_func) & pa1_ssbi2_read_bytes; pmic.write = (pm8921_write_func) & pa1_ssbi2_write_bytes; pm8921_init(&pmic); ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); smem_add_modem_partitions(&flash_ptable); /* Update the naming for apps partitions and type */ update_ptable_apps_partitions(); /* Update modem partitions to lower case for fastboot */ update_ptable_modem_partitions(); ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { uint32_t base_addr; uint8_t slot; dprintf(INFO, "target_init()\n"); spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID); target_keystatus(); config.pipes.read_pipe = DATA_PRODUCER_PIPE; config.pipes.write_pipe = DATA_CONSUMER_PIPE; config.pipes.cmd_pipe = CMD_PIPE; config.pipes.read_pipe_grp = DATA_PRODUCER_PIPE_GRP; config.pipes.write_pipe_grp = DATA_CONSUMER_PIPE_GRP; config.pipes.cmd_pipe_grp = CMD_PIPE_GRP; config.bam_base = MSM_NAND_BAM_BASE; config.nand_base = MSM_NAND_BASE; config.ee = QPIC_NAND_EE; config.max_desc_len = QPIC_NAND_MAX_DESC_LEN; qpic_nand_init(&config); ptable_init(&flash_ptable); smem_ptable_init(); smem_add_modem_partitions(&flash_ptable); update_ptable_names(); flash_set_ptable(&flash_ptable); }
void target_init(void) { struct ptentry *ptn; unsigned offset; dprintf(INFO, "target_init()\n"); keys_init(); keypad_init(); ptable_init(&flash_ptable); smem_ptable_init(); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) offset = BOARD_FLASH_OFFSET; for (ptn = &board_part_list[0]; ptn->name[0]; ptn++) { ptable_add(&flash_ptable, ptn->name, offset + ptn->start, ptn->length, ptn->flags); } ptable_dump(&flash_ptable); flash_init(&flash_ptable); }
void target_init(void) { unsigned offset; struct flash_info *flash_info; int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif if (target_is_emmc_boot()) return; ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; if ((len == 0) && (i == num_parts - 1)) len = flash_info->num_blocks - offset - ptn->start; ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { unsigned offset; struct flash_info *flash_info; struct ptentry *board_part_list; unsigned total_num_of_blocks; unsigned next_ptr_start_adr = 0; unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/ int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN display_init(); dprintf(SPEW, "Diplay initialized\n"); display_image_on_screen(); #endif if (target_is_emmc_boot()) { /* Must wait for modem-up before we can intialize MMC. */ while (readl(MSM_SHARED_BASE + 0x14) != 1); if(mmc_boot_main(MMC_SLOT, MSM_SDC3_BASE)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } return; } ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); total_num_of_blocks = flash_info->num_blocks; blocks_per_1MB = (1 << 20) / (flash_info->block_size); if (flash_ecc_bch_enabled()) board_part_list = board_part_list_bchecc; else board_part_list = board_part_list_default; for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ((ptn->length) * blocks_per_1MB); if(ptn->start != 0) ASSERT(ptn->start == DIFF_START_ADDR); ptn->start = next_ptr_start_adr; if(ptn->length == VARIABLE_LENGTH) { unsigned length_for_prt = 0; unsigned j; for (j = i+1; j < num_parts; j++) { struct ptentry *temp_ptn = &board_part_list[j]; ASSERT(temp_ptn->length != VARIABLE_LENGTH); length_for_prt += ((temp_ptn->length) * blocks_per_1MB); } len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); ASSERT(len >= 0); } next_ptr_start_adr = ptn->start + len; ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE); } smem_add_modem_partitions(&flash_ptable); ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { unsigned offset; struct flash_info *flash_info; unsigned total_num_of_blocks; unsigned next_ptr_start_adr = 0; unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/ unsigned base_addr; unsigned char slot; int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif if (target_is_emmc_boot()) { /* Trying Slot 2 first */ slot = 2; base_addr = mmc_sdc_base[slot-1]; if(mmc_boot_main(slot, base_addr)) { /* Trying Slot 4 next */ slot = 4; base_addr = mmc_sdc_base[slot-1]; if(mmc_boot_main(slot, base_addr)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } } return; } ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); enable_interleave_mode(target_is_interleaved_mode()); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); total_num_of_blocks = flash_info->num_blocks; blocks_per_1MB = (1 << 20) / (flash_info->block_size); for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ((ptn->length) * blocks_per_1MB); if(ptn->start != 0) ASSERT(ptn->start == DIFF_START_ADDR); ptn->start = next_ptr_start_adr; if(ptn->length == VARIABLE_LENGTH) { unsigned length_for_prt = 0; unsigned j; for (j = i+1; j < num_parts; j++) { struct ptentry *temp_ptn = &board_part_list[j]; ASSERT(temp_ptn->length != VARIABLE_LENGTH); length_for_prt += ((temp_ptn->length) * blocks_per_1MB); } len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); ASSERT(len >= 0); } next_ptr_start_adr = ptn->start + len; if(target_is_interleaved_mode()) { ptable_add(&flash_ptable, ptn->name, offset + (ptn->start / 2), (len / 2), ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE); } else { ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE); } } smem_add_modem_partitions(&flash_ptable); ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { unsigned offset; struct flash_info *flash_info; unsigned total_num_of_blocks; bool start_addr_changed = false; unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif if (target_is_emmc_boot()) return; ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; if(len == VARIABLE_LENGTH) { start_addr_changed = true; unsigned length_for_prt = 0; unsigned j; for (j = i+1; j < num_parts; j++) { struct ptentry *temp_ptn = &board_part_list[j]; ASSERT(temp_ptn->length != VARIABLE_LENGTH); length_for_prt += temp_ptn->length; } len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); ASSERT(len >= 0); next_ptr_start_adr = ptn->start + len; } if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) { ASSERT(next_ptr_start_adr); ptn->start = next_ptr_start_adr; next_ptr_start_adr = ptn->start + ptn->length; } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
void target_init(void) { unsigned offset; struct flash_info *flash_info; unsigned total_num_of_blocks; unsigned next_ptr_start_adr = 0; unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/ int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif if (target_is_emmc_boot()) return; ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); total_num_of_blocks = flash_info->num_blocks; blocks_per_1MB = (1 << 20) / (flash_info->block_size); for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ((ptn->length) * blocks_per_1MB); if(ptn->start != 0) ASSERT(ptn->start == DIFF_START_ADDR); ptn->start = next_ptr_start_adr; if(ptn->length == VARIABLE_LENGTH) { unsigned length_for_prt = 0; unsigned j; for (j = i+1; j < num_parts; j++) { struct ptentry *temp_ptn = &board_part_list[j]; ASSERT(temp_ptn->length != VARIABLE_LENGTH); length_for_prt += ((temp_ptn->length) * blocks_per_1MB); } len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); ASSERT(len >= 0); } next_ptr_start_adr = ptn->start + len; ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE); } smem_add_modem_partitions(&flash_ptable); ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
int board_init() { int ret; uint32_t start_blocks; uint32_t size_blocks; #ifdef CONFIG_IPQ_REPORT_L2ERR u32 l2esr; /* Record any kind of L2 errors caused during * the previous boot stages as we are clearing * the L2 errors before jumping to linux. * Refer to cleanup_before_linux() */ l2esr = get_l2_indirect_reg(L2ESR_IND_ADDR); report_l2err(l2esr); #endif ipq_smem_flash_info_t *sfi = &ipq_smem_flash_info; /* * after relocation gboard_param is reset to NULL * initialize again */ gd->bd->bi_boot_params = IPQ_BOOT_PARAMS_ADDR; gd->bd->bi_arch_number = smem_get_board_machtype(); gboard_param = get_board_param(gd->bd->bi_arch_number); ret = smem_get_boot_flash(&sfi->flash_type, &sfi->flash_index, &sfi->flash_chip_select, &sfi->flash_block_size); if (ret < 0) { printf("cdp: get boot flash failed\n"); return ret; } /* * Should be inited, before env_relocate() is called, * since env. offset is obtained from SMEM. */ if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) { ret = smem_ptable_init(); if (ret < 0) { printf("cdp: SMEM init failed\n"); return ret; } } if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { nand_env_device = CONFIG_IPQ_NAND_NAND_INFO_IDX; } else if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) { nand_env_device = CONFIG_IPQ_SPI_NAND_INFO_IDX; #ifdef CONFIG_IPQ_MMC if (gd->bd->bi_arch_number == MACH_TYPE_IPQ806X_AP145_1XX ) { gboard_param->emmc_gpio = emmc1_gpio; gboard_param->emmc_gpio_count = ARRAY_SIZE(emmc1_gpio); } } else if (sfi->flash_type == SMEM_BOOT_MMC_FLASH) { gboard_param->emmc_gpio = emmc1_gpio; gboard_param->emmc_gpio_count = ARRAY_SIZE(emmc1_gpio); #endif } else { printf("BUG: unsupported flash type : %d\n", sfi->flash_type); BUG(); } if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) { ret = smem_getpart("0:APPSBLENV", &start_blocks, &size_blocks); if (ret < 0) { printf("cdp: get environment part failed\n"); return ret; } board_env_offset = ((loff_t) sfi->flash_block_size) * start_blocks; board_env_size = ((loff_t) sfi->flash_block_size) * size_blocks; } if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { board_env_range = CONFIG_ENV_SIZE_MAX; BUG_ON(board_env_size < CONFIG_ENV_SIZE_MAX); } else if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) { board_env_range = board_env_size; BUG_ON(board_env_size > CONFIG_ENV_SIZE_MAX); #ifdef CONFIG_IPQ_MMC } else if (sfi->flash_type == SMEM_BOOT_MMC_FLASH) { board_env_range = CONFIG_ENV_SIZE_MAX; #endif } else { printf("BUG: unsupported flash type : %d\n", sfi->flash_type); BUG(); } if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) { saveenv = nand_saveenv; env_ptr = nand_env_ptr; env_name_spec = nand_env_name_spec; #ifdef CONFIG_IPQ_MMC } else { saveenv = mmc_saveenv; env_ptr = mmc_env_ptr; env_name_spec = mmc_env_name_spec; #endif } return 0; }