18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Pinctrl data for Wondermedia WM8750 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 wm8750_banks[] = {
258c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0),	/* 0 */
268c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4),	/* 1 */
278c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8),	/* 2 */
288c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC),	/* 3 */
298c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0),	/* 4 */
308c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4),	/* 5 */
318c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8),	/* 6 */
328c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC),	/* 7 */
338c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0),	/* 8 */
348c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0),	/* 9 */
358c2ecf20Sopenharmony_ci	WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC),	/* 10 */
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Please keep sorted by bank/bit */
398c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO0	WMT_PIN(0, 0)
408c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO1	WMT_PIN(0, 1)
418c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO2	WMT_PIN(0, 2)
428c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO3	WMT_PIN(0, 3)
438c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO4	WMT_PIN(0, 4)
448c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO5	WMT_PIN(0, 5)
458c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO6	WMT_PIN(0, 6)
468c2ecf20Sopenharmony_ci#define WMT_PIN_EXTGPIO7	WMT_PIN(0, 7)
478c2ecf20Sopenharmony_ci#define WMT_PIN_WAKEUP0		WMT_PIN(0, 16)
488c2ecf20Sopenharmony_ci#define WMT_PIN_WAKEUP1		WMT_PIN(0, 17)
498c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CD		WMT_PIN(0, 28)
508c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT0		WMT_PIN(1, 0)
518c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT1		WMT_PIN(1, 1)
528c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT2		WMT_PIN(1, 2)
538c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT3		WMT_PIN(1, 3)
548c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT4		WMT_PIN(1, 4)
558c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT5		WMT_PIN(1, 5)
568c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT6		WMT_PIN(1, 6)
578c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT7		WMT_PIN(1, 7)
588c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT8		WMT_PIN(1, 8)
598c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT9		WMT_PIN(1, 9)
608c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT10		WMT_PIN(1, 10)
618c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT11		WMT_PIN(1, 11)
628c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT12		WMT_PIN(1, 12)
638c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT13		WMT_PIN(1, 13)
648c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT14		WMT_PIN(1, 14)
658c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT15		WMT_PIN(1, 15)
668c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT16		WMT_PIN(1, 16)
678c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT17		WMT_PIN(1, 17)
688c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT18		WMT_PIN(1, 18)
698c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT19		WMT_PIN(1, 19)
708c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT20		WMT_PIN(1, 20)
718c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT21		WMT_PIN(1, 21)
728c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT22		WMT_PIN(1, 22)
738c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT23		WMT_PIN(1, 23)
748c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN0		WMT_PIN(2, 0)
758c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN1		WMT_PIN(2, 1)
768c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN2		WMT_PIN(2, 2)
778c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN3		WMT_PIN(2, 3)
788c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN4		WMT_PIN(2, 4)
798c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN5		WMT_PIN(2, 5)
808c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN6		WMT_PIN(2, 6)
818c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN7		WMT_PIN(2, 7)
828c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_MOSI	WMT_PIN(2, 24)
838c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_MISO	WMT_PIN(2, 25)
848c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_SS		WMT_PIN(2, 26)
858c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_CLK	WMT_PIN(2, 27)
868c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_SSB	WMT_PIN(2, 28)
878c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CLK		WMT_PIN(3, 17)
888c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CMD		WMT_PIN(3, 18)
898c2ecf20Sopenharmony_ci#define WMT_PIN_SD0WP		WMT_PIN(3, 19)
908c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA0	WMT_PIN(3, 20)
918c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA1	WMT_PIN(3, 21)
928c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA2	WMT_PIN(3, 22)
938c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA3	WMT_PIN(3, 23)
948c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA0	WMT_PIN(3, 24)
958c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA1	WMT_PIN(3, 25)
968c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA2	WMT_PIN(3, 26)
978c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA3	WMT_PIN(3, 27)
988c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA4	WMT_PIN(3, 28)
998c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA5	WMT_PIN(3, 29)
1008c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA6	WMT_PIN(3, 30)
1018c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA7	WMT_PIN(3, 31)
1028c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0_SCL	WMT_PIN(5, 8)
1038c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0_SDA	WMT_PIN(5, 9)
1048c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1_SCL	WMT_PIN(5, 10)
1058c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1_SDA	WMT_PIN(5, 11)
1068c2ecf20Sopenharmony_ci#define WMT_PIN_I2C2_SCL	WMT_PIN(5, 12)
1078c2ecf20Sopenharmony_ci#define WMT_PIN_I2C2_SDA	WMT_PIN(5, 13)
1088c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_RTS	WMT_PIN(5, 16)
1098c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_TXD	WMT_PIN(5, 17)
1108c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_CTS	WMT_PIN(5, 18)
1118c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_RXD	WMT_PIN(5, 19)
1128c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_RTS	WMT_PIN(5, 20)
1138c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_TXD	WMT_PIN(5, 21)
1148c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_CTS	WMT_PIN(5, 22)
1158c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_RXD	WMT_PIN(5, 23)
1168c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_RTS	WMT_PIN(5, 24)
1178c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_TXD	WMT_PIN(5, 25)
1188c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_CTS	WMT_PIN(5, 26)
1198c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_RXD	WMT_PIN(5, 27)
1208c2ecf20Sopenharmony_ci#define WMT_PIN_UART3_RTS	WMT_PIN(5, 28)
1218c2ecf20Sopenharmony_ci#define WMT_PIN_UART3_TXD	WMT_PIN(5, 29)
1228c2ecf20Sopenharmony_ci#define WMT_PIN_UART3_CTS	WMT_PIN(5, 30)
1238c2ecf20Sopenharmony_ci#define WMT_PIN_UART3_RXD	WMT_PIN(5, 31)
1248c2ecf20Sopenharmony_ci#define WMT_PIN_SD2CD		WMT_PIN(6, 0)
1258c2ecf20Sopenharmony_ci#define WMT_PIN_SD2DATA3	WMT_PIN(6, 1)
1268c2ecf20Sopenharmony_ci#define WMT_PIN_SD2DATA0	WMT_PIN(6, 2)
1278c2ecf20Sopenharmony_ci#define WMT_PIN_SD2WP		WMT_PIN(6, 3)
1288c2ecf20Sopenharmony_ci#define WMT_PIN_SD2DATA1	WMT_PIN(6, 4)
1298c2ecf20Sopenharmony_ci#define WMT_PIN_SD2DATA2	WMT_PIN(6, 5)
1308c2ecf20Sopenharmony_ci#define WMT_PIN_SD2CMD		WMT_PIN(6, 6)
1318c2ecf20Sopenharmony_ci#define WMT_PIN_SD2CLK		WMT_PIN(6, 7)
1328c2ecf20Sopenharmony_ci#define WMT_PIN_SD2PWR		WMT_PIN(6, 9)
1338c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CLK		WMT_PIN(7, 0)
1348c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CMD		WMT_PIN(7, 1)
1358c2ecf20Sopenharmony_ci#define WMT_PIN_SD1PWR		WMT_PIN(7, 10)
1368c2ecf20Sopenharmony_ci#define WMT_PIN_SD1WP		WMT_PIN(7, 11)
1378c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CD		WMT_PIN(7, 12)
1388c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0SS3		WMT_PIN(7, 24)
1398c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0SS2		WMT_PIN(7, 25)
1408c2ecf20Sopenharmony_ci#define WMT_PIN_PWMOUT1		WMT_PIN(7, 26)
1418c2ecf20Sopenharmony_ci#define WMT_PIN_PWMOUT0		WMT_PIN(7, 27)
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc wm8750_pins[] = {
1448c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
1458c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
1468c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
1478c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
1488c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
1498c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
1508c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
1518c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
1528c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"),
1538c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"),
1548c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"),
1558c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
1568c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
1578c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
1588c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
1598c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
1608c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
1618c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"),
1628c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"),
1638c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"),
1648c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"),
1658c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"),
1668c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"),
1678c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"),
1688c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"),
1698c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"),
1708c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"),
1718c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"),
1728c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"),
1738c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"),
1748c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"),
1758c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"),
1768c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"),
1778c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"),
1788c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"),
1798c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
1808c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
1818c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
1828c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
1838c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
1848c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
1858c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
1868c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
1878c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"),
1888c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"),
1898c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"),
1908c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"),
1918c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"),
1928c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"),
1938c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"),
1948c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"),
1958c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"),
1968c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"),
1978c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"),
1988c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"),
1998c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"),
2008c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"),
2018c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"),
2028c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"),
2038c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"),
2048c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"),
2058c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"),
2068c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"),
2078c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"),
2088c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"),
2098c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"),
2108c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"),
2118c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"),
2128c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"),
2138c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"),
2148c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"),
2158c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"),
2168c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"),
2178c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"),
2188c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"),
2198c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"),
2208c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"),
2218c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"),
2228c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"),
2238c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"),
2248c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"),
2258c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"),
2268c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"),
2278c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"),
2288c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"),
2298c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CD, "sd2_cd"),
2308c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2DATA3, "sd2_data3"),
2318c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2DATA0, "sd2_data0"),
2328c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"),
2338c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2DATA1, "sd2_data1"),
2348c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2DATA2, "sd2_data2"),
2358c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"),
2368c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"),
2378c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"),
2388c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"),
2398c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"),
2408c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"),
2418c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"),
2428c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"),
2438c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0SS3, "spi0_ss3"),
2448c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0SS2, "spi0_ss2"),
2458c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"),
2468c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"),
2478c2ecf20Sopenharmony_ci};
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/* Order of these names must match the above list */
2508c2ecf20Sopenharmony_cistatic const char * const wm8750_groups[] = {
2518c2ecf20Sopenharmony_ci	"extgpio0",
2528c2ecf20Sopenharmony_ci	"extgpio1",
2538c2ecf20Sopenharmony_ci	"extgpio2",
2548c2ecf20Sopenharmony_ci	"extgpio3",
2558c2ecf20Sopenharmony_ci	"extgpio4",
2568c2ecf20Sopenharmony_ci	"extgpio5",
2578c2ecf20Sopenharmony_ci	"extgpio6",
2588c2ecf20Sopenharmony_ci	"extgpio7",
2598c2ecf20Sopenharmony_ci	"wakeup0",
2608c2ecf20Sopenharmony_ci	"wakeup1",
2618c2ecf20Sopenharmony_ci	"sd0_cd",
2628c2ecf20Sopenharmony_ci	"vdout0",
2638c2ecf20Sopenharmony_ci	"vdout1",
2648c2ecf20Sopenharmony_ci	"vdout2",
2658c2ecf20Sopenharmony_ci	"vdout3",
2668c2ecf20Sopenharmony_ci	"vdout4",
2678c2ecf20Sopenharmony_ci	"vdout5",
2688c2ecf20Sopenharmony_ci	"vdout6",
2698c2ecf20Sopenharmony_ci	"vdout7",
2708c2ecf20Sopenharmony_ci	"vdout8",
2718c2ecf20Sopenharmony_ci	"vdout9",
2728c2ecf20Sopenharmony_ci	"vdout10",
2738c2ecf20Sopenharmony_ci	"vdout11",
2748c2ecf20Sopenharmony_ci	"vdout12",
2758c2ecf20Sopenharmony_ci	"vdout13",
2768c2ecf20Sopenharmony_ci	"vdout14",
2778c2ecf20Sopenharmony_ci	"vdout15",
2788c2ecf20Sopenharmony_ci	"vdout16",
2798c2ecf20Sopenharmony_ci	"vdout17",
2808c2ecf20Sopenharmony_ci	"vdout18",
2818c2ecf20Sopenharmony_ci	"vdout19",
2828c2ecf20Sopenharmony_ci	"vdout20",
2838c2ecf20Sopenharmony_ci	"vdout21",
2848c2ecf20Sopenharmony_ci	"vdout22",
2858c2ecf20Sopenharmony_ci	"vdout23",
2868c2ecf20Sopenharmony_ci	"vdin0",
2878c2ecf20Sopenharmony_ci	"vdin1",
2888c2ecf20Sopenharmony_ci	"vdin2",
2898c2ecf20Sopenharmony_ci	"vdin3",
2908c2ecf20Sopenharmony_ci	"vdin4",
2918c2ecf20Sopenharmony_ci	"vdin5",
2928c2ecf20Sopenharmony_ci	"vdin6",
2938c2ecf20Sopenharmony_ci	"vdin7",
2948c2ecf20Sopenharmony_ci	"spi0_mosi",
2958c2ecf20Sopenharmony_ci	"spi0_miso",
2968c2ecf20Sopenharmony_ci	"spi0_ss",
2978c2ecf20Sopenharmony_ci	"spi0_clk",
2988c2ecf20Sopenharmony_ci	"spi0_ssb",
2998c2ecf20Sopenharmony_ci	"sd0_clk",
3008c2ecf20Sopenharmony_ci	"sd0_cmd",
3018c2ecf20Sopenharmony_ci	"sd0_wp",
3028c2ecf20Sopenharmony_ci	"sd0_data0",
3038c2ecf20Sopenharmony_ci	"sd0_data1",
3048c2ecf20Sopenharmony_ci	"sd0_data2",
3058c2ecf20Sopenharmony_ci	"sd0_data3",
3068c2ecf20Sopenharmony_ci	"sd1_data0",
3078c2ecf20Sopenharmony_ci	"sd1_data1",
3088c2ecf20Sopenharmony_ci	"sd1_data2",
3098c2ecf20Sopenharmony_ci	"sd1_data3",
3108c2ecf20Sopenharmony_ci	"sd1_data4",
3118c2ecf20Sopenharmony_ci	"sd1_data5",
3128c2ecf20Sopenharmony_ci	"sd1_data6",
3138c2ecf20Sopenharmony_ci	"sd1_data7",
3148c2ecf20Sopenharmony_ci	"i2c0_scl",
3158c2ecf20Sopenharmony_ci	"i2c0_sda",
3168c2ecf20Sopenharmony_ci	"i2c1_scl",
3178c2ecf20Sopenharmony_ci	"i2c1_sda",
3188c2ecf20Sopenharmony_ci	"i2c2_scl",
3198c2ecf20Sopenharmony_ci	"i2c2_sda",
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	"uart2_rts",
3298c2ecf20Sopenharmony_ci	"uart2_txd",
3308c2ecf20Sopenharmony_ci	"uart2_cts",
3318c2ecf20Sopenharmony_ci	"uart2_rxd",
3328c2ecf20Sopenharmony_ci	"uart3_rts",
3338c2ecf20Sopenharmony_ci	"uart3_txd",
3348c2ecf20Sopenharmony_ci	"uart3_cts",
3358c2ecf20Sopenharmony_ci	"uart3_rxd",
3368c2ecf20Sopenharmony_ci	"sd2_cd",
3378c2ecf20Sopenharmony_ci	"sd2_data3",
3388c2ecf20Sopenharmony_ci	"sd2_data0",
3398c2ecf20Sopenharmony_ci	"sd2_wp",
3408c2ecf20Sopenharmony_ci	"sd2_data1",
3418c2ecf20Sopenharmony_ci	"sd2_data2",
3428c2ecf20Sopenharmony_ci	"sd2_cmd",
3438c2ecf20Sopenharmony_ci	"sd2_clk",
3448c2ecf20Sopenharmony_ci	"sd2_pwr",
3458c2ecf20Sopenharmony_ci	"sd1_clk",
3468c2ecf20Sopenharmony_ci	"sd1_cmd",
3478c2ecf20Sopenharmony_ci	"sd1_pwr",
3488c2ecf20Sopenharmony_ci	"sd1_wp",
3498c2ecf20Sopenharmony_ci	"sd1_cd",
3508c2ecf20Sopenharmony_ci	"spi0_ss3",
3518c2ecf20Sopenharmony_ci	"spi0_ss2",
3528c2ecf20Sopenharmony_ci	"pwmout1",
3538c2ecf20Sopenharmony_ci	"pwmout0",
3548c2ecf20Sopenharmony_ci};
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_cistatic int wm8750_pinctrl_probe(struct platform_device *pdev)
3578c2ecf20Sopenharmony_ci{
3588c2ecf20Sopenharmony_ci	struct wmt_pinctrl_data *data;
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
3618c2ecf20Sopenharmony_ci	if (!data)
3628c2ecf20Sopenharmony_ci		return -ENOMEM;
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci	data->banks = wm8750_banks;
3658c2ecf20Sopenharmony_ci	data->nbanks = ARRAY_SIZE(wm8750_banks);
3668c2ecf20Sopenharmony_ci	data->pins = wm8750_pins;
3678c2ecf20Sopenharmony_ci	data->npins = ARRAY_SIZE(wm8750_pins);
3688c2ecf20Sopenharmony_ci	data->groups = wm8750_groups;
3698c2ecf20Sopenharmony_ci	data->ngroups = ARRAY_SIZE(wm8750_groups);
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci	return wmt_pinctrl_probe(pdev, data);
3728c2ecf20Sopenharmony_ci}
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistatic const struct of_device_id wmt_pinctrl_of_match[] = {
3758c2ecf20Sopenharmony_ci	{ .compatible = "wm,wm8750-pinctrl" },
3768c2ecf20Sopenharmony_ci	{ /* sentinel */ },
3778c2ecf20Sopenharmony_ci};
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_cistatic struct platform_driver wmt_pinctrl_driver = {
3808c2ecf20Sopenharmony_ci	.probe	= wm8750_pinctrl_probe,
3818c2ecf20Sopenharmony_ci	.driver = {
3828c2ecf20Sopenharmony_ci		.name	= "pinctrl-wm8750",
3838c2ecf20Sopenharmony_ci		.of_match_table	= wmt_pinctrl_of_match,
3848c2ecf20Sopenharmony_ci		.suppress_bind_attrs = true,
3858c2ecf20Sopenharmony_ci	},
3868c2ecf20Sopenharmony_ci};
3878c2ecf20Sopenharmony_cibuiltin_platform_driver(wmt_pinctrl_driver);
388