pinctrl-vf610.c 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /*
  2. * VF610 pinctrl driver based on imx pinmux and pinconf core
  3. *
  4. * Copyright 2013 Freescale Semiconductor, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/of_device.h>
  17. #include <linux/pinctrl/pinctrl.h>
  18. #include "pinctrl-imx.h"
  19. enum vf610_pads {
  20. VF610_PAD_PTA6 = 0,
  21. VF610_PAD_PTA8 = 1,
  22. VF610_PAD_PTA9 = 2,
  23. VF610_PAD_PTA10 = 3,
  24. VF610_PAD_PTA11 = 4,
  25. VF610_PAD_PTA12 = 5,
  26. VF610_PAD_PTA16 = 6,
  27. VF610_PAD_PTA17 = 7,
  28. VF610_PAD_PTA18 = 8,
  29. VF610_PAD_PTA19 = 9,
  30. VF610_PAD_PTA20 = 10,
  31. VF610_PAD_PTA21 = 11,
  32. VF610_PAD_PTA22 = 12,
  33. VF610_PAD_PTA23 = 13,
  34. VF610_PAD_PTA24 = 14,
  35. VF610_PAD_PTA25 = 15,
  36. VF610_PAD_PTA26 = 16,
  37. VF610_PAD_PTA27 = 17,
  38. VF610_PAD_PTA28 = 18,
  39. VF610_PAD_PTA29 = 19,
  40. VF610_PAD_PTA30 = 20,
  41. VF610_PAD_PTA31 = 21,
  42. VF610_PAD_PTB0 = 22,
  43. VF610_PAD_PTB1 = 23,
  44. VF610_PAD_PTB2 = 24,
  45. VF610_PAD_PTB3 = 25,
  46. VF610_PAD_PTB4 = 26,
  47. VF610_PAD_PTB5 = 27,
  48. VF610_PAD_PTB6 = 28,
  49. VF610_PAD_PTB7 = 29,
  50. VF610_PAD_PTB8 = 30,
  51. VF610_PAD_PTB9 = 31,
  52. VF610_PAD_PTB10 = 32,
  53. VF610_PAD_PTB11 = 33,
  54. VF610_PAD_PTB12 = 34,
  55. VF610_PAD_PTB13 = 35,
  56. VF610_PAD_PTB14 = 36,
  57. VF610_PAD_PTB15 = 37,
  58. VF610_PAD_PTB16 = 38,
  59. VF610_PAD_PTB17 = 39,
  60. VF610_PAD_PTB18 = 40,
  61. VF610_PAD_PTB19 = 41,
  62. VF610_PAD_PTB20 = 42,
  63. VF610_PAD_PTB21 = 43,
  64. VF610_PAD_PTB22 = 44,
  65. VF610_PAD_PTC0 = 45,
  66. VF610_PAD_PTC1 = 46,
  67. VF610_PAD_PTC2 = 47,
  68. VF610_PAD_PTC3 = 48,
  69. VF610_PAD_PTC4 = 49,
  70. VF610_PAD_PTC5 = 50,
  71. VF610_PAD_PTC6 = 51,
  72. VF610_PAD_PTC7 = 52,
  73. VF610_PAD_PTC8 = 53,
  74. VF610_PAD_PTC9 = 54,
  75. VF610_PAD_PTC10 = 55,
  76. VF610_PAD_PTC11 = 56,
  77. VF610_PAD_PTC12 = 57,
  78. VF610_PAD_PTC13 = 58,
  79. VF610_PAD_PTC14 = 59,
  80. VF610_PAD_PTC15 = 60,
  81. VF610_PAD_PTC16 = 61,
  82. VF610_PAD_PTC17 = 62,
  83. VF610_PAD_PTD31 = 63,
  84. VF610_PAD_PTD30 = 64,
  85. VF610_PAD_PTD29 = 65,
  86. VF610_PAD_PTD28 = 66,
  87. VF610_PAD_PTD27 = 67,
  88. VF610_PAD_PTD26 = 68,
  89. VF610_PAD_PTD25 = 69,
  90. VF610_PAD_PTD24 = 70,
  91. VF610_PAD_PTD23 = 71,
  92. VF610_PAD_PTD22 = 72,
  93. VF610_PAD_PTD21 = 73,
  94. VF610_PAD_PTD20 = 74,
  95. VF610_PAD_PTD19 = 75,
  96. VF610_PAD_PTD18 = 76,
  97. VF610_PAD_PTD17 = 77,
  98. VF610_PAD_PTD16 = 78,
  99. VF610_PAD_PTD0 = 79,
  100. VF610_PAD_PTD1 = 80,
  101. VF610_PAD_PTD2 = 81,
  102. VF610_PAD_PTD3 = 82,
  103. VF610_PAD_PTD4 = 83,
  104. VF610_PAD_PTD5 = 84,
  105. VF610_PAD_PTD6 = 85,
  106. VF610_PAD_PTD7 = 86,
  107. VF610_PAD_PTD8 = 87,
  108. VF610_PAD_PTD9 = 88,
  109. VF610_PAD_PTD10 = 89,
  110. VF610_PAD_PTD11 = 90,
  111. VF610_PAD_PTD12 = 91,
  112. VF610_PAD_PTD13 = 92,
  113. VF610_PAD_PTB23 = 93,
  114. VF610_PAD_PTB24 = 94,
  115. VF610_PAD_PTB25 = 95,
  116. VF610_PAD_PTB26 = 96,
  117. VF610_PAD_PTB27 = 97,
  118. VF610_PAD_PTB28 = 98,
  119. VF610_PAD_PTC26 = 99,
  120. VF610_PAD_PTC27 = 100,
  121. VF610_PAD_PTC28 = 101,
  122. VF610_PAD_PTC29 = 102,
  123. VF610_PAD_PTC30 = 103,
  124. VF610_PAD_PTC31 = 104,
  125. VF610_PAD_PTE0 = 105,
  126. VF610_PAD_PTE1 = 106,
  127. VF610_PAD_PTE2 = 107,
  128. VF610_PAD_PTE3 = 108,
  129. VF610_PAD_PTE4 = 109,
  130. VF610_PAD_PTE5 = 110,
  131. VF610_PAD_PTE6 = 111,
  132. VF610_PAD_PTE7 = 112,
  133. VF610_PAD_PTE8 = 113,
  134. VF610_PAD_PTE9 = 114,
  135. VF610_PAD_PTE10 = 115,
  136. VF610_PAD_PTE11 = 116,
  137. VF610_PAD_PTE12 = 117,
  138. VF610_PAD_PTE13 = 118,
  139. VF610_PAD_PTE14 = 119,
  140. VF610_PAD_PTE15 = 120,
  141. VF610_PAD_PTE16 = 121,
  142. VF610_PAD_PTE17 = 122,
  143. VF610_PAD_PTE18 = 123,
  144. VF610_PAD_PTE19 = 124,
  145. VF610_PAD_PTE20 = 125,
  146. VF610_PAD_PTE21 = 126,
  147. VF610_PAD_PTE22 = 127,
  148. VF610_PAD_PTE23 = 128,
  149. VF610_PAD_PTE24 = 129,
  150. VF610_PAD_PTE25 = 130,
  151. VF610_PAD_PTE26 = 131,
  152. VF610_PAD_PTE27 = 132,
  153. VF610_PAD_PTE28 = 133,
  154. VF610_PAD_PTA7 = 134,
  155. };
  156. /* Pad names for the pinmux subsystem */
  157. static const struct pinctrl_pin_desc vf610_pinctrl_pads[] = {
  158. IMX_PINCTRL_PIN(VF610_PAD_PTA6),
  159. IMX_PINCTRL_PIN(VF610_PAD_PTA8),
  160. IMX_PINCTRL_PIN(VF610_PAD_PTA9),
  161. IMX_PINCTRL_PIN(VF610_PAD_PTA10),
  162. IMX_PINCTRL_PIN(VF610_PAD_PTA11),
  163. IMX_PINCTRL_PIN(VF610_PAD_PTA12),
  164. IMX_PINCTRL_PIN(VF610_PAD_PTA16),
  165. IMX_PINCTRL_PIN(VF610_PAD_PTA17),
  166. IMX_PINCTRL_PIN(VF610_PAD_PTA18),
  167. IMX_PINCTRL_PIN(VF610_PAD_PTA19),
  168. IMX_PINCTRL_PIN(VF610_PAD_PTA20),
  169. IMX_PINCTRL_PIN(VF610_PAD_PTA21),
  170. IMX_PINCTRL_PIN(VF610_PAD_PTA22),
  171. IMX_PINCTRL_PIN(VF610_PAD_PTA23),
  172. IMX_PINCTRL_PIN(VF610_PAD_PTA24),
  173. IMX_PINCTRL_PIN(VF610_PAD_PTA25),
  174. IMX_PINCTRL_PIN(VF610_PAD_PTA26),
  175. IMX_PINCTRL_PIN(VF610_PAD_PTA27),
  176. IMX_PINCTRL_PIN(VF610_PAD_PTA28),
  177. IMX_PINCTRL_PIN(VF610_PAD_PTA29),
  178. IMX_PINCTRL_PIN(VF610_PAD_PTA30),
  179. IMX_PINCTRL_PIN(VF610_PAD_PTA31),
  180. IMX_PINCTRL_PIN(VF610_PAD_PTB0),
  181. IMX_PINCTRL_PIN(VF610_PAD_PTB1),
  182. IMX_PINCTRL_PIN(VF610_PAD_PTB2),
  183. IMX_PINCTRL_PIN(VF610_PAD_PTB3),
  184. IMX_PINCTRL_PIN(VF610_PAD_PTB4),
  185. IMX_PINCTRL_PIN(VF610_PAD_PTB5),
  186. IMX_PINCTRL_PIN(VF610_PAD_PTB6),
  187. IMX_PINCTRL_PIN(VF610_PAD_PTB7),
  188. IMX_PINCTRL_PIN(VF610_PAD_PTB8),
  189. IMX_PINCTRL_PIN(VF610_PAD_PTB9),
  190. IMX_PINCTRL_PIN(VF610_PAD_PTB10),
  191. IMX_PINCTRL_PIN(VF610_PAD_PTB11),
  192. IMX_PINCTRL_PIN(VF610_PAD_PTB12),
  193. IMX_PINCTRL_PIN(VF610_PAD_PTB13),
  194. IMX_PINCTRL_PIN(VF610_PAD_PTB14),
  195. IMX_PINCTRL_PIN(VF610_PAD_PTB15),
  196. IMX_PINCTRL_PIN(VF610_PAD_PTB16),
  197. IMX_PINCTRL_PIN(VF610_PAD_PTB17),
  198. IMX_PINCTRL_PIN(VF610_PAD_PTB18),
  199. IMX_PINCTRL_PIN(VF610_PAD_PTB19),
  200. IMX_PINCTRL_PIN(VF610_PAD_PTB20),
  201. IMX_PINCTRL_PIN(VF610_PAD_PTB21),
  202. IMX_PINCTRL_PIN(VF610_PAD_PTB22),
  203. IMX_PINCTRL_PIN(VF610_PAD_PTC0),
  204. IMX_PINCTRL_PIN(VF610_PAD_PTC1),
  205. IMX_PINCTRL_PIN(VF610_PAD_PTC2),
  206. IMX_PINCTRL_PIN(VF610_PAD_PTC3),
  207. IMX_PINCTRL_PIN(VF610_PAD_PTC4),
  208. IMX_PINCTRL_PIN(VF610_PAD_PTC5),
  209. IMX_PINCTRL_PIN(VF610_PAD_PTC6),
  210. IMX_PINCTRL_PIN(VF610_PAD_PTC7),
  211. IMX_PINCTRL_PIN(VF610_PAD_PTC8),
  212. IMX_PINCTRL_PIN(VF610_PAD_PTC9),
  213. IMX_PINCTRL_PIN(VF610_PAD_PTC10),
  214. IMX_PINCTRL_PIN(VF610_PAD_PTC11),
  215. IMX_PINCTRL_PIN(VF610_PAD_PTC12),
  216. IMX_PINCTRL_PIN(VF610_PAD_PTC13),
  217. IMX_PINCTRL_PIN(VF610_PAD_PTC14),
  218. IMX_PINCTRL_PIN(VF610_PAD_PTC15),
  219. IMX_PINCTRL_PIN(VF610_PAD_PTC16),
  220. IMX_PINCTRL_PIN(VF610_PAD_PTC17),
  221. IMX_PINCTRL_PIN(VF610_PAD_PTD31),
  222. IMX_PINCTRL_PIN(VF610_PAD_PTD30),
  223. IMX_PINCTRL_PIN(VF610_PAD_PTD29),
  224. IMX_PINCTRL_PIN(VF610_PAD_PTD28),
  225. IMX_PINCTRL_PIN(VF610_PAD_PTD27),
  226. IMX_PINCTRL_PIN(VF610_PAD_PTD26),
  227. IMX_PINCTRL_PIN(VF610_PAD_PTD25),
  228. IMX_PINCTRL_PIN(VF610_PAD_PTD24),
  229. IMX_PINCTRL_PIN(VF610_PAD_PTD23),
  230. IMX_PINCTRL_PIN(VF610_PAD_PTD22),
  231. IMX_PINCTRL_PIN(VF610_PAD_PTD21),
  232. IMX_PINCTRL_PIN(VF610_PAD_PTD20),
  233. IMX_PINCTRL_PIN(VF610_PAD_PTD19),
  234. IMX_PINCTRL_PIN(VF610_PAD_PTD18),
  235. IMX_PINCTRL_PIN(VF610_PAD_PTD17),
  236. IMX_PINCTRL_PIN(VF610_PAD_PTD16),
  237. IMX_PINCTRL_PIN(VF610_PAD_PTD0),
  238. IMX_PINCTRL_PIN(VF610_PAD_PTD1),
  239. IMX_PINCTRL_PIN(VF610_PAD_PTD2),
  240. IMX_PINCTRL_PIN(VF610_PAD_PTD3),
  241. IMX_PINCTRL_PIN(VF610_PAD_PTD4),
  242. IMX_PINCTRL_PIN(VF610_PAD_PTD5),
  243. IMX_PINCTRL_PIN(VF610_PAD_PTD6),
  244. IMX_PINCTRL_PIN(VF610_PAD_PTD7),
  245. IMX_PINCTRL_PIN(VF610_PAD_PTD8),
  246. IMX_PINCTRL_PIN(VF610_PAD_PTD9),
  247. IMX_PINCTRL_PIN(VF610_PAD_PTD10),
  248. IMX_PINCTRL_PIN(VF610_PAD_PTD11),
  249. IMX_PINCTRL_PIN(VF610_PAD_PTD12),
  250. IMX_PINCTRL_PIN(VF610_PAD_PTD13),
  251. IMX_PINCTRL_PIN(VF610_PAD_PTB23),
  252. IMX_PINCTRL_PIN(VF610_PAD_PTB24),
  253. IMX_PINCTRL_PIN(VF610_PAD_PTB25),
  254. IMX_PINCTRL_PIN(VF610_PAD_PTB26),
  255. IMX_PINCTRL_PIN(VF610_PAD_PTB27),
  256. IMX_PINCTRL_PIN(VF610_PAD_PTB28),
  257. IMX_PINCTRL_PIN(VF610_PAD_PTC26),
  258. IMX_PINCTRL_PIN(VF610_PAD_PTC27),
  259. IMX_PINCTRL_PIN(VF610_PAD_PTC28),
  260. IMX_PINCTRL_PIN(VF610_PAD_PTC29),
  261. IMX_PINCTRL_PIN(VF610_PAD_PTC30),
  262. IMX_PINCTRL_PIN(VF610_PAD_PTC31),
  263. IMX_PINCTRL_PIN(VF610_PAD_PTE0),
  264. IMX_PINCTRL_PIN(VF610_PAD_PTE1),
  265. IMX_PINCTRL_PIN(VF610_PAD_PTE2),
  266. IMX_PINCTRL_PIN(VF610_PAD_PTE3),
  267. IMX_PINCTRL_PIN(VF610_PAD_PTE4),
  268. IMX_PINCTRL_PIN(VF610_PAD_PTE5),
  269. IMX_PINCTRL_PIN(VF610_PAD_PTE6),
  270. IMX_PINCTRL_PIN(VF610_PAD_PTE7),
  271. IMX_PINCTRL_PIN(VF610_PAD_PTE8),
  272. IMX_PINCTRL_PIN(VF610_PAD_PTE9),
  273. IMX_PINCTRL_PIN(VF610_PAD_PTE10),
  274. IMX_PINCTRL_PIN(VF610_PAD_PTE11),
  275. IMX_PINCTRL_PIN(VF610_PAD_PTE12),
  276. IMX_PINCTRL_PIN(VF610_PAD_PTE13),
  277. IMX_PINCTRL_PIN(VF610_PAD_PTE14),
  278. IMX_PINCTRL_PIN(VF610_PAD_PTE15),
  279. IMX_PINCTRL_PIN(VF610_PAD_PTE16),
  280. IMX_PINCTRL_PIN(VF610_PAD_PTE17),
  281. IMX_PINCTRL_PIN(VF610_PAD_PTE18),
  282. IMX_PINCTRL_PIN(VF610_PAD_PTE19),
  283. IMX_PINCTRL_PIN(VF610_PAD_PTE20),
  284. IMX_PINCTRL_PIN(VF610_PAD_PTE21),
  285. IMX_PINCTRL_PIN(VF610_PAD_PTE22),
  286. IMX_PINCTRL_PIN(VF610_PAD_PTE23),
  287. IMX_PINCTRL_PIN(VF610_PAD_PTE24),
  288. IMX_PINCTRL_PIN(VF610_PAD_PTE25),
  289. IMX_PINCTRL_PIN(VF610_PAD_PTE26),
  290. IMX_PINCTRL_PIN(VF610_PAD_PTE27),
  291. IMX_PINCTRL_PIN(VF610_PAD_PTE28),
  292. IMX_PINCTRL_PIN(VF610_PAD_PTA7),
  293. };
  294. static struct imx_pinctrl_soc_info vf610_pinctrl_info = {
  295. .pins = vf610_pinctrl_pads,
  296. .npins = ARRAY_SIZE(vf610_pinctrl_pads),
  297. .flags = SHARE_MUX_CONF_REG | ZERO_OFFSET_VALID,
  298. };
  299. static const struct of_device_id vf610_pinctrl_of_match[] = {
  300. { .compatible = "fsl,vf610-iomuxc", },
  301. { /* sentinel */ }
  302. };
  303. static int vf610_pinctrl_probe(struct platform_device *pdev)
  304. {
  305. return imx_pinctrl_probe(pdev, &vf610_pinctrl_info);
  306. }
  307. static struct platform_driver vf610_pinctrl_driver = {
  308. .driver = {
  309. .name = "vf610-pinctrl",
  310. .of_match_table = vf610_pinctrl_of_match,
  311. },
  312. .probe = vf610_pinctrl_probe,
  313. .remove = imx_pinctrl_remove,
  314. };
  315. static int __init vf610_pinctrl_init(void)
  316. {
  317. return platform_driver_register(&vf610_pinctrl_driver);
  318. }
  319. arch_initcall(vf610_pinctrl_init);
  320. static void __exit vf610_pinctrl_exit(void)
  321. {
  322. platform_driver_unregister(&vf610_pinctrl_driver);
  323. }
  324. module_exit(vf610_pinctrl_exit);
  325. MODULE_DESCRIPTION("Freescale VF610 pinctrl driver");
  326. MODULE_LICENSE("GPL v2");