pinctrl-vt8500.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. /*
  2. * Pinctrl data for VIA VT8500 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 vt8500_banks[] = {
  30. WMT_PINCTRL_BANK(NO_REG, 0x3C, 0x5C, 0x7C, NO_REG, NO_REG), /* 0 */
  31. WMT_PINCTRL_BANK(0x00, 0x20, 0x40, 0x60, NO_REG, NO_REG), /* 1 */
  32. WMT_PINCTRL_BANK(0x04, 0x24, 0x44, 0x64, NO_REG, NO_REG), /* 2 */
  33. WMT_PINCTRL_BANK(0x08, 0x28, 0x48, 0x68, NO_REG, NO_REG), /* 3 */
  34. WMT_PINCTRL_BANK(0x0C, 0x2C, 0x4C, 0x6C, NO_REG, NO_REG), /* 4 */
  35. WMT_PINCTRL_BANK(0x10, 0x30, 0x50, 0x70, NO_REG, NO_REG), /* 5 */
  36. WMT_PINCTRL_BANK(0x14, 0x34, 0x54, 0x74, NO_REG, NO_REG), /* 6 */
  37. };
  38. /* Please keep sorted by bank/bit */
  39. #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0)
  40. #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1)
  41. #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2)
  42. #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3)
  43. #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4)
  44. #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5)
  45. #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6)
  46. #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7)
  47. #define WMT_PIN_EXTGPIO8 WMT_PIN(0, 8)
  48. #define WMT_PIN_UART0RTS WMT_PIN(1, 0)
  49. #define WMT_PIN_UART0TXD WMT_PIN(1, 1)
  50. #define WMT_PIN_UART0CTS WMT_PIN(1, 2)
  51. #define WMT_PIN_UART0RXD WMT_PIN(1, 3)
  52. #define WMT_PIN_UART1RTS WMT_PIN(1, 4)
  53. #define WMT_PIN_UART1TXD WMT_PIN(1, 5)
  54. #define WMT_PIN_UART1CTS WMT_PIN(1, 6)
  55. #define WMT_PIN_UART1RXD WMT_PIN(1, 7)
  56. #define WMT_PIN_SPI0CLK WMT_PIN(1, 8)
  57. #define WMT_PIN_SPI0SS WMT_PIN(1, 9)
  58. #define WMT_PIN_SPI0MISO WMT_PIN(1, 10)
  59. #define WMT_PIN_SPI0MOSI WMT_PIN(1, 11)
  60. #define WMT_PIN_SPI1CLK WMT_PIN(1, 12)
  61. #define WMT_PIN_SPI1SS WMT_PIN(1, 13)
  62. #define WMT_PIN_SPI1MISO WMT_PIN(1, 14)
  63. #define WMT_PIN_SPI1MOSI WMT_PIN(1, 15)
  64. #define WMT_PIN_SPI2CLK WMT_PIN(1, 16)
  65. #define WMT_PIN_SPI2SS WMT_PIN(1, 17)
  66. #define WMT_PIN_SPI2MISO WMT_PIN(1, 18)
  67. #define WMT_PIN_SPI2MOSI WMT_PIN(1, 19)
  68. #define WMT_PIN_SDDATA0 WMT_PIN(2, 0)
  69. #define WMT_PIN_SDDATA1 WMT_PIN(2, 1)
  70. #define WMT_PIN_SDDATA2 WMT_PIN(2, 2)
  71. #define WMT_PIN_SDDATA3 WMT_PIN(2, 3)
  72. #define WMT_PIN_MMCDATA0 WMT_PIN(2, 4)
  73. #define WMT_PIN_MMCDATA1 WMT_PIN(2, 5)
  74. #define WMT_PIN_MMCDATA2 WMT_PIN(2, 6)
  75. #define WMT_PIN_MMCDATA3 WMT_PIN(2, 7)
  76. #define WMT_PIN_SDCLK WMT_PIN(2, 8)
  77. #define WMT_PIN_SDWP WMT_PIN(2, 9)
  78. #define WMT_PIN_SDCMD WMT_PIN(2, 10)
  79. #define WMT_PIN_MSDATA0 WMT_PIN(2, 16)
  80. #define WMT_PIN_MSDATA1 WMT_PIN(2, 17)
  81. #define WMT_PIN_MSDATA2 WMT_PIN(2, 18)
  82. #define WMT_PIN_MSDATA3 WMT_PIN(2, 19)
  83. #define WMT_PIN_MSCLK WMT_PIN(2, 20)
  84. #define WMT_PIN_MSBS WMT_PIN(2, 21)
  85. #define WMT_PIN_MSINS WMT_PIN(2, 22)
  86. #define WMT_PIN_I2C0SCL WMT_PIN(2, 24)
  87. #define WMT_PIN_I2C0SDA WMT_PIN(2, 25)
  88. #define WMT_PIN_I2C1SCL WMT_PIN(2, 26)
  89. #define WMT_PIN_I2C1SDA WMT_PIN(2, 27)
  90. #define WMT_PIN_MII0RXD0 WMT_PIN(3, 0)
  91. #define WMT_PIN_MII0RXD1 WMT_PIN(3, 1)
  92. #define WMT_PIN_MII0RXD2 WMT_PIN(3, 2)
  93. #define WMT_PIN_MII0RXD3 WMT_PIN(3, 3)
  94. #define WMT_PIN_MII0RXCLK WMT_PIN(3, 4)
  95. #define WMT_PIN_MII0RXDV WMT_PIN(3, 5)
  96. #define WMT_PIN_MII0RXERR WMT_PIN(3, 6)
  97. #define WMT_PIN_MII0PHYRST WMT_PIN(3, 7)
  98. #define WMT_PIN_MII0TXD0 WMT_PIN(3, 8)
  99. #define WMT_PIN_MII0TXD1 WMT_PIN(3, 9)
  100. #define WMT_PIN_MII0TXD2 WMT_PIN(3, 10)
  101. #define WMT_PIN_MII0TXD3 WMT_PIN(3, 11)
  102. #define WMT_PIN_MII0TXCLK WMT_PIN(3, 12)
  103. #define WMT_PIN_MII0TXEN WMT_PIN(3, 13)
  104. #define WMT_PIN_MII0TXERR WMT_PIN(3, 14)
  105. #define WMT_PIN_MII0PHYPD WMT_PIN(3, 15)
  106. #define WMT_PIN_MII0COL WMT_PIN(3, 16)
  107. #define WMT_PIN_MII0CRS WMT_PIN(3, 17)
  108. #define WMT_PIN_MII0MDIO WMT_PIN(3, 18)
  109. #define WMT_PIN_MII0MDC WMT_PIN(3, 19)
  110. #define WMT_PIN_SEECS WMT_PIN(3, 20)
  111. #define WMT_PIN_SEECK WMT_PIN(3, 21)
  112. #define WMT_PIN_SEEDI WMT_PIN(3, 22)
  113. #define WMT_PIN_SEEDO WMT_PIN(3, 23)
  114. #define WMT_PIN_IDEDREQ0 WMT_PIN(3, 24)
  115. #define WMT_PIN_IDEDREQ1 WMT_PIN(3, 25)
  116. #define WMT_PIN_IDEIOW WMT_PIN(3, 26)
  117. #define WMT_PIN_IDEIOR WMT_PIN(3, 27)
  118. #define WMT_PIN_IDEDACK WMT_PIN(3, 28)
  119. #define WMT_PIN_IDEIORDY WMT_PIN(3, 29)
  120. #define WMT_PIN_IDEINTRQ WMT_PIN(3, 30)
  121. #define WMT_PIN_VDIN0 WMT_PIN(4, 0)
  122. #define WMT_PIN_VDIN1 WMT_PIN(4, 1)
  123. #define WMT_PIN_VDIN2 WMT_PIN(4, 2)
  124. #define WMT_PIN_VDIN3 WMT_PIN(4, 3)
  125. #define WMT_PIN_VDIN4 WMT_PIN(4, 4)
  126. #define WMT_PIN_VDIN5 WMT_PIN(4, 5)
  127. #define WMT_PIN_VDIN6 WMT_PIN(4, 6)
  128. #define WMT_PIN_VDIN7 WMT_PIN(4, 7)
  129. #define WMT_PIN_VDOUT0 WMT_PIN(4, 8)
  130. #define WMT_PIN_VDOUT1 WMT_PIN(4, 9)
  131. #define WMT_PIN_VDOUT2 WMT_PIN(4, 10)
  132. #define WMT_PIN_VDOUT3 WMT_PIN(4, 11)
  133. #define WMT_PIN_VDOUT4 WMT_PIN(4, 12)
  134. #define WMT_PIN_VDOUT5 WMT_PIN(4, 13)
  135. #define WMT_PIN_NANDCLE0 WMT_PIN(4, 14)
  136. #define WMT_PIN_NANDCLE1 WMT_PIN(4, 15)
  137. #define WMT_PIN_VDOUT6_7 WMT_PIN(4, 16)
  138. #define WMT_PIN_VHSYNC WMT_PIN(4, 17)
  139. #define WMT_PIN_VVSYNC WMT_PIN(4, 18)
  140. #define WMT_PIN_TSDIN0 WMT_PIN(5, 8)
  141. #define WMT_PIN_TSDIN1 WMT_PIN(5, 9)
  142. #define WMT_PIN_TSDIN2 WMT_PIN(5, 10)
  143. #define WMT_PIN_TSDIN3 WMT_PIN(5, 11)
  144. #define WMT_PIN_TSDIN4 WMT_PIN(5, 12)
  145. #define WMT_PIN_TSDIN5 WMT_PIN(5, 13)
  146. #define WMT_PIN_TSDIN6 WMT_PIN(5, 14)
  147. #define WMT_PIN_TSDIN7 WMT_PIN(5, 15)
  148. #define WMT_PIN_TSSYNC WMT_PIN(5, 16)
  149. #define WMT_PIN_TSVALID WMT_PIN(5, 17)
  150. #define WMT_PIN_TSCLK WMT_PIN(5, 18)
  151. #define WMT_PIN_LCDD0 WMT_PIN(6, 0)
  152. #define WMT_PIN_LCDD1 WMT_PIN(6, 1)
  153. #define WMT_PIN_LCDD2 WMT_PIN(6, 2)
  154. #define WMT_PIN_LCDD3 WMT_PIN(6, 3)
  155. #define WMT_PIN_LCDD4 WMT_PIN(6, 4)
  156. #define WMT_PIN_LCDD5 WMT_PIN(6, 5)
  157. #define WMT_PIN_LCDD6 WMT_PIN(6, 6)
  158. #define WMT_PIN_LCDD7 WMT_PIN(6, 7)
  159. #define WMT_PIN_LCDD8 WMT_PIN(6, 8)
  160. #define WMT_PIN_LCDD9 WMT_PIN(6, 9)
  161. #define WMT_PIN_LCDD10 WMT_PIN(6, 10)
  162. #define WMT_PIN_LCDD11 WMT_PIN(6, 11)
  163. #define WMT_PIN_LCDD12 WMT_PIN(6, 12)
  164. #define WMT_PIN_LCDD13 WMT_PIN(6, 13)
  165. #define WMT_PIN_LCDD14 WMT_PIN(6, 14)
  166. #define WMT_PIN_LCDD15 WMT_PIN(6, 15)
  167. #define WMT_PIN_LCDD16 WMT_PIN(6, 16)
  168. #define WMT_PIN_LCDD17 WMT_PIN(6, 17)
  169. #define WMT_PIN_LCDCLK WMT_PIN(6, 18)
  170. #define WMT_PIN_LCDDEN WMT_PIN(6, 19)
  171. #define WMT_PIN_LCDLINE WMT_PIN(6, 20)
  172. #define WMT_PIN_LCDFRM WMT_PIN(6, 21)
  173. #define WMT_PIN_LCDBIAS WMT_PIN(6, 22)
  174. static const struct pinctrl_pin_desc vt8500_pins[] = {
  175. PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
  176. PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
  177. PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
  178. PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
  179. PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
  180. PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
  181. PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
  182. PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
  183. PINCTRL_PIN(WMT_PIN_EXTGPIO8, "extgpio8"),
  184. PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"),
  185. PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"),
  186. PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"),
  187. PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"),
  188. PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"),
  189. PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"),
  190. PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"),
  191. PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"),
  192. PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"),
  193. PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"),
  194. PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"),
  195. PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"),
  196. PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"),
  197. PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"),
  198. PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"),
  199. PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"),
  200. PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"),
  201. PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"),
  202. PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"),
  203. PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"),
  204. PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"),
  205. PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"),
  206. PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"),
  207. PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"),
  208. PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"),
  209. PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"),
  210. PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"),
  211. PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"),
  212. PINCTRL_PIN(WMT_PIN_SDCLK, "sd_clk"),
  213. PINCTRL_PIN(WMT_PIN_SDWP, "sd_wp"),
  214. PINCTRL_PIN(WMT_PIN_SDCMD, "sd_cmd"),
  215. PINCTRL_PIN(WMT_PIN_MSDATA0, "ms_data0"),
  216. PINCTRL_PIN(WMT_PIN_MSDATA1, "ms_data1"),
  217. PINCTRL_PIN(WMT_PIN_MSDATA2, "ms_data2"),
  218. PINCTRL_PIN(WMT_PIN_MSDATA3, "ms_data3"),
  219. PINCTRL_PIN(WMT_PIN_MSCLK, "ms_clk"),
  220. PINCTRL_PIN(WMT_PIN_MSBS, "ms_bs"),
  221. PINCTRL_PIN(WMT_PIN_MSINS, "ms_ins"),
  222. PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"),
  223. PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"),
  224. PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"),
  225. PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"),
  226. PINCTRL_PIN(WMT_PIN_MII0RXD0, "mii0_rxd0"),
  227. PINCTRL_PIN(WMT_PIN_MII0RXD1, "mii0_rxd1"),
  228. PINCTRL_PIN(WMT_PIN_MII0RXD2, "mii0_rxd2"),
  229. PINCTRL_PIN(WMT_PIN_MII0RXD3, "mii0_rxd3"),
  230. PINCTRL_PIN(WMT_PIN_MII0RXCLK, "mii0_rxclk"),
  231. PINCTRL_PIN(WMT_PIN_MII0RXDV, "mii0_rxdv"),
  232. PINCTRL_PIN(WMT_PIN_MII0RXERR, "mii0_rxerr"),
  233. PINCTRL_PIN(WMT_PIN_MII0PHYRST, "mii0_phyrst"),
  234. PINCTRL_PIN(WMT_PIN_MII0TXD0, "mii0_txd0"),
  235. PINCTRL_PIN(WMT_PIN_MII0TXD1, "mii0_txd1"),
  236. PINCTRL_PIN(WMT_PIN_MII0TXD2, "mii0_txd2"),
  237. PINCTRL_PIN(WMT_PIN_MII0TXD3, "mii0_txd3"),
  238. PINCTRL_PIN(WMT_PIN_MII0TXCLK, "mii0_txclk"),
  239. PINCTRL_PIN(WMT_PIN_MII0TXEN, "mii0_txen"),
  240. PINCTRL_PIN(WMT_PIN_MII0TXERR, "mii0_txerr"),
  241. PINCTRL_PIN(WMT_PIN_MII0PHYPD, "mii0_phypd"),
  242. PINCTRL_PIN(WMT_PIN_MII0COL, "mii0_col"),
  243. PINCTRL_PIN(WMT_PIN_MII0CRS, "mii0_crs"),
  244. PINCTRL_PIN(WMT_PIN_MII0MDIO, "mii0_mdio"),
  245. PINCTRL_PIN(WMT_PIN_MII0MDC, "mii0_mdc"),
  246. PINCTRL_PIN(WMT_PIN_SEECS, "see_cs"),
  247. PINCTRL_PIN(WMT_PIN_SEECK, "see_ck"),
  248. PINCTRL_PIN(WMT_PIN_SEEDI, "see_di"),
  249. PINCTRL_PIN(WMT_PIN_SEEDO, "see_do"),
  250. PINCTRL_PIN(WMT_PIN_IDEDREQ0, "ide_dreq0"),
  251. PINCTRL_PIN(WMT_PIN_IDEDREQ1, "ide_dreq1"),
  252. PINCTRL_PIN(WMT_PIN_IDEIOW, "ide_iow"),
  253. PINCTRL_PIN(WMT_PIN_IDEIOR, "ide_ior"),
  254. PINCTRL_PIN(WMT_PIN_IDEDACK, "ide_dack"),
  255. PINCTRL_PIN(WMT_PIN_IDEIORDY, "ide_iordy"),
  256. PINCTRL_PIN(WMT_PIN_IDEINTRQ, "ide_intrq"),
  257. PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
  258. PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
  259. PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
  260. PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
  261. PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
  262. PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
  263. PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
  264. PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
  265. PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
  266. PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
  267. PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
  268. PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
  269. PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
  270. PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
  271. PINCTRL_PIN(WMT_PIN_NANDCLE0, "nand_cle0"),
  272. PINCTRL_PIN(WMT_PIN_NANDCLE1, "nand_cle1"),
  273. PINCTRL_PIN(WMT_PIN_VDOUT6_7, "vdout6_7"),
  274. PINCTRL_PIN(WMT_PIN_VHSYNC, "vhsync"),
  275. PINCTRL_PIN(WMT_PIN_VVSYNC, "vvsync"),
  276. PINCTRL_PIN(WMT_PIN_TSDIN0, "tsdin0"),
  277. PINCTRL_PIN(WMT_PIN_TSDIN1, "tsdin1"),
  278. PINCTRL_PIN(WMT_PIN_TSDIN2, "tsdin2"),
  279. PINCTRL_PIN(WMT_PIN_TSDIN3, "tsdin3"),
  280. PINCTRL_PIN(WMT_PIN_TSDIN4, "tsdin4"),
  281. PINCTRL_PIN(WMT_PIN_TSDIN5, "tsdin5"),
  282. PINCTRL_PIN(WMT_PIN_TSDIN6, "tsdin6"),
  283. PINCTRL_PIN(WMT_PIN_TSDIN7, "tsdin7"),
  284. PINCTRL_PIN(WMT_PIN_TSSYNC, "tssync"),
  285. PINCTRL_PIN(WMT_PIN_TSVALID, "tsvalid"),
  286. PINCTRL_PIN(WMT_PIN_TSCLK, "tsclk"),
  287. PINCTRL_PIN(WMT_PIN_LCDD0, "lcd_d0"),
  288. PINCTRL_PIN(WMT_PIN_LCDD1, "lcd_d1"),
  289. PINCTRL_PIN(WMT_PIN_LCDD2, "lcd_d2"),
  290. PINCTRL_PIN(WMT_PIN_LCDD3, "lcd_d3"),
  291. PINCTRL_PIN(WMT_PIN_LCDD4, "lcd_d4"),
  292. PINCTRL_PIN(WMT_PIN_LCDD5, "lcd_d5"),
  293. PINCTRL_PIN(WMT_PIN_LCDD6, "lcd_d6"),
  294. PINCTRL_PIN(WMT_PIN_LCDD7, "lcd_d7"),
  295. PINCTRL_PIN(WMT_PIN_LCDD8, "lcd_d8"),
  296. PINCTRL_PIN(WMT_PIN_LCDD9, "lcd_d9"),
  297. PINCTRL_PIN(WMT_PIN_LCDD10, "lcd_d10"),
  298. PINCTRL_PIN(WMT_PIN_LCDD11, "lcd_d11"),
  299. PINCTRL_PIN(WMT_PIN_LCDD12, "lcd_d12"),
  300. PINCTRL_PIN(WMT_PIN_LCDD13, "lcd_d13"),
  301. PINCTRL_PIN(WMT_PIN_LCDD14, "lcd_d14"),
  302. PINCTRL_PIN(WMT_PIN_LCDD15, "lcd_d15"),
  303. PINCTRL_PIN(WMT_PIN_LCDD16, "lcd_d16"),
  304. PINCTRL_PIN(WMT_PIN_LCDD17, "lcd_d17"),
  305. PINCTRL_PIN(WMT_PIN_LCDCLK, "lcd_clk"),
  306. PINCTRL_PIN(WMT_PIN_LCDDEN, "lcd_den"),
  307. PINCTRL_PIN(WMT_PIN_LCDLINE, "lcd_line"),
  308. PINCTRL_PIN(WMT_PIN_LCDFRM, "lcd_frm"),
  309. PINCTRL_PIN(WMT_PIN_LCDBIAS, "lcd_bias"),
  310. };
  311. /* Order of these names must match the above list */
  312. static const char * const vt8500_groups[] = {
  313. "extgpio0",
  314. "extgpio1",
  315. "extgpio2",
  316. "extgpio3",
  317. "extgpio4",
  318. "extgpio5",
  319. "extgpio6",
  320. "extgpio7",
  321. "extgpio8",
  322. "uart0_rts",
  323. "uart0_txd",
  324. "uart0_cts",
  325. "uart0_rxd",
  326. "uart1_rts",
  327. "uart1_txd",
  328. "uart1_cts",
  329. "uart1_rxd",
  330. "spi0_clk",
  331. "spi0_ss",
  332. "spi0_miso",
  333. "spi0_mosi",
  334. "spi1_clk",
  335. "spi1_ss",
  336. "spi1_miso",
  337. "spi1_mosi",
  338. "spi2_clk",
  339. "spi2_ss",
  340. "spi2_miso",
  341. "spi2_mosi",
  342. "sd_data0",
  343. "sd_data1",
  344. "sd_data2",
  345. "sd_data3",
  346. "mmc_data0",
  347. "mmc_data1",
  348. "mmc_data2",
  349. "mmc_data3",
  350. "sd_clk",
  351. "sd_wp",
  352. "sd_cmd",
  353. "ms_data0",
  354. "ms_data1",
  355. "ms_data2",
  356. "ms_data3",
  357. "ms_clk",
  358. "ms_bs",
  359. "ms_ins",
  360. "i2c0_scl",
  361. "i2c0_sda",
  362. "i2c1_scl",
  363. "i2c1_sda",
  364. "mii0_rxd0",
  365. "mii0_rxd1",
  366. "mii0_rxd2",
  367. "mii0_rxd3",
  368. "mii0_rxclk",
  369. "mii0_rxdv",
  370. "mii0_rxerr",
  371. "mii0_phyrst",
  372. "mii0_txd0",
  373. "mii0_txd1",
  374. "mii0_txd2",
  375. "mii0_txd3",
  376. "mii0_txclk",
  377. "mii0_txen",
  378. "mii0_txerr",
  379. "mii0_phypd",
  380. "mii0_col",
  381. "mii0_crs",
  382. "mii0_mdio",
  383. "mii0_mdc",
  384. "see_cs",
  385. "see_ck",
  386. "see_di",
  387. "see_do",
  388. "ide_dreq0",
  389. "ide_dreq1",
  390. "ide_iow",
  391. "ide_ior",
  392. "ide_dack",
  393. "ide_iordy",
  394. "ide_intrq",
  395. "vdin0",
  396. "vdin1",
  397. "vdin2",
  398. "vdin3",
  399. "vdin4",
  400. "vdin5",
  401. "vdin6",
  402. "vdin7",
  403. "vdout0",
  404. "vdout1",
  405. "vdout2",
  406. "vdout3",
  407. "vdout4",
  408. "vdout5",
  409. "nand_cle0",
  410. "nand_cle1",
  411. "vdout6_7",
  412. "vhsync",
  413. "vvsync",
  414. "tsdin0",
  415. "tsdin1",
  416. "tsdin2",
  417. "tsdin3",
  418. "tsdin4",
  419. "tsdin5",
  420. "tsdin6",
  421. "tsdin7",
  422. "tssync",
  423. "tsvalid",
  424. "tsclk",
  425. "lcd_d0",
  426. "lcd_d1",
  427. "lcd_d2",
  428. "lcd_d3",
  429. "lcd_d4",
  430. "lcd_d5",
  431. "lcd_d6",
  432. "lcd_d7",
  433. "lcd_d8",
  434. "lcd_d9",
  435. "lcd_d10",
  436. "lcd_d11",
  437. "lcd_d12",
  438. "lcd_d13",
  439. "lcd_d14",
  440. "lcd_d15",
  441. "lcd_d16",
  442. "lcd_d17",
  443. "lcd_clk",
  444. "lcd_den",
  445. "lcd_line",
  446. "lcd_frm",
  447. "lcd_bias",
  448. };
  449. static int vt8500_pinctrl_probe(struct platform_device *pdev)
  450. {
  451. struct wmt_pinctrl_data *data;
  452. data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
  453. if (!data) {
  454. dev_err(&pdev->dev, "failed to allocate data\n");
  455. return -ENOMEM;
  456. }
  457. data->banks = vt8500_banks;
  458. data->nbanks = ARRAY_SIZE(vt8500_banks);
  459. data->pins = vt8500_pins;
  460. data->npins = ARRAY_SIZE(vt8500_pins);
  461. data->groups = vt8500_groups;
  462. data->ngroups = ARRAY_SIZE(vt8500_groups);
  463. return wmt_pinctrl_probe(pdev, data);
  464. }
  465. static int vt8500_pinctrl_remove(struct platform_device *pdev)
  466. {
  467. return wmt_pinctrl_remove(pdev);
  468. }
  469. static const struct of_device_id wmt_pinctrl_of_match[] = {
  470. { .compatible = "via,vt8500-pinctrl" },
  471. { /* sentinel */ },
  472. };
  473. static struct platform_driver wmt_pinctrl_driver = {
  474. .probe = vt8500_pinctrl_probe,
  475. .remove = vt8500_pinctrl_remove,
  476. .driver = {
  477. .name = "pinctrl-vt8500",
  478. .of_match_table = wmt_pinctrl_of_match,
  479. },
  480. };
  481. module_platform_driver(wmt_pinctrl_driver);
  482. MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>");
  483. MODULE_DESCRIPTION("VIA VT8500 Pincontrol driver");
  484. MODULE_LICENSE("GPL v2");
  485. MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);