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