2 * Authors: Xiangfu Liu <xiangfu.z@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 3 of the License, or (at your option) any later version.
12 #include <asm/mipsregs.h>
13 #include <asm/jz4740.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 static void gpio_init(void)
20 * Initialize NAND Flash Pins
25 * Initialize SDRAM pins
27 __gpio_as_sdram_32bit();
40 * Initialize Other pins
43 for (i = 0; i < 7; i++){
44 __gpio_as_input(GPIO_KEYIN_BASE + i);
45 __gpio_enable_pull(GPIO_KEYIN_BASE + i);
48 for (i = 0; i < 8; i++) {
49 __gpio_as_output(GPIO_KEYOUT_BASE + i);
50 __gpio_clear_pin(GPIO_KEYOUT_BASE + i);
54 * Initialize UART0 pins, in Ben NanoNote uart0 and keyin8 use the
55 * same gpio, init the gpio as uart0 cause a keyboard bug. so for
56 * end user we disable the uart0
58 if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
60 printf("[S] pressed, enable UART0\n");
64 printf("[S] not pressed, disable UART0\n");
65 __gpio_as_input(GPIO_KEYIN_8);
66 __gpio_enable_pull(GPIO_KEYIN_8);
69 __gpio_as_output(GPIO_AUDIO_POP);
70 __gpio_set_pin(GPIO_AUDIO_POP);
72 __gpio_as_output(GPIO_LCD_CS);
73 __gpio_clear_pin(GPIO_LCD_CS);
75 __gpio_as_output(GPIO_AMP_EN);
76 __gpio_clear_pin(GPIO_AMP_EN);
78 __gpio_as_output(GPIO_SDPW_EN);
79 __gpio_disable_pull(GPIO_SDPW_EN);
80 __gpio_clear_pin(GPIO_SDPW_EN);
82 __gpio_as_input(GPIO_SD_DETECT);
83 __gpio_disable_pull(GPIO_SD_DETECT);
85 __gpio_as_input(GPIO_USB_DETECT);
86 __gpio_enable_pull(GPIO_USB_DETECT);
88 if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) {
89 printf("[M] pressed, boot from sd card\n");
94 static void cpm_init(void)
105 /* __cpm_stop_aic2();*/
108 void board_early_init(void)
114 /* U-Boot common routines */
116 int checkboard (void)
119 printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %d MHz)\n",
120 gd->cpu_clk/1000000);
122 return 0; /* success */