18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Pinctrl data for Wondermedia WM8850 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 wm8850_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_WAKEUP2		WMT_PIN(0, 18)
508c2ecf20Sopenharmony_ci#define WMT_PIN_WAKEUP3		WMT_PIN(0, 19)
518c2ecf20Sopenharmony_ci#define WMT_PIN_SUSGPIO0	WMT_PIN(0, 21)
528c2ecf20Sopenharmony_ci#define WMT_PIN_SUSGPIO1	WMT_PIN(0, 22)
538c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CD		WMT_PIN(0, 28)
548c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT0		WMT_PIN(1, 0)
558c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT1		WMT_PIN(1, 1)
568c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT2		WMT_PIN(1, 2)
578c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT3		WMT_PIN(1, 3)
588c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT4		WMT_PIN(1, 4)
598c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT5		WMT_PIN(1, 5)
608c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT6		WMT_PIN(1, 6)
618c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT7		WMT_PIN(1, 7)
628c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT8		WMT_PIN(1, 8)
638c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT9		WMT_PIN(1, 9)
648c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT10		WMT_PIN(1, 10)
658c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT11		WMT_PIN(1, 11)
668c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT12		WMT_PIN(1, 12)
678c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT13		WMT_PIN(1, 13)
688c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT14		WMT_PIN(1, 14)
698c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT15		WMT_PIN(1, 15)
708c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT16		WMT_PIN(1, 16)
718c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT17		WMT_PIN(1, 17)
728c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT18		WMT_PIN(1, 18)
738c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT19		WMT_PIN(1, 19)
748c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT20		WMT_PIN(1, 20)
758c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT21		WMT_PIN(1, 21)
768c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT22		WMT_PIN(1, 22)
778c2ecf20Sopenharmony_ci#define WMT_PIN_VDOUT23		WMT_PIN(1, 23)
788c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN0		WMT_PIN(2, 0)
798c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN1		WMT_PIN(2, 1)
808c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN2		WMT_PIN(2, 2)
818c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN3		WMT_PIN(2, 3)
828c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN4		WMT_PIN(2, 4)
838c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN5		WMT_PIN(2, 5)
848c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN6		WMT_PIN(2, 6)
858c2ecf20Sopenharmony_ci#define WMT_PIN_VDIN7		WMT_PIN(2, 7)
868c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_MOSI	WMT_PIN(2, 24)
878c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_MISO	WMT_PIN(2, 25)
888c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_SS		WMT_PIN(2, 26)
898c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_CLK	WMT_PIN(2, 27)
908c2ecf20Sopenharmony_ci#define WMT_PIN_SPI0_SSB	WMT_PIN(2, 28)
918c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CLK		WMT_PIN(3, 17)
928c2ecf20Sopenharmony_ci#define WMT_PIN_SD0CMD		WMT_PIN(3, 18)
938c2ecf20Sopenharmony_ci#define WMT_PIN_SD0WP		WMT_PIN(3, 19)
948c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA0	WMT_PIN(3, 20)
958c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA1	WMT_PIN(3, 21)
968c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA2	WMT_PIN(3, 22)
978c2ecf20Sopenharmony_ci#define WMT_PIN_SD0DATA3	WMT_PIN(3, 23)
988c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA0	WMT_PIN(3, 24)
998c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA1	WMT_PIN(3, 25)
1008c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA2	WMT_PIN(3, 26)
1018c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA3	WMT_PIN(3, 27)
1028c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA4	WMT_PIN(3, 28)
1038c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA5	WMT_PIN(3, 29)
1048c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA6	WMT_PIN(3, 30)
1058c2ecf20Sopenharmony_ci#define WMT_PIN_SD1DATA7	WMT_PIN(3, 31)
1068c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0_SCL	WMT_PIN(5, 8)
1078c2ecf20Sopenharmony_ci#define WMT_PIN_I2C0_SDA	WMT_PIN(5, 9)
1088c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1_SCL	WMT_PIN(5, 10)
1098c2ecf20Sopenharmony_ci#define WMT_PIN_I2C1_SDA	WMT_PIN(5, 11)
1108c2ecf20Sopenharmony_ci#define WMT_PIN_I2C2_SCL	WMT_PIN(5, 12)
1118c2ecf20Sopenharmony_ci#define WMT_PIN_I2C2_SDA	WMT_PIN(5, 13)
1128c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_RTS	WMT_PIN(5, 16)
1138c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_TXD	WMT_PIN(5, 17)
1148c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_CTS	WMT_PIN(5, 18)
1158c2ecf20Sopenharmony_ci#define WMT_PIN_UART0_RXD	WMT_PIN(5, 19)
1168c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_RTS	WMT_PIN(5, 20)
1178c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_TXD	WMT_PIN(5, 21)
1188c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_CTS	WMT_PIN(5, 22)
1198c2ecf20Sopenharmony_ci#define WMT_PIN_UART1_RXD	WMT_PIN(5, 23)
1208c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_RTS	WMT_PIN(5, 24)
1218c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_TXD	WMT_PIN(5, 25)
1228c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_CTS	WMT_PIN(5, 26)
1238c2ecf20Sopenharmony_ci#define WMT_PIN_UART2_RXD	WMT_PIN(5, 27)
1248c2ecf20Sopenharmony_ci#define WMT_PIN_SD2WP		WMT_PIN(6, 3)
1258c2ecf20Sopenharmony_ci#define WMT_PIN_SD2CMD		WMT_PIN(6, 6)
1268c2ecf20Sopenharmony_ci#define WMT_PIN_SD2CLK		WMT_PIN(6, 7)
1278c2ecf20Sopenharmony_ci#define WMT_PIN_SD2PWR		WMT_PIN(6, 9)
1288c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CLK		WMT_PIN(7, 0)
1298c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CMD		WMT_PIN(7, 1)
1308c2ecf20Sopenharmony_ci#define WMT_PIN_SD1PWR		WMT_PIN(7, 10)
1318c2ecf20Sopenharmony_ci#define WMT_PIN_SD1WP		WMT_PIN(7, 11)
1328c2ecf20Sopenharmony_ci#define WMT_PIN_SD1CD		WMT_PIN(7, 12)
1338c2ecf20Sopenharmony_ci#define WMT_PIN_PWMOUT1		WMT_PIN(7, 26)
1348c2ecf20Sopenharmony_ci#define WMT_PIN_PWMOUT0		WMT_PIN(7, 27)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc wm8850_pins[] = {
1378c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
1388c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
1398c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
1408c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
1418c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
1428c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
1438c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
1448c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
1458c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"),
1468c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"),
1478c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"),
1488c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"),
1498c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"),
1508c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SUSGPIO1, "susgpio1"),
1518c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"),
1528c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
1538c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
1548c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
1558c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
1568c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
1578c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
1588c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"),
1598c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"),
1608c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"),
1618c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"),
1628c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"),
1638c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"),
1648c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"),
1658c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"),
1668c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"),
1678c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"),
1688c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"),
1698c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"),
1708c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"),
1718c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"),
1728c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"),
1738c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"),
1748c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"),
1758c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"),
1768c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
1778c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
1788c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
1798c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
1808c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
1818c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
1828c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
1838c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
1848c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"),
1858c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"),
1868c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"),
1878c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"),
1888c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"),
1898c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"),
1908c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"),
1918c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"),
1928c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"),
1938c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"),
1948c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"),
1958c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"),
1968c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"),
1978c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"),
1988c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"),
1998c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"),
2008c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"),
2018c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"),
2028c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"),
2038c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"),
2048c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"),
2058c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"),
2068c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"),
2078c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"),
2088c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"),
2098c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"),
2108c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"),
2118c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"),
2128c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"),
2138c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"),
2148c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"),
2158c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"),
2168c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"),
2178c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"),
2188c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"),
2198c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"),
2208c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"),
2218c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"),
2228c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"),
2238c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"),
2248c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"),
2258c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"),
2268c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"),
2278c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"),
2288c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"),
2298c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"),
2308c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"),
2318c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"),
2328c2ecf20Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"),
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* Order of these names must match the above list */
2368c2ecf20Sopenharmony_cistatic const char * const wm8850_groups[] = {
2378c2ecf20Sopenharmony_ci	"extgpio0",
2388c2ecf20Sopenharmony_ci	"extgpio1",
2398c2ecf20Sopenharmony_ci	"extgpio2",
2408c2ecf20Sopenharmony_ci	"extgpio3",
2418c2ecf20Sopenharmony_ci	"extgpio4",
2428c2ecf20Sopenharmony_ci	"extgpio5",
2438c2ecf20Sopenharmony_ci	"extgpio6",
2448c2ecf20Sopenharmony_ci	"extgpio7",
2458c2ecf20Sopenharmony_ci	"wakeup0",
2468c2ecf20Sopenharmony_ci	"wakeup1",
2478c2ecf20Sopenharmony_ci	"wakeup2",
2488c2ecf20Sopenharmony_ci	"wakeup3",
2498c2ecf20Sopenharmony_ci	"susgpio0",
2508c2ecf20Sopenharmony_ci	"susgpio1",
2518c2ecf20Sopenharmony_ci	"sd0_cd",
2528c2ecf20Sopenharmony_ci	"vdout0",
2538c2ecf20Sopenharmony_ci	"vdout1",
2548c2ecf20Sopenharmony_ci	"vdout2",
2558c2ecf20Sopenharmony_ci	"vdout3",
2568c2ecf20Sopenharmony_ci	"vdout4",
2578c2ecf20Sopenharmony_ci	"vdout5",
2588c2ecf20Sopenharmony_ci	"vdout6",
2598c2ecf20Sopenharmony_ci	"vdout7",
2608c2ecf20Sopenharmony_ci	"vdout8",
2618c2ecf20Sopenharmony_ci	"vdout9",
2628c2ecf20Sopenharmony_ci	"vdout10",
2638c2ecf20Sopenharmony_ci	"vdout11",
2648c2ecf20Sopenharmony_ci	"vdout12",
2658c2ecf20Sopenharmony_ci	"vdout13",
2668c2ecf20Sopenharmony_ci	"vdout14",
2678c2ecf20Sopenharmony_ci	"vdout15",
2688c2ecf20Sopenharmony_ci	"vdout16",
2698c2ecf20Sopenharmony_ci	"vdout17",
2708c2ecf20Sopenharmony_ci	"vdout18",
2718c2ecf20Sopenharmony_ci	"vdout19",
2728c2ecf20Sopenharmony_ci	"vdout20",
2738c2ecf20Sopenharmony_ci	"vdout21",
2748c2ecf20Sopenharmony_ci	"vdout22",
2758c2ecf20Sopenharmony_ci	"vdout23",
2768c2ecf20Sopenharmony_ci	"vdin0",
2778c2ecf20Sopenharmony_ci	"vdin1",
2788c2ecf20Sopenharmony_ci	"vdin2",
2798c2ecf20Sopenharmony_ci	"vdin3",
2808c2ecf20Sopenharmony_ci	"vdin4",
2818c2ecf20Sopenharmony_ci	"vdin5",
2828c2ecf20Sopenharmony_ci	"vdin6",
2838c2ecf20Sopenharmony_ci	"vdin7",
2848c2ecf20Sopenharmony_ci	"spi0_mosi",
2858c2ecf20Sopenharmony_ci	"spi0_miso",
2868c2ecf20Sopenharmony_ci	"spi0_ss",
2878c2ecf20Sopenharmony_ci	"spi0_clk",
2888c2ecf20Sopenharmony_ci	"spi0_ssb",
2898c2ecf20Sopenharmony_ci	"sd0_clk",
2908c2ecf20Sopenharmony_ci	"sd0_cmd",
2918c2ecf20Sopenharmony_ci	"sd0_wp",
2928c2ecf20Sopenharmony_ci	"sd0_data0",
2938c2ecf20Sopenharmony_ci	"sd0_data1",
2948c2ecf20Sopenharmony_ci	"sd0_data2",
2958c2ecf20Sopenharmony_ci	"sd0_data3",
2968c2ecf20Sopenharmony_ci	"sd1_data0",
2978c2ecf20Sopenharmony_ci	"sd1_data1",
2988c2ecf20Sopenharmony_ci	"sd1_data2",
2998c2ecf20Sopenharmony_ci	"sd1_data3",
3008c2ecf20Sopenharmony_ci	"sd1_data4",
3018c2ecf20Sopenharmony_ci	"sd1_data5",
3028c2ecf20Sopenharmony_ci	"sd1_data6",
3038c2ecf20Sopenharmony_ci	"sd1_data7",
3048c2ecf20Sopenharmony_ci	"i2c0_scl",
3058c2ecf20Sopenharmony_ci	"i2c0_sda",
3068c2ecf20Sopenharmony_ci	"i2c1_scl",
3078c2ecf20Sopenharmony_ci	"i2c1_sda",
3088c2ecf20Sopenharmony_ci	"i2c2_scl",
3098c2ecf20Sopenharmony_ci	"i2c2_sda",
3108c2ecf20Sopenharmony_ci	"uart0_rts",
3118c2ecf20Sopenharmony_ci	"uart0_txd",
3128c2ecf20Sopenharmony_ci	"uart0_cts",
3138c2ecf20Sopenharmony_ci	"uart0_rxd",
3148c2ecf20Sopenharmony_ci	"uart1_rts",
3158c2ecf20Sopenharmony_ci	"uart1_txd",
3168c2ecf20Sopenharmony_ci	"uart1_cts",
3178c2ecf20Sopenharmony_ci	"uart1_rxd",
3188c2ecf20Sopenharmony_ci	"uart2_rts",
3198c2ecf20Sopenharmony_ci	"uart2_txd",
3208c2ecf20Sopenharmony_ci	"uart2_cts",
3218c2ecf20Sopenharmony_ci	"uart2_rxd",
3228c2ecf20Sopenharmony_ci	"sd2_wp",
3238c2ecf20Sopenharmony_ci	"sd2_cmd",
3248c2ecf20Sopenharmony_ci	"sd2_clk",
3258c2ecf20Sopenharmony_ci	"sd2_pwr",
3268c2ecf20Sopenharmony_ci	"sd1_clk",
3278c2ecf20Sopenharmony_ci	"sd1_cmd",
3288c2ecf20Sopenharmony_ci	"sd1_pwr",
3298c2ecf20Sopenharmony_ci	"sd1_wp",
3308c2ecf20Sopenharmony_ci	"sd1_cd",
3318c2ecf20Sopenharmony_ci	"pwmout1",
3328c2ecf20Sopenharmony_ci	"pwmout0",
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistatic int wm8850_pinctrl_probe(struct platform_device *pdev)
3368c2ecf20Sopenharmony_ci{
3378c2ecf20Sopenharmony_ci	struct wmt_pinctrl_data *data;
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
3408c2ecf20Sopenharmony_ci	if (!data)
3418c2ecf20Sopenharmony_ci		return -ENOMEM;
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci	data->banks = wm8850_banks;
3448c2ecf20Sopenharmony_ci	data->nbanks = ARRAY_SIZE(wm8850_banks);
3458c2ecf20Sopenharmony_ci	data->pins = wm8850_pins;
3468c2ecf20Sopenharmony_ci	data->npins = ARRAY_SIZE(wm8850_pins);
3478c2ecf20Sopenharmony_ci	data->groups = wm8850_groups;
3488c2ecf20Sopenharmony_ci	data->ngroups = ARRAY_SIZE(wm8850_groups);
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	return wmt_pinctrl_probe(pdev, data);
3518c2ecf20Sopenharmony_ci}
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_cistatic const struct of_device_id wmt_pinctrl_of_match[] = {
3548c2ecf20Sopenharmony_ci	{ .compatible = "wm,wm8850-pinctrl" },
3558c2ecf20Sopenharmony_ci	{ /* sentinel */ },
3568c2ecf20Sopenharmony_ci};
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cistatic struct platform_driver wmt_pinctrl_driver = {
3598c2ecf20Sopenharmony_ci	.probe	= wm8850_pinctrl_probe,
3608c2ecf20Sopenharmony_ci	.driver = {
3618c2ecf20Sopenharmony_ci		.name	= "pinctrl-wm8850",
3628c2ecf20Sopenharmony_ci		.of_match_table	= wmt_pinctrl_of_match,
3638c2ecf20Sopenharmony_ci		.suppress_bind_attrs = true,
3648c2ecf20Sopenharmony_ci	},
3658c2ecf20Sopenharmony_ci};
3668c2ecf20Sopenharmony_cibuiltin_platform_driver(wmt_pinctrl_driver);
367