void msg_test(void)//struct bootloader_message *msg) { unsigned char data[CFG_NAND_PAGE_SIZE]; // clear data array ... if (nand_erase_block(64) || nand_erase_block(64 + 1)) serial_puts_info("NAND erase failed !!!\n"); if (nand_program_page(data, 8192)) serial_puts_info("NAND program failed !!!\n"); serial_puts_info("msg_test finish.\n"); }
void nand_boot(int nand_boot_select) { unsigned int offset; void (*kernel)(int, char **, char *) = (void (*)(int, char **, char *))CFG_KERNEL_DST; serial_puts_info("Enter nand_boot for zImage...\n"); do_nand(CFG_BOOT_OFFS, 6 * 0x100000, CFG_KERNEL_DST); flush_cache_all(); serial_puts_info("Jump to kernel entry...\n"); (*kernel)(0, (char **)(PARAM_BASE + 16), (char *)PARAM_BASE); }
int board_private_init(void) { unsigned int signature = 0; /*add board privater gpio here ,it while be called by boot_main to nitialization*/ /*init GPIO_KEYPAD_5x5*/ __gpio_clear_pin(GPIO_COL0); __gpio_as_output(GPIO_COL0); __gpio_set_pin(GPIO_ROW0); __gpio_as_output(GPIO_ROW0); __gpio_clear_pin(GPIO_COL2); __gpio_as_output(GPIO_COL2); __gpio_clear_pin(GPIO_COL3); __gpio_as_output(GPIO_COL3); __gpio_clear_pin(GPIO_COL4); __gpio_as_output(GPIO_COL4); /*Add for the hibernate function and the other function*/ /*Do first battery set up detect and then hibernate or power on*/ if ((REG_RTC_HWRSR & 0x10)){ serial_puts_info("Ready to into hibernate mode ... \n"); jz_pm_do_hibernate(); } /*Check the recovery signature,if exist,skip the charge_detect func.*/ signature = cpm_get_scrpad(); if ((signature == RECOVERY_SIGNATURE) || (signature == RECOVERY_SIGNATURE_SEC)) { if (signature == RECOVERY_SIGNATURE_SEC) cpm_set_scrpad(0); goto skip_chgdet; } /*Usb Cable detection ,If connected ,then do charge else skip it*/ if(charge_detect()){ charge_logo_display(); } /* * enable vibrator to tell user power on. */ __gpio_set_pin(32*5+10); __gpio_as_output(32*5+10); mdelay(100); __gpio_clear_pin(32*5+10); skip_chgdet: /*Before Enter the system,check the battery status, If low battery,then Enter the hibernate mode */ while(low_battery_detect() && !charge_detect()){ low_battery_warning(); jz_pm_do_hibernate(); } }
static void jz_lcd_desc_init(vidinfo_t *vid) { struct jz_fb_info * fbi; fbi = &vid->jz_fb; fbi->dmadesc_fblow = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 3*32); fbi->dmadesc_fbhigh = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 2*32); fbi->dmadesc_palette = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 1*32); #define BYTES_PER_PANEL (((vid->vl_col * NBITS(vid->vl_bpix) / 8 + 3) >> 2 << 2) * vid->vl_row) fbi->dmadesc_fblow->fdadr = virt_to_phys(fbi->dmadesc_fblow); fbi->dmadesc_fblow->fsadr = virt_to_phys((void *)(fbi->screen + BYTES_PER_PANEL)); fbi->dmadesc_fblow->fidr = 1; fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL / 4 ; fbi->dmadesc_fblow->offsize = 0; fbi->dmadesc_fblow->page_width = 0; fbi->dmadesc_fblow->desc_size = jzfb.osd.fg1.h << 16 | jzfb.osd.fg1.w; REG_LCD_SIZE1 = (jzfb.osd.fg1.h<<16)|jzfb.osd.fg1.w; fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* only used in dual-panel mode */ fbi->dmadesc_fbhigh->fsadr = virt_to_phys((void *)fbi->screen); fbi->dmadesc_fbhigh->fidr = 0; fbi->dmadesc_fbhigh->ldcmd = BYTES_PER_PANEL / 4; /* length in word */ fbi->dmadesc_fbhigh->offsize = 0; fbi->dmadesc_fbhigh->page_width = 0; fbi->dmadesc_fbhigh->desc_size = jzfb.osd.fg0.h << 16 | jzfb.osd.fg0.w; REG_LCD_SIZE0 = jzfb.osd.fg0.h << 16|jzfb.osd.fg0.w; fbi->dmadesc_palette->fsadr = virt_to_phys((void *)fbi->palette); fbi->dmadesc_palette->fidr = 0; fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2)/4 | (1<<28); /* palette shouldn't be loaded in true-color mode */ fbi->dmadesc_fbhigh->fdadr = virt_to_phys((void *)fbi->dmadesc_fbhigh); fbi->dmadesc_fblow->fdadr = virt_to_phys((void *)fbi->dmadesc_fblow); fbi->fdadr0 = virt_to_phys(fbi->dmadesc_fbhigh); /* no pal just fbhigh */ fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* just fblow */ flush_cache_all(); #ifdef DEBUG serial_puts_info("***********************LCD DESC INFO**********************************\n"); serial_puts_msg("fblow = "); dump_uint(fbi->dmadesc_fblow); serial_puts_msg(" fbhigh = "); dump_uint(fbi->dmadesc_fbhigh); serial_puts_msg(" dmadesc_palette = "); dump_uint(fbi->dmadesc_palette); serial_puts_msg(" \n"); /* populate descriptors */ serial_puts_msg("BYTES_PER_PANEL = "); dump_uint(BYTES_PER_PANEL); serial_puts_msg(" \n"); #endif }
int set_bootloader_message(const struct bootloader_message *in) { unsigned char data[CFG_NAND_PAGE_SIZE]; memset(data, '\0', CFG_NAND_PAGE_SIZE); memcpy(data, in, sizeof(struct bootloader_message)); /* Clear MISC partition, and write bootloader_message. */ if (nand_erase_block(64) || nand_erase_block(64 + 1)) { serial_puts_info("NAND erase failed!!!\n"); return 1; } if (nand_program_page(data, PTN_MISC_OFFSET / CFG_NAND_PAGE_SIZE)) { serial_puts_info("NAND program failed !!!\n"); return 1; } serial_puts_info("set_bootloader_message finish ...\n"); return 0; }
void musb_platform_init(void) { // int i = 0; // musb->b_dma_share_usb_irq = 1; // musb->board_set_vbus = jz_musb_set_vbus; // cpm_set_clock(CGU_OTGCLK, JZ_EXTAL); #ifdef CONFIG_JZ4760 //jz4760b and jz4770 is not support this bit /*Clear ECS bit of CPCCR,0:clock source is EXCLK,1:clock source is EXCLK/2*/ REG_CPM_CPCCR &= (~(CPM_CPCCR_ECS)); #endif /*Clear all bits of USBCDR,0:OTG clock source is pin EXCLK,PLL0 output,divider = 1,12MHZ*/ REG_CPM_USBCDR = 0; /*Set CE bit of CPCCR,it means frequence is changed immediately*/ REG_CPM_CPCCR |= CPM_CPCCR_CE; udelay(3); // cpm_start_clock(CGM_OTG); /*Clear OTG bit of CLKGR0,0:device can be accessed*/ REG_CPM_CLKGR0 &= (~(CPM_CLKGR0_OTG)); #ifdef DEBUG serial_puts_info("**************************MUSB REG INFO*******************************\n"); serial_puts_info("CPCCR : "); serial_put_hex(REG_CPM_CPCCR); serial_puts_info("USBCDR : "); serial_put_hex(REG_CPM_USBCDR); serial_puts_info("CPCCR : "); serial_put_hex(REG_CPM_CPCCR); serial_puts_info("CLKGR0 : "); serial_put_hex(REG_CPM_CLKGR0); #endif jz_musb_init(); return; }
static inline void jz_musb_init(void) { /* fil */ REG_CPM_USBVBFIL = 0x80; #ifdef DEBUG serial_puts_info("USBVBFIL : "); serial_put_hex(REG_CPM_USBVBFIL); #endif /* rdt */ REG_CPM_USBRDT = 0x96; /* rdt - filload_en */ REG_CPM_USBRDT |= (1 << 25); #ifdef DEBUG serial_puts_info("USBRDT : "); serial_put_hex(REG_CPM_USBRDT); #endif /* TXRISETUNE & TXVREFTUNE. */ REG_CPM_USBPCR &= ~0x3f; REG_CPM_USBPCR |= 0x35; // if (is_host_enabled(musb)) { // jz_musb_set_normal_mode(); // }else jz_musb_set_device_only_mode(); jz_musb_phy_reset(); #ifdef DEBUG serial_puts_info("USBPCR : "); serial_put_hex(REG_CPM_USBPCR); #endif return; }
void kfm701a21_1a_panel_display_pin_init(void) { __gpio_as_output(LCD_RESET_PIN); __gpio_as_output(LCD_CS_PIN); __gpio_clear_pin(LCD_CS_PIN); mdelay(20); __gpio_set_pin(LCD_RESET_PIN); mdelay(10); __gpio_clear_pin(LCD_RESET_PIN); mdelay(10); __gpio_set_pin(LCD_RESET_PIN); mdelay(80); serial_puts_info("kfm701a21_1a panel display pin init\n"); }
void lcd_ctrl_init(void *lcdbase) { __lcd_close_backlight(); __lcd_display_pin_init(); #if defined(CONFIG_ANDROID_LCD_PROBE) __gpio_disable_pull(GPIO_LCD_PWR_N); __gpio_clear_pin(GPIO_LCD_PWR_N); __gpio_as_output(GPIO_LCD_PWR_N); msdelay(50); __gpio_set_pin(LCD_RESET_PIN); msdelay(1); __gpio_clear_pin(LCD_RESET_PIN); msdelay(10); __gpio_set_pin(LCD_RESET_PIN); msdelay(100); Jz_LcdProbe(); // __gpio_clear_pin(LCD_RESET_PIN); // mdelay(10); // __gpio_set_pin(LCD_RESET_PIN); // mdelay(100); #endif jz_lcd_init_mem(lcdbase, &panel_info); jz_lcd_desc_init(&panel_info); jz_lcd_hw_init(&panel_info); board_lcd_board_init(); // __lcd_display_on(); // lcd_enable(); #ifdef DEBUG serial_puts_info("***************************LCDC INFO****************************\n"); serial_puts_msg("lcdbase = "); dump_uint(lcdbase); serial_puts_msg(" vl_bpix = "); dump_uint(panel_info.vl_bpix); serial_puts_msg(" \n"); print_lcdc_desc(&panel_info); #endif }
static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid) { unsigned long palette_mem_size; struct jz_fb_info *fbi = &vid->jz_fb; int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8; fbi->screen = (unsigned long)lcdbase; fbi->palette_size = 256; palette_mem_size = fbi->palette_size * sizeof(u16); /* locate palette and descs at end of page following fb */ fbi->palette = (unsigned long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size; #ifdef DEBUG serial_puts_info("********************LCD MEM INFO*****************************\n"); serial_puts_msg("palette_mem_size = "); dump_uint(palette_mem_size); serial_puts_msg(" palette = "); dump_uint(fbi->palette); serial_puts_msg(" \n"); #endif return 0; }
void kfm701a21_1a_panel_display_off(void) { __gpio_clear_pin(LCD_RESET_PIN); serial_puts_info("kfm701a21_1a panel display off\n"); }
/* * 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; }
int board_private_init(void) { #if DEBUG_SLEEP_WAKE unsigned int pin[] = {32 * 4 + 23, END_PIN}; serial_puts_info("Now simultion key\n"); simulation_random_key(pin, 500, 6000, 1); #endif serial_puts_info("grus low i2c pin\n"); __gpio_as_output(GPIO_I2C0_SDA); __gpio_clear_pin(GPIO_I2C0_SDA); __gpio_as_output(GPIO_I2C1_SCL); __gpio_clear_pin(GPIO_I2C1_SCL); __gpio_as_output(GPIO_I2C3_SCL); __gpio_clear_pin(GPIO_I2C3_SCL); #if 1 serial_puts_info("output low GPA17 5V-EN\n"); __gpio_as_output(17); __gpio_set_pin(17); serial_puts_info("output low GPB23 LCD-VCC-EN\n"); __gpio_as_output(4 * 32 + 9); __gpio_clear_pin(4 * 32 + 9); serial_puts_info("output low GPB25 MOTOR-EN\n"); __gpio_as_output(1 * 32 + 25); __gpio_clear_pin(1 * 32 + 25); serial_puts_info("output low GPB27 CIM-VCC-EN\n"); __gpio_as_output(1 * 32 + 27); __gpio_clear_pin(1 * 32 + 27); serial_puts_info("output low GPD8 WLAN-PW-EN\n"); __gpio_as_output(3 * 32 + 8); __gpio_clear_pin(3 * 32 + 8); serial_puts_info("output HIGH GPF20 SD0-CD-N\n"); __gpio_as_output(5 * 32 + 20); __gpio_clear_pin(5 * 32 + 20); serial_puts_info("Power off : WiFi\n"); act8600_ldo_disable(ACT8600_LDO6_VOLTAGE_SET); __gpio_as_output(3 * 32 + 20); __gpio_clear_pin(3 * 32 + 20); __gpio_as_output(3 * 32 + 21); __gpio_clear_pin(3 * 32 + 21); __gpio_as_output(3 * 32 + 22); __gpio_clear_pin(3 * 32 + 22); __gpio_as_output(3 * 32 + 23); __gpio_clear_pin(3 * 32 + 23); serial_puts_info("Power off : TouchScreen\n"); act8600_ldo_disable(ACT8600_LDO7_VOLTAGE_SET); #endif #if 0 #if defined(CONFIG_XBOOT_LOW_BATTERY_DETECT) /*Usb Cable detection ,If connected ,then do charge else skip it*/ // if(!(low_battery_detect())){ // serial_puts_info("low_battery_detect=0\n"); // } if(charge_detect()&&(low_battery_detect())){ // serial_puts_info("charge_logo_display before\n"); charge_logo_display(); // serial_puts_info("charge_logo_display after\n"); } #endif if(charge_detect()){ serial_puts_info("charge_logo display\n"); charge_logo_display(); } #endif mdelay(100); }
void board_lcd_board_init(void) { serial_puts_info("grus board_lcd_board_init\n"); set_lcd_power_on(); __gpio_as_lcd_24bit(); }
static int jz_lcd_hw_init(vidinfo_t *vid) { struct jz_fb_info *fbi = &vid->jz_fb; unsigned int val = 0; unsigned int pclk,pll_clk,pll1_flag; /* Setting Control register */ val = jzfb.panel.ctrl; switch (vid->vl_bpix) { case 0: val |= LCD_CTRL_BPP_1; break; case 1: val |= LCD_CTRL_BPP_2; break; case 2: val |= LCD_CTRL_BPP_4; break; case 3: val |= LCD_CTRL_BPP_8; break; case 4: val |= LCD_CTRL_BPP_16; break; case 5: val |= LCD_CTRL_BPP_18_24; /* target is 4bytes/pixel */ break; default: // printf("The BPP %d is not supported\n", 1 << panel_info.vl_bpix); val |= LCD_CTRL_BPP_18_24; break; } // val |= LCD_CTRL_BST_16; /* Burst Length is 16WORD=64Byte */ // val |= LCD_CTRL_OFUP; /* OutFIFO underrun protect */ jzfb.panel.ctrl = val; REG_LCD_CTRL = val; switch (jzfb.panel.cfg & LCD_CFG_MODE_MASK) { case LCD_CFG_MODE_GENERIC_TFT: case LCD_CFG_MODE_INTER_CCIR656: case LCD_CFG_MODE_NONINTER_CCIR656: case LCD_CFG_MODE_SLCD: default: /* only support TFT16 TFT32 */ REG_LCD_VAT = (((jzfb.panel.blw + jzfb.panel.w + jzfb.panel.elw + jzfb.panel.hsw)) << 16) | (jzfb.panel.vsw + jzfb.panel.bfw + jzfb.panel.h + jzfb.panel.efw); REG_LCD_DAH = ((jzfb.panel.hsw + jzfb.panel.blw) << 16) | (jzfb.panel.hsw + jzfb.panel.blw + jzfb.panel.w); REG_LCD_DAV = ((jzfb.panel.vsw + jzfb.panel.bfw) << 16) | (jzfb.panel.vsw + jzfb.panel.bfw + jzfb.panel.h); REG_LCD_HSYNC = (0 << 16) | jzfb.panel.hsw; REG_LCD_VSYNC = (0 << 16) | jzfb.panel.vsw; break; } /* Configure the LCD panel */ REG_LCD_CFG = jzfb.panel.cfg; REG_LCD_OSDC = jzfb.osd.osd_cfg; REG_LCD_OSDCTRL = jzfb.osd.osd_ctrl; /* IPUEN, bpp */ REG_LCD_RGBC = jzfb.osd.rgb_ctrl; REG_LCD_BGC = jzfb.osd.bgcolor; REG_LCD_KEY0 = jzfb.osd.colorkey0; REG_LCD_KEY1 = jzfb.osd.colorkey1; REG_LCD_ALPHA = jzfb.osd.alpha; REG_LCD_IPUR = jzfb.osd.ipu_restart; /* Timing setting */ __cpm_stop_lcd(); val = jzfb.panel.fclk; /* frame clk */ if ( (jzfb.panel.cfg & LCD_CFG_MODE_MASK) != LCD_CFG_MODE_SERIAL_TFT) { pclk = val * (jzfb.panel.w + jzfb.panel.hsw + jzfb.panel.elw + jzfb.panel.blw) * (jzfb.panel.h + jzfb.panel.vsw + jzfb.panel.efw + jzfb.panel.bfw); /* Pixclk */ } else { /* serial mode: Hsync period = 3*Width_Pixel */ pclk = val * (jzfb.panel.w*3 + jzfb.panel.hsw + jzfb.panel.elw + jzfb.panel.blw) * (jzfb.panel.h + jzfb.panel.vsw + jzfb.panel.efw + jzfb.panel.bfw); /* Pixclk */ } #ifndef CONFIG_LCD_GET_PIXCLK_FROM_PLL1 pll_clk = __cpm_get_pllout2(); /* pixclk get from PLL 0 */ pll1_flag = 0; #else serial_puts_msg("PixCLK get from PLL1 !\n"); pll_clk = cpm_get_pllout1(); /* pixclk get from PLL 1 */ pll1_flag = 1; if(!pll_clk){ serial_puts_msg("PLL1 isn't on, pixclk will get from PLL0 !!!\n"); pll_clk = __cpm_get_pllout2(); /* pixclk get from PLL 0 */ pll1_flag = 0; } #endif val = pll_clk / pclk; /* pclk */ val--; if ( val > 0x7ff ) { #ifdef DEBUG serial_puts_msg("Pixel Clock Divid Is Too Large, Set it to 0x7ff\n"); #endif val = 0x7ff; } if(pll1_flag) __cpm_select_lcdpclk_pll1(); __cpm_set_pixdiv(val); #if 1 serial_puts_info("PixCLK = 0x"); dump_uint(pclk); serial_puts_msg(" \n"); serial_puts_info("PLL_CLK = 0x"); dump_uint(pll_clk); serial_puts_msg(" \n"); #endif #if 0 /*Jz4760 has no ldiv*/ val = pclk * 3 ; /* LCDClock > 2.5*Pixclock */ val =__cpm_get_pllout2() / val; if ( val > 0x1f ) { printf("lcd clock divide is too large, set it to 0x1f\n"); val = 0x1f; } __cpm_set_ldiv( val ); #endif REG_CPM_CPCCR |= CPM_CPCCR_CE ; /* update divide */ __cpm_start_lcd(); udelay(1000); REG_LCD_DA0 = fbi->fdadr0; /* foreground 0 descripter*/ REG_LCD_DA1 = fbi->fdadr1; /* foreground 1 descripter*/ return 0; }
void nand_boot(int nand_boot_select) { unsigned int offset, size; void (*kernel)(int, char **, char *); int i; static u32 *param_addr = 0; static u8 *tmpbuf = 0; static u8 cmdline[256] = CFG_CMDLINE; serial_puts_info("Enter nand_boot routine ...\n"); switch (nand_boot_select) { case NORMAL_BOOT: offset = CFG_BOOT_OFFS; size = CFG_BOOT_SIZE; #ifdef BOOTARGS_NORMAL strcpy((char *)cmdline, BOOTARGS_NORMAL); #endif serial_puts_info("Normal boot ...\n"); break; case RECOVERY_BOOT: offset = CFG_RECOVERY_OFFS; size = CFG_RECOVERY_SIZE; #ifdef BOOTARGS_RECOVERY strcpy((char *)cmdline, BOOTARGS_RECOVERY); #endif serial_puts_info("Recovery boot ...\n"); break; #if defined(CONFIG_JZ4760_PT701_8) case PRETEST_BOOT: offset = CFG_PRETEST_OFFS; size = CFG_PRETEST_SIZE; serial_puts_info("Pretest boot ...\n"); break; #endif default: serial_puts_info("Get nand boot select failed, defualt normal boot ...\n"); offset = CFG_BOOT_OFFS; size = CFG_BOOT_SIZE; break; } serial_puts_info("Load kernel from NAND ...\n"); /* Load kernel and ramdisk */ do_nand(offset,CFG_NAND_PAGE_SIZE,(u8 *)CFG_KERNEL_DST); struct boot_img_hdr *bootimginfo; int kernel_actual; int ramdisk_actual; unsigned int page_mask; if(2048 < sizeof(struct boot_img_hdr)){ serial_puts_info("size too small"); } bootimginfo = (struct boot_img_hdr *)CFG_KERNEL_DST; page_mask = CFG_NAND_PAGE_SIZE - 1; kernel_actual = (bootimginfo->kernel_size + page_mask) & (~page_mask); ramdisk_actual = (bootimginfo->ramdisk_size + page_mask) & (~page_mask); size = kernel_actual + ramdisk_actual + M; // ' + M' to make sure including the special data. do_nand(offset + CFG_NAND_PAGE_SIZE, size, (u8 *)(CFG_KERNEL_DST + CFG_NAND_PAGE_SIZE)); #ifdef CONFIG_SECURITY_ENABLE // Special data is 4M from head. if(data_verify((unsigned char *)CFG_KERNEL_DST, 4 * M, ENV_BOOTLOADER) < 0) { serial_puts_spl("kernel verify failed, power off\n"); //powerdown(); while(1); } #endif #if 0 serial_puts_info("CRC32 = 0x"); serial_put_hex(CRC_32(CFG_KERNEL_DST,2973696)); serial_put_hex(*((unsigned int *)(CFG_KERNEL_DST+0))); serial_put_hex(*((unsigned int *)(CFG_KERNEL_DST+4))); serial_put_hex(*((unsigned int *)(CFG_KERNEL_DST+8))); serial_put_hex(*((unsigned int *)(CFG_KERNEL_DST+12))); #endif serial_puts_info("Prepare kernel parameters ...\n"); /* init kernel, ramdisk and prepare parameters */ if (init_boot_linux((unsigned char*)CFG_KERNEL_DST, size) == 0) { serial_puts_info("Jump to kernel start Addr 0x"); dump_uint(CFG_KERNEL_DST); serial_puts("\n\n"); kernel = (void (*)(int, char **, char *))CFG_KERNEL_DST; flush_cache_all(); #if CONFIG_XBOOT_LOGO_FILE //__lcd_display_off(); #endif /* Jump to kernel image */ (*kernel)(2, (char **)(PARAM_BASE + 16), (char *)PARAM_BASE); serial_puts_info("We should not come here ... \n"); } else serial_puts_info("Magic number error,boot error...\n"); }
void kfm701a21_1a_panel_display_on(void) { mdelay(120); serial_puts_info("kfm701a21_1a panel display on\n"); }
int board_private_init(void) { #if DEBUG_SLEEP_WAKE unsigned int pin[] = {25, 26,END_PIN}; serial_puts_info("Now simultion key\n"); simulation_random_key(pin, 500, 6000, 1); #endif serial_puts_info("warrior low i2c pin\n"); __gpio_as_output(GPIO_I2C0_SDA); __gpio_clear_pin(GPIO_I2C0_SDA); __gpio_as_output(GPIO_I2C1_SCL); __gpio_clear_pin(GPIO_I2C1_SCL); __gpio_as_output(GPIO_I2C3_SCL); __gpio_clear_pin(GPIO_I2C3_SCL); #if 1 #if 0 //if the board is old warrior:aa, you can open the if condition serial_puts_info("output low GPA17 5V-EN\n"); __gpio_as_output(17); __gpio_set_pin(17); #endif serial_puts_info("Output low GPB2 for setting DC charg current\n"); __gpio_as_output(1 * 32 + 2); __gpio_clear_pin(1 * 32 + 2); serial_puts_info("output low GPB23 LCD-VCC-EN\n"); __gpio_as_output(1 * 32 + 23); __gpio_clear_pin(1 * 32 + 23); serial_puts_info("output low GPB25 MOTOR-EN\n"); __gpio_as_output(1 * 32 + 25); __gpio_clear_pin(1 * 32 + 25); serial_puts_info("output low GPB27 CIM-VCC-EN\n"); __gpio_as_output(1 * 32 + 27); __gpio_clear_pin(1 * 32 + 27); serial_puts_info("output low GPD8 WLAN-PW-EN\n"); __gpio_as_output(3 * 32 + 8); __gpio_clear_pin(3 * 32 + 8); #ifdef NO_CHARGE_DETE serial_puts_info("output HIGH GPF20 SD0-CD-N\n"); __gpio_as_output(5 * 32 + 20); __gpio_set_pin(5 * 32 + 20); /* * set TF-Card GPIO mode as input-nopull to reset it to avoid card state confused. */ __gpio_as_input(4 * 32 + 20); __gpio_disable_pull(4 * 32 + 20); __gpio_as_input(4 * 32 + 21); __gpio_disable_pull(4 * 32 + 21); __gpio_as_input(4 * 32 + 22); __gpio_disable_pull(4 * 32 + 22); __gpio_as_input(4 * 32 + 23); __gpio_disable_pull(4 * 32 + 23); __gpio_as_input(4 * 32 + 28); __gpio_disable_pull(4 * 32 + 28); __gpio_as_input(4 * 32 + 29); __gpio_disable_pull(4 * 32 + 29); #endif serial_puts_info("Power off : WiFi\n"); act8600_ldo_disable(ACT8600_LDO6_VOLTAGE_SET); __gpio_as_output(3 * 32 + 20); __gpio_clear_pin(3 * 32 + 20); __gpio_as_output(3 * 32 + 21); __gpio_clear_pin(3 * 32 + 21); __gpio_as_output(3 * 32 + 22); __gpio_clear_pin(3 * 32 + 22); __gpio_as_output(3 * 32 + 23); __gpio_clear_pin(3 * 32 + 23); serial_puts_info("Power off : TouchScreen\n"); act8600_ldo_disable(ACT8600_LDO7_VOLTAGE_SET); act8600_vbus_disable(); #endif #ifdef NO_CHARGE_DETE if(0 == detect_boot_mode()){ if(charge_detect()){ charge_logo_display(); } } #endif }