board-mop500-pins.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * License terms: GNU General Public License (GPL) version 2
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/init.h>
  8. #include <linux/bug.h>
  9. #include <linux/string.h>
  10. #include <asm/mach-types.h>
  11. #include <plat/pincfg.h>
  12. #include <plat/gpio-nomadik.h>
  13. #include <mach/hardware.h>
  14. #include "pins-db8500.h"
  15. #include "pins.h"
  16. #include "board-mop500.h"
  17. enum custom_pin_cfg_t {
  18. PINS_FOR_DEFAULT,
  19. PINS_FOR_U9500,
  20. };
  21. static enum custom_pin_cfg_t pinsfor;
  22. static pin_cfg_t mop500_pins_common[] = {
  23. /* uMSP0 */
  24. GPIO12_MSP0_TXD,
  25. GPIO13_MSP0_TFS,
  26. GPIO14_MSP0_TCK,
  27. GPIO15_MSP0_RXD,
  28. /* MSP2: HDMI */
  29. GPIO193_MSP2_TXD | PIN_INPUT_PULLDOWN,
  30. GPIO194_MSP2_TCK | PIN_INPUT_PULLDOWN,
  31. GPIO195_MSP2_TFS | PIN_INPUT_PULLDOWN,
  32. GPIO196_MSP2_RXD | PIN_OUTPUT_LOW,
  33. /* LCD TE0 */
  34. GPIO68_LCD_VSI0 | PIN_INPUT_PULLUP,
  35. /* Touch screen INTERFACE */
  36. GPIO84_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT1 */
  37. /* STMPE1601/tc35893 keypad IRQ */
  38. GPIO218_GPIO | PIN_INPUT_PULLUP,
  39. /* UART */
  40. /* uart-0 pins gpio configuration should be
  41. * kept intact to prevent glitch in tx line
  42. * when tty dev is opened. Later these pins
  43. * are configured to uart mop500_pins_uart0
  44. *
  45. * It will be replaced with uart configuration
  46. * once the issue is solved.
  47. */
  48. GPIO0_GPIO | PIN_INPUT_PULLUP,
  49. GPIO1_GPIO | PIN_OUTPUT_HIGH,
  50. GPIO2_GPIO | PIN_INPUT_PULLUP,
  51. GPIO3_GPIO | PIN_OUTPUT_HIGH,
  52. GPIO29_U2_RXD | PIN_INPUT_PULLUP,
  53. GPIO30_U2_TXD | PIN_OUTPUT_HIGH,
  54. GPIO31_U2_CTSn | PIN_INPUT_PULLUP,
  55. GPIO32_U2_RTSn | PIN_OUTPUT_HIGH,
  56. };
  57. static pin_cfg_t mop500_pins_default[] = {
  58. /* SSP0 */
  59. GPIO143_SSP0_CLK,
  60. GPIO144_SSP0_FRM,
  61. GPIO145_SSP0_RXD | PIN_PULL_DOWN,
  62. GPIO146_SSP0_TXD,
  63. /* XENON Flashgun INTERFACE */
  64. GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */
  65. GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */
  66. GPIO217_GPIO | PIN_INPUT_PULLUP, /* TC35892 IRQ */
  67. /* sdi0 (removable MMC/SD/SDIO cards) not handled by pm_runtime */
  68. GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH,
  69. /* UART */
  70. GPIO4_U1_RXD | PIN_INPUT_PULLUP,
  71. GPIO5_U1_TXD | PIN_OUTPUT_HIGH,
  72. GPIO6_U1_CTSn | PIN_INPUT_PULLUP,
  73. GPIO7_U1_RTSn | PIN_OUTPUT_HIGH,
  74. };
  75. static pin_cfg_t hrefv60_pins[] = {
  76. /* WLAN */
  77. GPIO85_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */
  78. /* XENON Flashgun INTERFACE */
  79. GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */
  80. GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */
  81. /* Assistant LED INTERFACE */
  82. GPIO21_GPIO | PIN_OUTPUT_LOW, /* XENON_EN1 */
  83. GPIO64_IP_GPIO4 | PIN_OUTPUT_LOW, /* XENON_EN2 */
  84. /* Magnetometer */
  85. GPIO31_GPIO | PIN_INPUT_PULLUP, /* magnetometer_INT */
  86. GPIO32_GPIO | PIN_INPUT_PULLDOWN, /* Magnetometer DRDY */
  87. /* Display Interface */
  88. GPIO65_GPIO | PIN_OUTPUT_HIGH, /* DISP1 NO RST */
  89. GPIO66_GPIO | PIN_OUTPUT_LOW, /* DISP2 RST */
  90. /* Touch screen INTERFACE */
  91. GPIO143_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST1 */
  92. /* Touch screen INTERFACE 2 */
  93. GPIO67_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT2 */
  94. GPIO146_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST2 */
  95. /* ETM_PTM_TRACE INTERFACE */
  96. GPIO70_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA23 */
  97. GPIO71_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA22 */
  98. GPIO72_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA21 */
  99. GPIO73_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA20 */
  100. GPIO74_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA19 */
  101. /* NAHJ INTERFACE */
  102. GPIO76_GPIO | PIN_OUTPUT_LOW,/* NAHJ_CTRL */
  103. GPIO216_GPIO | PIN_OUTPUT_HIGH,/* NAHJ_CTRL_INV */
  104. /* NFC INTERFACE */
  105. GPIO77_GPIO | PIN_OUTPUT_LOW, /* NFC_ENA */
  106. GPIO144_GPIO | PIN_INPUT_PULLDOWN, /* NFC_IRQ */
  107. GPIO142_GPIO | PIN_OUTPUT_LOW, /* NFC_RESET */
  108. /* Keyboard MATRIX INTERFACE */
  109. GPIO90_MC5_CMD | PIN_OUTPUT_LOW, /* KP_O_1 */
  110. GPIO87_MC5_DAT1 | PIN_OUTPUT_LOW, /* KP_O_2 */
  111. GPIO86_MC5_DAT0 | PIN_OUTPUT_LOW, /* KP_O_3 */
  112. GPIO96_KP_O6 | PIN_OUTPUT_LOW, /* KP_O_6 */
  113. GPIO94_KP_O7 | PIN_OUTPUT_LOW, /* KP_O_7 */
  114. GPIO93_MC5_DAT4 | PIN_INPUT_PULLUP, /* KP_I_0 */
  115. GPIO89_MC5_DAT3 | PIN_INPUT_PULLUP, /* KP_I_2 */
  116. GPIO88_MC5_DAT2 | PIN_INPUT_PULLUP, /* KP_I_3 */
  117. GPIO91_GPIO | PIN_INPUT_PULLUP, /* FORCE_SENSING_INT */
  118. GPIO92_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_RST */
  119. GPIO97_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_WU */
  120. /* DiPro Sensor Interface */
  121. GPIO139_GPIO | PIN_INPUT_PULLUP, /* DIPRO_INT */
  122. /* Audio Amplifier Interface */
  123. GPIO149_GPIO | PIN_OUTPUT_HIGH, /* VAUDIO_HF_EN, enable MAX8968 */
  124. /* GBF INTERFACE */
  125. GPIO171_GPIO | PIN_OUTPUT_LOW, /* GBF_ENA_RESET */
  126. /* MSP : HDTV INTERFACE */
  127. GPIO192_GPIO | PIN_INPUT_PULLDOWN,
  128. /* ACCELEROMETER_INTERFACE */
  129. GPIO82_GPIO | PIN_INPUT_PULLUP, /* ACC_INT1 */
  130. GPIO83_GPIO | PIN_INPUT_PULLUP, /* ACC_INT2 */
  131. /* SD card detect */
  132. GPIO95_GPIO | PIN_INPUT_PULLUP,
  133. };
  134. static pin_cfg_t u9500_pins[] = {
  135. GPIO4_U1_RXD | PIN_INPUT_PULLUP,
  136. GPIO5_U1_TXD | PIN_OUTPUT_HIGH,
  137. GPIO144_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
  138. /* HSI */
  139. GPIO219_HSIR_FLA0 | PIN_INPUT_PULLDOWN,
  140. GPIO220_HSIR_DAT0 | PIN_INPUT_PULLDOWN,
  141. GPIO221_HSIR_RDY0 | PIN_OUTPUT_LOW,
  142. GPIO222_HSIT_FLA0 | PIN_OUTPUT_LOW,
  143. GPIO223_HSIT_DAT0 | PIN_OUTPUT_LOW,
  144. GPIO224_HSIT_RDY0 | PIN_INPUT_PULLDOWN,
  145. GPIO225_HSIT_CAWAKE0 | PIN_INPUT_PULLDOWN, /* CA_WAKE0 */
  146. GPIO226_GPIO | PIN_OUTPUT_HIGH, /* AC_WAKE0 */
  147. };
  148. static pin_cfg_t u8500_pins[] = {
  149. GPIO226_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */
  150. GPIO4_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
  151. };
  152. static pin_cfg_t snowball_pins[] = {
  153. /* SSP0, to AB8500 */
  154. GPIO143_SSP0_CLK,
  155. GPIO144_SSP0_FRM,
  156. GPIO145_SSP0_RXD | PIN_PULL_DOWN,
  157. GPIO146_SSP0_TXD,
  158. /* MMC0: MicroSD card */
  159. GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH,
  160. /* MMC2: LAN */
  161. GPIO86_SM_ADQ0,
  162. GPIO87_SM_ADQ1,
  163. GPIO88_SM_ADQ2,
  164. GPIO89_SM_ADQ3,
  165. GPIO90_SM_ADQ4,
  166. GPIO91_SM_ADQ5,
  167. GPIO92_SM_ADQ6,
  168. GPIO93_SM_ADQ7,
  169. GPIO94_SM_ADVn,
  170. GPIO95_SM_CS0n,
  171. GPIO96_SM_OEn,
  172. GPIO97_SM_WEn,
  173. GPIO128_SM_CKO,
  174. GPIO130_SM_FBCLK,
  175. GPIO131_SM_ADQ8,
  176. GPIO132_SM_ADQ9,
  177. GPIO133_SM_ADQ10,
  178. GPIO134_SM_ADQ11,
  179. GPIO135_SM_ADQ12,
  180. GPIO136_SM_ADQ13,
  181. GPIO137_SM_ADQ14,
  182. GPIO138_SM_ADQ15,
  183. /* RSTn_LAN */
  184. GPIO141_GPIO | PIN_OUTPUT_HIGH,
  185. /* Accelerometer/Magnetometer */
  186. GPIO163_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ1 */
  187. GPIO164_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ2 */
  188. GPIO165_GPIO | PIN_INPUT_PULLUP, /* MAG_DRDY */
  189. /* WLAN/GBF */
  190. GPIO161_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */
  191. GPIO171_GPIO | PIN_OUTPUT_HIGH,/* GBF_ENA */
  192. GPIO215_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */
  193. GPIO216_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */
  194. };
  195. /*
  196. * I2C
  197. */
  198. static UX500_PINS(mop500_pins_i2c0,
  199. GPIO147_I2C0_SCL |
  200. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  201. GPIO148_I2C0_SDA |
  202. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  203. );
  204. static UX500_PINS(mop500_pins_i2c1,
  205. GPIO16_I2C1_SCL |
  206. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  207. GPIO17_I2C1_SDA |
  208. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  209. );
  210. static UX500_PINS(mop500_pins_i2c2,
  211. GPIO10_I2C2_SDA |
  212. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  213. GPIO11_I2C2_SCL |
  214. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  215. );
  216. static UX500_PINS(mop500_pins_i2c3,
  217. GPIO229_I2C3_SDA |
  218. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  219. GPIO230_I2C3_SCL |
  220. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  221. );
  222. static UX500_PINS(mop500_pins_mcde_tvout,
  223. GPIO78_LCD_D8,
  224. GPIO79_LCD_D9,
  225. GPIO80_LCD_D10,
  226. GPIO81_LCD_D11,
  227. GPIO150_LCDA_CLK,
  228. );
  229. static UX500_PINS(mop500_pins_mcde_hdmi,
  230. GPIO69_LCD_VSI1 | PIN_INPUT_PULLUP,
  231. );
  232. static UX500_PINS(mop500_pins_ske,
  233. GPIO153_KP_I7 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  234. GPIO154_KP_I6 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  235. GPIO155_KP_I5 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  236. GPIO156_KP_I4 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  237. GPIO161_KP_I3 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  238. GPIO162_KP_I2 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  239. GPIO163_KP_I1 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  240. GPIO164_KP_I0 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
  241. GPIO157_KP_O7 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  242. GPIO158_KP_O6 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  243. GPIO159_KP_O5 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  244. GPIO160_KP_O4 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  245. GPIO165_KP_O3 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  246. GPIO166_KP_O2 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  247. GPIO167_KP_O1 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  248. GPIO168_KP_O0 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
  249. );
  250. /* sdi0 (removable MMC/SD/SDIO cards) */
  251. static UX500_PINS(mop500_pins_sdi0,
  252. GPIO18_MC0_CMDDIR | PIN_OUTPUT_HIGH,
  253. GPIO19_MC0_DAT0DIR | PIN_OUTPUT_HIGH,
  254. GPIO20_MC0_DAT2DIR | PIN_OUTPUT_HIGH,
  255. GPIO22_MC0_FBCLK | PIN_INPUT_NOPULL,
  256. GPIO23_MC0_CLK | PIN_OUTPUT_LOW,
  257. GPIO24_MC0_CMD | PIN_INPUT_PULLUP,
  258. GPIO25_MC0_DAT0 | PIN_INPUT_PULLUP,
  259. GPIO26_MC0_DAT1 | PIN_INPUT_PULLUP,
  260. GPIO27_MC0_DAT2 | PIN_INPUT_PULLUP,
  261. GPIO28_MC0_DAT3 | PIN_INPUT_PULLUP,
  262. );
  263. /* sdi1 (WLAN CW1200) */
  264. static UX500_PINS(mop500_pins_sdi1,
  265. GPIO208_MC1_CLK | PIN_OUTPUT_LOW,
  266. GPIO209_MC1_FBCLK | PIN_INPUT_NOPULL,
  267. GPIO210_MC1_CMD | PIN_INPUT_PULLUP,
  268. GPIO211_MC1_DAT0 | PIN_INPUT_PULLUP,
  269. GPIO212_MC1_DAT1 | PIN_INPUT_PULLUP,
  270. GPIO213_MC1_DAT2 | PIN_INPUT_PULLUP,
  271. GPIO214_MC1_DAT3 | PIN_INPUT_PULLUP,
  272. );
  273. /* sdi2 (POP eMMC) */
  274. static UX500_PINS(mop500_pins_sdi2,
  275. GPIO128_MC2_CLK | PIN_OUTPUT_LOW,
  276. GPIO129_MC2_CMD | PIN_INPUT_PULLUP,
  277. GPIO130_MC2_FBCLK | PIN_INPUT_NOPULL,
  278. GPIO131_MC2_DAT0 | PIN_INPUT_PULLUP,
  279. GPIO132_MC2_DAT1 | PIN_INPUT_PULLUP,
  280. GPIO133_MC2_DAT2 | PIN_INPUT_PULLUP,
  281. GPIO134_MC2_DAT3 | PIN_INPUT_PULLUP,
  282. GPIO135_MC2_DAT4 | PIN_INPUT_PULLUP,
  283. GPIO136_MC2_DAT5 | PIN_INPUT_PULLUP,
  284. GPIO137_MC2_DAT6 | PIN_INPUT_PULLUP,
  285. GPIO138_MC2_DAT7 | PIN_INPUT_PULLUP,
  286. );
  287. /* sdi4 (PCB eMMC) */
  288. static UX500_PINS(mop500_pins_sdi4,
  289. GPIO197_MC4_DAT3 | PIN_INPUT_PULLUP,
  290. GPIO198_MC4_DAT2 | PIN_INPUT_PULLUP,
  291. GPIO199_MC4_DAT1 | PIN_INPUT_PULLUP,
  292. GPIO200_MC4_DAT0 | PIN_INPUT_PULLUP,
  293. GPIO201_MC4_CMD | PIN_INPUT_PULLUP,
  294. GPIO202_MC4_FBCLK | PIN_INPUT_NOPULL,
  295. GPIO203_MC4_CLK | PIN_OUTPUT_LOW,
  296. GPIO204_MC4_DAT7 | PIN_INPUT_PULLUP,
  297. GPIO205_MC4_DAT6 | PIN_INPUT_PULLUP,
  298. GPIO206_MC4_DAT5 | PIN_INPUT_PULLUP,
  299. GPIO207_MC4_DAT4 | PIN_INPUT_PULLUP,
  300. );
  301. /* USB */
  302. static UX500_PINS(mop500_pins_usb,
  303. GPIO256_USB_NXT,
  304. GPIO257_USB_STP | PIN_OUTPUT_HIGH,
  305. GPIO258_USB_XCLK,
  306. GPIO259_USB_DIR,
  307. GPIO260_USB_DAT7,
  308. GPIO261_USB_DAT6,
  309. GPIO262_USB_DAT5,
  310. GPIO263_USB_DAT4,
  311. GPIO264_USB_DAT3,
  312. GPIO265_USB_DAT2,
  313. GPIO266_USB_DAT1,
  314. GPIO267_USB_DAT0,
  315. );
  316. /* SPI2 */
  317. static UX500_PINS(mop500_pins_spi2,
  318. GPIO216_GPIO | PIN_OUTPUT_HIGH,
  319. GPIO218_SPI2_RXD | PIN_INPUT_PULLDOWN,
  320. GPIO215_SPI2_TXD | PIN_OUTPUT_LOW,
  321. GPIO217_SPI2_CLK | PIN_OUTPUT_LOW,
  322. );
  323. static UX500_PINS(mop500_pins_sensors1p_v60,
  324. GPIO217_GPIO| PIN_INPUT_PULLUP |
  325. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  326. GPIO145_GPIO | PIN_INPUT_PULLDOWN |
  327. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  328. GPIO139_GPIO | PIN_INPUT_PULLUP |
  329. PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
  330. );
  331. static UX500_PINS(mop500_pins_sensors1p,
  332. PIN_CFG_INPUT(GPIO_PROX_SENSOR, GPIO, NOPULL),
  333. PIN_CFG_INPUT(GPIO_HAL_SENSOR, GPIO, NOPULL),
  334. );
  335. static struct ux500_pin_lookup mop500_runtime_pins[] = {
  336. PIN_LOOKUP("mcde-tvout", &mop500_pins_mcde_tvout),
  337. PIN_LOOKUP("av8100-hdmi", &mop500_pins_mcde_hdmi),
  338. PIN_LOOKUP("nmk-i2c.0", &mop500_pins_i2c0),
  339. PIN_LOOKUP("nmk-i2c.1", &mop500_pins_i2c1),
  340. PIN_LOOKUP("nmk-i2c.2", &mop500_pins_i2c2),
  341. PIN_LOOKUP("nmk-i2c.3", &mop500_pins_i2c3),
  342. PIN_LOOKUP("sdi0", &mop500_pins_sdi0),
  343. PIN_LOOKUP("sdi1", &mop500_pins_sdi1),
  344. PIN_LOOKUP("sdi2", &mop500_pins_sdi2),
  345. PIN_LOOKUP("sdi4", &mop500_pins_sdi4),
  346. PIN_LOOKUP("musb-ux500.0", &mop500_pins_usb),
  347. PIN_LOOKUP("spi2", &mop500_pins_spi2),
  348. };
  349. static struct ux500_pin_lookup mop500_runtime_pins_v60[] = {
  350. PIN_LOOKUP("ske", &mop500_pins_ske),
  351. PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p_v60),
  352. };
  353. static struct ux500_pin_lookup mop500_runtime_pins_pre_v60[] = {
  354. PIN_LOOKUP("ske", &mop500_pins_ske),
  355. PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p),
  356. };
  357. /*
  358. * passing "pinsfor=" in kernel cmdline allows for custom
  359. * configuration of GPIOs on u8500 derived boards.
  360. */
  361. static int __init early_pinsfor(char *p)
  362. {
  363. pinsfor = PINS_FOR_DEFAULT;
  364. if (strcmp(p, "u9500-21") == 0)
  365. pinsfor = PINS_FOR_U9500;
  366. return 0;
  367. }
  368. early_param("pinsfor", early_pinsfor);
  369. int pins_for_u9500(void)
  370. {
  371. if (pinsfor == PINS_FOR_U9500)
  372. return 1;
  373. return 0;
  374. }
  375. void __init mop500_pins_init(void)
  376. {
  377. nmk_config_pins(mop500_pins_common,
  378. ARRAY_SIZE(mop500_pins_common));
  379. ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
  380. ux500_pins_add(mop500_runtime_pins_pre_v60,
  381. ARRAY_SIZE(mop500_runtime_pins_pre_v60));
  382. switch (pinsfor) {
  383. case PINS_FOR_U9500:
  384. nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
  385. break;
  386. case PINS_FOR_DEFAULT:
  387. nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
  388. default:
  389. break;
  390. }
  391. nmk_config_pins(mop500_pins_default,
  392. ARRAY_SIZE(mop500_pins_default));
  393. }
  394. void __init snowball_pins_init(void)
  395. {
  396. nmk_config_pins(mop500_pins_common,
  397. ARRAY_SIZE(mop500_pins_common));
  398. ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
  399. nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
  400. nmk_config_pins(snowball_pins, ARRAY_SIZE(snowball_pins));
  401. }
  402. void __init hrefv60_pins_init(void)
  403. {
  404. nmk_config_pins(mop500_pins_common,
  405. ARRAY_SIZE(mop500_pins_common));
  406. ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
  407. ux500_pins_add(mop500_runtime_pins_v60,
  408. ARRAY_SIZE(mop500_runtime_pins_v60));
  409. nmk_config_pins(hrefv60_pins,
  410. ARRAY_SIZE(hrefv60_pins));
  411. switch (pinsfor) {
  412. case PINS_FOR_U9500:
  413. nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
  414. break;
  415. case PINS_FOR_DEFAULT:
  416. nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
  417. default:
  418. break;
  419. }
  420. }