void init_gpio(void)
{
#if defined(CONFIG_JZ4760_CRATER)
	//volatile int i=10000000;

	/* set lcd function pin to low to avoid powering up lcd partially. */
	__gpio_clear_lcd_24bit();
	__gpio_as_output(GPIO_LCD_DISP_N);
	__gpio_clear_pin(GPIO_LCD_DISP_N);

	//while(i--);
	//__gpio_as_output(GPIO_LCD_VCC_EN_N);
	//__gpio_set_pin(GPIO_LCD_VCC_EN_N);
#endif	

#if defined(CONFIG_JZ4760_Z800)
/*
 * In z800 board PA30 is used as charge enable, we need to enable 
 * it before start system as a default.
 */
__gpio_clear_pin(32*0+27);
__gpio_as_output(32*0+27);
#endif

/* Init nand pins */
#if (CFG_NAND_BW8 == 1)
        __gpio_as_nand_8bit(1);
#else
        __gpio_as_nand_16bit(1);
#endif

/*Init lcd pins*/
#if defined(CONFIG_JZ4760_ANDROID_LCD_TRULY_TFT_ER61581)
	__gpio_as_lcd_16bit();
#elif defined(CONFIG_JZ4760_ANDROID_LCD_YUE_TFT_YL10922NT)
	__gpio_as_lcd_16bit();
#elif defined(CONFIG_JZ4760_PT701_8) || defined(CONFIG_JZ4760_PT701) || defined(CONFIG_JZ4760_TABLET_P2) || defined(CONFIG_JZ4760_LEPUS) || defined(CONFIG_JZ4760_PX7_2R) || defined(CONFIG_JZ4760_TABLET_8II)
	__gpio_as_lcd_24bit();
#elif defined(CONFIG_JZ4760_ANDROID_LCD_PROBE)
	__gpio_as_lcd_16bit();
#endif

        /*
         * Initialize UART1 pins
         */
#if CFG_UART_BASE == UART0_BASE
        __gpio_as_uart0();
#elif CFG_UART_BASE == UART1_BASE
        __gpio_as_uart1();
#elif CFG_UART_BASE == UART2_BASE
        __gpio_as_uart2();
#else /* CFG_UART_BASE == UART1_BASE */
        __gpio_as_uart3();
#endif

#if defined(CONFIG_JZ4760_PT701_8)
	__gpio_clear_pin(GPIO_SPK_EN); // close speaker	
#endif

}
int board_private_init(void)
{
	unsigned int signature = 0;
	/*add board privater gpio here ,it while be called by boot_main to nitialization*/
	//for ethernet initialization
	__gpio_as_nand_16bit(1);
	
	__gpio_as_func0(CS_PIN);
	__gpio_as_func0(RD_N_PIN);
	__gpio_as_func0(WE_N_PIN);
	
	__gpio_as_func0(32 * 1 + 2);
	__gpio_as_func0(32 * 1 + 3);

	REG_GPIO_PXFUNS(0) = 0x0000ffff;
	REG_GPIO_PXTRGC(0) = 0x0000ffff;
	REG_GPIO_PXSELC(0) = 0x0000ffff;
	
	__gpio_as_func0(WAIT_N);
	
	REG_NEMC_SMCR6 &= ~NEMC_SMCR_BW_MASK;
	REG_NEMC_SMCR6 |= NEMC_SMCR_BW_16BIT;

	/*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);
#if defined(CONFIG_XBOOT_LOW_BATTERY_DETECT)
		goto skip_chgdet;
#endif
	}
	
#if defined(CONFIG_XBOOT_LOW_BATTERY_DETECT)
	/*Usb Cable detection ,If connected ,then do charge else skip it*/
	//if(charge_detect()){
	if(charge_detect()&&(low_battery_detect())){
		charge_logo_display();
		}
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();
		}
#endif
}
Beispiel #3
0
static void gpio_init(void)
{
	/* For ethernet data line init */
	__gpio_as_nand_16bit(1);


	/*
	 * Initialize UART1 pins
	 */
#if CFG_UART_BASE == UART0_BASE
	__gpio_as_uart0();
#elif CFG_UART_BASE == UART1_BASE
	__gpio_as_uart1();
#elif CFG_UART_BASE == UART2_BASE
	__gpio_as_uart2();
#else /* CFG_UART_BASE == UART1_BASE */
	__gpio_as_uart3();
#endif
}
Beispiel #4
0
static void nand_gpio_init(void)
{
	/* For ethernet data line init */
	__gpio_as_nand_16bit(1);
}