18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Pinctrl data for VIA VT8500 SoC
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/io.h>
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
118c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
128c2ecf20Sopenharmony_ci#include <linux/slab.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "pinctrl-wmt.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Describe the register offsets within the GPIO memory space
188c2ecf20Sopenharmony_ci * The dedicated external GPIO's should always be listed in bank 0
198c2ecf20Sopenharmony_ci * so they are exported in the 0..31 range which is what users
208c2ecf20Sopenharmony_ci * expect.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Do not reorder these banks as it will change the pin numbering
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_cistatic const struct wmt_pinctrl_bank_registers vt8500_banks[] = {
258c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(NO_REG, 0x3C, 0x5C, 0x7C, NO_REG, NO_REG),	/* 0 */
268c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x00, 0x20, 0x40, 0x60, NO_REG, NO_REG),	/* 1 */
278c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x04, 0x24, 0x44, 0x64, NO_REG, NO_REG),	/* 2 */
288c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x08, 0x28, 0x48, 0x68, NO_REG, NO_REG),	/* 3 */
298c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x0C, 0x2C, 0x4C, 0x6C, NO_REG, NO_REG),	/* 4 */
308c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x10, 0x30, 0x50, 0x70, NO_REG, NO_REG),	/* 5 */
318c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x14, 0x34, 0x54, 0x74, NO_REG, NO_REG),	/* 6 */
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Please keep sorted by bank/bit */
358c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO0	WMT_PIN(0, 0)
368c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO1	WMT_PIN(0, 1)
378c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO2	WMT_PIN(0, 2)
388c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO3	WMT_PIN(0, 3)
398c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO4	WMT_PIN(0, 4)
408c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO5	WMT_PIN(0, 5)
418c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO6	WMT_PIN(0, 6)
428c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO7	WMT_PIN(0, 7)
438c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO8	WMT_PIN(0, 8)
448c2ecf20Sopenharmony_ci#define WMT_PIN_UART0RTS	WMT_PIN(1, 0)
458c2ecf20Sopenharmony_ci#define WMT_PIN_UART0TXD	WMT_PIN(1, 1)
468c2ecf20Sopenharmony_ci#define WMT_PIN_UART0CTS	WMT_PIN(1, 2)
478c2ecf20Sopenharmony_ci#define WMT_PIN_UART0RXD	WMT_PIN(1, 3)
488c2ecf20Sopenharmony_ci#define WMT_PIN_UART1RTS	WMT_PIN(1, 4)
498c2ecf20Sopenharmony_ci#define WMT_PIN_UART1TXD	WMT_PIN(1, 5)
508c2ecf20Sopenharmony_ci#define WMT_PIN_UART1CTS	WMT_PIN(1, 6)
518c2ecf20Sopenharmony_ci#define WMT_PIN_UART1RXD	WMT_PIN(1, 7)
528c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0CLK		WMT_PIN(1, 8)
538c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0SS		WMT_PIN(1, 9)
548c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0MISO	WMT_PIN(1, 10)
558c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0MOSI	WMT_PIN(1, 11)
568c2ecf20Sopenharmony_ci#define WMT_PIN_SPI1CLK		WMT_PIN(1, 12)
578c2ecf20Sopenharmony_ci#define WMT_PIN_SPI1SS		WMT_PIN(1, 13)
588c2ecf20Sopenharmony_ci#define WMT_PIN_SPI1MISO	WMT_PIN(1, 14)
598c2ecf20Sopenharmony_ci#define WMT_PIN_SPI1MOSI	WMT_PIN(1, 15)
608c2ecf20Sopenharmony_ci#define WMT_PIN_SPI2CLK		WMT_PIN(1, 16)
618c2ecf20Sopenharmony_ci#define WMT_PIN_SPI2SS		WMT_PIN(1, 17)
628c2ecf20Sopenharmony_ci#define WMT_PIN_SPI2MISO	WMT_PIN(1, 18)
638c2ecf20Sopenharmony_ci#define WMT_PIN_SPI2MOSI	WMT_PIN(1, 19)
648c2ecf20Sopenharmony_ci#define WMT_PIN_SDDATA0		WMT_PIN(2, 0)
658c2ecf20Sopenharmony_ci#define WMT_PIN_SDDATA1		WMT_PIN(2, 1)
668c2ecf20Sopenharmony_ci#define WMT_PIN_SDDATA2		WMT_PIN(2, 2)
678c2ecf20Sopenharmony_ci#define WMT_PIN_SDDATA3		WMT_PIN(2, 3)
688c2ecf20Sopenharmony_ci#define WMT_PIN_MMCDATA0	WMT_PIN(2, 4)
698c2ecf20Sopenharmony_ci#define WMT_PIN_MMCDATA1	WMT_PIN(2, 5)
708c2ecf20Sopenharmony_ci#define WMT_PIN_MMCDATA2	WMT_PIN(2, 6)
718c2ecf20Sopenharmony_ci#define WMT_PIN_MMCDATA3	WMT_PIN(2, 7)
728c2ecf20Sopenharmony_ci#define WMT_PIN_SDCLK		WMT_PIN(2, 8)
738c2ecf20Sopenharmony_ci#define WMT_PIN_SDWP		WMT_PIN(2, 9)
748c2ecf20Sopenharmony_ci#define WMT_PIN_SDCMD		WMT_PIN(2, 10)
758c2ecf20Sopenharmony_ci#define WMT_PIN_MSDATA0		WMT_PIN(2, 16)
768c2ecf20Sopenharmony_ci#define WMT_PIN_MSDATA1		WMT_PIN(2, 17)
778c2ecf20Sopenharmony_ci#define WMT_PIN_MSDATA2		WMT_PIN(2, 18)
788c2ecf20Sopenharmony_ci#define WMT_PIN_MSDATA3		WMT_PIN(2, 19)
798c2ecf20Sopenharmony_ci#define WMT_PIN_MSCLK		WMT_PIN(2, 20)
808c2ecf20Sopenharmony_ci#define WMT_PIN_MSBS		WMT_PIN(2, 21)
818c2ecf20Sopenharmony_ci#define WMT_PIN_MSINS		WMT_PIN(2, 22)
828c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0SCL		WMT_PIN(2, 24)
838c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0SDA		WMT_PIN(2, 25)
848c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1SCL		WMT_PIN(2, 26)
858c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1SDA		WMT_PIN(2, 27)
868c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXD0	WMT_PIN(3, 0)
878c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXD1	WMT_PIN(3, 1)
888c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXD2	WMT_PIN(3, 2)
898c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXD3	WMT_PIN(3, 3)
908c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXCLK	WMT_PIN(3, 4)
918c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXDV	WMT_PIN(3, 5)
928c2ecf20Sopenharmony_ci#define WMT_PIN_MII0RXERR	WMT_PIN(3, 6)
938c2ecf20Sopenharmony_ci#define WMT_PIN_MII0PHYRST	WMT_PIN(3, 7)
948c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXD0	WMT_PIN(3, 8)
958c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXD1	WMT_PIN(3, 9)
968c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXD2	WMT_PIN(3, 10)
978c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXD3	WMT_PIN(3, 11)
988c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXCLK	WMT_PIN(3, 12)
998c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXEN	WMT_PIN(3, 13)
1008c2ecf20Sopenharmony_ci#define WMT_PIN_MII0TXERR	WMT_PIN(3, 14)
1018c2ecf20Sopenharmony_ci#define WMT_PIN_MII0PHYPD	WMT_PIN(3, 15)
1028c2ecf20Sopenharmony_ci#define WMT_PIN_MII0COL		WMT_PIN(3, 16)
1038c2ecf20Sopenharmony_ci#define WMT_PIN_MII0CRS		WMT_PIN(3, 17)
1048c2ecf20Sopenharmony_ci#define WMT_PIN_MII0MDIO	WMT_PIN(3, 18)
1058c2ecf20Sopenharmony_ci#define WMT_PIN_MII0MDC		WMT_PIN(3, 19)
1068c2ecf20Sopenharmony_ci#define WMT_PIN_SEECS		WMT_PIN(3, 20)
1078c2ecf20Sopenharmony_ci#define WMT_PIN_SEECK		WMT_PIN(3, 21)
1088c2ecf20Sopenharmony_ci#define WMT_PIN_SEEDI		WMT_PIN(3, 22)
1098c2ecf20Sopenharmony_ci#define WMT_PIN_SEEDO		WMT_PIN(3, 23)
1108c2ecf20Sopenharmony_ci#define WMT_PIN_IDEDREQ0	WMT_PIN(3, 24)
1118c2ecf20Sopenharmony_ci#define WMT_PIN_IDEDREQ1	WMT_PIN(3, 25)
1128c2ecf20Sopenharmony_ci#define WMT_PIN_IDEIOW		WMT_PIN(3, 26)
1138c2ecf20Sopenharmony_ci#define WMT_PIN_IDEIOR		WMT_PIN(3, 27)
1148c2ecf20Sopenharmony_ci#define WMT_PIN_IDEDACK		WMT_PIN(3, 28)
1158c2ecf20Sopenharmony_ci#define WMT_PIN_IDEIORDY	WMT_PIN(3, 29)
1168c2ecf20Sopenharmony_ci#define WMT_PIN_IDEINTRQ	WMT_PIN(3, 30)
1178c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN0		WMT_PIN(4, 0)
1188c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN1		WMT_PIN(4, 1)
1198c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN2		WMT_PIN(4, 2)
1208c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN3		WMT_PIN(4, 3)
1218c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN4		WMT_PIN(4, 4)
1228c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN5		WMT_PIN(4, 5)
1238c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN6		WMT_PIN(4, 6)
1248c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN7		WMT_PIN(4, 7)
1258c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT0		WMT_PIN(4, 8)
1268c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT1		WMT_PIN(4, 9)
1278c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT2		WMT_PIN(4, 10)
1288c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT3		WMT_PIN(4, 11)
1298c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT4		WMT_PIN(4, 12)
1308c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT5		WMT_PIN(4, 13)
1318c2ecf20Sopenharmony_ci#define WMT_PIN_NANDCLE0	WMT_PIN(4, 14)
1328c2ecf20Sopenharmony_ci#define WMT_PIN_NANDCLE1	WMT_PIN(4, 15)
1338c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT6_7	WMT_PIN(4, 16)
1348c2ecf20Sopenharmony_ci#define WMT_PIN_VHSYNC		WMT_PIN(4, 17)
1358c2ecf20Sopenharmony_ci#define WMT_PIN_VVSYNC		WMT_PIN(4, 18)
1368c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN0		WMT_PIN(5, 8)
1378c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN1		WMT_PIN(5, 9)
1388c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN2		WMT_PIN(5, 10)
1398c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN3		WMT_PIN(5, 11)
1408c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN4		WMT_PIN(5, 12)
1418c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN5		WMT_PIN(5, 13)
1428c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN6		WMT_PIN(5, 14)
1438c2ecf20Sopenharmony_ci#define WMT_PIN_TSDIN7		WMT_PIN(5, 15)
1448c2ecf20Sopenharmony_ci#define WMT_PIN_TSSYNC		WMT_PIN(5, 16)
1458c2ecf20Sopenharmony_ci#define WMT_PIN_TSVALID		WMT_PIN(5, 17)
1468c2ecf20Sopenharmony_ci#define WMT_PIN_TSCLK		WMT_PIN(5, 18)
1478c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD0		WMT_PIN(6, 0)
1488c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD1		WMT_PIN(6, 1)
1498c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD2		WMT_PIN(6, 2)
1508c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD3		WMT_PIN(6, 3)
1518c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD4		WMT_PIN(6, 4)
1528c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD5		WMT_PIN(6, 5)
1538c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD6		WMT_PIN(6, 6)
1548c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD7		WMT_PIN(6, 7)
1558c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD8		WMT_PIN(6, 8)
1568c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD9		WMT_PIN(6, 9)
1578c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD10		WMT_PIN(6, 10)
1588c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD11		WMT_PIN(6, 11)
1598c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD12		WMT_PIN(6, 12)
1608c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD13		WMT_PIN(6, 13)
1618c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD14		WMT_PIN(6, 14)
1628c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD15		WMT_PIN(6, 15)
1638c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD16		WMT_PIN(6, 16)
1648c2ecf20Sopenharmony_ci#define WMT_PIN_LCDD17		WMT_PIN(6, 17)
1658c2ecf20Sopenharmony_ci#define WMT_PIN_LCDCLK		WMT_PIN(6, 18)
1668c2ecf20Sopenharmony_ci#define WMT_PIN_LCDDEN		WMT_PIN(6, 19)
1678c2ecf20Sopenharmony_ci#define WMT_PIN_LCDLINE		WMT_PIN(6, 20)
1688c2ecf20Sopenharmony_ci#define WMT_PIN_LCDFRM		WMT_PIN(6, 21)
1698c2ecf20Sopenharmony_ci#define WMT_PIN_LCDBIAS		WMT_PIN(6, 22)
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc vt8500_pins[] = {
1728c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
1738c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
1748c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
1758c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
1768c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
1778c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
1788c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
1798c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
1808c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO8, "extgpio8"),
1818c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"),
1828c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"),
1838c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"),
1848c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"),
1858c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"),
1868c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"),
1878c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"),
1888c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"),
1898c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"),
1908c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"),
1918c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"),
1928c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"),
1938c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"),
1948c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"),
1958c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"),
1968c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"),
1978c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"),
1988c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"),
1998c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"),
2008c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"),
2018c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"),
2028c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"),
2038c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"),
2048c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"),
2058c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"),
2068c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"),
2078c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"),
2088c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"),
2098c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDCLK, "sd_clk"),
2108c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDWP, "sd_wp"),
2118c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SDCMD, "sd_cmd"),
2128c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSDATA0, "ms_data0"),
2138c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSDATA1, "ms_data1"),
2148c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSDATA2, "ms_data2"),
2158c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSDATA3, "ms_data3"),
2168c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSCLK, "ms_clk"),
2178c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSBS, "ms_bs"),
2188c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MSINS, "ms_ins"),
2198c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"),
2208c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"),
2218c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"),
2228c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"),
2238c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXD0, "mii0_rxd0"),
2248c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXD1, "mii0_rxd1"),
2258c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXD2, "mii0_rxd2"),
2268c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXD3, "mii0_rxd3"),
2278c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXCLK, "mii0_rxclk"),
2288c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXDV, "mii0_rxdv"),
2298c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0RXERR, "mii0_rxerr"),
2308c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0PHYRST, "mii0_phyrst"),
2318c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXD0, "mii0_txd0"),
2328c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXD1, "mii0_txd1"),
2338c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXD2, "mii0_txd2"),
2348c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXD3, "mii0_txd3"),
2358c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXCLK, "mii0_txclk"),
2368c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXEN, "mii0_txen"),
2378c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0TXERR, "mii0_txerr"),
2388c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0PHYPD, "mii0_phypd"),
2398c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0COL, "mii0_col"),
2408c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0CRS, "mii0_crs"),
2418c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0MDIO, "mii0_mdio"),
2428c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_MII0MDC, "mii0_mdc"),
2438c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SEECS, "see_cs"),
2448c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SEECK, "see_ck"),
2458c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SEEDI, "see_di"),
2468c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SEEDO, "see_do"),
2478c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEDREQ0, "ide_dreq0"),
2488c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEDREQ1, "ide_dreq1"),
2498c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEIOW, "ide_iow"),
2508c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEIOR, "ide_ior"),
2518c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEDACK, "ide_dack"),
2528c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEIORDY, "ide_iordy"),
2538c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_IDEINTRQ, "ide_intrq"),
2548c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
2558c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
2568c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
2578c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
2588c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
2598c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
2608c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
2618c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
2628c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
2638c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
2648c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
2658c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
2668c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
2678c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
2688c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_NANDCLE0, "nand_cle0"),
2698c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_NANDCLE1, "nand_cle1"),
2708c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT6_7, "vdout6_7"),
2718c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VHSYNC, "vhsync"),
2728c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VVSYNC, "vvsync"),
2738c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN0, "tsdin0"),
2748c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN1, "tsdin1"),
2758c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN2, "tsdin2"),
2768c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN3, "tsdin3"),
2778c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN4, "tsdin4"),
2788c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN5, "tsdin5"),
2798c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN6, "tsdin6"),
2808c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSDIN7, "tsdin7"),
2818c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSSYNC, "tssync"),
2828c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSVALID, "tsvalid"),
2838c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_TSCLK, "tsclk"),
2848c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD0, "lcd_d0"),
2858c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD1, "lcd_d1"),
2868c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD2, "lcd_d2"),
2878c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD3, "lcd_d3"),
2888c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD4, "lcd_d4"),
2898c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD5, "lcd_d5"),
2908c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD6, "lcd_d6"),
2918c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD7, "lcd_d7"),
2928c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD8, "lcd_d8"),
2938c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD9, "lcd_d9"),
2948c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD10, "lcd_d10"),
2958c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD11, "lcd_d11"),
2968c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD12, "lcd_d12"),
2978c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD13, "lcd_d13"),
2988c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD14, "lcd_d14"),
2998c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD15, "lcd_d15"),
3008c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD16, "lcd_d16"),
3018c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDD17, "lcd_d17"),
3028c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDCLK, "lcd_clk"),
3038c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDDEN, "lcd_den"),
3048c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDLINE, "lcd_line"),
3058c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDFRM, "lcd_frm"),
3068c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_LCDBIAS, "lcd_bias"),
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* Order of these names must match the above list */
3108c2ecf20Sopenharmony_cistatic const char * const vt8500_groups[] = {
3118c2ecf20Sopenharmony_ci	"extgpio0",
3128c2ecf20Sopenharmony_ci	"extgpio1",
3138c2ecf20Sopenharmony_ci	"extgpio2",
3148c2ecf20Sopenharmony_ci	"extgpio3",
3158c2ecf20Sopenharmony_ci	"extgpio4",
3168c2ecf20Sopenharmony_ci	"extgpio5",
3178c2ecf20Sopenharmony_ci	"extgpio6",
3188c2ecf20Sopenharmony_ci	"extgpio7",
3198c2ecf20Sopenharmony_ci	"extgpio8",
3208c2ecf20Sopenharmony_ci	"uart0_rts",
3218c2ecf20Sopenharmony_ci	"uart0_txd",
3228c2ecf20Sopenharmony_ci	"uart0_cts",
3238c2ecf20Sopenharmony_ci	"uart0_rxd",
3248c2ecf20Sopenharmony_ci	"uart1_rts",
3258c2ecf20Sopenharmony_ci	"uart1_txd",
3268c2ecf20Sopenharmony_ci	"uart1_cts",
3278c2ecf20Sopenharmony_ci	"uart1_rxd",
3288c2ecf20Sopenharmony_ci	"spi0_clk",
3298c2ecf20Sopenharmony_ci	"spi0_ss",
3308c2ecf20Sopenharmony_ci	"spi0_miso",
3318c2ecf20Sopenharmony_ci	"spi0_mosi",
3328c2ecf20Sopenharmony_ci	"spi1_clk",
3338c2ecf20Sopenharmony_ci	"spi1_ss",
3348c2ecf20Sopenharmony_ci	"spi1_miso",
3358c2ecf20Sopenharmony_ci	"spi1_mosi",
3368c2ecf20Sopenharmony_ci	"spi2_clk",
3378c2ecf20Sopenharmony_ci	"spi2_ss",
3388c2ecf20Sopenharmony_ci	"spi2_miso",
3398c2ecf20Sopenharmony_ci	"spi2_mosi",
3408c2ecf20Sopenharmony_ci	"sd_data0",
3418c2ecf20Sopenharmony_ci	"sd_data1",
3428c2ecf20Sopenharmony_ci	"sd_data2",
3438c2ecf20Sopenharmony_ci	"sd_data3",
3448c2ecf20Sopenharmony_ci	"mmc_data0",
3458c2ecf20Sopenharmony_ci	"mmc_data1",
3468c2ecf20Sopenharmony_ci	"mmc_data2",
3478c2ecf20Sopenharmony_ci	"mmc_data3",
3488c2ecf20Sopenharmony_ci	"sd_clk",
3498c2ecf20Sopenharmony_ci	"sd_wp",
3508c2ecf20Sopenharmony_ci	"sd_cmd",
3518c2ecf20Sopenharmony_ci	"ms_data0",
3528c2ecf20Sopenharmony_ci	"ms_data1",
3538c2ecf20Sopenharmony_ci	"ms_data2",
3548c2ecf20Sopenharmony_ci	"ms_data3",
3558c2ecf20Sopenharmony_ci	"ms_clk",
3568c2ecf20Sopenharmony_ci	"ms_bs",
3578c2ecf20Sopenharmony_ci	"ms_ins",
3588c2ecf20Sopenharmony_ci	"i2c0_scl",
3598c2ecf20Sopenharmony_ci	"i2c0_sda",
3608c2ecf20Sopenharmony_ci	"i2c1_scl",
3618c2ecf20Sopenharmony_ci	"i2c1_sda",
3628c2ecf20Sopenharmony_ci	"mii0_rxd0",
3638c2ecf20Sopenharmony_ci	"mii0_rxd1",
3648c2ecf20Sopenharmony_ci	"mii0_rxd2",
3658c2ecf20Sopenharmony_ci	"mii0_rxd3",
3668c2ecf20Sopenharmony_ci	"mii0_rxclk",
3678c2ecf20Sopenharmony_ci	"mii0_rxdv",
3688c2ecf20Sopenharmony_ci	"mii0_rxerr",
3698c2ecf20Sopenharmony_ci	"mii0_phyrst",
3708c2ecf20Sopenharmony_ci	"mii0_txd0",
3718c2ecf20Sopenharmony_ci	"mii0_txd1",
3728c2ecf20Sopenharmony_ci	"mii0_txd2",
3738c2ecf20Sopenharmony_ci	"mii0_txd3",
3748c2ecf20Sopenharmony_ci	"mii0_txclk",
3758c2ecf20Sopenharmony_ci	"mii0_txen",
3768c2ecf20Sopenharmony_ci	"mii0_txerr",
3778c2ecf20Sopenharmony_ci	"mii0_phypd",
3788c2ecf20Sopenharmony_ci	"mii0_col",
3798c2ecf20Sopenharmony_ci	"mii0_crs",
3808c2ecf20Sopenharmony_ci	"mii0_mdio",
3818c2ecf20Sopenharmony_ci	"mii0_mdc",
3828c2ecf20Sopenharmony_ci	"see_cs",
3838c2ecf20Sopenharmony_ci	"see_ck",
3848c2ecf20Sopenharmony_ci	"see_di",
3858c2ecf20Sopenharmony_ci	"see_do",
3868c2ecf20Sopenharmony_ci	"ide_dreq0",
3878c2ecf20Sopenharmony_ci	"ide_dreq1",
3888c2ecf20Sopenharmony_ci	"ide_iow",
3898c2ecf20Sopenharmony_ci	"ide_ior",
3908c2ecf20Sopenharmony_ci	"ide_dack",
3918c2ecf20Sopenharmony_ci	"ide_iordy",
3928c2ecf20Sopenharmony_ci	"ide_intrq",
3938c2ecf20Sopenharmony_ci	"vdin0",
3948c2ecf20Sopenharmony_ci	"vdin1",
3958c2ecf20Sopenharmony_ci	"vdin2",
3968c2ecf20Sopenharmony_ci	"vdin3",
3978c2ecf20Sopenharmony_ci	"vdin4",
3988c2ecf20Sopenharmony_ci	"vdin5",
3998c2ecf20Sopenharmony_ci	"vdin6",
4008c2ecf20Sopenharmony_ci	"vdin7",
4018c2ecf20Sopenharmony_ci	"vdout0",
4028c2ecf20Sopenharmony_ci	"vdout1",
4038c2ecf20Sopenharmony_ci	"vdout2",
4048c2ecf20Sopenharmony_ci	"vdout3",
4058c2ecf20Sopenharmony_ci	"vdout4",
4068c2ecf20Sopenharmony_ci	"vdout5",
4078c2ecf20Sopenharmony_ci	"nand_cle0",
4088c2ecf20Sopenharmony_ci	"nand_cle1",
4098c2ecf20Sopenharmony_ci	"vdout6_7",
4108c2ecf20Sopenharmony_ci	"vhsync",
4118c2ecf20Sopenharmony_ci	"vvsync",
4128c2ecf20Sopenharmony_ci	"tsdin0",
4138c2ecf20Sopenharmony_ci	"tsdin1",
4148c2ecf20Sopenharmony_ci	"tsdin2",
4158c2ecf20Sopenharmony_ci	"tsdin3",
4168c2ecf20Sopenharmony_ci	"tsdin4",
4178c2ecf20Sopenharmony_ci	"tsdin5",
4188c2ecf20Sopenharmony_ci	"tsdin6",
4198c2ecf20Sopenharmony_ci	"tsdin7",
4208c2ecf20Sopenharmony_ci	"tssync",
4218c2ecf20Sopenharmony_ci	"tsvalid",
4228c2ecf20Sopenharmony_ci	"tsclk",
4238c2ecf20Sopenharmony_ci	"lcd_d0",
4248c2ecf20Sopenharmony_ci	"lcd_d1",
4258c2ecf20Sopenharmony_ci	"lcd_d2",
4268c2ecf20Sopenharmony_ci	"lcd_d3",
4278c2ecf20Sopenharmony_ci	"lcd_d4",
4288c2ecf20Sopenharmony_ci	"lcd_d5",
4298c2ecf20Sopenharmony_ci	"lcd_d6",
4308c2ecf20Sopenharmony_ci	"lcd_d7",
4318c2ecf20Sopenharmony_ci	"lcd_d8",
4328c2ecf20Sopenharmony_ci	"lcd_d9",
4338c2ecf20Sopenharmony_ci	"lcd_d10",
4348c2ecf20Sopenharmony_ci	"lcd_d11",
4358c2ecf20Sopenharmony_ci	"lcd_d12",
4368c2ecf20Sopenharmony_ci	"lcd_d13",
4378c2ecf20Sopenharmony_ci	"lcd_d14",
4388c2ecf20Sopenharmony_ci	"lcd_d15",
4398c2ecf20Sopenharmony_ci	"lcd_d16",
4408c2ecf20Sopenharmony_ci	"lcd_d17",
4418c2ecf20Sopenharmony_ci	"lcd_clk",
4428c2ecf20Sopenharmony_ci	"lcd_den",
4438c2ecf20Sopenharmony_ci	"lcd_line",
4448c2ecf20Sopenharmony_ci	"lcd_frm",
4458c2ecf20Sopenharmony_ci	"lcd_bias",
4468c2ecf20Sopenharmony_ci};
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cistatic int vt8500_pinctrl_probe(struct platform_device *pdev)
4498c2ecf20Sopenharmony_ci{
4508c2ecf20Sopenharmony_ci	struct wmt_pinctrl_data *data;
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
4538c2ecf20Sopenharmony_ci	if (!data)
4548c2ecf20Sopenharmony_ci		return -ENOMEM;
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci	data->banks = vt8500_banks;
4578c2ecf20Sopenharmony_ci	data->nbanks = ARRAY_SIZE(vt8500_banks);
4588c2ecf20Sopenharmony_ci	data->pins = vt8500_pins;
4598c2ecf20Sopenharmony_ci	data->npins = ARRAY_SIZE(vt8500_pins);
4608c2ecf20Sopenharmony_ci	data->groups = vt8500_groups;
4618c2ecf20Sopenharmony_ci	data->ngroups = ARRAY_SIZE(vt8500_groups);
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci	return wmt_pinctrl_probe(pdev, data);
4648c2ecf20Sopenharmony_ci}
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_cistatic const struct of_device_id wmt_pinctrl_of_match[] = {
4678c2ecf20Sopenharmony_ci	{ .compatible = "via,vt8500-pinctrl" },
4688c2ecf20Sopenharmony_ci	{ /* sentinel */ },
4698c2ecf20Sopenharmony_ci};
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_cistatic struct platform_driver wmt_pinctrl_driver = {
4728c2ecf20Sopenharmony_ci	.probe	= vt8500_pinctrl_probe,
4738c2ecf20Sopenharmony_ci	.driver = {
4748c2ecf20Sopenharmony_ci		.name	= "pinctrl-vt8500",
4758c2ecf20Sopenharmony_ci		.of_match_table	= wmt_pinctrl_of_match,
4768c2ecf20Sopenharmony_ci		.suppress_bind_attrs = true,
4778c2ecf20Sopenharmony_ci	},
4788c2ecf20Sopenharmony_ci};
4798c2ecf20Sopenharmony_cibuiltin_platform_driver(wmt_pinctrl_driver);
480