bug.h: add include of it to various implicit C users
[linux-2.6.git] / arch / arm / mach-ux500 / board-mop500-pins.c
1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * License terms: GNU General Public License (GPL) version 2
5  */
6
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/bug.h>
10
11 #include <asm/mach-types.h>
12 #include <plat/pincfg.h>
13 #include <plat/gpio-nomadik.h>
14 #include <mach/hardware.h>
15
16 #include "pins-db8500.h"
17
18 static pin_cfg_t mop500_pins_common[] = {
19         /* I2C */
20         GPIO147_I2C0_SCL,
21         GPIO148_I2C0_SDA,
22         GPIO16_I2C1_SCL,
23         GPIO17_I2C1_SDA,
24         GPIO10_I2C2_SDA,
25         GPIO11_I2C2_SCL,
26         GPIO229_I2C3_SDA,
27         GPIO230_I2C3_SCL,
28
29         /* MSP0 */
30         GPIO12_MSP0_TXD,
31         GPIO13_MSP0_TFS,
32         GPIO14_MSP0_TCK,
33         GPIO15_MSP0_RXD,
34
35         /* MSP2: HDMI */
36         GPIO193_MSP2_TXD,
37         GPIO194_MSP2_TCK,
38         GPIO195_MSP2_TFS,
39         GPIO196_MSP2_RXD | PIN_OUTPUT_LOW,
40
41         /* Touch screen INTERFACE */
42         GPIO84_GPIO     | PIN_INPUT_PULLUP, /* TOUCH_INT1 */
43
44         /* STMPE1601/tc35893 keypad  IRQ */
45         GPIO218_GPIO    | PIN_INPUT_PULLUP,
46
47         /* MMC0 (MicroSD card) */
48         GPIO18_MC0_CMDDIR       | PIN_OUTPUT_HIGH,
49         GPIO19_MC0_DAT0DIR      | PIN_OUTPUT_HIGH,
50         GPIO20_MC0_DAT2DIR      | PIN_OUTPUT_HIGH,
51
52         GPIO22_MC0_FBCLK        | PIN_INPUT_NOPULL,
53         GPIO23_MC0_CLK          | PIN_OUTPUT_LOW,
54         GPIO24_MC0_CMD          | PIN_INPUT_PULLUP,
55         GPIO25_MC0_DAT0         | PIN_INPUT_PULLUP,
56         GPIO26_MC0_DAT1         | PIN_INPUT_PULLUP,
57         GPIO27_MC0_DAT2         | PIN_INPUT_PULLUP,
58         GPIO28_MC0_DAT3         | PIN_INPUT_PULLUP,
59
60         /* SDI1 (SDIO) */
61         GPIO208_MC1_CLK         | PIN_OUTPUT_LOW,
62         GPIO209_MC1_FBCLK       | PIN_INPUT_NOPULL,
63         GPIO210_MC1_CMD         | PIN_INPUT_PULLUP,
64         GPIO211_MC1_DAT0        | PIN_INPUT_PULLUP,
65         GPIO212_MC1_DAT1        | PIN_INPUT_PULLUP,
66         GPIO213_MC1_DAT2        | PIN_INPUT_PULLUP,
67         GPIO214_MC1_DAT3        | PIN_INPUT_PULLUP,
68
69         /* MMC2 (On-board DATA INTERFACE eMMC) */
70         GPIO128_MC2_CLK         | PIN_OUTPUT_LOW,
71         GPIO129_MC2_CMD         | PIN_INPUT_PULLUP,
72         GPIO130_MC2_FBCLK       | PIN_INPUT_NOPULL,
73         GPIO131_MC2_DAT0        | PIN_INPUT_PULLUP,
74         GPIO132_MC2_DAT1        | PIN_INPUT_PULLUP,
75         GPIO133_MC2_DAT2        | PIN_INPUT_PULLUP,
76         GPIO134_MC2_DAT3        | PIN_INPUT_PULLUP,
77         GPIO135_MC2_DAT4        | PIN_INPUT_PULLUP,
78         GPIO136_MC2_DAT5        | PIN_INPUT_PULLUP,
79         GPIO137_MC2_DAT6        | PIN_INPUT_PULLUP,
80         GPIO138_MC2_DAT7        | PIN_INPUT_PULLUP,
81
82         /* MMC4 (On-board STORAGE INTERFACE eMMC) */
83         GPIO197_MC4_DAT3        | PIN_INPUT_PULLUP,
84         GPIO198_MC4_DAT2        | PIN_INPUT_PULLUP,
85         GPIO199_MC4_DAT1        | PIN_INPUT_PULLUP,
86         GPIO200_MC4_DAT0        | PIN_INPUT_PULLUP,
87         GPIO201_MC4_CMD         | PIN_INPUT_PULLUP,
88         GPIO202_MC4_FBCLK       | PIN_INPUT_NOPULL,
89         GPIO203_MC4_CLK         | PIN_OUTPUT_LOW,
90         GPIO204_MC4_DAT7        | PIN_INPUT_PULLUP,
91         GPIO205_MC4_DAT6        | PIN_INPUT_PULLUP,
92         GPIO206_MC4_DAT5        | PIN_INPUT_PULLUP,
93         GPIO207_MC4_DAT4        | PIN_INPUT_PULLUP,
94
95         /* SKE keypad */
96         GPIO153_KP_I7,
97         GPIO154_KP_I6,
98         GPIO155_KP_I5,
99         GPIO156_KP_I4,
100         GPIO157_KP_O7,
101         GPIO158_KP_O6,
102         GPIO159_KP_O5,
103         GPIO160_KP_O4,
104         GPIO161_KP_I3,
105         GPIO162_KP_I2,
106         GPIO163_KP_I1,
107         GPIO164_KP_I0,
108         GPIO165_KP_O3,
109         GPIO166_KP_O2,
110         GPIO167_KP_O1,
111         GPIO168_KP_O0,
112
113         /* UART */
114         /* uart-0 pins gpio configuration should be
115          * kept intact to prevent glitch in tx line
116          * when tty dev is opened. Later these pins
117          * are configured to uart mop500_pins_uart0
118          *
119          * It will be replaced with uart configuration
120          * once the issue is solved.
121          */
122         GPIO0_GPIO      | PIN_INPUT_PULLUP,
123         GPIO1_GPIO      | PIN_OUTPUT_HIGH,
124         GPIO2_GPIO      | PIN_INPUT_PULLUP,
125         GPIO3_GPIO      | PIN_OUTPUT_HIGH,
126
127         GPIO29_U2_RXD   | PIN_INPUT_PULLUP,
128         GPIO30_U2_TXD   | PIN_OUTPUT_HIGH,
129         GPIO31_U2_CTSn  | PIN_INPUT_PULLUP,
130         GPIO32_U2_RTSn  | PIN_OUTPUT_HIGH,
131
132         /* Display & HDMI HW sync */
133         GPIO68_LCD_VSI0 | PIN_INPUT_PULLUP,
134         GPIO69_LCD_VSI1 | PIN_INPUT_PULLUP,
135 };
136
137 static pin_cfg_t mop500_pins_default[] = {
138         /* SSP0 */
139         GPIO143_SSP0_CLK,
140         GPIO144_SSP0_FRM,
141         GPIO145_SSP0_RXD | PIN_PULL_DOWN,
142         GPIO146_SSP0_TXD,
143
144
145         GPIO217_GPIO    | PIN_INPUT_PULLUP, /* TC35892 IRQ */
146
147         /* SDI0 (MicroSD card) */
148         GPIO21_MC0_DAT31DIR     | PIN_OUTPUT_HIGH,
149
150         /* UART */
151         GPIO4_U1_RXD    | PIN_INPUT_PULLUP,
152         GPIO5_U1_TXD    | PIN_OUTPUT_HIGH,
153         GPIO6_U1_CTSn   | PIN_INPUT_PULLUP,
154         GPIO7_U1_RTSn   | PIN_OUTPUT_HIGH,
155 };
156
157 static pin_cfg_t hrefv60_pins[] = {
158         /* WLAN */
159         GPIO4_GPIO              | PIN_INPUT_PULLUP,/* WLAN_IRQ */
160         GPIO85_GPIO             | PIN_OUTPUT_LOW,/* WLAN_ENA */
161
162         /* XENON Flashgun INTERFACE */
163         GPIO6_IP_GPIO0  | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */
164         GPIO7_IP_GPIO1  | PIN_INPUT_PULLUP,/* XENON_READY */
165         GPIO170_GPIO    | PIN_OUTPUT_LOW, /* XENON_CHARGE */
166
167         /* Assistant LED INTERFACE */
168         GPIO21_GPIO | PIN_OUTPUT_LOW,  /* XENON_EN1 */
169         GPIO64_IP_GPIO4 | PIN_OUTPUT_LOW,  /* XENON_EN2 */
170
171         /* Magnetometer */
172         GPIO31_GPIO | PIN_INPUT_PULLUP,  /* magnetometer_INT */
173         GPIO32_GPIO | PIN_INPUT_PULLDOWN, /* Magnetometer DRDY */
174
175         /* Display Interface */
176         GPIO65_GPIO             | PIN_OUTPUT_LOW, /* DISP1 RST */
177         GPIO66_GPIO             | PIN_OUTPUT_LOW, /* DISP2 RST */
178
179         /* Touch screen INTERFACE */
180         GPIO143_GPIO    | PIN_OUTPUT_LOW,/*TOUCH_RST1 */
181
182         /* Touch screen INTERFACE 2 */
183         GPIO67_GPIO     | PIN_INPUT_PULLUP, /* TOUCH_INT2 */
184         GPIO146_GPIO    | PIN_OUTPUT_LOW,/*TOUCH_RST2 */
185
186         /* ETM_PTM_TRACE INTERFACE */
187         GPIO70_GPIO     | PIN_OUTPUT_LOW,/* ETM_PTM_DATA23 */
188         GPIO71_GPIO     | PIN_OUTPUT_LOW,/* ETM_PTM_DATA22 */
189         GPIO72_GPIO     | PIN_OUTPUT_LOW,/* ETM_PTM_DATA21 */
190         GPIO73_GPIO     | PIN_OUTPUT_LOW,/* ETM_PTM_DATA20 */
191         GPIO74_GPIO     | PIN_OUTPUT_LOW,/* ETM_PTM_DATA19 */
192
193         /* NAHJ INTERFACE */
194         GPIO76_GPIO     | PIN_OUTPUT_LOW,/* NAHJ_CTRL */
195         GPIO216_GPIO    | PIN_OUTPUT_HIGH,/* NAHJ_CTRL_INV */
196
197         /* NFC INTERFACE */
198         GPIO77_GPIO     | PIN_OUTPUT_LOW, /* NFC_ENA */
199         GPIO144_GPIO    | PIN_INPUT_PULLDOWN, /* NFC_IRQ */
200         GPIO142_GPIO    | PIN_OUTPUT_LOW, /* NFC_RESET */
201
202         /* Keyboard MATRIX INTERFACE */
203         GPIO90_MC5_CMD  | PIN_OUTPUT_LOW, /* KP_O_1 */
204         GPIO87_MC5_DAT1 | PIN_OUTPUT_LOW, /* KP_O_2 */
205         GPIO86_MC5_DAT0 | PIN_OUTPUT_LOW, /* KP_O_3 */
206         GPIO96_KP_O6    | PIN_OUTPUT_LOW, /* KP_O_6 */
207         GPIO94_KP_O7    | PIN_OUTPUT_LOW, /* KP_O_7 */
208         GPIO93_MC5_DAT4 | PIN_INPUT_PULLUP, /* KP_I_0 */
209         GPIO89_MC5_DAT3 | PIN_INPUT_PULLUP, /* KP_I_2 */
210         GPIO88_MC5_DAT2 | PIN_INPUT_PULLUP, /* KP_I_3 */
211         GPIO91_GPIO     | PIN_INPUT_PULLUP, /* FORCE_SENSING_INT */
212         GPIO92_GPIO     | PIN_OUTPUT_LOW, /* FORCE_SENSING_RST */
213         GPIO97_GPIO     | PIN_OUTPUT_LOW, /* FORCE_SENSING_WU */
214
215         /* DiPro Sensor Interface */
216         GPIO139_GPIO    | PIN_INPUT_PULLUP, /* DIPRO_INT */
217
218         /* HAL SWITCH INTERFACE */
219         GPIO145_GPIO    | PIN_INPUT_PULLDOWN,/* HAL_SW */
220
221         /* Audio Amplifier Interface */
222         GPIO149_GPIO    | PIN_OUTPUT_LOW, /* VAUDIO_HF_EN */
223
224         /* GBF INTERFACE */
225         GPIO171_GPIO    | PIN_OUTPUT_LOW, /* GBF_ENA_RESET */
226
227         /* MSP : HDTV INTERFACE */
228         GPIO192_GPIO    | PIN_INPUT_PULLDOWN,
229
230         /* ACCELEROMETER_INTERFACE */
231         GPIO82_GPIO             | PIN_INPUT_PULLUP, /* ACC_INT1 */
232         GPIO83_GPIO             | PIN_INPUT_PULLUP, /* ACC_INT2 */
233
234         /* Proximity Sensor */
235         GPIO217_GPIO            | PIN_INPUT_PULLUP,
236
237
238 };
239
240 static pin_cfg_t snowball_pins[] = {
241         /* SSP0, to AB8500 */
242         GPIO143_SSP0_CLK,
243         GPIO144_SSP0_FRM,
244         GPIO145_SSP0_RXD        | PIN_PULL_DOWN,
245         GPIO146_SSP0_TXD,
246
247         /* MMC0: MicroSD card */
248         GPIO21_MC0_DAT31DIR     | PIN_OUTPUT_HIGH,
249
250         /* MMC2: LAN */
251         GPIO86_SM_ADQ0,
252         GPIO87_SM_ADQ1,
253         GPIO88_SM_ADQ2,
254         GPIO89_SM_ADQ3,
255         GPIO90_SM_ADQ4,
256         GPIO91_SM_ADQ5,
257         GPIO92_SM_ADQ6,
258         GPIO93_SM_ADQ7,
259
260         GPIO94_SM_ADVn,
261         GPIO95_SM_CS0n,
262         GPIO96_SM_OEn,
263         GPIO97_SM_WEn,
264
265         GPIO128_SM_CKO,
266         GPIO130_SM_FBCLK,
267         GPIO131_SM_ADQ8,
268         GPIO132_SM_ADQ9,
269         GPIO133_SM_ADQ10,
270         GPIO134_SM_ADQ11,
271         GPIO135_SM_ADQ12,
272         GPIO136_SM_ADQ13,
273         GPIO137_SM_ADQ14,
274         GPIO138_SM_ADQ15,
275
276         /* RSTn_LAN */
277         GPIO141_GPIO            | PIN_OUTPUT_HIGH,
278 };
279
280 void __init mop500_pins_init(void)
281 {
282         nmk_config_pins(mop500_pins_common,
283                         ARRAY_SIZE(mop500_pins_common));
284
285         nmk_config_pins(mop500_pins_default,
286                         ARRAY_SIZE(mop500_pins_default));
287 }
288
289 void __init snowball_pins_init(void)
290 {
291         nmk_config_pins(mop500_pins_common,
292                         ARRAY_SIZE(mop500_pins_common));
293
294         nmk_config_pins(snowball_pins,
295                         ARRAY_SIZE(snowball_pins));
296 }
297
298 void __init hrefv60_pins_init(void)
299 {
300         nmk_config_pins(mop500_pins_common,
301                         ARRAY_SIZE(mop500_pins_common));
302
303         nmk_config_pins(hrefv60_pins,
304                         ARRAY_SIZE(hrefv60_pins));
305 }