blob: df5b190d331c8444f90769bdd850a34bfc0e99d8 [file] [log] [blame]
Rabin Vincentfe052032011-02-11 17:07:21 -07001/*
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>
Paul Gortmaker50af5ea2012-01-20 18:35:53 -05009#include <linux/bug.h>
Linus Walleij1baa5742012-04-19 18:27:38 +020010#include <linux/string.h>
Rabin Vincentfe052032011-02-11 17:07:21 -070011
Bibek Basu4bc3a692011-02-15 10:46:59 +010012#include <asm/mach-types.h>
Rabin Vincentfe052032011-02-11 17:07:21 -070013#include <plat/pincfg.h>
Linus Walleij0f332862011-08-22 08:33:30 +010014#include <plat/gpio-nomadik.h>
Linus Walleij1baa5742012-04-19 18:27:38 +020015
Rabin Vincentfe052032011-02-11 17:07:21 -070016#include <mach/hardware.h>
17
18#include "pins-db8500.h"
Rabin Vincent339bcf32012-04-17 13:35:31 +020019#include "pins.h"
Linus Walleij1baa5742012-04-19 18:27:38 +020020#include "board-mop500.h"
21
22enum custom_pin_cfg_t {
23 PINS_FOR_DEFAULT,
24 PINS_FOR_U9500,
25};
26
27static enum custom_pin_cfg_t pinsfor;
Rabin Vincentfe052032011-02-11 17:07:21 -070028
Bibek Basu4bc3a692011-02-15 10:46:59 +010029static pin_cfg_t mop500_pins_common[] = {
Linus Walleij1baa5742012-04-19 18:27:38 +020030 /* uMSP0 */
Bibek Basu4bc3a692011-02-15 10:46:59 +010031 GPIO12_MSP0_TXD,
32 GPIO13_MSP0_TFS,
33 GPIO14_MSP0_TCK,
34 GPIO15_MSP0_RXD,
35
36 /* MSP2: HDMI */
Linus Walleij1baa5742012-04-19 18:27:38 +020037 GPIO193_MSP2_TXD | PIN_INPUT_PULLDOWN,
38 GPIO194_MSP2_TCK | PIN_INPUT_PULLDOWN,
39 GPIO195_MSP2_TFS | PIN_INPUT_PULLDOWN,
Bibek Basu4bc3a692011-02-15 10:46:59 +010040 GPIO196_MSP2_RXD | PIN_OUTPUT_LOW,
41
Linus Walleij1baa5742012-04-19 18:27:38 +020042 /* LCD TE0 */
43 GPIO68_LCD_VSI0 | PIN_INPUT_PULLUP,
44
Bibek Basu4bc3a692011-02-15 10:46:59 +010045 /* Touch screen INTERFACE */
46 GPIO84_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT1 */
47
48 /* STMPE1601/tc35893 keypad IRQ */
49 GPIO218_GPIO | PIN_INPUT_PULLUP,
50
Bibek Basu4bc3a692011-02-15 10:46:59 +010051 /* UART */
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020052 /* uart-0 pins gpio configuration should be
53 * kept intact to prevent glitch in tx line
54 * when tty dev is opened. Later these pins
55 * are configured to uart mop500_pins_uart0
56 *
57 * It will be replaced with uart configuration
58 * once the issue is solved.
59 */
60 GPIO0_GPIO | PIN_INPUT_PULLUP,
61 GPIO1_GPIO | PIN_OUTPUT_HIGH,
62 GPIO2_GPIO | PIN_INPUT_PULLUP,
63 GPIO3_GPIO | PIN_OUTPUT_HIGH,
Rabin Vincentfe052032011-02-11 17:07:21 -070064
Bibek Basu4bc3a692011-02-15 10:46:59 +010065 GPIO29_U2_RXD | PIN_INPUT_PULLUP,
66 GPIO30_U2_TXD | PIN_OUTPUT_HIGH,
67 GPIO31_U2_CTSn | PIN_INPUT_PULLUP,
68 GPIO32_U2_RTSn | PIN_OUTPUT_HIGH,
Bibek Basu4bc3a692011-02-15 10:46:59 +010069};
Rabin Vincentfe052032011-02-11 17:07:21 -070070
Bibek Basu4bc3a692011-02-15 10:46:59 +010071static pin_cfg_t mop500_pins_default[] = {
72 /* SSP0 */
73 GPIO143_SSP0_CLK,
74 GPIO144_SSP0_FRM,
75 GPIO145_SSP0_RXD | PIN_PULL_DOWN,
76 GPIO146_SSP0_TXD,
77
Linus Walleij1baa5742012-04-19 18:27:38 +020078 /* XENON Flashgun INTERFACE */
79 GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */
80 GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */
Bibek Basu4bc3a692011-02-15 10:46:59 +010081
82 GPIO217_GPIO | PIN_INPUT_PULLUP, /* TC35892 IRQ */
83
Linus Walleij1baa5742012-04-19 18:27:38 +020084 /* sdi0 (removable MMC/SD/SDIO cards) not handled by pm_runtime */
Bibek Basu4bc3a692011-02-15 10:46:59 +010085 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH,
86
87 /* UART */
88 GPIO4_U1_RXD | PIN_INPUT_PULLUP,
89 GPIO5_U1_TXD | PIN_OUTPUT_HIGH,
90 GPIO6_U1_CTSn | PIN_INPUT_PULLUP,
91 GPIO7_U1_RTSn | PIN_OUTPUT_HIGH,
92};
93
Lee Jones110c2c22011-08-26 16:54:07 +010094static pin_cfg_t hrefv60_pins[] = {
Bibek Basu4bc3a692011-02-15 10:46:59 +010095 /* WLAN */
Bibek Basu4bc3a692011-02-15 10:46:59 +010096 GPIO85_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */
97
98 /* XENON Flashgun INTERFACE */
99 GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */
100 GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */
Bibek Basu4bc3a692011-02-15 10:46:59 +0100101
102 /* Assistant LED INTERFACE */
103 GPIO21_GPIO | PIN_OUTPUT_LOW, /* XENON_EN1 */
104 GPIO64_IP_GPIO4 | PIN_OUTPUT_LOW, /* XENON_EN2 */
105
106 /* Magnetometer */
107 GPIO31_GPIO | PIN_INPUT_PULLUP, /* magnetometer_INT */
108 GPIO32_GPIO | PIN_INPUT_PULLDOWN, /* Magnetometer DRDY */
109
110 /* Display Interface */
Linus Walleij1baa5742012-04-19 18:27:38 +0200111 GPIO65_GPIO | PIN_OUTPUT_HIGH, /* DISP1 NO RST */
Bibek Basu4bc3a692011-02-15 10:46:59 +0100112 GPIO66_GPIO | PIN_OUTPUT_LOW, /* DISP2 RST */
113
114 /* Touch screen INTERFACE */
115 GPIO143_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST1 */
116
117 /* Touch screen INTERFACE 2 */
118 GPIO67_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT2 */
119 GPIO146_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST2 */
120
121 /* ETM_PTM_TRACE INTERFACE */
122 GPIO70_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA23 */
123 GPIO71_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA22 */
124 GPIO72_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA21 */
125 GPIO73_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA20 */
126 GPIO74_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA19 */
127
128 /* NAHJ INTERFACE */
129 GPIO76_GPIO | PIN_OUTPUT_LOW,/* NAHJ_CTRL */
130 GPIO216_GPIO | PIN_OUTPUT_HIGH,/* NAHJ_CTRL_INV */
131
132 /* NFC INTERFACE */
133 GPIO77_GPIO | PIN_OUTPUT_LOW, /* NFC_ENA */
134 GPIO144_GPIO | PIN_INPUT_PULLDOWN, /* NFC_IRQ */
135 GPIO142_GPIO | PIN_OUTPUT_LOW, /* NFC_RESET */
136
137 /* Keyboard MATRIX INTERFACE */
138 GPIO90_MC5_CMD | PIN_OUTPUT_LOW, /* KP_O_1 */
139 GPIO87_MC5_DAT1 | PIN_OUTPUT_LOW, /* KP_O_2 */
140 GPIO86_MC5_DAT0 | PIN_OUTPUT_LOW, /* KP_O_3 */
141 GPIO96_KP_O6 | PIN_OUTPUT_LOW, /* KP_O_6 */
142 GPIO94_KP_O7 | PIN_OUTPUT_LOW, /* KP_O_7 */
143 GPIO93_MC5_DAT4 | PIN_INPUT_PULLUP, /* KP_I_0 */
144 GPIO89_MC5_DAT3 | PIN_INPUT_PULLUP, /* KP_I_2 */
145 GPIO88_MC5_DAT2 | PIN_INPUT_PULLUP, /* KP_I_3 */
146 GPIO91_GPIO | PIN_INPUT_PULLUP, /* FORCE_SENSING_INT */
147 GPIO92_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_RST */
148 GPIO97_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_WU */
149
150 /* DiPro Sensor Interface */
151 GPIO139_GPIO | PIN_INPUT_PULLUP, /* DIPRO_INT */
152
Bibek Basu4bc3a692011-02-15 10:46:59 +0100153 /* Audio Amplifier Interface */
Linus Walleij1baa5742012-04-19 18:27:38 +0200154 GPIO149_GPIO | PIN_OUTPUT_HIGH, /* VAUDIO_HF_EN, enable MAX8968 */
Bibek Basu4bc3a692011-02-15 10:46:59 +0100155
156 /* GBF INTERFACE */
157 GPIO171_GPIO | PIN_OUTPUT_LOW, /* GBF_ENA_RESET */
158
159 /* MSP : HDTV INTERFACE */
160 GPIO192_GPIO | PIN_INPUT_PULLDOWN,
161
162 /* ACCELEROMETER_INTERFACE */
163 GPIO82_GPIO | PIN_INPUT_PULLUP, /* ACC_INT1 */
164 GPIO83_GPIO | PIN_INPUT_PULLUP, /* ACC_INT2 */
165
Linus Walleij1baa5742012-04-19 18:27:38 +0200166 /* SD card detect */
167 GPIO95_GPIO | PIN_INPUT_PULLUP,
168};
Bibek Basu4bc3a692011-02-15 10:46:59 +0100169
Linus Walleij1baa5742012-04-19 18:27:38 +0200170static pin_cfg_t u9500_pins[] = {
171 GPIO4_U1_RXD | PIN_INPUT_PULLUP,
172 GPIO5_U1_TXD | PIN_OUTPUT_HIGH,
173 GPIO144_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
Bibek Basu4bc3a692011-02-15 10:46:59 +0100174
Linus Walleij1baa5742012-04-19 18:27:38 +0200175 /* HSI */
176 GPIO219_HSIR_FLA0 | PIN_INPUT_PULLDOWN,
177 GPIO220_HSIR_DAT0 | PIN_INPUT_PULLDOWN,
178 GPIO221_HSIR_RDY0 | PIN_OUTPUT_LOW,
179 GPIO222_HSIT_FLA0 | PIN_OUTPUT_LOW,
180 GPIO223_HSIT_DAT0 | PIN_OUTPUT_LOW,
181 GPIO224_HSIT_RDY0 | PIN_INPUT_PULLDOWN,
182 GPIO225_HSIT_CAWAKE0 | PIN_INPUT_PULLDOWN, /* CA_WAKE0 */
183 GPIO226_GPIO | PIN_OUTPUT_HIGH, /* AC_WAKE0 */
184};
185
186static pin_cfg_t u8500_pins[] = {
187 GPIO226_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */
188 GPIO4_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
Rabin Vincentfe052032011-02-11 17:07:21 -0700189};
190
Robert Marklundc41fac82011-06-21 09:39:13 +0200191static pin_cfg_t snowball_pins[] = {
192 /* SSP0, to AB8500 */
193 GPIO143_SSP0_CLK,
194 GPIO144_SSP0_FRM,
195 GPIO145_SSP0_RXD | PIN_PULL_DOWN,
196 GPIO146_SSP0_TXD,
197
198 /* MMC0: MicroSD card */
199 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH,
200
201 /* MMC2: LAN */
202 GPIO86_SM_ADQ0,
203 GPIO87_SM_ADQ1,
204 GPIO88_SM_ADQ2,
205 GPIO89_SM_ADQ3,
206 GPIO90_SM_ADQ4,
207 GPIO91_SM_ADQ5,
208 GPIO92_SM_ADQ6,
209 GPIO93_SM_ADQ7,
210
211 GPIO94_SM_ADVn,
212 GPIO95_SM_CS0n,
213 GPIO96_SM_OEn,
214 GPIO97_SM_WEn,
215
216 GPIO128_SM_CKO,
217 GPIO130_SM_FBCLK,
218 GPIO131_SM_ADQ8,
219 GPIO132_SM_ADQ9,
220 GPIO133_SM_ADQ10,
221 GPIO134_SM_ADQ11,
222 GPIO135_SM_ADQ12,
223 GPIO136_SM_ADQ13,
224 GPIO137_SM_ADQ14,
225 GPIO138_SM_ADQ15,
226
227 /* RSTn_LAN */
228 GPIO141_GPIO | PIN_OUTPUT_HIGH,
Linus Walleij1baa5742012-04-19 18:27:38 +0200229
230 /* Accelerometer/Magnetometer */
231 GPIO163_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ1 */
232 GPIO164_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ2 */
233 GPIO165_GPIO | PIN_INPUT_PULLUP, /* MAG_DRDY */
234
235 /* WLAN/GBF */
236 GPIO161_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */
237 GPIO171_GPIO | PIN_OUTPUT_HIGH,/* GBF_ENA */
238 GPIO215_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */
239 GPIO216_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
Robert Marklundc41fac82011-06-21 09:39:13 +0200240};
241
Linus Walleij1baa5742012-04-19 18:27:38 +0200242/*
243 * I2C
244 */
245
246static UX500_PINS(mop500_pins_i2c0,
247 GPIO147_I2C0_SCL |
248 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
249 GPIO148_I2C0_SDA |
250 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
251);
252
253static UX500_PINS(mop500_pins_i2c1,
254 GPIO16_I2C1_SCL |
255 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
256 GPIO17_I2C1_SDA |
257 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
258);
259
260static UX500_PINS(mop500_pins_i2c2,
261 GPIO10_I2C2_SDA |
262 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
263 GPIO11_I2C2_SCL |
264 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
265);
266
267static UX500_PINS(mop500_pins_i2c3,
268 GPIO229_I2C3_SDA |
269 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
270 GPIO230_I2C3_SCL |
271 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
272);
273
274static UX500_PINS(mop500_pins_mcde_tvout,
275 GPIO78_LCD_D8,
276 GPIO79_LCD_D9,
277 GPIO80_LCD_D10,
278 GPIO81_LCD_D11,
279 GPIO150_LCDA_CLK,
280);
281
282static UX500_PINS(mop500_pins_mcde_hdmi,
283 GPIO69_LCD_VSI1 | PIN_INPUT_PULLUP,
284);
285
286static UX500_PINS(mop500_pins_ske,
287 GPIO153_KP_I7 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
288 GPIO154_KP_I6 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
289 GPIO155_KP_I5 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
290 GPIO156_KP_I4 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
291 GPIO161_KP_I3 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
292 GPIO162_KP_I2 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
293 GPIO163_KP_I1 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
294 GPIO164_KP_I0 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
295 GPIO157_KP_O7 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
296 GPIO158_KP_O6 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
297 GPIO159_KP_O5 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
298 GPIO160_KP_O4 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
299 GPIO165_KP_O3 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
300 GPIO166_KP_O2 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
301 GPIO167_KP_O1 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
302 GPIO168_KP_O0 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
303);
304
305/* sdi0 (removable MMC/SD/SDIO cards) */
306static UX500_PINS(mop500_pins_sdi0,
307 GPIO18_MC0_CMDDIR | PIN_OUTPUT_HIGH,
308 GPIO19_MC0_DAT0DIR | PIN_OUTPUT_HIGH,
309 GPIO20_MC0_DAT2DIR | PIN_OUTPUT_HIGH,
310
311 GPIO22_MC0_FBCLK | PIN_INPUT_NOPULL,
312 GPIO23_MC0_CLK | PIN_OUTPUT_LOW,
313 GPIO24_MC0_CMD | PIN_INPUT_PULLUP,
314 GPIO25_MC0_DAT0 | PIN_INPUT_PULLUP,
315 GPIO26_MC0_DAT1 | PIN_INPUT_PULLUP,
316 GPIO27_MC0_DAT2 | PIN_INPUT_PULLUP,
317 GPIO28_MC0_DAT3 | PIN_INPUT_PULLUP,
318);
319
320/* sdi1 (WLAN CW1200) */
321static UX500_PINS(mop500_pins_sdi1,
322 GPIO208_MC1_CLK | PIN_OUTPUT_LOW,
323 GPIO209_MC1_FBCLK | PIN_INPUT_NOPULL,
324 GPIO210_MC1_CMD | PIN_INPUT_PULLUP,
325 GPIO211_MC1_DAT0 | PIN_INPUT_PULLUP,
326 GPIO212_MC1_DAT1 | PIN_INPUT_PULLUP,
327 GPIO213_MC1_DAT2 | PIN_INPUT_PULLUP,
328 GPIO214_MC1_DAT3 | PIN_INPUT_PULLUP,
329);
330
331/* sdi2 (POP eMMC) */
332static UX500_PINS(mop500_pins_sdi2,
333 GPIO128_MC2_CLK | PIN_OUTPUT_LOW,
334 GPIO129_MC2_CMD | PIN_INPUT_PULLUP,
335 GPIO130_MC2_FBCLK | PIN_INPUT_NOPULL,
336 GPIO131_MC2_DAT0 | PIN_INPUT_PULLUP,
337 GPIO132_MC2_DAT1 | PIN_INPUT_PULLUP,
338 GPIO133_MC2_DAT2 | PIN_INPUT_PULLUP,
339 GPIO134_MC2_DAT3 | PIN_INPUT_PULLUP,
340 GPIO135_MC2_DAT4 | PIN_INPUT_PULLUP,
341 GPIO136_MC2_DAT5 | PIN_INPUT_PULLUP,
342 GPIO137_MC2_DAT6 | PIN_INPUT_PULLUP,
343 GPIO138_MC2_DAT7 | PIN_INPUT_PULLUP,
344);
345
346/* sdi4 (PCB eMMC) */
347static UX500_PINS(mop500_pins_sdi4,
348 GPIO197_MC4_DAT3 | PIN_INPUT_PULLUP,
349 GPIO198_MC4_DAT2 | PIN_INPUT_PULLUP,
350 GPIO199_MC4_DAT1 | PIN_INPUT_PULLUP,
351 GPIO200_MC4_DAT0 | PIN_INPUT_PULLUP,
352 GPIO201_MC4_CMD | PIN_INPUT_PULLUP,
353 GPIO202_MC4_FBCLK | PIN_INPUT_NOPULL,
354 GPIO203_MC4_CLK | PIN_OUTPUT_LOW,
355 GPIO204_MC4_DAT7 | PIN_INPUT_PULLUP,
356 GPIO205_MC4_DAT6 | PIN_INPUT_PULLUP,
357 GPIO206_MC4_DAT5 | PIN_INPUT_PULLUP,
358 GPIO207_MC4_DAT4 | PIN_INPUT_PULLUP,
359);
360
361/* USB */
362static UX500_PINS(mop500_pins_usb,
363 GPIO256_USB_NXT,
364 GPIO257_USB_STP | PIN_OUTPUT_HIGH,
365 GPIO258_USB_XCLK,
366 GPIO259_USB_DIR,
367 GPIO260_USB_DAT7,
368 GPIO261_USB_DAT6,
369 GPIO262_USB_DAT5,
370 GPIO263_USB_DAT4,
371 GPIO264_USB_DAT3,
372 GPIO265_USB_DAT2,
373 GPIO266_USB_DAT1,
374 GPIO267_USB_DAT0,
375);
376
377/* SPI2 */
378static UX500_PINS(mop500_pins_spi2,
379 GPIO216_GPIO | PIN_OUTPUT_HIGH,
380 GPIO218_SPI2_RXD | PIN_INPUT_PULLDOWN,
381 GPIO215_SPI2_TXD | PIN_OUTPUT_LOW,
382 GPIO217_SPI2_CLK | PIN_OUTPUT_LOW,
383);
384
385static UX500_PINS(mop500_pins_sensors1p_v60,
386 GPIO217_GPIO| PIN_INPUT_PULLUP |
387 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
388 GPIO145_GPIO | PIN_INPUT_PULLDOWN |
389 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
390 GPIO139_GPIO | PIN_INPUT_PULLUP |
391 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
392);
393
394static UX500_PINS(mop500_pins_sensors1p,
395 PIN_CFG_INPUT(GPIO_PROX_SENSOR, GPIO, NOPULL),
396 PIN_CFG_INPUT(GPIO_HAL_SENSOR, GPIO, NOPULL),
397);
398
399static struct ux500_pin_lookup mop500_runtime_pins[] = {
400 PIN_LOOKUP("mcde-tvout", &mop500_pins_mcde_tvout),
401 PIN_LOOKUP("av8100-hdmi", &mop500_pins_mcde_hdmi),
402 PIN_LOOKUP("nmk-i2c.0", &mop500_pins_i2c0),
403 PIN_LOOKUP("nmk-i2c.1", &mop500_pins_i2c1),
404 PIN_LOOKUP("nmk-i2c.2", &mop500_pins_i2c2),
405 PIN_LOOKUP("nmk-i2c.3", &mop500_pins_i2c3),
406 PIN_LOOKUP("sdi0", &mop500_pins_sdi0),
407 PIN_LOOKUP("sdi1", &mop500_pins_sdi1),
408 PIN_LOOKUP("sdi2", &mop500_pins_sdi2),
409 PIN_LOOKUP("sdi4", &mop500_pins_sdi4),
410 PIN_LOOKUP("musb-ux500.0", &mop500_pins_usb),
411 PIN_LOOKUP("spi2", &mop500_pins_spi2),
412};
413
414static struct ux500_pin_lookup mop500_runtime_pins_v60[] = {
415 PIN_LOOKUP("ske", &mop500_pins_ske),
416 PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p_v60),
417};
418
419static struct ux500_pin_lookup mop500_runtime_pins_pre_v60[] = {
420 PIN_LOOKUP("ske", &mop500_pins_ske),
421 PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p),
422};
423
424/*
425 * passing "pinsfor=" in kernel cmdline allows for custom
426 * configuration of GPIOs on u8500 derived boards.
427 */
428static int __init early_pinsfor(char *p)
429{
430 pinsfor = PINS_FOR_DEFAULT;
431
432 if (strcmp(p, "u9500-21") == 0)
433 pinsfor = PINS_FOR_U9500;
434
435 return 0;
436}
437early_param("pinsfor", early_pinsfor);
438
439int pins_for_u9500(void)
440{
441 if (pinsfor == PINS_FOR_U9500)
442 return 1;
443
444 return 0;
445}
446
Rabin Vincentfe052032011-02-11 17:07:21 -0700447void __init mop500_pins_init(void)
448{
Bibek Basu4bc3a692011-02-15 10:46:59 +0100449 nmk_config_pins(mop500_pins_common,
Lee Jones110c2c22011-08-26 16:54:07 +0100450 ARRAY_SIZE(mop500_pins_common));
451
Linus Walleij1baa5742012-04-19 18:27:38 +0200452 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
453
454 ux500_pins_add(mop500_runtime_pins_pre_v60,
455 ARRAY_SIZE(mop500_runtime_pins_pre_v60));
456
457 switch (pinsfor) {
458 case PINS_FOR_U9500:
459 nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
460 break;
461
462 case PINS_FOR_DEFAULT:
463 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
464 default:
465 break;
466 }
467
Lee Jones110c2c22011-08-26 16:54:07 +0100468 nmk_config_pins(mop500_pins_default,
469 ARRAY_SIZE(mop500_pins_default));
470}
471
472void __init snowball_pins_init(void)
473{
474 nmk_config_pins(mop500_pins_common,
475 ARRAY_SIZE(mop500_pins_common));
476
Linus Walleij1baa5742012-04-19 18:27:38 +0200477 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
478
479 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
480
481 nmk_config_pins(snowball_pins, ARRAY_SIZE(snowball_pins));
Lee Jones110c2c22011-08-26 16:54:07 +0100482}
483
484void __init hrefv60_pins_init(void)
485{
486 nmk_config_pins(mop500_pins_common,
487 ARRAY_SIZE(mop500_pins_common));
488
Linus Walleij1baa5742012-04-19 18:27:38 +0200489 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
490
491 ux500_pins_add(mop500_runtime_pins_v60,
492 ARRAY_SIZE(mop500_runtime_pins_v60));
493
Lee Jones110c2c22011-08-26 16:54:07 +0100494 nmk_config_pins(hrefv60_pins,
495 ARRAY_SIZE(hrefv60_pins));
Linus Walleij1baa5742012-04-19 18:27:38 +0200496
497 switch (pinsfor) {
498 case PINS_FOR_U9500:
499 nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
500 break;
501
502 case PINS_FOR_DEFAULT:
503 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
504 default:
505 break;
506 }
Rabin Vincentfe052032011-02-11 17:07:21 -0700507}