pinctrl-wm8505.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. /*
  2. * Pinctrl data for Wondermedia WM8505 SoC
  3. *
  4. * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. */
  15. #include <linux/io.h>
  16. #include <linux/module.h>
  17. #include <linux/pinctrl/pinctrl.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/slab.h>
  20. #include "pinctrl-wmt.h"
  21. /*
  22. * Describe the register offsets within the GPIO memory space
  23. * The dedicated external GPIO's should always be listed in bank 0
  24. * so they are exported in the 0..31 range which is what users
  25. * expect.
  26. *
  27. * Do not reorder these banks as it will change the pin numbering
  28. */
  29. static const struct wmt_pinctrl_bank_registers wm8505_banks[] = {
  30. WMT_PINCTRL_BANK(0x64, 0x8C, 0xB4, 0xDC, NO_REG, NO_REG), /* 0 */
  31. WMT_PINCTRL_BANK(0x40, 0x68, 0x90, 0xB8, NO_REG, NO_REG), /* 1 */
  32. WMT_PINCTRL_BANK(0x44, 0x6C, 0x94, 0xBC, NO_REG, NO_REG), /* 2 */
  33. WMT_PINCTRL_BANK(0x48, 0x70, 0x98, 0xC0, NO_REG, NO_REG), /* 3 */
  34. WMT_PINCTRL_BANK(0x4C, 0x74, 0x9C, 0xC4, NO_REG, NO_REG), /* 4 */
  35. WMT_PINCTRL_BANK(0x50, 0x78, 0xA0, 0xC8, NO_REG, NO_REG), /* 5 */
  36. WMT_PINCTRL_BANK(0x54, 0x7C, 0xA4, 0xD0, NO_REG, NO_REG), /* 6 */
  37. WMT_PINCTRL_BANK(0x58, 0x80, 0xA8, 0xD4, NO_REG, NO_REG), /* 7 */
  38. WMT_PINCTRL_BANK(0x5C, 0x84, 0xAC, 0xD8, NO_REG, NO_REG), /* 8 */
  39. WMT_PINCTRL_BANK(0x60, 0x88, 0xB0, 0xDC, NO_REG, NO_REG), /* 9 */
  40. WMT_PINCTRL_BANK(0x500, 0x504, 0x508, 0x50C, NO_REG, NO_REG), /* 10 */
  41. };
  42. /* Please keep sorted by bank/bit */
  43. #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0)
  44. #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1)
  45. #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2)
  46. #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3)
  47. #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4)
  48. #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5)
  49. #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6)
  50. #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7)
  51. #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16)
  52. #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17)
  53. #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18)
  54. #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19)
  55. #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21)
  56. #define WMT_PIN_SDDATA0 WMT_PIN(1, 0)
  57. #define WMT_PIN_SDDATA1 WMT_PIN(1, 1)
  58. #define WMT_PIN_SDDATA2 WMT_PIN(1, 2)
  59. #define WMT_PIN_SDDATA3 WMT_PIN(1, 3)
  60. #define WMT_PIN_MMCDATA0 WMT_PIN(1, 4)
  61. #define WMT_PIN_MMCDATA1 WMT_PIN(1, 5)
  62. #define WMT_PIN_MMCDATA2 WMT_PIN(1, 6)
  63. #define WMT_PIN_MMCDATA3 WMT_PIN(1, 7)
  64. #define WMT_PIN_VDIN0 WMT_PIN(2, 0)
  65. #define WMT_PIN_VDIN1 WMT_PIN(2, 1)
  66. #define WMT_PIN_VDIN2 WMT_PIN(2, 2)
  67. #define WMT_PIN_VDIN3 WMT_PIN(2, 3)
  68. #define WMT_PIN_VDIN4 WMT_PIN(2, 4)
  69. #define WMT_PIN_VDIN5 WMT_PIN(2, 5)
  70. #define WMT_PIN_VDIN6 WMT_PIN(2, 6)
  71. #define WMT_PIN_VDIN7 WMT_PIN(2, 7)
  72. #define WMT_PIN_VDOUT0 WMT_PIN(2, 8)
  73. #define WMT_PIN_VDOUT1 WMT_PIN(2, 9)
  74. #define WMT_PIN_VDOUT2 WMT_PIN(2, 10)
  75. #define WMT_PIN_VDOUT3 WMT_PIN(2, 11)
  76. #define WMT_PIN_VDOUT4 WMT_PIN(2, 12)
  77. #define WMT_PIN_VDOUT5 WMT_PIN(2, 13)
  78. #define WMT_PIN_VDOUT6 WMT_PIN(2, 14)
  79. #define WMT_PIN_VDOUT7 WMT_PIN(2, 15)
  80. #define WMT_PIN_VDOUT8 WMT_PIN(2, 16)
  81. #define WMT_PIN_VDOUT9 WMT_PIN(2, 17)
  82. #define WMT_PIN_VDOUT10 WMT_PIN(2, 18)
  83. #define WMT_PIN_VDOUT11 WMT_PIN(2, 19)
  84. #define WMT_PIN_VDOUT12 WMT_PIN(2, 20)
  85. #define WMT_PIN_VDOUT13 WMT_PIN(2, 21)
  86. #define WMT_PIN_VDOUT14 WMT_PIN(2, 22)
  87. #define WMT_PIN_VDOUT15 WMT_PIN(2, 23)
  88. #define WMT_PIN_VDOUT16 WMT_PIN(2, 24)
  89. #define WMT_PIN_VDOUT17 WMT_PIN(2, 25)
  90. #define WMT_PIN_VDOUT18 WMT_PIN(2, 26)
  91. #define WMT_PIN_VDOUT19 WMT_PIN(2, 27)
  92. #define WMT_PIN_VDOUT20 WMT_PIN(2, 28)
  93. #define WMT_PIN_VDOUT21 WMT_PIN(2, 29)
  94. #define WMT_PIN_VDOUT22 WMT_PIN(2, 30)
  95. #define WMT_PIN_VDOUT23 WMT_PIN(2, 31)
  96. #define WMT_PIN_VHSYNC WMT_PIN(3, 0)
  97. #define WMT_PIN_VVSYNC WMT_PIN(3, 1)
  98. #define WMT_PIN_VGAHSYNC WMT_PIN(3, 2)
  99. #define WMT_PIN_VGAVSYNC WMT_PIN(3, 3)
  100. #define WMT_PIN_VDHSYNC WMT_PIN(3, 4)
  101. #define WMT_PIN_VDVSYNC WMT_PIN(3, 5)
  102. #define WMT_PIN_NORD0 WMT_PIN(4, 0)
  103. #define WMT_PIN_NORD1 WMT_PIN(4, 1)
  104. #define WMT_PIN_NORD2 WMT_PIN(4, 2)
  105. #define WMT_PIN_NORD3 WMT_PIN(4, 3)
  106. #define WMT_PIN_NORD4 WMT_PIN(4, 4)
  107. #define WMT_PIN_NORD5 WMT_PIN(4, 5)
  108. #define WMT_PIN_NORD6 WMT_PIN(4, 6)
  109. #define WMT_PIN_NORD7 WMT_PIN(4, 7)
  110. #define WMT_PIN_NORD8 WMT_PIN(4, 8)
  111. #define WMT_PIN_NORD9 WMT_PIN(4, 9)
  112. #define WMT_PIN_NORD10 WMT_PIN(4, 10)
  113. #define WMT_PIN_NORD11 WMT_PIN(4, 11)
  114. #define WMT_PIN_NORD12 WMT_PIN(4, 12)
  115. #define WMT_PIN_NORD13 WMT_PIN(4, 13)
  116. #define WMT_PIN_NORD14 WMT_PIN(4, 14)
  117. #define WMT_PIN_NORD15 WMT_PIN(4, 15)
  118. #define WMT_PIN_NORA0 WMT_PIN(5, 0)
  119. #define WMT_PIN_NORA1 WMT_PIN(5, 1)
  120. #define WMT_PIN_NORA2 WMT_PIN(5, 2)
  121. #define WMT_PIN_NORA3 WMT_PIN(5, 3)
  122. #define WMT_PIN_NORA4 WMT_PIN(5, 4)
  123. #define WMT_PIN_NORA5 WMT_PIN(5, 5)
  124. #define WMT_PIN_NORA6 WMT_PIN(5, 6)
  125. #define WMT_PIN_NORA7 WMT_PIN(5, 7)
  126. #define WMT_PIN_NORA8 WMT_PIN(5, 8)
  127. #define WMT_PIN_NORA9 WMT_PIN(5, 9)
  128. #define WMT_PIN_NORA10 WMT_PIN(5, 10)
  129. #define WMT_PIN_NORA11 WMT_PIN(5, 11)
  130. #define WMT_PIN_NORA12 WMT_PIN(5, 12)
  131. #define WMT_PIN_NORA13 WMT_PIN(5, 13)
  132. #define WMT_PIN_NORA14 WMT_PIN(5, 14)
  133. #define WMT_PIN_NORA15 WMT_PIN(5, 15)
  134. #define WMT_PIN_NORA16 WMT_PIN(5, 16)
  135. #define WMT_PIN_NORA17 WMT_PIN(5, 17)
  136. #define WMT_PIN_NORA18 WMT_PIN(5, 18)
  137. #define WMT_PIN_NORA19 WMT_PIN(5, 19)
  138. #define WMT_PIN_NORA20 WMT_PIN(5, 20)
  139. #define WMT_PIN_NORA21 WMT_PIN(5, 21)
  140. #define WMT_PIN_NORA22 WMT_PIN(5, 22)
  141. #define WMT_PIN_NORA23 WMT_PIN(5, 23)
  142. #define WMT_PIN_NORA24 WMT_PIN(5, 24)
  143. #define WMT_PIN_AC97SDI WMT_PIN(6, 0)
  144. #define WMT_PIN_AC97SYNC WMT_PIN(6, 1)
  145. #define WMT_PIN_AC97SDO WMT_PIN(6, 2)
  146. #define WMT_PIN_AC97BCLK WMT_PIN(6, 3)
  147. #define WMT_PIN_AC97RST WMT_PIN(6, 4)
  148. #define WMT_PIN_SFDO WMT_PIN(7, 0)
  149. #define WMT_PIN_SFCS0 WMT_PIN(7, 1)
  150. #define WMT_PIN_SFCS1 WMT_PIN(7, 2)
  151. #define WMT_PIN_SFCLK WMT_PIN(7, 3)
  152. #define WMT_PIN_SFDI WMT_PIN(7, 4)
  153. #define WMT_PIN_SPI0CLK WMT_PIN(8, 0)
  154. #define WMT_PIN_SPI0MISO WMT_PIN(8, 1)
  155. #define WMT_PIN_SPI0MOSI WMT_PIN(8, 2)
  156. #define WMT_PIN_SPI0SS WMT_PIN(8, 3)
  157. #define WMT_PIN_SPI1CLK WMT_PIN(8, 4)
  158. #define WMT_PIN_SPI1MISO WMT_PIN(8, 5)
  159. #define WMT_PIN_SPI1MOSI WMT_PIN(8, 6)
  160. #define WMT_PIN_SPI1SS WMT_PIN(8, 7)
  161. #define WMT_PIN_SPI2CLK WMT_PIN(8, 8)
  162. #define WMT_PIN_SPI2MISO WMT_PIN(8, 9)
  163. #define WMT_PIN_SPI2MOSI WMT_PIN(8, 10)
  164. #define WMT_PIN_SPI2SS WMT_PIN(8, 11)
  165. #define WMT_PIN_UART0_RTS WMT_PIN(9, 0)
  166. #define WMT_PIN_UART0_TXD WMT_PIN(9, 1)
  167. #define WMT_PIN_UART0_CTS WMT_PIN(9, 2)
  168. #define WMT_PIN_UART0_RXD WMT_PIN(9, 3)
  169. #define WMT_PIN_UART1_RTS WMT_PIN(9, 4)
  170. #define WMT_PIN_UART1_TXD WMT_PIN(9, 5)
  171. #define WMT_PIN_UART1_CTS WMT_PIN(9, 6)
  172. #define WMT_PIN_UART1_RXD WMT_PIN(9, 7)
  173. #define WMT_PIN_UART2_RTS WMT_PIN(9, 8)
  174. #define WMT_PIN_UART2_TXD WMT_PIN(9, 9)
  175. #define WMT_PIN_UART2_CTS WMT_PIN(9, 10)
  176. #define WMT_PIN_UART2_RXD WMT_PIN(9, 11)
  177. #define WMT_PIN_UART3_RTS WMT_PIN(9, 12)
  178. #define WMT_PIN_UART3_TXD WMT_PIN(9, 13)
  179. #define WMT_PIN_UART3_CTS WMT_PIN(9, 14)
  180. #define WMT_PIN_UART3_RXD WMT_PIN(9, 15)
  181. #define WMT_PIN_I2C0SCL WMT_PIN(10, 0)
  182. #define WMT_PIN_I2C0SDA WMT_PIN(10, 1)
  183. #define WMT_PIN_I2C1SCL WMT_PIN(10, 2)
  184. #define WMT_PIN_I2C1SDA WMT_PIN(10, 3)
  185. #define WMT_PIN_I2C2SCL WMT_PIN(10, 4)
  186. #define WMT_PIN_I2C2SDA WMT_PIN(10, 5)
  187. static const struct pinctrl_pin_desc wm8505_pins[] = {
  188. PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
  189. PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
  190. PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
  191. PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
  192. PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
  193. PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
  194. PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
  195. PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
  196. PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"),
  197. PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"),
  198. PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"),
  199. PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"),
  200. PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"),
  201. PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"),
  202. PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"),
  203. PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"),
  204. PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"),
  205. PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"),
  206. PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"),
  207. PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"),
  208. PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"),
  209. PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
  210. PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
  211. PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
  212. PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
  213. PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
  214. PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
  215. PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
  216. PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
  217. PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
  218. PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
  219. PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
  220. PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
  221. PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
  222. PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
  223. PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"),
  224. PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"),
  225. PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"),
  226. PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"),
  227. PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"),
  228. PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"),
  229. PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"),
  230. PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"),
  231. PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"),
  232. PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"),
  233. PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"),
  234. PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"),
  235. PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"),
  236. PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"),
  237. PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"),
  238. PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"),
  239. PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"),
  240. PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"),
  241. PINCTRL_PIN(WMT_PIN_VHSYNC, "v_hsync"),
  242. PINCTRL_PIN(WMT_PIN_VVSYNC, "v_vsync"),
  243. PINCTRL_PIN(WMT_PIN_VGAHSYNC, "vga_hsync"),
  244. PINCTRL_PIN(WMT_PIN_VGAVSYNC, "vga_vsync"),
  245. PINCTRL_PIN(WMT_PIN_VDHSYNC, "vd_hsync"),
  246. PINCTRL_PIN(WMT_PIN_VDVSYNC, "vd_vsync"),
  247. PINCTRL_PIN(WMT_PIN_NORD0, "nor_d0"),
  248. PINCTRL_PIN(WMT_PIN_NORD1, "nor_d1"),
  249. PINCTRL_PIN(WMT_PIN_NORD2, "nor_d2"),
  250. PINCTRL_PIN(WMT_PIN_NORD3, "nor_d3"),
  251. PINCTRL_PIN(WMT_PIN_NORD4, "nor_d4"),
  252. PINCTRL_PIN(WMT_PIN_NORD5, "nor_d5"),
  253. PINCTRL_PIN(WMT_PIN_NORD6, "nor_d6"),
  254. PINCTRL_PIN(WMT_PIN_NORD7, "nor_d7"),
  255. PINCTRL_PIN(WMT_PIN_NORD8, "nor_d8"),
  256. PINCTRL_PIN(WMT_PIN_NORD9, "nor_d9"),
  257. PINCTRL_PIN(WMT_PIN_NORD10, "nor_d10"),
  258. PINCTRL_PIN(WMT_PIN_NORD11, "nor_d11"),
  259. PINCTRL_PIN(WMT_PIN_NORD12, "nor_d12"),
  260. PINCTRL_PIN(WMT_PIN_NORD13, "nor_d13"),
  261. PINCTRL_PIN(WMT_PIN_NORD14, "nor_d14"),
  262. PINCTRL_PIN(WMT_PIN_NORD15, "nor_d15"),
  263. PINCTRL_PIN(WMT_PIN_NORA0, "nor_a0"),
  264. PINCTRL_PIN(WMT_PIN_NORA1, "nor_a1"),
  265. PINCTRL_PIN(WMT_PIN_NORA2, "nor_a2"),
  266. PINCTRL_PIN(WMT_PIN_NORA3, "nor_a3"),
  267. PINCTRL_PIN(WMT_PIN_NORA4, "nor_a4"),
  268. PINCTRL_PIN(WMT_PIN_NORA5, "nor_a5"),
  269. PINCTRL_PIN(WMT_PIN_NORA6, "nor_a6"),
  270. PINCTRL_PIN(WMT_PIN_NORA7, "nor_a7"),
  271. PINCTRL_PIN(WMT_PIN_NORA8, "nor_a8"),
  272. PINCTRL_PIN(WMT_PIN_NORA9, "nor_a9"),
  273. PINCTRL_PIN(WMT_PIN_NORA10, "nor_a10"),
  274. PINCTRL_PIN(WMT_PIN_NORA11, "nor_a11"),
  275. PINCTRL_PIN(WMT_PIN_NORA12, "nor_a12"),
  276. PINCTRL_PIN(WMT_PIN_NORA13, "nor_a13"),
  277. PINCTRL_PIN(WMT_PIN_NORA14, "nor_a14"),
  278. PINCTRL_PIN(WMT_PIN_NORA15, "nor_a15"),
  279. PINCTRL_PIN(WMT_PIN_NORA16, "nor_a16"),
  280. PINCTRL_PIN(WMT_PIN_NORA17, "nor_a17"),
  281. PINCTRL_PIN(WMT_PIN_NORA18, "nor_a18"),
  282. PINCTRL_PIN(WMT_PIN_NORA19, "nor_a19"),
  283. PINCTRL_PIN(WMT_PIN_NORA20, "nor_a20"),
  284. PINCTRL_PIN(WMT_PIN_NORA21, "nor_a21"),
  285. PINCTRL_PIN(WMT_PIN_NORA22, "nor_a22"),
  286. PINCTRL_PIN(WMT_PIN_NORA23, "nor_a23"),
  287. PINCTRL_PIN(WMT_PIN_NORA24, "nor_a24"),
  288. PINCTRL_PIN(WMT_PIN_AC97SDI, "ac97_sdi"),
  289. PINCTRL_PIN(WMT_PIN_AC97SYNC, "ac97_sync"),
  290. PINCTRL_PIN(WMT_PIN_AC97SDO, "ac97_sdo"),
  291. PINCTRL_PIN(WMT_PIN_AC97BCLK, "ac97_bclk"),
  292. PINCTRL_PIN(WMT_PIN_AC97RST, "ac97_rst"),
  293. PINCTRL_PIN(WMT_PIN_SFDO, "sf_do"),
  294. PINCTRL_PIN(WMT_PIN_SFCS0, "sf_cs0"),
  295. PINCTRL_PIN(WMT_PIN_SFCS1, "sf_cs1"),
  296. PINCTRL_PIN(WMT_PIN_SFCLK, "sf_clk"),
  297. PINCTRL_PIN(WMT_PIN_SFDI, "sf_di"),
  298. PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"),
  299. PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"),
  300. PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"),
  301. PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"),
  302. PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"),
  303. PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"),
  304. PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"),
  305. PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"),
  306. PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"),
  307. PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"),
  308. PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"),
  309. PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"),
  310. PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"),
  311. PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"),
  312. PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"),
  313. PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"),
  314. PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"),
  315. PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"),
  316. PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"),
  317. PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"),
  318. PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"),
  319. PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"),
  320. PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"),
  321. PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"),
  322. PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"),
  323. PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"),
  324. PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"),
  325. PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"),
  326. PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"),
  327. PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"),
  328. PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"),
  329. PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"),
  330. PINCTRL_PIN(WMT_PIN_I2C2SCL, "i2c2_scl"),
  331. PINCTRL_PIN(WMT_PIN_I2C2SDA, "i2c2_sda"),
  332. };
  333. /* Order of these names must match the above list */
  334. static const char * const wm8505_groups[] = {
  335. "extgpio0",
  336. "extgpio1",
  337. "extgpio2",
  338. "extgpio3",
  339. "extgpio4",
  340. "extgpio5",
  341. "extgpio6",
  342. "extgpio7",
  343. "wakeup0",
  344. "wakeup1",
  345. "wakeup2",
  346. "wakeup3",
  347. "susgpio0",
  348. "sd_data0",
  349. "sd_data1",
  350. "sd_data2",
  351. "sd_data3",
  352. "mmc_data0",
  353. "mmc_data1",
  354. "mmc_data2",
  355. "mmc_data3",
  356. "vdin0",
  357. "vdin1",
  358. "vdin2",
  359. "vdin3",
  360. "vdin4",
  361. "vdin5",
  362. "vdin6",
  363. "vdin7",
  364. "vdout0",
  365. "vdout1",
  366. "vdout2",
  367. "vdout3",
  368. "vdout4",
  369. "vdout5",
  370. "vdout6",
  371. "vdout7",
  372. "vdout8",
  373. "vdout9",
  374. "vdout10",
  375. "vdout11",
  376. "vdout12",
  377. "vdout13",
  378. "vdout14",
  379. "vdout15",
  380. "vdout16",
  381. "vdout17",
  382. "vdout18",
  383. "vdout19",
  384. "vdout20",
  385. "vdout21",
  386. "vdout22",
  387. "vdout23",
  388. "v_hsync",
  389. "v_vsync",
  390. "vga_hsync",
  391. "vga_vsync",
  392. "vd_hsync",
  393. "vd_vsync",
  394. "nor_d0",
  395. "nor_d1",
  396. "nor_d2",
  397. "nor_d3",
  398. "nor_d4",
  399. "nor_d5",
  400. "nor_d6",
  401. "nor_d7",
  402. "nor_d8",
  403. "nor_d9",
  404. "nor_d10",
  405. "nor_d11",
  406. "nor_d12",
  407. "nor_d13",
  408. "nor_d14",
  409. "nor_d15",
  410. "nor_a0",
  411. "nor_a1",
  412. "nor_a2",
  413. "nor_a3",
  414. "nor_a4",
  415. "nor_a5",
  416. "nor_a6",
  417. "nor_a7",
  418. "nor_a8",
  419. "nor_a9",
  420. "nor_a10",
  421. "nor_a11",
  422. "nor_a12",
  423. "nor_a13",
  424. "nor_a14",
  425. "nor_a15",
  426. "nor_a16",
  427. "nor_a17",
  428. "nor_a18",
  429. "nor_a19",
  430. "nor_a20",
  431. "nor_a21",
  432. "nor_a22",
  433. "nor_a23",
  434. "nor_a24",
  435. "ac97_sdi",
  436. "ac97_sync",
  437. "ac97_sdo",
  438. "ac97_bclk",
  439. "ac97_rst",
  440. "sf_do",
  441. "sf_cs0",
  442. "sf_cs1",
  443. "sf_clk",
  444. "sf_di",
  445. "spi0_clk",
  446. "spi0_miso",
  447. "spi0_mosi",
  448. "spi0_ss",
  449. "spi1_clk",
  450. "spi1_miso",
  451. "spi1_mosi",
  452. "spi1_ss",
  453. "spi2_clk",
  454. "spi2_miso",
  455. "spi2_mosi",
  456. "spi2_ss",
  457. "uart0_rts",
  458. "uart0_txd",
  459. "uart0_cts",
  460. "uart0_rxd",
  461. "uart1_rts",
  462. "uart1_txd",
  463. "uart1_cts",
  464. "uart1_rxd",
  465. "uart2_rts",
  466. "uart2_txd",
  467. "uart2_cts",
  468. "uart2_rxd",
  469. "uart3_rts",
  470. "uart3_txd",
  471. "uart3_cts",
  472. "uart3_rxd",
  473. "i2c0_scl",
  474. "i2c0_sda",
  475. "i2c1_scl",
  476. "i2c1_sda",
  477. "i2c2_scl",
  478. "i2c2_sda",
  479. };
  480. static int wm8505_pinctrl_probe(struct platform_device *pdev)
  481. {
  482. struct wmt_pinctrl_data *data;
  483. data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
  484. if (!data) {
  485. dev_err(&pdev->dev, "failed to allocate data\n");
  486. return -ENOMEM;
  487. }
  488. data->banks = wm8505_banks;
  489. data->nbanks = ARRAY_SIZE(wm8505_banks);
  490. data->pins = wm8505_pins;
  491. data->npins = ARRAY_SIZE(wm8505_pins);
  492. data->groups = wm8505_groups;
  493. data->ngroups = ARRAY_SIZE(wm8505_groups);
  494. return wmt_pinctrl_probe(pdev, data);
  495. }
  496. static int wm8505_pinctrl_remove(struct platform_device *pdev)
  497. {
  498. return wmt_pinctrl_remove(pdev);
  499. }
  500. static const struct of_device_id wmt_pinctrl_of_match[] = {
  501. { .compatible = "wm,wm8505-pinctrl" },
  502. { /* sentinel */ },
  503. };
  504. static struct platform_driver wmt_pinctrl_driver = {
  505. .probe = wm8505_pinctrl_probe,
  506. .remove = wm8505_pinctrl_remove,
  507. .driver = {
  508. .name = "pinctrl-wm8505",
  509. .of_match_table = wmt_pinctrl_of_match,
  510. },
  511. };
  512. module_platform_driver(wmt_pinctrl_driver);
  513. MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>");
  514. MODULE_DESCRIPTION("Wondermedia WM8505 Pincontrol driver");
  515. MODULE_LICENSE("GPL v2");
  516. MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);