void display_init(void) { struct fbcon_config *fb_cfg; #if DISPLAY_TYPE_LCDC struct lcdc_timing_parameters *lcd_timing; mdp_clock_init(); if (board_machtype() == LINUX_MACHTYPE_8660_FLUID) { mmss_pixel_clock_configure(PIXEL_CLK_INDEX_25M); } else { mmss_pixel_clock_configure(PIXEL_CLK_INDEX_54M); } lcd_timing = get_lcd_timing(); fb_cfg = lcdc_init_set( lcd_timing ); fbcon_setup(fb_cfg); fbcon_clear(); panel_poweron(); #endif #if DISPLAY_TYPE_MIPI mdp_clock_init(); configure_dsicore_dsiclk(); configure_dsicore_byteclk(); configure_dsicore_pclk(); fb_cfg = mipi_init(); fbcon_setup(fb_cfg); #endif }
void target_uart_init(void) { unsigned target_id = board_machtype(); switch (target_id) { case LINUX_MACHTYPE_8960_SIM: case LINUX_MACHTYPE_8960_RUMI3: case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MTP: case LINUX_MACHTYPE_8960_FLUID: case LINUX_MACHTYPE_8960_APQ: case LINUX_MACHTYPE_8960_LIQUID: if(board_baseband() == BASEBAND_SGLTE) { uart_dm_init(8, 0x1A000000, 0x1A040000);; } else { uart_dm_init(5, 0x16400000, 0x16440000); } break; case LINUX_MACHTYPE_8930_CDP: case LINUX_MACHTYPE_8930_MTP: case LINUX_MACHTYPE_8930_FLUID: uart_dm_init(5, 0x16400000, 0x16440000); break; case LINUX_MACHTYPE_8064_SIM: case LINUX_MACHTYPE_8064_RUMI3: uart_dm_init(3, 0x16200000, 0x16240000); break; case LINUX_MACHTYPE_8064_CDP: case LINUX_MACHTYPE_8064_MTP: case LINUX_MACHTYPE_8064_LIQUID: uart_dm_init(7, 0x16600000, 0x16640000); break; case LINUX_MACHTYPE_8064_MPQ_CDP: case LINUX_MACHTYPE_8064_MPQ_HRD: case LINUX_MACHTYPE_8064_MPQ_DTV: uart_dm_init(5, 0x1A200000, 0x1A240000); break; case LINUX_MACHTYPE_8627_CDP: case LINUX_MACHTYPE_8627_MTP: uart_dm_init(5, 0x16400000, 0x16440000); break; default: dprintf(CRITICAL, "uart gsbi not defined for target: %d\n", target_id); ASSERT(0); } }
struct lcdc_timing_parameters *get_lcd_timing(void) { if (board_machtype() == LINUX_MACHTYPE_8660_FLUID) return auo_timing_param(); else return DEFAULT_LCD_TIMING; }
void ssbi_keypad_init(struct qwerty_keypad_info *qwerty_kp) { unsigned int mach_id; int len; len = sizeof(struct gpio_qwerty_kp); qwerty_keypad = malloc(len); ASSERT(qwerty_keypad); memset(qwerty_keypad, 0, len); qwerty_keypad->keypad_info = qwerty_kp; event_init(&qwerty_keypad->full_scan, false, EVENT_FLAG_AUTOUNSIGNAL); timer_initialize(&qwerty_keypad->timer); mach_id = board_machtype(); ssbi_gpio_init(mach_id); if(mach_id == LINUX_MACHTYPE_8660_QT) { mdelay((qwerty_keypad->keypad_info)->settle_time); #ifdef QT_8660_KEYPAD_HW_BUG timer_set_oneshot(&qwerty_keypad->timer, 0, scan_qt_keypad, NULL); #endif } else timer_set_oneshot(&qwerty_keypad->timer, 0, scan_qwerty_keypad, NULL); /* wait for the keypad to complete one full scan */ event_wait(&qwerty_keypad->full_scan); }
int grub_boot(void) { void (*entry)(unsigned, unsigned, unsigned*) = (void*)GRUB_LOADING_ADDRESS_VIRT; // load grub into RAM #ifdef GRUB_BOOT_PARTITION if(grub_load_from_mmc()) { dprintf(CRITICAL, "%s: failed to load grub from mmc.\n", __func__); } else goto boot; #endif #if !BOOT_2NDSTAGE if(grub_load_from_tar()) { dprintf(CRITICAL, "%s: failed to load grub from tar.\n", __func__); } else goto boot; #endif dprintf(CRITICAL, "%s: Couldn't find grub at any known location!\n", __func__); return -1; boot: // BOOT ! dprintf(INFO, "booting GRUB @ %p\n", entry); #if WITH_APP_DISPLAY_SERVER display_server_stop(); #endif entry(0, board_machtype(), NULL); return 0; }
int machine_is_qrd7() { if (board_machtype() == MSM8X25_QRD7) return 1; else return 0; }
int machine_is_qrd5a() { if (board_machtype() == MSM7X27A_QRD5A) return 1; else return 0; }
struct lcdc_timing_parameters *get_lcd_timing(void) { if (board_machtype() == LINUX_MACHTYPE_7x30_FLUID) { return sharp_timing_param(); } else { return DEFAULT_LCD_TIMING; } }
static int msm7627a_mdp_clock_init(int enable) { int ret = 0; unsigned rate = 0; rate = panel.panel_info.clk_rate; if (enable) { /* enable MDP clock in MP to boost display up */ if (board_machtype() != MSM8X25_QRD5 && board_machtype() != MSM8X25Q_SKUD) mdp_clock_init(rate); } else { mdp_clock_disable(); } return ret; }
void keypad_init(void) { unsigned int mach_id; mach_id = board_machtype(); if(mach_id == LINUX_MACHTYPE_8660_QT) ssbi_keypad_init(&qt_keypad); else ssbi_keypad_init(&qwerty_keypad); }
void panel_poweron(void) { #if DISPLAY_TYPE_LCDC if (board_machtype() == LINUX_MACHTYPE_7x30_FLUID) { sharp_lcdc_on(); } else { panel_backlight(1); lcdc_on(); } #endif }
void panel_poweron(void) { if (board_machtype() == LINUX_MACHTYPE_8660_FLUID) { auo_board_lcd_enable(); } else { panel_backlight(1); lcdc_on(); } }
int machine_is_skua() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM8X25_SKUA: ret = 1; break; default: ret = 0; } return ret; }
static void boot_linux(void) { unsigned *tags = (unsigned*) 0x10000100; void (*entry)(unsigned,unsigned,unsigned) = (void*) kernel_addr; if(linux_type == 0) { linux_type = board_machtype(); } fixup_tags((unsigned*) linux_tags, tags, cmdline); entry(0, linux_type, tags); for(;;); }
int target_is_sku3() { int ret = 0; unsigned mach_type = 0; mach_type = board_machtype(); switch(mach_type) { case MSM7X27A_QRD3: ret = 1; break; default: ret = 0; }; return ret; }
int machine_is_skud() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM8X25Q_SKUD_PRIME: case MSM8X25Q_SKUD: case MSM8X25Q_EVBD: ret = 1; break; default: ret = 0; } return ret; }
int machine_is_evb() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM7X27A_EVB: case MSM8X25_EVB: case MSM8X25_EVT: ret = 1; break; default: ret = 0; } return ret; }
int machine_is_qrd() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM7X27A_QRD1: case MSM7X27A_QRD3: case MSM8X25_QRD7: ret = 1; break; default: ret = 0; } return ret; }
static int grub_sideload_handler(void *data) { struct boot_img_hdr *hdr = (struct boot_img_hdr *)data; unsigned kernel_size = ALIGN(hdr->kernel_size, hdr->page_size); void* local_kernel_addr = data + hdr->page_size; void* local_ramdisk_addr = local_kernel_addr + kernel_size; // Load ramdisk & kernel memmove((void*) hdr->kernel_addr, local_kernel_addr, hdr->kernel_size); memmove((void*) hdr->ramdisk_addr, local_ramdisk_addr, hdr->ramdisk_size); // use ramdisk if(hdr->ramdisk_size>0) { // prepare block api priv.index = 0; priv.ptn = (unsigned) hdr->ramdisk_addr; priv.is_ramdisk = 1; tio.blksz = BLOCK_SIZE; tio.lba = hdr->ramdisk_size; // set bootdev grub_bootdev = strdup("hd1"); grub_bootpath = strdup("/boot/grub"); grub_found_tar = 1; } else { // set bootdev unsigned int index = (unsigned int) partition_get_index(GRUB_BOOT_PARTITION); char buf[20]; sprintf(buf, "hd0,%u", index+1); grub_bootdev = strdup(buf); grub_bootpath = strdup(GRUB_BOOT_PATH_PREFIX "boot/grub"); } dprintf(INFO, "bootdev: %s\n", grub_bootdev); dprintf(INFO, "bootpath: %s\n", grub_bootpath); // BOOT ! void (*entry)(unsigned, unsigned, unsigned*) = (void*)hdr->kernel_addr; dprintf(INFO, "booting GRUB from sideload @ %p ramdisk @ %p\n", entry, (void*)hdr->ramdisk_addr); #if WITH_APP_DISPLAY_SERVER display_server_stop(); #endif entry(0, board_machtype(), NULL); return 0; }
int target_cont_splash_screen() { int ret = 0; unsigned mach_type = 0; mach_type = board_machtype(); switch(mach_type) { case MSM8X25_EVB: case MSM8X25_EVT: ret = 1; break; default: ret = 0; }; return ret; }
int machine_is_7x27a_surf_ffa() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM7X27A_FFA: case MSM7X27A_SURF: case MSM7X25A_SURF: case MSM7X25A_FFA: ret = 1; break; default: ret = 0; } return ret; }
int machine_is_8x25() { int ret = 0; unsigned mach_type = board_machtype(); switch(mach_type) { case MSM8X25_SURF: case MSM8X25_FFA: case MSM8X25_EVB: case MSM8X25_EVT: case MSM8X25_QRD7: ret = 1; break; default: ret = 0; } return ret; }
void cmd_boot(const char *arg, void *data, unsigned sz) { unsigned kernel_actual; unsigned ramdisk_actual; static struct boot_img_hdr hdr; char *ptr = ((char*) data); if (sz < sizeof(hdr)) { fastboot_fail("invalid bootimage header"); return; } memcpy(&hdr, data, sizeof(hdr)); /* ensure commandline is terminated */ hdr.cmdline[BOOT_ARGS_SIZE-1] = 0; if(target_is_emmc_boot() && hdr.page_size) { page_size = hdr.page_size; page_mask = page_size - 1; } kernel_actual = ROUND_TO_PAGE(hdr.kernel_size, page_mask); ramdisk_actual = ROUND_TO_PAGE(hdr.ramdisk_size, page_mask); if (page_size + kernel_actual + ramdisk_actual < sz) { fastboot_fail("incomplete bootimage"); return; } memmove((void*) KERNEL_ADDR, ptr + page_size, hdr.kernel_size); memmove((void*) RAMDISK_ADDR, ptr + page_size + kernel_actual, hdr.ramdisk_size); fastboot_okay(""); target_battery_charging_enable(0, 1); udc_stop(); boot_linux((void*) KERNEL_ADDR, (void*) TAGS_ADDR, (const char*) hdr.cmdline, board_machtype(), (void*) RAMDISK_ADDR, hdr.ramdisk_size); }
static void boot_linux(void) { unsigned *tags = (unsigned*) TAGS_ADDR; int ret; int (*entry)(unsigned,unsigned,unsigned) = (void*) kernel_addr; if(linux_type == 0) { linux_type = board_machtype(); } if(!cmdline[0]){ strcpy(cmdline, board_cmdline()); } fixup_tags((unsigned*) linux_tags, tags, cmdline); DISPLAY_MSG("entry=%x, entry(%d, %d, %x)\n", entry, 0, linux_type, tags); ret = entry(0, linux_type, tags); mmu_off(); DISPLAY_MSG("ok ret=%x\n", ret); //goroh for re-entry boot-img loading // for(;;); }
static void boot_linux(unsigned kaddr) { void (*entry)(unsigned,unsigned,unsigned) = (void*) kaddr; entry(0, board_machtype(), ADDR_TAGS); }
static int lcd_power_on() { uint8_t buffer = 0x0, mask = 0x0, prev_val = 0x0; int ret = 0; /* Configure LDO L2 TEST Bank 2, to Range Select 0 */ /* Not updating reference voltage */ buffer = (0x80); /* Write mode */ buffer |= (PM8901_LDO_TEST_BANK(2)); /* Test Bank 2 */ mask = buffer | LDO_TEST_RANGE_SELECT_MASK; if ((ret = pm8901_test_bank_read(&prev_val, PM8901_LDO_TEST_BANK(2), PM8901_LDO_L2_TEST_BANK))) { return ret; } if ((ret = pm8901_vreg_write(&buffer, mask, PM8901_LDO_L2_TEST_BANK, prev_val))) { return ret; } /* Enable LDO L2 at Max Voltage (should be around 3.3v) */ buffer = (0x0 << PM8901_LDO_CTL_ENABLE__S); /* Disable Pull Down */ buffer |= (0x1 << PM8901_LDO_CTL_PULL_DOWN__S); /* Put LDO into normal mode instead of low power mode */ buffer |= (0x0 << PM8901_LDO_CTL_MODE__S); /* Set voltage programming to 3.3V or 2.85V(8660 fluid) */ if (board_machtype() == LINUX_MACHTYPE_8660_FLUID) buffer |= (0xB); else buffer |= (0xF); mask = buffer | LDO_CTL_ENABLE_MASK | LDO_CTL_PULL_DOWN_MASK | LDO_CTL_NORMAL_POWER_MODE_MASK | LDO_CTL_VOLTAGE_SET_MASK; /* Do a normal read here, as to not destroy the value in LDO control */ if ((ret = pm8901_read(&prev_val, 1, PM8901_LDO_L2))) { return ret; } /* Configure the LDO2 for 3.3V or 2.85V(8660 fluid) */ ret = pm8901_vreg_write(&buffer, mask, PM8901_LDO_L2, prev_val); /* Configure LDO L2 TEST Bank 4, for High Range Mode */ buffer = (0x80); /* Write mode */ buffer |= (PM8901_LDO_TEST_BANK(4)); /* Test Bank 4 */ buffer |= (0x01); /* Put into High Range Mode */ mask = buffer | LDO_TEST_OUTPUT_RANGE_MASK; if ((ret = pm8901_test_bank_read(&prev_val, PM8901_LDO_TEST_BANK(4), PM8901_LDO_L2_TEST_BANK))) { return ret; } if ((ret = pm8901_vreg_write(&buffer, mask, PM8901_LDO_L2_TEST_BANK, prev_val))) { return ret; } /* Configure LDO L2 TEST Bank 2, to Range Select 0 */ buffer = (0x80); /* Write mode */ buffer |= (PM8901_LDO_TEST_BANK(2)); /* Test Bank 2 */ buffer |= (1<<1); /* For fine step 50 mV */ buffer |= (1<<3); /* to update reference voltage */ mask = buffer | LDO_TEST_RANGE_SELECT_MASK; mask |= (1<<2); /* Setting mask to make ref voltage as 1.25 V */ if ((ret = pm8901_test_bank_read(&prev_val, PM8901_LDO_TEST_BANK(2), PM8901_LDO_L2_TEST_BANK))) { return ret; } if ((ret = pm8901_vreg_write(&buffer, mask, PM8901_LDO_L2_TEST_BANK, prev_val))) { return ret; } /* Enable PMR for LDO L2 */ buffer = 0x7F; mask = 0x7F; if ((ret = pm8901_read(&prev_val, 1, PM8901_PMR_7))) { return ret; } ret = pm8901_vreg_write(&buffer, mask, PM8901_PMR_7, prev_val); return ret; }
int _main(unsigned zero, unsigned type, unsigned tags) { const char *cmdline = 0; int n; arm11_clock_init(); /* must do this before board_init() so that we ** use the partition table in the tags if it ** already exists */ if((zero == 0) && (type != 0) && tags_okay(tags)) { linux_type = type; linux_tags = tags; cmdline = tags_get_cmdline((void*) linux_tags); tags_import_partitions((void*) linux_tags); revision = tags_get_revision((void*) linux_tags); if(revision == 1) { console_set_colors(0x03E0, 0xFFFF); } if(revision == 2) { console_set_colors(0x49B2, 0xFFFF); } /* we're running as a second-stage, so wait for interrupt */ boot_from_flash = 0; } else { linux_type = board_machtype(); linux_tags = 0; } board_init(); keypad_init(); console_init(); dprintf_set_putc(uart_putc); if(linux_tags == 0) { /* generate atags containing partitions * from the bootloader, etc */ linux_tags = ADDR_TAGS; create_atags(linux_tags, 0, 0, 0); } if (cmdline) { char *sn = strstr(cmdline, SERIALNO_STR); if (sn) { char *s = serialno; sn += SERIALNO_LEN; while (*sn && (*sn != ' ') && ((s - serialno) < 31)) { *s++ = *sn++; } *s++ = 0; } } cprintf("\n\nUSB FastBoot: V%s\n", get_fastboot_version()); cprintf("Machine ID: %d v%d\n", linux_type, revision); cprintf("Build Date: "__DATE__", "__TIME__"\n\n"); cprintf("Serial Number: %s\n\n", serialno[0] ? serialno : "UNKNOWN"); flash_dump_ptn(); flash_init(); /* scan the keyboard a bit */ for(n = 0; n < 50; n++) { boot_poll(); } if (boot_from_flash) { cprintf("\n ** BOOTING LINUX FROM FLASH **\n"); boot_linux_from_flash(); } usbloader_init(); for(;;) { usb_poll(); } return 0; }
/* * USB boot routine * * Desc: usb boot. * Retn: 0 for success, -1 for error. */ int usb_boot(unsigned zero, unsigned type, unsigned tags) { #ifdef DEBUG serial_puts_info("Usb_boot: In function of usb_boot ...\n"); #endif /* see all of files in android-1.5r2/bootable/bootloader/legacy/usbloader */ unsigned long ram_size; unsigned long addr; USB_STATUS status = {NULL, {0, 0}, 0, 0, 0}; int usb_last_stat; /* must do this before board_init() so that we ** use the partition table in the tags if it ** already exists */ linux_type = board_machtype(); linux_tags = 0; #ifdef DEBUG serial_puts_info("Usb_boot: Board init ...\n"); #endif board_init(); ram_size = initdram(0); /*test*/ if (ram_size > EMC_LOW_SDRAM_SPACE_SIZE) ram_size = EMC_LOW_SDRAM_SPACE_SIZE; /*test*/ addr = CFG_SDRAM_BASE + ram_size; /* We can reserve some RAM "on top" here. */ /* round down to next 4 kB limit. */ addr &= ~(4096 - 1); #ifdef DEBUG serial_puts_info("Usb_boot: Lcd_setmem ...\n"); #endif addr = lcd_setmem(addr); fb_base = addr; #ifdef DEBUG serial_puts_info("Usb_boot: Drv_lcd_init ...\n"); #endif drv_lcd_init(); lcd_console_init(); #if 0 memset(print_buf, 0, PRINT_BUF_MAX); strcpy(print_buf, "123456:USB FastBoot:bbb"); lcd_puts(print_buf); memset(print_buf, 0, PRINT_BUF_MAX); cprintf(print_buf, ":ABC%dEFG:a\rabc",3); lcd_puts(print_buf); #endif #if 1 memset(print_buf, '\0', PRINT_BUF_MAX); cprintf(print_buf, "USB FastBoot: V %s\n", FAST_BOOT_VERSION); lcd_puts(print_buf); memset(print_buf, '\0', PRINT_BUF_MAX); cprintf(print_buf, "Machine ID: %d v %d\n", linux_type, revision); lcd_puts(print_buf); memset(print_buf, '\0', PRINT_BUF_MAX); cprintf(print_buf, "Build Date: "__DATE__", "__TIME__"\n"); lcd_puts(print_buf); /* memset(print_buf, '\0', PRINT_BUF_MAX); */ /* cprintf(print_buf, "Serial Number: %s\n", "UNKNOWN"); */ /* lcd_puts(print_buf); */ #endif #if 1 serial_puts_msg("\nUSB FastBoot: V "); serial_puts_msg(FAST_BOOT_VERSION); serial_puts_msg(" \n"); serial_puts_msg("Machine ID: "); dump_uint(linux_type); serial_puts_msg(" v "); dump_uint(revision); serial_puts_msg(" \n"); serial_puts_msg("Build Date: "); serial_puts_msg(__DATE__); serial_puts_msg(" "); serial_puts_msg(__TIME__); serial_puts_msg("\n"); serial_puts_msg("Serial Number: "); if (serialno[0]) serial_puts_msg(serialno); else serial_puts_msg("UNKNOWN\n"); #endif flash_dump_ptn(); jz4780_usbloader_init(); usb_last_stat = 1; for(;;) { /* if(__usb_detected()) { */ /* if(usb_last_stat == 0) { */ /* serial_puts("USB status: ONLINE\n"); */ /* memset(print_buf, 0, PRINT_BUF_MAX); */ /* cprintf(print_buf, "\rUSB status: ONLINE"); */ /* lcd_puts(print_buf); */ /* } */ /* usb_last_stat = 1; */ /* } else { */ /* if(usb_last_stat == 1) { */ /* serial_puts("USB status: OFFLINE\n"); */ /* memset(print_buf, 0, PRINT_BUF_MAX); */ /* cprintf(print_buf, "\rUSB status: OFFLINE"); */ /* lcd_puts(print_buf); */ /* } */ /* usb_last_stat = 0; */ /* } */ jz4780_usb_poll(&status); } return 0; }
void cmd_boot(const char *arg, void *data, unsigned sz) { unsigned kernel_actual; unsigned ramdisk_actual; static struct boot_img_hdr hdr; char *ptr = ((char*) data); unsigned page_size = 0; unsigned page_mask = 0; int strlen = 0; if (sz < sizeof(hdr)) { fastboot_fail("invalid bootimage header"); return; } memcpy(&hdr, data, sizeof(hdr)); printf("\n============================================================\n"); hdr.magic[7] = '\0'; printf("[%s] Android Boot IMG Hdr - Magic : %s\n",MODULE_NAME,hdr.magic); printf("[%s] Android Boot IMG Hdr - Kernel Size : 0x%x\n",MODULE_NAME,hdr.kernel_size); printf("[%s] Android Boot IMG Hdr - Rootfs Size : 0x%x\n",MODULE_NAME,hdr.ramdisk_size); printf("[%s] Android Boot IMG Hdr - Page Size : 0x%x\n",MODULE_NAME,hdr.page_size); printf("============================================================\n"); /* ensure commandline is terminated */ hdr.cmdline[BOOT_ARGS_SIZE-1] = 0; if(hdr.page_size) { page_size = hdr.page_size; page_mask = page_size - 1; //page_mask = 2*1024 ; /*FIXME*/ } else { printf("[FASTBOOT] Please specify the storage page-size in the boot header!\n"); fastboot_fail("Please specify the storage page-size in the boot header!\n"); return; } kernel_actual = ROUND_TO_PAGE(hdr.kernel_size, page_mask); ramdisk_actual = ROUND_TO_PAGE(hdr.ramdisk_size, page_mask); /* sz should have atleast raw boot image */ if (page_size + kernel_actual + ramdisk_actual > sz) { fastboot_fail("incomplete bootimage"); return; } memmove((void*) hdr.kernel_addr, (ptr + MKIMG_HEADER_SZ + BIMG_HEADER_SZ), hdr.kernel_size); memmove((void*) hdr.ramdisk_addr, (ptr + MKIMG_HEADER_SZ + BIMG_HEADER_SZ + kernel_actual), hdr.ramdisk_size); strlen += sprintf((const char*) hdr.cmdline, "%s lcm=%1d-%s", hdr.cmdline, DISP_IsLcmFound(), mt_disp_get_lcm_id()); strlen += sprintf((const char*) hdr.cmdline, "%s fps=%1d", hdr.cmdline, mt_disp_get_lcd_time()); fastboot_okay(""); udc_stop(); mtk_wdt_init(); //re-open wdt g_boot_mode = NORMAL_BOOT; boot_linux((void*) hdr.kernel_addr, (void*) hdr.tags_addr, (const char*) hdr.cmdline, board_machtype(), (void*) hdr.ramdisk_addr, hdr.ramdisk_size); #if 0 unsigned kernel_actual; unsigned ramdisk_actual; struct boot_img_hdr boot_hdr; unsigned int k_pg_cnt = 0; unsigned int r_pg_cnt = 0; unsigned int b_pg_cnt = 0; unsigned int size_b = 0; unsigned int pg_sz = 2*1024 ; int strlen = 0; /*copy hdr data from download_base*/ memcpy(&boot_hdr, data, sizeof(boot_hdr)); /* ensure commandline is terminated */ boot_hdr.cmdline[BOOT_ARGS_SIZE-1] = 0; printf("\n============================================================\n"); boot_hdr.magic[7] = '\0'; printf("[%s] Android Boot IMG Hdr - Magic : %s\n",MODULE_NAME,boot_hdr.magic); printf("[%s] Android Boot IMG Hdr - Kernel Size : 0x%x\n",MODULE_NAME,boot_hdr.kernel_size); printf("[%s] Android Boot IMG Hdr - Rootfs Size : 0x%x\n",MODULE_NAME,boot_hdr.ramdisk_size); printf("[%s] Android Boot IMG Hdr - Page Size : 0x%x\n",MODULE_NAME,boot_hdr.page_size); printf("============================================================\n"); //*************** //* check partition magic //* if (strncmp(boot_hdr.magic,BOOT_MAGIC, sizeof(BOOT_MAGIC))!=0) { printf("[%s] boot image header magic error\n", MODULE_NAME); return -1; } g_kmem_off = (unsigned int)target_get_scratch_address(); g_kmem_off = g_kmem_off + MKIMG_HEADER_SZ + BIMG_HEADER_SZ; if(boot_hdr.kernel_size % pg_sz == 0) { k_pg_cnt = boot_hdr.kernel_size / pg_sz; } else { k_pg_cnt = (boot_hdr.kernel_size / pg_sz) + 1; } if(boot_hdr.ramdisk_size % pg_sz == 0) { r_pg_cnt = boot_hdr.ramdisk_size / pg_sz; } else { r_pg_cnt = (boot_hdr.ramdisk_size / pg_sz) + 1; } printf(" > page count of kernel image = %d\n",k_pg_cnt); g_rmem_off = g_kmem_off + k_pg_cnt * pg_sz; printf(" > kernel mem offset = 0x%x\n",g_kmem_off); printf(" > rootfs mem offset = 0x%x\n",g_rmem_off); //*************** //* specify boot image size //* g_bimg_sz = (k_pg_cnt + r_pg_cnt + 2)* pg_sz; printf(" > boot image size = 0x%x\n",g_bimg_sz); memmove((void*)CFG_BOOTIMG_LOAD_ADDR , g_kmem_off, boot_hdr.kernel_size); memmove((void*)CFG_RAMDISK_LOAD_ADDR , g_rmem_off, boot_hdr.ramdisk_size); //custom_port_in_kernel(g_boot_mode, commanline); //strlen += sprintf(commanline, "%s lcm=%1d-%s", commanline, DISP_IsLcmFound(), mt_disp_get_lcm_id()); //strlen += sprintf(commanline, "%s fps=%1d", commanline, mt_disp_get_lcd_time()); fastboot_okay(""); udc_stop(); mtk_wdt_init(); boot_linux((void *)CFG_BOOTIMG_LOAD_ADDR, (unsigned *)CFG_BOOTARGS_ADDR, (const char*) boot_hdr.cmdline, board_machtype(), (void *)CFG_RAMDISK_LOAD_ADDR, boot_hdr.ramdisk_size); #endif }
void display_init(void) { unsigned mach_type; mach_type = board_machtype(); dprintf(SPEW, "display_init\n"); switch (mach_type) { case MSM7X27A_SURF: case MSM8X25_SURF: case MSM7X27A_FFA: #if MIPI_VIDEO_MODE mipi_renesas_video_fwvga_init(&(panel.panel_info)); #else mipi_renesas_cmd_fwvga_init(&(panel.panel_info)); #endif panel.clk_func = msm7627a_mdp_clock_init; panel.power_func = mipi_renesas_panel_dsi_config; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_303; break; case MSM7X25A_SURF: case MSM7X25A_FFA: #if MIPI_VIDEO_MODE mipi_renesas_video_hvga_init(&(panel.panel_info)); #else mipi_renesas_cmd_hvga_init(&(panel.panel_info)); #endif panel.clk_func = msm7627a_mdp_clock_init; panel.power_func = mipi_renesas_panel_dsi_config; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_303; break; case MSM7X27A_EVB: case MSM8X25_EVB: case MSM8X25_EVT: #if MIPI_VIDEO_MODE mipi_nt35510_video_wvga_init(&(panel.panel_info)); #else mipi_nt35510_cmd_wvga_init(&(panel.panel_info)); #endif panel.clk_func = msm7627a_mdp_clock_init; panel.power_func = mipi_nt35510_panel_dsi_config; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_303; if (mach_type == MSM8X25_EVT) panel.rotate = 1; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_enabled = 1; }