2 * Authors: Xiangfu Liu <xiangfu@sharism.cc>
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/jz4740.h>
14 DECLARE_GLOBAL_DATA_PTR;
16 static void gpio_init(void)
20 /* Initialize NAND Flash Pins */
23 /* Initialize SDRAM pins */
24 __gpio_as_sdram_16bit_4720();
26 /* Initialize LCD pins */
27 __gpio_as_lcd_18bit();
29 /* Initialize MSC pins */
32 /* Initialize Other pins */
33 for (i = 0; i < 7; i++) {
34 __gpio_as_input(GPIO_KEYIN_BASE + i);
35 __gpio_enable_pull(GPIO_KEYIN_BASE + i);
38 for (i = 0; i < 8; i++) {
39 __gpio_as_output(GPIO_KEYOUT_BASE + i);
40 __gpio_clear_pin(GPIO_KEYOUT_BASE + i);
43 __gpio_as_input(GPIO_KEYIN_8);
44 __gpio_enable_pull(GPIO_KEYIN_8);
46 /* enable the TP4, TP5 as UART0 */
47 __gpio_jtag_to_uart0();
49 __gpio_as_output(GPIO_AUDIO_POP);
50 __gpio_set_pin(GPIO_AUDIO_POP);
52 __gpio_as_output(GPIO_LCD_CS);
53 __gpio_clear_pin(GPIO_LCD_CS);
55 __gpio_as_output(GPIO_AMP_EN);
56 __gpio_clear_pin(GPIO_AMP_EN);
58 __gpio_as_output(GPIO_SDPW_EN);
59 __gpio_disable_pull(GPIO_SDPW_EN);
60 __gpio_clear_pin(GPIO_SDPW_EN);
62 __gpio_as_input(GPIO_SD_DETECT);
63 __gpio_disable_pull(GPIO_SD_DETECT);
65 __gpio_as_input(GPIO_USB_DETECT);
66 __gpio_enable_pull(GPIO_USB_DETECT);
69 static void cpm_init(void)
71 struct jz4740_cpm *cpm = (struct jz4740_cpm *)JZ4740_CPM_BASE;
72 uint32_t reg = readl(&cpm->clkgr);
74 reg |= CPM_CLKGR_IPU |
84 writel(reg, &cpm->clkgr);
87 int board_early_init_f(void)
91 calc_clocks(); /* calc the clocks */
92 rtc_init(); /* init rtc on any reset */
97 /* U-Boot common routines */
100 printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %ld MHz)\n",
101 gd->cpu_clk / 1000000);