pinctrl-imx23.c 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. /*
  2. * Freescale i.MX23 pinctrl driver
  3. *
  4. * Author: Shawn Guo <shawn.guo@linaro.org>
  5. * Copyright 2012 Freescale Semiconductor, Inc.
  6. *
  7. * The code contained herein is licensed under the GNU General Public
  8. * License. You may obtain a copy of the GNU General Public License
  9. * Version 2 or later at the following locations:
  10. *
  11. * http://www.opensource.org/licenses/gpl-license.html
  12. * http://www.gnu.org/copyleft/gpl.html
  13. */
  14. #include <linux/init.h>
  15. #include <linux/of_device.h>
  16. #include <linux/pinctrl/pinctrl.h>
  17. #include "pinctrl-mxs.h"
  18. enum imx23_pin_enum {
  19. GPMI_D00 = PINID(0, 0),
  20. GPMI_D01 = PINID(0, 1),
  21. GPMI_D02 = PINID(0, 2),
  22. GPMI_D03 = PINID(0, 3),
  23. GPMI_D04 = PINID(0, 4),
  24. GPMI_D05 = PINID(0, 5),
  25. GPMI_D06 = PINID(0, 6),
  26. GPMI_D07 = PINID(0, 7),
  27. GPMI_D08 = PINID(0, 8),
  28. GPMI_D09 = PINID(0, 9),
  29. GPMI_D10 = PINID(0, 10),
  30. GPMI_D11 = PINID(0, 11),
  31. GPMI_D12 = PINID(0, 12),
  32. GPMI_D13 = PINID(0, 13),
  33. GPMI_D14 = PINID(0, 14),
  34. GPMI_D15 = PINID(0, 15),
  35. GPMI_CLE = PINID(0, 16),
  36. GPMI_ALE = PINID(0, 17),
  37. GPMI_CE2N = PINID(0, 18),
  38. GPMI_RDY0 = PINID(0, 19),
  39. GPMI_RDY1 = PINID(0, 20),
  40. GPMI_RDY2 = PINID(0, 21),
  41. GPMI_RDY3 = PINID(0, 22),
  42. GPMI_WPN = PINID(0, 23),
  43. GPMI_WRN = PINID(0, 24),
  44. GPMI_RDN = PINID(0, 25),
  45. AUART1_CTS = PINID(0, 26),
  46. AUART1_RTS = PINID(0, 27),
  47. AUART1_RX = PINID(0, 28),
  48. AUART1_TX = PINID(0, 29),
  49. I2C_SCL = PINID(0, 30),
  50. I2C_SDA = PINID(0, 31),
  51. LCD_D00 = PINID(1, 0),
  52. LCD_D01 = PINID(1, 1),
  53. LCD_D02 = PINID(1, 2),
  54. LCD_D03 = PINID(1, 3),
  55. LCD_D04 = PINID(1, 4),
  56. LCD_D05 = PINID(1, 5),
  57. LCD_D06 = PINID(1, 6),
  58. LCD_D07 = PINID(1, 7),
  59. LCD_D08 = PINID(1, 8),
  60. LCD_D09 = PINID(1, 9),
  61. LCD_D10 = PINID(1, 10),
  62. LCD_D11 = PINID(1, 11),
  63. LCD_D12 = PINID(1, 12),
  64. LCD_D13 = PINID(1, 13),
  65. LCD_D14 = PINID(1, 14),
  66. LCD_D15 = PINID(1, 15),
  67. LCD_D16 = PINID(1, 16),
  68. LCD_D17 = PINID(1, 17),
  69. LCD_RESET = PINID(1, 18),
  70. LCD_RS = PINID(1, 19),
  71. LCD_WR = PINID(1, 20),
  72. LCD_CS = PINID(1, 21),
  73. LCD_DOTCK = PINID(1, 22),
  74. LCD_ENABLE = PINID(1, 23),
  75. LCD_HSYNC = PINID(1, 24),
  76. LCD_VSYNC = PINID(1, 25),
  77. PWM0 = PINID(1, 26),
  78. PWM1 = PINID(1, 27),
  79. PWM2 = PINID(1, 28),
  80. PWM3 = PINID(1, 29),
  81. PWM4 = PINID(1, 30),
  82. SSP1_CMD = PINID(2, 0),
  83. SSP1_DETECT = PINID(2, 1),
  84. SSP1_DATA0 = PINID(2, 2),
  85. SSP1_DATA1 = PINID(2, 3),
  86. SSP1_DATA2 = PINID(2, 4),
  87. SSP1_DATA3 = PINID(2, 5),
  88. SSP1_SCK = PINID(2, 6),
  89. ROTARYA = PINID(2, 7),
  90. ROTARYB = PINID(2, 8),
  91. EMI_A00 = PINID(2, 9),
  92. EMI_A01 = PINID(2, 10),
  93. EMI_A02 = PINID(2, 11),
  94. EMI_A03 = PINID(2, 12),
  95. EMI_A04 = PINID(2, 13),
  96. EMI_A05 = PINID(2, 14),
  97. EMI_A06 = PINID(2, 15),
  98. EMI_A07 = PINID(2, 16),
  99. EMI_A08 = PINID(2, 17),
  100. EMI_A09 = PINID(2, 18),
  101. EMI_A10 = PINID(2, 19),
  102. EMI_A11 = PINID(2, 20),
  103. EMI_A12 = PINID(2, 21),
  104. EMI_BA0 = PINID(2, 22),
  105. EMI_BA1 = PINID(2, 23),
  106. EMI_CASN = PINID(2, 24),
  107. EMI_CE0N = PINID(2, 25),
  108. EMI_CE1N = PINID(2, 26),
  109. GPMI_CE1N = PINID(2, 27),
  110. GPMI_CE0N = PINID(2, 28),
  111. EMI_CKE = PINID(2, 29),
  112. EMI_RASN = PINID(2, 30),
  113. EMI_WEN = PINID(2, 31),
  114. EMI_D00 = PINID(3, 0),
  115. EMI_D01 = PINID(3, 1),
  116. EMI_D02 = PINID(3, 2),
  117. EMI_D03 = PINID(3, 3),
  118. EMI_D04 = PINID(3, 4),
  119. EMI_D05 = PINID(3, 5),
  120. EMI_D06 = PINID(3, 6),
  121. EMI_D07 = PINID(3, 7),
  122. EMI_D08 = PINID(3, 8),
  123. EMI_D09 = PINID(3, 9),
  124. EMI_D10 = PINID(3, 10),
  125. EMI_D11 = PINID(3, 11),
  126. EMI_D12 = PINID(3, 12),
  127. EMI_D13 = PINID(3, 13),
  128. EMI_D14 = PINID(3, 14),
  129. EMI_D15 = PINID(3, 15),
  130. EMI_DQM0 = PINID(3, 16),
  131. EMI_DQM1 = PINID(3, 17),
  132. EMI_DQS0 = PINID(3, 18),
  133. EMI_DQS1 = PINID(3, 19),
  134. EMI_CLK = PINID(3, 20),
  135. EMI_CLKN = PINID(3, 21),
  136. };
  137. static const struct pinctrl_pin_desc imx23_pins[] = {
  138. MXS_PINCTRL_PIN(GPMI_D00),
  139. MXS_PINCTRL_PIN(GPMI_D01),
  140. MXS_PINCTRL_PIN(GPMI_D02),
  141. MXS_PINCTRL_PIN(GPMI_D03),
  142. MXS_PINCTRL_PIN(GPMI_D04),
  143. MXS_PINCTRL_PIN(GPMI_D05),
  144. MXS_PINCTRL_PIN(GPMI_D06),
  145. MXS_PINCTRL_PIN(GPMI_D07),
  146. MXS_PINCTRL_PIN(GPMI_D08),
  147. MXS_PINCTRL_PIN(GPMI_D09),
  148. MXS_PINCTRL_PIN(GPMI_D10),
  149. MXS_PINCTRL_PIN(GPMI_D11),
  150. MXS_PINCTRL_PIN(GPMI_D12),
  151. MXS_PINCTRL_PIN(GPMI_D13),
  152. MXS_PINCTRL_PIN(GPMI_D14),
  153. MXS_PINCTRL_PIN(GPMI_D15),
  154. MXS_PINCTRL_PIN(GPMI_CLE),
  155. MXS_PINCTRL_PIN(GPMI_ALE),
  156. MXS_PINCTRL_PIN(GPMI_CE2N),
  157. MXS_PINCTRL_PIN(GPMI_RDY0),
  158. MXS_PINCTRL_PIN(GPMI_RDY1),
  159. MXS_PINCTRL_PIN(GPMI_RDY2),
  160. MXS_PINCTRL_PIN(GPMI_RDY3),
  161. MXS_PINCTRL_PIN(GPMI_WPN),
  162. MXS_PINCTRL_PIN(GPMI_WRN),
  163. MXS_PINCTRL_PIN(GPMI_RDN),
  164. MXS_PINCTRL_PIN(AUART1_CTS),
  165. MXS_PINCTRL_PIN(AUART1_RTS),
  166. MXS_PINCTRL_PIN(AUART1_RX),
  167. MXS_PINCTRL_PIN(AUART1_TX),
  168. MXS_PINCTRL_PIN(I2C_SCL),
  169. MXS_PINCTRL_PIN(I2C_SDA),
  170. MXS_PINCTRL_PIN(LCD_D00),
  171. MXS_PINCTRL_PIN(LCD_D01),
  172. MXS_PINCTRL_PIN(LCD_D02),
  173. MXS_PINCTRL_PIN(LCD_D03),
  174. MXS_PINCTRL_PIN(LCD_D04),
  175. MXS_PINCTRL_PIN(LCD_D05),
  176. MXS_PINCTRL_PIN(LCD_D06),
  177. MXS_PINCTRL_PIN(LCD_D07),
  178. MXS_PINCTRL_PIN(LCD_D08),
  179. MXS_PINCTRL_PIN(LCD_D09),
  180. MXS_PINCTRL_PIN(LCD_D10),
  181. MXS_PINCTRL_PIN(LCD_D11),
  182. MXS_PINCTRL_PIN(LCD_D12),
  183. MXS_PINCTRL_PIN(LCD_D13),
  184. MXS_PINCTRL_PIN(LCD_D14),
  185. MXS_PINCTRL_PIN(LCD_D15),
  186. MXS_PINCTRL_PIN(LCD_D16),
  187. MXS_PINCTRL_PIN(LCD_D17),
  188. MXS_PINCTRL_PIN(LCD_RESET),
  189. MXS_PINCTRL_PIN(LCD_RS),
  190. MXS_PINCTRL_PIN(LCD_WR),
  191. MXS_PINCTRL_PIN(LCD_CS),
  192. MXS_PINCTRL_PIN(LCD_DOTCK),
  193. MXS_PINCTRL_PIN(LCD_ENABLE),
  194. MXS_PINCTRL_PIN(LCD_HSYNC),
  195. MXS_PINCTRL_PIN(LCD_VSYNC),
  196. MXS_PINCTRL_PIN(PWM0),
  197. MXS_PINCTRL_PIN(PWM1),
  198. MXS_PINCTRL_PIN(PWM2),
  199. MXS_PINCTRL_PIN(PWM3),
  200. MXS_PINCTRL_PIN(PWM4),
  201. MXS_PINCTRL_PIN(SSP1_CMD),
  202. MXS_PINCTRL_PIN(SSP1_DETECT),
  203. MXS_PINCTRL_PIN(SSP1_DATA0),
  204. MXS_PINCTRL_PIN(SSP1_DATA1),
  205. MXS_PINCTRL_PIN(SSP1_DATA2),
  206. MXS_PINCTRL_PIN(SSP1_DATA3),
  207. MXS_PINCTRL_PIN(SSP1_SCK),
  208. MXS_PINCTRL_PIN(ROTARYA),
  209. MXS_PINCTRL_PIN(ROTARYB),
  210. MXS_PINCTRL_PIN(EMI_A00),
  211. MXS_PINCTRL_PIN(EMI_A01),
  212. MXS_PINCTRL_PIN(EMI_A02),
  213. MXS_PINCTRL_PIN(EMI_A03),
  214. MXS_PINCTRL_PIN(EMI_A04),
  215. MXS_PINCTRL_PIN(EMI_A05),
  216. MXS_PINCTRL_PIN(EMI_A06),
  217. MXS_PINCTRL_PIN(EMI_A07),
  218. MXS_PINCTRL_PIN(EMI_A08),
  219. MXS_PINCTRL_PIN(EMI_A09),
  220. MXS_PINCTRL_PIN(EMI_A10),
  221. MXS_PINCTRL_PIN(EMI_A11),
  222. MXS_PINCTRL_PIN(EMI_A12),
  223. MXS_PINCTRL_PIN(EMI_BA0),
  224. MXS_PINCTRL_PIN(EMI_BA1),
  225. MXS_PINCTRL_PIN(EMI_CASN),
  226. MXS_PINCTRL_PIN(EMI_CE0N),
  227. MXS_PINCTRL_PIN(EMI_CE1N),
  228. MXS_PINCTRL_PIN(GPMI_CE1N),
  229. MXS_PINCTRL_PIN(GPMI_CE0N),
  230. MXS_PINCTRL_PIN(EMI_CKE),
  231. MXS_PINCTRL_PIN(EMI_RASN),
  232. MXS_PINCTRL_PIN(EMI_WEN),
  233. MXS_PINCTRL_PIN(EMI_D00),
  234. MXS_PINCTRL_PIN(EMI_D01),
  235. MXS_PINCTRL_PIN(EMI_D02),
  236. MXS_PINCTRL_PIN(EMI_D03),
  237. MXS_PINCTRL_PIN(EMI_D04),
  238. MXS_PINCTRL_PIN(EMI_D05),
  239. MXS_PINCTRL_PIN(EMI_D06),
  240. MXS_PINCTRL_PIN(EMI_D07),
  241. MXS_PINCTRL_PIN(EMI_D08),
  242. MXS_PINCTRL_PIN(EMI_D09),
  243. MXS_PINCTRL_PIN(EMI_D10),
  244. MXS_PINCTRL_PIN(EMI_D11),
  245. MXS_PINCTRL_PIN(EMI_D12),
  246. MXS_PINCTRL_PIN(EMI_D13),
  247. MXS_PINCTRL_PIN(EMI_D14),
  248. MXS_PINCTRL_PIN(EMI_D15),
  249. MXS_PINCTRL_PIN(EMI_DQM0),
  250. MXS_PINCTRL_PIN(EMI_DQM1),
  251. MXS_PINCTRL_PIN(EMI_DQS0),
  252. MXS_PINCTRL_PIN(EMI_DQS1),
  253. MXS_PINCTRL_PIN(EMI_CLK),
  254. MXS_PINCTRL_PIN(EMI_CLKN),
  255. };
  256. static const struct mxs_regs imx23_regs = {
  257. .muxsel = 0x100,
  258. .drive = 0x200,
  259. .pull = 0x400,
  260. };
  261. static struct mxs_pinctrl_soc_data imx23_pinctrl_data = {
  262. .regs = &imx23_regs,
  263. .pins = imx23_pins,
  264. .npins = ARRAY_SIZE(imx23_pins),
  265. };
  266. static int imx23_pinctrl_probe(struct platform_device *pdev)
  267. {
  268. return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data);
  269. }
  270. static const struct of_device_id imx23_pinctrl_of_match[] = {
  271. { .compatible = "fsl,imx23-pinctrl", },
  272. { /* sentinel */ }
  273. };
  274. static struct platform_driver imx23_pinctrl_driver = {
  275. .driver = {
  276. .name = "imx23-pinctrl",
  277. .suppress_bind_attrs = true,
  278. .of_match_table = imx23_pinctrl_of_match,
  279. },
  280. .probe = imx23_pinctrl_probe,
  281. };
  282. static int __init imx23_pinctrl_init(void)
  283. {
  284. return platform_driver_register(&imx23_pinctrl_driver);
  285. }
  286. postcore_initcall(imx23_pinctrl_init);