pinctrl-imx25.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /*
  2. * imx25 pinctrl driver.
  3. *
  4. * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
  5. *
  6. * This driver was mostly copied from the imx51 pinctrl driver which has:
  7. *
  8. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  9. * Copyright (C) 2012 Linaro, Inc.
  10. *
  11. * Author: Denis Carikli <denis@eukrea.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as published
  15. * by the Free Software Foundation.
  16. */
  17. #include <linux/err.h>
  18. #include <linux/init.h>
  19. #include <linux/io.h>
  20. #include <linux/of.h>
  21. #include <linux/of_device.h>
  22. #include <linux/pinctrl/pinctrl.h>
  23. #include "pinctrl-imx.h"
  24. enum imx25_pads {
  25. MX25_PAD_RESERVE0 = 0,
  26. MX25_PAD_RESERVE1 = 1,
  27. MX25_PAD_A10 = 2,
  28. MX25_PAD_A13 = 3,
  29. MX25_PAD_A14 = 4,
  30. MX25_PAD_A15 = 5,
  31. MX25_PAD_A16 = 6,
  32. MX25_PAD_A17 = 7,
  33. MX25_PAD_A18 = 8,
  34. MX25_PAD_A19 = 9,
  35. MX25_PAD_A20 = 10,
  36. MX25_PAD_A21 = 11,
  37. MX25_PAD_A22 = 12,
  38. MX25_PAD_A23 = 13,
  39. MX25_PAD_A24 = 14,
  40. MX25_PAD_A25 = 15,
  41. MX25_PAD_EB0 = 16,
  42. MX25_PAD_EB1 = 17,
  43. MX25_PAD_OE = 18,
  44. MX25_PAD_CS0 = 19,
  45. MX25_PAD_CS1 = 20,
  46. MX25_PAD_CS4 = 21,
  47. MX25_PAD_CS5 = 22,
  48. MX25_PAD_NF_CE0 = 23,
  49. MX25_PAD_ECB = 24,
  50. MX25_PAD_LBA = 25,
  51. MX25_PAD_BCLK = 26,
  52. MX25_PAD_RW = 27,
  53. MX25_PAD_NFWE_B = 28,
  54. MX25_PAD_NFRE_B = 29,
  55. MX25_PAD_NFALE = 30,
  56. MX25_PAD_NFCLE = 31,
  57. MX25_PAD_NFWP_B = 32,
  58. MX25_PAD_NFRB = 33,
  59. MX25_PAD_D15 = 34,
  60. MX25_PAD_D14 = 35,
  61. MX25_PAD_D13 = 36,
  62. MX25_PAD_D12 = 37,
  63. MX25_PAD_D11 = 38,
  64. MX25_PAD_D10 = 39,
  65. MX25_PAD_D9 = 40,
  66. MX25_PAD_D8 = 41,
  67. MX25_PAD_D7 = 42,
  68. MX25_PAD_D6 = 43,
  69. MX25_PAD_D5 = 44,
  70. MX25_PAD_D4 = 45,
  71. MX25_PAD_D3 = 46,
  72. MX25_PAD_D2 = 47,
  73. MX25_PAD_D1 = 48,
  74. MX25_PAD_D0 = 49,
  75. MX25_PAD_LD0 = 50,
  76. MX25_PAD_LD1 = 51,
  77. MX25_PAD_LD2 = 52,
  78. MX25_PAD_LD3 = 53,
  79. MX25_PAD_LD4 = 54,
  80. MX25_PAD_LD5 = 55,
  81. MX25_PAD_LD6 = 56,
  82. MX25_PAD_LD7 = 57,
  83. MX25_PAD_LD8 = 58,
  84. MX25_PAD_LD9 = 59,
  85. MX25_PAD_LD10 = 60,
  86. MX25_PAD_LD11 = 61,
  87. MX25_PAD_LD12 = 62,
  88. MX25_PAD_LD13 = 63,
  89. MX25_PAD_LD14 = 64,
  90. MX25_PAD_LD15 = 65,
  91. MX25_PAD_HSYNC = 66,
  92. MX25_PAD_VSYNC = 67,
  93. MX25_PAD_LSCLK = 68,
  94. MX25_PAD_OE_ACD = 69,
  95. MX25_PAD_CONTRAST = 70,
  96. MX25_PAD_PWM = 71,
  97. MX25_PAD_CSI_D2 = 72,
  98. MX25_PAD_CSI_D3 = 73,
  99. MX25_PAD_CSI_D4 = 74,
  100. MX25_PAD_CSI_D5 = 75,
  101. MX25_PAD_CSI_D6 = 76,
  102. MX25_PAD_CSI_D7 = 77,
  103. MX25_PAD_CSI_D8 = 78,
  104. MX25_PAD_CSI_D9 = 79,
  105. MX25_PAD_CSI_MCLK = 80,
  106. MX25_PAD_CSI_VSYNC = 81,
  107. MX25_PAD_CSI_HSYNC = 82,
  108. MX25_PAD_CSI_PIXCLK = 83,
  109. MX25_PAD_I2C1_CLK = 84,
  110. MX25_PAD_I2C1_DAT = 85,
  111. MX25_PAD_CSPI1_MOSI = 86,
  112. MX25_PAD_CSPI1_MISO = 87,
  113. MX25_PAD_CSPI1_SS0 = 88,
  114. MX25_PAD_CSPI1_SS1 = 89,
  115. MX25_PAD_CSPI1_SCLK = 90,
  116. MX25_PAD_CSPI1_RDY = 91,
  117. MX25_PAD_UART1_RXD = 92,
  118. MX25_PAD_UART1_TXD = 93,
  119. MX25_PAD_UART1_RTS = 94,
  120. MX25_PAD_UART1_CTS = 95,
  121. MX25_PAD_UART2_RXD = 96,
  122. MX25_PAD_UART2_TXD = 97,
  123. MX25_PAD_UART2_RTS = 98,
  124. MX25_PAD_UART2_CTS = 99,
  125. MX25_PAD_SD1_CMD = 100,
  126. MX25_PAD_SD1_CLK = 101,
  127. MX25_PAD_SD1_DATA0 = 102,
  128. MX25_PAD_SD1_DATA1 = 103,
  129. MX25_PAD_SD1_DATA2 = 104,
  130. MX25_PAD_SD1_DATA3 = 105,
  131. MX25_PAD_KPP_ROW0 = 106,
  132. MX25_PAD_KPP_ROW1 = 107,
  133. MX25_PAD_KPP_ROW2 = 108,
  134. MX25_PAD_KPP_ROW3 = 109,
  135. MX25_PAD_KPP_COL0 = 110,
  136. MX25_PAD_KPP_COL1 = 111,
  137. MX25_PAD_KPP_COL2 = 112,
  138. MX25_PAD_KPP_COL3 = 113,
  139. MX25_PAD_FEC_MDC = 114,
  140. MX25_PAD_FEC_MDIO = 115,
  141. MX25_PAD_FEC_TDATA0 = 116,
  142. MX25_PAD_FEC_TDATA1 = 117,
  143. MX25_PAD_FEC_TX_EN = 118,
  144. MX25_PAD_FEC_RDATA0 = 119,
  145. MX25_PAD_FEC_RDATA1 = 120,
  146. MX25_PAD_FEC_RX_DV = 121,
  147. MX25_PAD_FEC_TX_CLK = 122,
  148. MX25_PAD_RTCK = 123,
  149. MX25_PAD_DE_B = 124,
  150. MX25_PAD_GPIO_A = 125,
  151. MX25_PAD_GPIO_B = 126,
  152. MX25_PAD_GPIO_C = 127,
  153. MX25_PAD_GPIO_D = 128,
  154. MX25_PAD_GPIO_E = 129,
  155. MX25_PAD_GPIO_F = 130,
  156. MX25_PAD_EXT_ARMCLK = 131,
  157. MX25_PAD_UPLL_BYPCLK = 132,
  158. MX25_PAD_VSTBY_REQ = 133,
  159. MX25_PAD_VSTBY_ACK = 134,
  160. MX25_PAD_POWER_FAIL = 135,
  161. MX25_PAD_CLKO = 136,
  162. MX25_PAD_BOOT_MODE0 = 137,
  163. MX25_PAD_BOOT_MODE1 = 138,
  164. };
  165. /* Pad names for the pinmux subsystem */
  166. static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = {
  167. IMX_PINCTRL_PIN(MX25_PAD_RESERVE0),
  168. IMX_PINCTRL_PIN(MX25_PAD_RESERVE1),
  169. IMX_PINCTRL_PIN(MX25_PAD_A10),
  170. IMX_PINCTRL_PIN(MX25_PAD_A13),
  171. IMX_PINCTRL_PIN(MX25_PAD_A14),
  172. IMX_PINCTRL_PIN(MX25_PAD_A15),
  173. IMX_PINCTRL_PIN(MX25_PAD_A16),
  174. IMX_PINCTRL_PIN(MX25_PAD_A17),
  175. IMX_PINCTRL_PIN(MX25_PAD_A18),
  176. IMX_PINCTRL_PIN(MX25_PAD_A19),
  177. IMX_PINCTRL_PIN(MX25_PAD_A20),
  178. IMX_PINCTRL_PIN(MX25_PAD_A21),
  179. IMX_PINCTRL_PIN(MX25_PAD_A22),
  180. IMX_PINCTRL_PIN(MX25_PAD_A23),
  181. IMX_PINCTRL_PIN(MX25_PAD_A24),
  182. IMX_PINCTRL_PIN(MX25_PAD_A25),
  183. IMX_PINCTRL_PIN(MX25_PAD_EB0),
  184. IMX_PINCTRL_PIN(MX25_PAD_EB1),
  185. IMX_PINCTRL_PIN(MX25_PAD_OE),
  186. IMX_PINCTRL_PIN(MX25_PAD_CS0),
  187. IMX_PINCTRL_PIN(MX25_PAD_CS1),
  188. IMX_PINCTRL_PIN(MX25_PAD_CS4),
  189. IMX_PINCTRL_PIN(MX25_PAD_CS5),
  190. IMX_PINCTRL_PIN(MX25_PAD_NF_CE0),
  191. IMX_PINCTRL_PIN(MX25_PAD_ECB),
  192. IMX_PINCTRL_PIN(MX25_PAD_LBA),
  193. IMX_PINCTRL_PIN(MX25_PAD_BCLK),
  194. IMX_PINCTRL_PIN(MX25_PAD_RW),
  195. IMX_PINCTRL_PIN(MX25_PAD_NFWE_B),
  196. IMX_PINCTRL_PIN(MX25_PAD_NFRE_B),
  197. IMX_PINCTRL_PIN(MX25_PAD_NFALE),
  198. IMX_PINCTRL_PIN(MX25_PAD_NFCLE),
  199. IMX_PINCTRL_PIN(MX25_PAD_NFWP_B),
  200. IMX_PINCTRL_PIN(MX25_PAD_NFRB),
  201. IMX_PINCTRL_PIN(MX25_PAD_D15),
  202. IMX_PINCTRL_PIN(MX25_PAD_D14),
  203. IMX_PINCTRL_PIN(MX25_PAD_D13),
  204. IMX_PINCTRL_PIN(MX25_PAD_D12),
  205. IMX_PINCTRL_PIN(MX25_PAD_D11),
  206. IMX_PINCTRL_PIN(MX25_PAD_D10),
  207. IMX_PINCTRL_PIN(MX25_PAD_D9),
  208. IMX_PINCTRL_PIN(MX25_PAD_D8),
  209. IMX_PINCTRL_PIN(MX25_PAD_D7),
  210. IMX_PINCTRL_PIN(MX25_PAD_D6),
  211. IMX_PINCTRL_PIN(MX25_PAD_D5),
  212. IMX_PINCTRL_PIN(MX25_PAD_D4),
  213. IMX_PINCTRL_PIN(MX25_PAD_D3),
  214. IMX_PINCTRL_PIN(MX25_PAD_D2),
  215. IMX_PINCTRL_PIN(MX25_PAD_D1),
  216. IMX_PINCTRL_PIN(MX25_PAD_D0),
  217. IMX_PINCTRL_PIN(MX25_PAD_LD0),
  218. IMX_PINCTRL_PIN(MX25_PAD_LD1),
  219. IMX_PINCTRL_PIN(MX25_PAD_LD2),
  220. IMX_PINCTRL_PIN(MX25_PAD_LD3),
  221. IMX_PINCTRL_PIN(MX25_PAD_LD4),
  222. IMX_PINCTRL_PIN(MX25_PAD_LD5),
  223. IMX_PINCTRL_PIN(MX25_PAD_LD6),
  224. IMX_PINCTRL_PIN(MX25_PAD_LD7),
  225. IMX_PINCTRL_PIN(MX25_PAD_LD8),
  226. IMX_PINCTRL_PIN(MX25_PAD_LD9),
  227. IMX_PINCTRL_PIN(MX25_PAD_LD10),
  228. IMX_PINCTRL_PIN(MX25_PAD_LD11),
  229. IMX_PINCTRL_PIN(MX25_PAD_LD12),
  230. IMX_PINCTRL_PIN(MX25_PAD_LD13),
  231. IMX_PINCTRL_PIN(MX25_PAD_LD14),
  232. IMX_PINCTRL_PIN(MX25_PAD_LD15),
  233. IMX_PINCTRL_PIN(MX25_PAD_HSYNC),
  234. IMX_PINCTRL_PIN(MX25_PAD_VSYNC),
  235. IMX_PINCTRL_PIN(MX25_PAD_LSCLK),
  236. IMX_PINCTRL_PIN(MX25_PAD_OE_ACD),
  237. IMX_PINCTRL_PIN(MX25_PAD_CONTRAST),
  238. IMX_PINCTRL_PIN(MX25_PAD_PWM),
  239. IMX_PINCTRL_PIN(MX25_PAD_CSI_D2),
  240. IMX_PINCTRL_PIN(MX25_PAD_CSI_D3),
  241. IMX_PINCTRL_PIN(MX25_PAD_CSI_D4),
  242. IMX_PINCTRL_PIN(MX25_PAD_CSI_D5),
  243. IMX_PINCTRL_PIN(MX25_PAD_CSI_D6),
  244. IMX_PINCTRL_PIN(MX25_PAD_CSI_D7),
  245. IMX_PINCTRL_PIN(MX25_PAD_CSI_D8),
  246. IMX_PINCTRL_PIN(MX25_PAD_CSI_D9),
  247. IMX_PINCTRL_PIN(MX25_PAD_CSI_MCLK),
  248. IMX_PINCTRL_PIN(MX25_PAD_CSI_VSYNC),
  249. IMX_PINCTRL_PIN(MX25_PAD_CSI_HSYNC),
  250. IMX_PINCTRL_PIN(MX25_PAD_CSI_PIXCLK),
  251. IMX_PINCTRL_PIN(MX25_PAD_I2C1_CLK),
  252. IMX_PINCTRL_PIN(MX25_PAD_I2C1_DAT),
  253. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MOSI),
  254. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MISO),
  255. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS0),
  256. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS1),
  257. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SCLK),
  258. IMX_PINCTRL_PIN(MX25_PAD_CSPI1_RDY),
  259. IMX_PINCTRL_PIN(MX25_PAD_UART1_RXD),
  260. IMX_PINCTRL_PIN(MX25_PAD_UART1_TXD),
  261. IMX_PINCTRL_PIN(MX25_PAD_UART1_RTS),
  262. IMX_PINCTRL_PIN(MX25_PAD_UART1_CTS),
  263. IMX_PINCTRL_PIN(MX25_PAD_UART2_RXD),
  264. IMX_PINCTRL_PIN(MX25_PAD_UART2_TXD),
  265. IMX_PINCTRL_PIN(MX25_PAD_UART2_RTS),
  266. IMX_PINCTRL_PIN(MX25_PAD_UART2_CTS),
  267. IMX_PINCTRL_PIN(MX25_PAD_SD1_CMD),
  268. IMX_PINCTRL_PIN(MX25_PAD_SD1_CLK),
  269. IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA0),
  270. IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA1),
  271. IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA2),
  272. IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA3),
  273. IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW0),
  274. IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW1),
  275. IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW2),
  276. IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW3),
  277. IMX_PINCTRL_PIN(MX25_PAD_KPP_COL0),
  278. IMX_PINCTRL_PIN(MX25_PAD_KPP_COL1),
  279. IMX_PINCTRL_PIN(MX25_PAD_KPP_COL2),
  280. IMX_PINCTRL_PIN(MX25_PAD_KPP_COL3),
  281. IMX_PINCTRL_PIN(MX25_PAD_FEC_MDC),
  282. IMX_PINCTRL_PIN(MX25_PAD_FEC_MDIO),
  283. IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA0),
  284. IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA1),
  285. IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_EN),
  286. IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA0),
  287. IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA1),
  288. IMX_PINCTRL_PIN(MX25_PAD_FEC_RX_DV),
  289. IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_CLK),
  290. IMX_PINCTRL_PIN(MX25_PAD_RTCK),
  291. IMX_PINCTRL_PIN(MX25_PAD_DE_B),
  292. IMX_PINCTRL_PIN(MX25_PAD_GPIO_A),
  293. IMX_PINCTRL_PIN(MX25_PAD_GPIO_B),
  294. IMX_PINCTRL_PIN(MX25_PAD_GPIO_C),
  295. IMX_PINCTRL_PIN(MX25_PAD_GPIO_D),
  296. IMX_PINCTRL_PIN(MX25_PAD_GPIO_E),
  297. IMX_PINCTRL_PIN(MX25_PAD_GPIO_F),
  298. IMX_PINCTRL_PIN(MX25_PAD_EXT_ARMCLK),
  299. IMX_PINCTRL_PIN(MX25_PAD_UPLL_BYPCLK),
  300. IMX_PINCTRL_PIN(MX25_PAD_VSTBY_REQ),
  301. IMX_PINCTRL_PIN(MX25_PAD_VSTBY_ACK),
  302. IMX_PINCTRL_PIN(MX25_PAD_POWER_FAIL),
  303. IMX_PINCTRL_PIN(MX25_PAD_CLKO),
  304. IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE0),
  305. IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE1),
  306. };
  307. static struct imx_pinctrl_soc_info imx25_pinctrl_info = {
  308. .pins = imx25_pinctrl_pads,
  309. .npins = ARRAY_SIZE(imx25_pinctrl_pads),
  310. };
  311. static const struct of_device_id imx25_pinctrl_of_match[] = {
  312. { .compatible = "fsl,imx25-iomuxc", },
  313. { /* sentinel */ }
  314. };
  315. static int imx25_pinctrl_probe(struct platform_device *pdev)
  316. {
  317. return imx_pinctrl_probe(pdev, &imx25_pinctrl_info);
  318. }
  319. static struct platform_driver imx25_pinctrl_driver = {
  320. .driver = {
  321. .name = "imx25-pinctrl",
  322. .of_match_table = of_match_ptr(imx25_pinctrl_of_match),
  323. },
  324. .probe = imx25_pinctrl_probe,
  325. };
  326. static int __init imx25_pinctrl_init(void)
  327. {
  328. return platform_driver_register(&imx25_pinctrl_driver);
  329. }
  330. arch_initcall(imx25_pinctrl_init);