pinctrl-imx28.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /*
  2. * Copyright 2012 Freescale Semiconductor, Inc.
  3. *
  4. * The code contained herein is licensed under the GNU General Public
  5. * License. You may obtain a copy of the GNU General Public License
  6. * Version 2 or later at the following locations:
  7. *
  8. * http://www.opensource.org/licenses/gpl-license.html
  9. * http://www.gnu.org/copyleft/gpl.html
  10. */
  11. #include <linux/init.h>
  12. #include <linux/module.h>
  13. #include <linux/of_device.h>
  14. #include <linux/pinctrl/pinctrl.h>
  15. #include "pinctrl-mxs.h"
  16. enum imx28_pin_enum {
  17. GPMI_D00 = PINID(0, 0),
  18. GPMI_D01 = PINID(0, 1),
  19. GPMI_D02 = PINID(0, 2),
  20. GPMI_D03 = PINID(0, 3),
  21. GPMI_D04 = PINID(0, 4),
  22. GPMI_D05 = PINID(0, 5),
  23. GPMI_D06 = PINID(0, 6),
  24. GPMI_D07 = PINID(0, 7),
  25. GPMI_CE0N = PINID(0, 16),
  26. GPMI_CE1N = PINID(0, 17),
  27. GPMI_CE2N = PINID(0, 18),
  28. GPMI_CE3N = PINID(0, 19),
  29. GPMI_RDY0 = PINID(0, 20),
  30. GPMI_RDY1 = PINID(0, 21),
  31. GPMI_RDY2 = PINID(0, 22),
  32. GPMI_RDY3 = PINID(0, 23),
  33. GPMI_RDN = PINID(0, 24),
  34. GPMI_WRN = PINID(0, 25),
  35. GPMI_ALE = PINID(0, 26),
  36. GPMI_CLE = PINID(0, 27),
  37. GPMI_RESETN = PINID(0, 28),
  38. LCD_D00 = PINID(1, 0),
  39. LCD_D01 = PINID(1, 1),
  40. LCD_D02 = PINID(1, 2),
  41. LCD_D03 = PINID(1, 3),
  42. LCD_D04 = PINID(1, 4),
  43. LCD_D05 = PINID(1, 5),
  44. LCD_D06 = PINID(1, 6),
  45. LCD_D07 = PINID(1, 7),
  46. LCD_D08 = PINID(1, 8),
  47. LCD_D09 = PINID(1, 9),
  48. LCD_D10 = PINID(1, 10),
  49. LCD_D11 = PINID(1, 11),
  50. LCD_D12 = PINID(1, 12),
  51. LCD_D13 = PINID(1, 13),
  52. LCD_D14 = PINID(1, 14),
  53. LCD_D15 = PINID(1, 15),
  54. LCD_D16 = PINID(1, 16),
  55. LCD_D17 = PINID(1, 17),
  56. LCD_D18 = PINID(1, 18),
  57. LCD_D19 = PINID(1, 19),
  58. LCD_D20 = PINID(1, 20),
  59. LCD_D21 = PINID(1, 21),
  60. LCD_D22 = PINID(1, 22),
  61. LCD_D23 = PINID(1, 23),
  62. LCD_RD_E = PINID(1, 24),
  63. LCD_WR_RWN = PINID(1, 25),
  64. LCD_RS = PINID(1, 26),
  65. LCD_CS = PINID(1, 27),
  66. LCD_VSYNC = PINID(1, 28),
  67. LCD_HSYNC = PINID(1, 29),
  68. LCD_DOTCLK = PINID(1, 30),
  69. LCD_ENABLE = PINID(1, 31),
  70. SSP0_DATA0 = PINID(2, 0),
  71. SSP0_DATA1 = PINID(2, 1),
  72. SSP0_DATA2 = PINID(2, 2),
  73. SSP0_DATA3 = PINID(2, 3),
  74. SSP0_DATA4 = PINID(2, 4),
  75. SSP0_DATA5 = PINID(2, 5),
  76. SSP0_DATA6 = PINID(2, 6),
  77. SSP0_DATA7 = PINID(2, 7),
  78. SSP0_CMD = PINID(2, 8),
  79. SSP0_DETECT = PINID(2, 9),
  80. SSP0_SCK = PINID(2, 10),
  81. SSP1_SCK = PINID(2, 12),
  82. SSP1_CMD = PINID(2, 13),
  83. SSP1_DATA0 = PINID(2, 14),
  84. SSP1_DATA3 = PINID(2, 15),
  85. SSP2_SCK = PINID(2, 16),
  86. SSP2_MOSI = PINID(2, 17),
  87. SSP2_MISO = PINID(2, 18),
  88. SSP2_SS0 = PINID(2, 19),
  89. SSP2_SS1 = PINID(2, 20),
  90. SSP2_SS2 = PINID(2, 21),
  91. SSP3_SCK = PINID(2, 24),
  92. SSP3_MOSI = PINID(2, 25),
  93. SSP3_MISO = PINID(2, 26),
  94. SSP3_SS0 = PINID(2, 27),
  95. AUART0_RX = PINID(3, 0),
  96. AUART0_TX = PINID(3, 1),
  97. AUART0_CTS = PINID(3, 2),
  98. AUART0_RTS = PINID(3, 3),
  99. AUART1_RX = PINID(3, 4),
  100. AUART1_TX = PINID(3, 5),
  101. AUART1_CTS = PINID(3, 6),
  102. AUART1_RTS = PINID(3, 7),
  103. AUART2_RX = PINID(3, 8),
  104. AUART2_TX = PINID(3, 9),
  105. AUART2_CTS = PINID(3, 10),
  106. AUART2_RTS = PINID(3, 11),
  107. AUART3_RX = PINID(3, 12),
  108. AUART3_TX = PINID(3, 13),
  109. AUART3_CTS = PINID(3, 14),
  110. AUART3_RTS = PINID(3, 15),
  111. PWM0 = PINID(3, 16),
  112. PWM1 = PINID(3, 17),
  113. PWM2 = PINID(3, 18),
  114. SAIF0_MCLK = PINID(3, 20),
  115. SAIF0_LRCLK = PINID(3, 21),
  116. SAIF0_BITCLK = PINID(3, 22),
  117. SAIF0_SDATA0 = PINID(3, 23),
  118. I2C0_SCL = PINID(3, 24),
  119. I2C0_SDA = PINID(3, 25),
  120. SAIF1_SDATA0 = PINID(3, 26),
  121. SPDIF = PINID(3, 27),
  122. PWM3 = PINID(3, 28),
  123. PWM4 = PINID(3, 29),
  124. LCD_RESET = PINID(3, 30),
  125. ENET0_MDC = PINID(4, 0),
  126. ENET0_MDIO = PINID(4, 1),
  127. ENET0_RX_EN = PINID(4, 2),
  128. ENET0_RXD0 = PINID(4, 3),
  129. ENET0_RXD1 = PINID(4, 4),
  130. ENET0_TX_CLK = PINID(4, 5),
  131. ENET0_TX_EN = PINID(4, 6),
  132. ENET0_TXD0 = PINID(4, 7),
  133. ENET0_TXD1 = PINID(4, 8),
  134. ENET0_RXD2 = PINID(4, 9),
  135. ENET0_RXD3 = PINID(4, 10),
  136. ENET0_TXD2 = PINID(4, 11),
  137. ENET0_TXD3 = PINID(4, 12),
  138. ENET0_RX_CLK = PINID(4, 13),
  139. ENET0_COL = PINID(4, 14),
  140. ENET0_CRS = PINID(4, 15),
  141. ENET_CLK = PINID(4, 16),
  142. JTAG_RTCK = PINID(4, 20),
  143. EMI_D00 = PINID(5, 0),
  144. EMI_D01 = PINID(5, 1),
  145. EMI_D02 = PINID(5, 2),
  146. EMI_D03 = PINID(5, 3),
  147. EMI_D04 = PINID(5, 4),
  148. EMI_D05 = PINID(5, 5),
  149. EMI_D06 = PINID(5, 6),
  150. EMI_D07 = PINID(5, 7),
  151. EMI_D08 = PINID(5, 8),
  152. EMI_D09 = PINID(5, 9),
  153. EMI_D10 = PINID(5, 10),
  154. EMI_D11 = PINID(5, 11),
  155. EMI_D12 = PINID(5, 12),
  156. EMI_D13 = PINID(5, 13),
  157. EMI_D14 = PINID(5, 14),
  158. EMI_D15 = PINID(5, 15),
  159. EMI_ODT0 = PINID(5, 16),
  160. EMI_DQM0 = PINID(5, 17),
  161. EMI_ODT1 = PINID(5, 18),
  162. EMI_DQM1 = PINID(5, 19),
  163. EMI_DDR_OPEN_FB = PINID(5, 20),
  164. EMI_CLK = PINID(5, 21),
  165. EMI_DQS0 = PINID(5, 22),
  166. EMI_DQS1 = PINID(5, 23),
  167. EMI_DDR_OPEN = PINID(5, 26),
  168. EMI_A00 = PINID(6, 0),
  169. EMI_A01 = PINID(6, 1),
  170. EMI_A02 = PINID(6, 2),
  171. EMI_A03 = PINID(6, 3),
  172. EMI_A04 = PINID(6, 4),
  173. EMI_A05 = PINID(6, 5),
  174. EMI_A06 = PINID(6, 6),
  175. EMI_A07 = PINID(6, 7),
  176. EMI_A08 = PINID(6, 8),
  177. EMI_A09 = PINID(6, 9),
  178. EMI_A10 = PINID(6, 10),
  179. EMI_A11 = PINID(6, 11),
  180. EMI_A12 = PINID(6, 12),
  181. EMI_A13 = PINID(6, 13),
  182. EMI_A14 = PINID(6, 14),
  183. EMI_BA0 = PINID(6, 16),
  184. EMI_BA1 = PINID(6, 17),
  185. EMI_BA2 = PINID(6, 18),
  186. EMI_CASN = PINID(6, 19),
  187. EMI_RASN = PINID(6, 20),
  188. EMI_WEN = PINID(6, 21),
  189. EMI_CE0N = PINID(6, 22),
  190. EMI_CE1N = PINID(6, 23),
  191. EMI_CKE = PINID(6, 24),
  192. };
  193. static const struct pinctrl_pin_desc imx28_pins[] = {
  194. MXS_PINCTRL_PIN(GPMI_D00),
  195. MXS_PINCTRL_PIN(GPMI_D01),
  196. MXS_PINCTRL_PIN(GPMI_D02),
  197. MXS_PINCTRL_PIN(GPMI_D03),
  198. MXS_PINCTRL_PIN(GPMI_D04),
  199. MXS_PINCTRL_PIN(GPMI_D05),
  200. MXS_PINCTRL_PIN(GPMI_D06),
  201. MXS_PINCTRL_PIN(GPMI_D07),
  202. MXS_PINCTRL_PIN(GPMI_CE0N),
  203. MXS_PINCTRL_PIN(GPMI_CE1N),
  204. MXS_PINCTRL_PIN(GPMI_CE2N),
  205. MXS_PINCTRL_PIN(GPMI_CE3N),
  206. MXS_PINCTRL_PIN(GPMI_RDY0),
  207. MXS_PINCTRL_PIN(GPMI_RDY1),
  208. MXS_PINCTRL_PIN(GPMI_RDY2),
  209. MXS_PINCTRL_PIN(GPMI_RDY3),
  210. MXS_PINCTRL_PIN(GPMI_RDN),
  211. MXS_PINCTRL_PIN(GPMI_WRN),
  212. MXS_PINCTRL_PIN(GPMI_ALE),
  213. MXS_PINCTRL_PIN(GPMI_CLE),
  214. MXS_PINCTRL_PIN(GPMI_RESETN),
  215. MXS_PINCTRL_PIN(LCD_D00),
  216. MXS_PINCTRL_PIN(LCD_D01),
  217. MXS_PINCTRL_PIN(LCD_D02),
  218. MXS_PINCTRL_PIN(LCD_D03),
  219. MXS_PINCTRL_PIN(LCD_D04),
  220. MXS_PINCTRL_PIN(LCD_D05),
  221. MXS_PINCTRL_PIN(LCD_D06),
  222. MXS_PINCTRL_PIN(LCD_D07),
  223. MXS_PINCTRL_PIN(LCD_D08),
  224. MXS_PINCTRL_PIN(LCD_D09),
  225. MXS_PINCTRL_PIN(LCD_D10),
  226. MXS_PINCTRL_PIN(LCD_D11),
  227. MXS_PINCTRL_PIN(LCD_D12),
  228. MXS_PINCTRL_PIN(LCD_D13),
  229. MXS_PINCTRL_PIN(LCD_D14),
  230. MXS_PINCTRL_PIN(LCD_D15),
  231. MXS_PINCTRL_PIN(LCD_D16),
  232. MXS_PINCTRL_PIN(LCD_D17),
  233. MXS_PINCTRL_PIN(LCD_D18),
  234. MXS_PINCTRL_PIN(LCD_D19),
  235. MXS_PINCTRL_PIN(LCD_D20),
  236. MXS_PINCTRL_PIN(LCD_D21),
  237. MXS_PINCTRL_PIN(LCD_D22),
  238. MXS_PINCTRL_PIN(LCD_D23),
  239. MXS_PINCTRL_PIN(LCD_RD_E),
  240. MXS_PINCTRL_PIN(LCD_WR_RWN),
  241. MXS_PINCTRL_PIN(LCD_RS),
  242. MXS_PINCTRL_PIN(LCD_CS),
  243. MXS_PINCTRL_PIN(LCD_VSYNC),
  244. MXS_PINCTRL_PIN(LCD_HSYNC),
  245. MXS_PINCTRL_PIN(LCD_DOTCLK),
  246. MXS_PINCTRL_PIN(LCD_ENABLE),
  247. MXS_PINCTRL_PIN(SSP0_DATA0),
  248. MXS_PINCTRL_PIN(SSP0_DATA1),
  249. MXS_PINCTRL_PIN(SSP0_DATA2),
  250. MXS_PINCTRL_PIN(SSP0_DATA3),
  251. MXS_PINCTRL_PIN(SSP0_DATA4),
  252. MXS_PINCTRL_PIN(SSP0_DATA5),
  253. MXS_PINCTRL_PIN(SSP0_DATA6),
  254. MXS_PINCTRL_PIN(SSP0_DATA7),
  255. MXS_PINCTRL_PIN(SSP0_CMD),
  256. MXS_PINCTRL_PIN(SSP0_DETECT),
  257. MXS_PINCTRL_PIN(SSP0_SCK),
  258. MXS_PINCTRL_PIN(SSP1_SCK),
  259. MXS_PINCTRL_PIN(SSP1_CMD),
  260. MXS_PINCTRL_PIN(SSP1_DATA0),
  261. MXS_PINCTRL_PIN(SSP1_DATA3),
  262. MXS_PINCTRL_PIN(SSP2_SCK),
  263. MXS_PINCTRL_PIN(SSP2_MOSI),
  264. MXS_PINCTRL_PIN(SSP2_MISO),
  265. MXS_PINCTRL_PIN(SSP2_SS0),
  266. MXS_PINCTRL_PIN(SSP2_SS1),
  267. MXS_PINCTRL_PIN(SSP2_SS2),
  268. MXS_PINCTRL_PIN(SSP3_SCK),
  269. MXS_PINCTRL_PIN(SSP3_MOSI),
  270. MXS_PINCTRL_PIN(SSP3_MISO),
  271. MXS_PINCTRL_PIN(SSP3_SS0),
  272. MXS_PINCTRL_PIN(AUART0_RX),
  273. MXS_PINCTRL_PIN(AUART0_TX),
  274. MXS_PINCTRL_PIN(AUART0_CTS),
  275. MXS_PINCTRL_PIN(AUART0_RTS),
  276. MXS_PINCTRL_PIN(AUART1_RX),
  277. MXS_PINCTRL_PIN(AUART1_TX),
  278. MXS_PINCTRL_PIN(AUART1_CTS),
  279. MXS_PINCTRL_PIN(AUART1_RTS),
  280. MXS_PINCTRL_PIN(AUART2_RX),
  281. MXS_PINCTRL_PIN(AUART2_TX),
  282. MXS_PINCTRL_PIN(AUART2_CTS),
  283. MXS_PINCTRL_PIN(AUART2_RTS),
  284. MXS_PINCTRL_PIN(AUART3_RX),
  285. MXS_PINCTRL_PIN(AUART3_TX),
  286. MXS_PINCTRL_PIN(AUART3_CTS),
  287. MXS_PINCTRL_PIN(AUART3_RTS),
  288. MXS_PINCTRL_PIN(PWM0),
  289. MXS_PINCTRL_PIN(PWM1),
  290. MXS_PINCTRL_PIN(PWM2),
  291. MXS_PINCTRL_PIN(SAIF0_MCLK),
  292. MXS_PINCTRL_PIN(SAIF0_LRCLK),
  293. MXS_PINCTRL_PIN(SAIF0_BITCLK),
  294. MXS_PINCTRL_PIN(SAIF0_SDATA0),
  295. MXS_PINCTRL_PIN(I2C0_SCL),
  296. MXS_PINCTRL_PIN(I2C0_SDA),
  297. MXS_PINCTRL_PIN(SAIF1_SDATA0),
  298. MXS_PINCTRL_PIN(SPDIF),
  299. MXS_PINCTRL_PIN(PWM3),
  300. MXS_PINCTRL_PIN(PWM4),
  301. MXS_PINCTRL_PIN(LCD_RESET),
  302. MXS_PINCTRL_PIN(ENET0_MDC),
  303. MXS_PINCTRL_PIN(ENET0_MDIO),
  304. MXS_PINCTRL_PIN(ENET0_RX_EN),
  305. MXS_PINCTRL_PIN(ENET0_RXD0),
  306. MXS_PINCTRL_PIN(ENET0_RXD1),
  307. MXS_PINCTRL_PIN(ENET0_TX_CLK),
  308. MXS_PINCTRL_PIN(ENET0_TX_EN),
  309. MXS_PINCTRL_PIN(ENET0_TXD0),
  310. MXS_PINCTRL_PIN(ENET0_TXD1),
  311. MXS_PINCTRL_PIN(ENET0_RXD2),
  312. MXS_PINCTRL_PIN(ENET0_RXD3),
  313. MXS_PINCTRL_PIN(ENET0_TXD2),
  314. MXS_PINCTRL_PIN(ENET0_TXD3),
  315. MXS_PINCTRL_PIN(ENET0_RX_CLK),
  316. MXS_PINCTRL_PIN(ENET0_COL),
  317. MXS_PINCTRL_PIN(ENET0_CRS),
  318. MXS_PINCTRL_PIN(ENET_CLK),
  319. MXS_PINCTRL_PIN(JTAG_RTCK),
  320. MXS_PINCTRL_PIN(EMI_D00),
  321. MXS_PINCTRL_PIN(EMI_D01),
  322. MXS_PINCTRL_PIN(EMI_D02),
  323. MXS_PINCTRL_PIN(EMI_D03),
  324. MXS_PINCTRL_PIN(EMI_D04),
  325. MXS_PINCTRL_PIN(EMI_D05),
  326. MXS_PINCTRL_PIN(EMI_D06),
  327. MXS_PINCTRL_PIN(EMI_D07),
  328. MXS_PINCTRL_PIN(EMI_D08),
  329. MXS_PINCTRL_PIN(EMI_D09),
  330. MXS_PINCTRL_PIN(EMI_D10),
  331. MXS_PINCTRL_PIN(EMI_D11),
  332. MXS_PINCTRL_PIN(EMI_D12),
  333. MXS_PINCTRL_PIN(EMI_D13),
  334. MXS_PINCTRL_PIN(EMI_D14),
  335. MXS_PINCTRL_PIN(EMI_D15),
  336. MXS_PINCTRL_PIN(EMI_ODT0),
  337. MXS_PINCTRL_PIN(EMI_DQM0),
  338. MXS_PINCTRL_PIN(EMI_ODT1),
  339. MXS_PINCTRL_PIN(EMI_DQM1),
  340. MXS_PINCTRL_PIN(EMI_DDR_OPEN_FB),
  341. MXS_PINCTRL_PIN(EMI_CLK),
  342. MXS_PINCTRL_PIN(EMI_DQS0),
  343. MXS_PINCTRL_PIN(EMI_DQS1),
  344. MXS_PINCTRL_PIN(EMI_DDR_OPEN),
  345. MXS_PINCTRL_PIN(EMI_A00),
  346. MXS_PINCTRL_PIN(EMI_A01),
  347. MXS_PINCTRL_PIN(EMI_A02),
  348. MXS_PINCTRL_PIN(EMI_A03),
  349. MXS_PINCTRL_PIN(EMI_A04),
  350. MXS_PINCTRL_PIN(EMI_A05),
  351. MXS_PINCTRL_PIN(EMI_A06),
  352. MXS_PINCTRL_PIN(EMI_A07),
  353. MXS_PINCTRL_PIN(EMI_A08),
  354. MXS_PINCTRL_PIN(EMI_A09),
  355. MXS_PINCTRL_PIN(EMI_A10),
  356. MXS_PINCTRL_PIN(EMI_A11),
  357. MXS_PINCTRL_PIN(EMI_A12),
  358. MXS_PINCTRL_PIN(EMI_A13),
  359. MXS_PINCTRL_PIN(EMI_A14),
  360. MXS_PINCTRL_PIN(EMI_BA0),
  361. MXS_PINCTRL_PIN(EMI_BA1),
  362. MXS_PINCTRL_PIN(EMI_BA2),
  363. MXS_PINCTRL_PIN(EMI_CASN),
  364. MXS_PINCTRL_PIN(EMI_RASN),
  365. MXS_PINCTRL_PIN(EMI_WEN),
  366. MXS_PINCTRL_PIN(EMI_CE0N),
  367. MXS_PINCTRL_PIN(EMI_CE1N),
  368. MXS_PINCTRL_PIN(EMI_CKE),
  369. };
  370. static struct mxs_regs imx28_regs = {
  371. .muxsel = 0x100,
  372. .drive = 0x300,
  373. .pull = 0x600,
  374. };
  375. static struct mxs_pinctrl_soc_data imx28_pinctrl_data = {
  376. .regs = &imx28_regs,
  377. .pins = imx28_pins,
  378. .npins = ARRAY_SIZE(imx28_pins),
  379. };
  380. static int imx28_pinctrl_probe(struct platform_device *pdev)
  381. {
  382. return mxs_pinctrl_probe(pdev, &imx28_pinctrl_data);
  383. }
  384. static const struct of_device_id imx28_pinctrl_of_match[] = {
  385. { .compatible = "fsl,imx28-pinctrl", },
  386. { /* sentinel */ }
  387. };
  388. MODULE_DEVICE_TABLE(of, imx28_pinctrl_of_match);
  389. static struct platform_driver imx28_pinctrl_driver = {
  390. .driver = {
  391. .name = "imx28-pinctrl",
  392. .of_match_table = imx28_pinctrl_of_match,
  393. },
  394. .probe = imx28_pinctrl_probe,
  395. .remove = mxs_pinctrl_remove,
  396. };
  397. static int __init imx28_pinctrl_init(void)
  398. {
  399. return platform_driver_register(&imx28_pinctrl_driver);
  400. }
  401. postcore_initcall(imx28_pinctrl_init);
  402. static void __exit imx28_pinctrl_exit(void)
  403. {
  404. platform_driver_unregister(&imx28_pinctrl_driver);
  405. }
  406. module_exit(imx28_pinctrl_exit);
  407. MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
  408. MODULE_DESCRIPTION("Freescale i.MX28 pinctrl driver");
  409. MODULE_LICENSE("GPL v2");