ar71xx: ag71xx: make switch register access atomic
[openwrt.git] / package / uboot-xburst / files / board / nanonote / nanonote.c
1 /*
2 * Authors: Xiangfu Liu <xiangfu.z@gmail.com>
3 *
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.
8 */
9
10 #include <common.h>
11 #include <command.h>
12 #include <asm/mipsregs.h>
13 #include <asm/jz4740.h>
14
15 DECLARE_GLOBAL_DATA_PTR;
16
17 static void gpio_init(void)
18 {
19 /*
20 * Initialize NAND Flash Pins
21 */
22 __gpio_as_nand();
23
24 /*
25 * Initialize SDRAM pins
26 */
27 __gpio_as_sdram_32bit();
28
29 /*
30 * Initialize LCD pins
31 */
32 __gpio_as_lcd_8bit();
33
34 /*
35 * Initialize MSC pins
36 */
37 __gpio_as_msc();
38
39 /*
40 * Initialize Other pins
41 */
42 unsigned int i;
43 for (i = 0; i < 7; i++){
44 __gpio_as_input(GPIO_KEYIN_BASE + i);
45 __gpio_enable_pull(GPIO_KEYIN_BASE + i);
46 }
47
48 for (i = 0; i < 8; i++) {
49 __gpio_as_output(GPIO_KEYOUT_BASE + i);
50 __gpio_clear_pin(GPIO_KEYOUT_BASE + i);
51 }
52
53 /*
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
57 */
58 if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
59 /* if pressed [S] */
60 printf("[S] pressed, enable UART0\n");
61 gd->boot_option = 5;
62 __gpio_as_uart0();
63 } else {
64 printf("[S] not pressed, disable UART0\n");
65 __gpio_as_input(GPIO_KEYIN_8);
66 __gpio_enable_pull(GPIO_KEYIN_8);
67 }
68
69 __gpio_as_output(GPIO_AUDIO_POP);
70 __gpio_set_pin(GPIO_AUDIO_POP);
71
72 __gpio_as_output(GPIO_LCD_CS);
73 __gpio_clear_pin(GPIO_LCD_CS);
74
75 __gpio_as_output(GPIO_AMP_EN);
76 __gpio_clear_pin(GPIO_AMP_EN);
77
78 __gpio_as_output(GPIO_SDPW_EN);
79 __gpio_disable_pull(GPIO_SDPW_EN);
80 __gpio_clear_pin(GPIO_SDPW_EN);
81
82 __gpio_as_input(GPIO_SD_DETECT);
83 __gpio_disable_pull(GPIO_SD_DETECT);
84
85 __gpio_as_input(GPIO_USB_DETECT);
86 __gpio_enable_pull(GPIO_USB_DETECT);
87
88 if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) {
89 printf("[M] pressed, boot from sd card\n");
90 gd->boot_option = 1;
91 }
92 }
93
94 static void cpm_init(void)
95 {
96 __cpm_stop_ipu();
97 __cpm_stop_cim();
98 __cpm_stop_i2c();
99 __cpm_stop_ssi();
100 __cpm_stop_uart1();
101 __cpm_stop_sadc();
102 __cpm_stop_uhc();
103 __cpm_stop_udc();
104 __cpm_stop_aic1();
105 /* __cpm_stop_aic2();*/
106 }
107
108 void board_early_init(void)
109 {
110 gpio_init();
111 cpm_init();
112 }
113
114 /* U-Boot common routines */
115
116 int checkboard (void)
117 {
118
119 printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %d MHz)\n",
120 gd->cpu_clk/1000000);
121
122 return 0; /* success */
123 }
This page took 0.048988 seconds and 5 git commands to generate.