162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Pinctrl data for Wondermedia WM8850 SoC
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/io.h>
962306a36Sopenharmony_ci#include <linux/init.h>
1062306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1162306a36Sopenharmony_ci#include <linux/platform_device.h>
1262306a36Sopenharmony_ci#include <linux/slab.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include "pinctrl-wmt.h"
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * Describe the register offsets within the GPIO memory space
1862306a36Sopenharmony_ci * The dedicated external GPIO's should always be listed in bank 0
1962306a36Sopenharmony_ci * so they are exported in the 0..31 range which is what users
2062306a36Sopenharmony_ci * expect.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Do not reorder these banks as it will change the pin numbering
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_cistatic const struct wmt_pinctrl_bank_registers wm8850_banks[] = {
2562306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0),		/* 0 */
2662306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4),		/* 1 */
2762306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8),		/* 2 */
2862306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC),		/* 3 */
2962306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0),		/* 4 */
3062306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4),		/* 5 */
3162306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8),		/* 6 */
3262306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC),		/* 7 */
3362306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0),		/* 8 */
3462306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0),		/* 9 */
3562306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC),		/* 10 */
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* Please keep sorted by bank/bit */
3962306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO0	WMT_PIN(0, 0)
4062306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO1	WMT_PIN(0, 1)
4162306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO2	WMT_PIN(0, 2)
4262306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO3	WMT_PIN(0, 3)
4362306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO4	WMT_PIN(0, 4)
4462306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO5	WMT_PIN(0, 5)
4562306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO6	WMT_PIN(0, 6)
4662306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO7	WMT_PIN(0, 7)
4762306a36Sopenharmony_ci#define WMT_PIN_WAKEUP0		WMT_PIN(0, 16)
4862306a36Sopenharmony_ci#define WMT_PIN_WAKEUP1		WMT_PIN(0, 17)
4962306a36Sopenharmony_ci#define WMT_PIN_WAKEUP2		WMT_PIN(0, 18)
5062306a36Sopenharmony_ci#define WMT_PIN_WAKEUP3		WMT_PIN(0, 19)
5162306a36Sopenharmony_ci#define WMT_PIN_SUSGPIO0	WMT_PIN(0, 21)
5262306a36Sopenharmony_ci#define WMT_PIN_SUSGPIO1	WMT_PIN(0, 22)
5362306a36Sopenharmony_ci#define WMT_PIN_SD0CD		WMT_PIN(0, 28)
5462306a36Sopenharmony_ci#define WMT_PIN_VDOUT0		WMT_PIN(1, 0)
5562306a36Sopenharmony_ci#define WMT_PIN_VDOUT1		WMT_PIN(1, 1)
5662306a36Sopenharmony_ci#define WMT_PIN_VDOUT2		WMT_PIN(1, 2)
5762306a36Sopenharmony_ci#define WMT_PIN_VDOUT3		WMT_PIN(1, 3)
5862306a36Sopenharmony_ci#define WMT_PIN_VDOUT4		WMT_PIN(1, 4)
5962306a36Sopenharmony_ci#define WMT_PIN_VDOUT5		WMT_PIN(1, 5)
6062306a36Sopenharmony_ci#define WMT_PIN_VDOUT6		WMT_PIN(1, 6)
6162306a36Sopenharmony_ci#define WMT_PIN_VDOUT7		WMT_PIN(1, 7)
6262306a36Sopenharmony_ci#define WMT_PIN_VDOUT8		WMT_PIN(1, 8)
6362306a36Sopenharmony_ci#define WMT_PIN_VDOUT9		WMT_PIN(1, 9)
6462306a36Sopenharmony_ci#define WMT_PIN_VDOUT10		WMT_PIN(1, 10)
6562306a36Sopenharmony_ci#define WMT_PIN_VDOUT11		WMT_PIN(1, 11)
6662306a36Sopenharmony_ci#define WMT_PIN_VDOUT12		WMT_PIN(1, 12)
6762306a36Sopenharmony_ci#define WMT_PIN_VDOUT13		WMT_PIN(1, 13)
6862306a36Sopenharmony_ci#define WMT_PIN_VDOUT14		WMT_PIN(1, 14)
6962306a36Sopenharmony_ci#define WMT_PIN_VDOUT15		WMT_PIN(1, 15)
7062306a36Sopenharmony_ci#define WMT_PIN_VDOUT16		WMT_PIN(1, 16)
7162306a36Sopenharmony_ci#define WMT_PIN_VDOUT17		WMT_PIN(1, 17)
7262306a36Sopenharmony_ci#define WMT_PIN_VDOUT18		WMT_PIN(1, 18)
7362306a36Sopenharmony_ci#define WMT_PIN_VDOUT19		WMT_PIN(1, 19)
7462306a36Sopenharmony_ci#define WMT_PIN_VDOUT20		WMT_PIN(1, 20)
7562306a36Sopenharmony_ci#define WMT_PIN_VDOUT21		WMT_PIN(1, 21)
7662306a36Sopenharmony_ci#define WMT_PIN_VDOUT22		WMT_PIN(1, 22)
7762306a36Sopenharmony_ci#define WMT_PIN_VDOUT23		WMT_PIN(1, 23)
7862306a36Sopenharmony_ci#define WMT_PIN_VDIN0		WMT_PIN(2, 0)
7962306a36Sopenharmony_ci#define WMT_PIN_VDIN1		WMT_PIN(2, 1)
8062306a36Sopenharmony_ci#define WMT_PIN_VDIN2		WMT_PIN(2, 2)
8162306a36Sopenharmony_ci#define WMT_PIN_VDIN3		WMT_PIN(2, 3)
8262306a36Sopenharmony_ci#define WMT_PIN_VDIN4		WMT_PIN(2, 4)
8362306a36Sopenharmony_ci#define WMT_PIN_VDIN5		WMT_PIN(2, 5)
8462306a36Sopenharmony_ci#define WMT_PIN_VDIN6		WMT_PIN(2, 6)
8562306a36Sopenharmony_ci#define WMT_PIN_VDIN7		WMT_PIN(2, 7)
8662306a36Sopenharmony_ci#define WMT_PIN_SPI0_MOSI	WMT_PIN(2, 24)
8762306a36Sopenharmony_ci#define WMT_PIN_SPI0_MISO	WMT_PIN(2, 25)
8862306a36Sopenharmony_ci#define WMT_PIN_SPI0_SS		WMT_PIN(2, 26)
8962306a36Sopenharmony_ci#define WMT_PIN_SPI0_CLK	WMT_PIN(2, 27)
9062306a36Sopenharmony_ci#define WMT_PIN_SPI0_SSB	WMT_PIN(2, 28)
9162306a36Sopenharmony_ci#define WMT_PIN_SD0CLK		WMT_PIN(3, 17)
9262306a36Sopenharmony_ci#define WMT_PIN_SD0CMD		WMT_PIN(3, 18)
9362306a36Sopenharmony_ci#define WMT_PIN_SD0WP		WMT_PIN(3, 19)
9462306a36Sopenharmony_ci#define WMT_PIN_SD0DATA0	WMT_PIN(3, 20)
9562306a36Sopenharmony_ci#define WMT_PIN_SD0DATA1	WMT_PIN(3, 21)
9662306a36Sopenharmony_ci#define WMT_PIN_SD0DATA2	WMT_PIN(3, 22)
9762306a36Sopenharmony_ci#define WMT_PIN_SD0DATA3	WMT_PIN(3, 23)
9862306a36Sopenharmony_ci#define WMT_PIN_SD1DATA0	WMT_PIN(3, 24)
9962306a36Sopenharmony_ci#define WMT_PIN_SD1DATA1	WMT_PIN(3, 25)
10062306a36Sopenharmony_ci#define WMT_PIN_SD1DATA2	WMT_PIN(3, 26)
10162306a36Sopenharmony_ci#define WMT_PIN_SD1DATA3	WMT_PIN(3, 27)
10262306a36Sopenharmony_ci#define WMT_PIN_SD1DATA4	WMT_PIN(3, 28)
10362306a36Sopenharmony_ci#define WMT_PIN_SD1DATA5	WMT_PIN(3, 29)
10462306a36Sopenharmony_ci#define WMT_PIN_SD1DATA6	WMT_PIN(3, 30)
10562306a36Sopenharmony_ci#define WMT_PIN_SD1DATA7	WMT_PIN(3, 31)
10662306a36Sopenharmony_ci#define WMT_PIN_I2C0_SCL	WMT_PIN(5, 8)
10762306a36Sopenharmony_ci#define WMT_PIN_I2C0_SDA	WMT_PIN(5, 9)
10862306a36Sopenharmony_ci#define WMT_PIN_I2C1_SCL	WMT_PIN(5, 10)
10962306a36Sopenharmony_ci#define WMT_PIN_I2C1_SDA	WMT_PIN(5, 11)
11062306a36Sopenharmony_ci#define WMT_PIN_I2C2_SCL	WMT_PIN(5, 12)
11162306a36Sopenharmony_ci#define WMT_PIN_I2C2_SDA	WMT_PIN(5, 13)
11262306a36Sopenharmony_ci#define WMT_PIN_UART0_RTS	WMT_PIN(5, 16)
11362306a36Sopenharmony_ci#define WMT_PIN_UART0_TXD	WMT_PIN(5, 17)
11462306a36Sopenharmony_ci#define WMT_PIN_UART0_CTS	WMT_PIN(5, 18)
11562306a36Sopenharmony_ci#define WMT_PIN_UART0_RXD	WMT_PIN(5, 19)
11662306a36Sopenharmony_ci#define WMT_PIN_UART1_RTS	WMT_PIN(5, 20)
11762306a36Sopenharmony_ci#define WMT_PIN_UART1_TXD	WMT_PIN(5, 21)
11862306a36Sopenharmony_ci#define WMT_PIN_UART1_CTS	WMT_PIN(5, 22)
11962306a36Sopenharmony_ci#define WMT_PIN_UART1_RXD	WMT_PIN(5, 23)
12062306a36Sopenharmony_ci#define WMT_PIN_UART2_RTS	WMT_PIN(5, 24)
12162306a36Sopenharmony_ci#define WMT_PIN_UART2_TXD	WMT_PIN(5, 25)
12262306a36Sopenharmony_ci#define WMT_PIN_UART2_CTS	WMT_PIN(5, 26)
12362306a36Sopenharmony_ci#define WMT_PIN_UART2_RXD	WMT_PIN(5, 27)
12462306a36Sopenharmony_ci#define WMT_PIN_SD2WP		WMT_PIN(6, 3)
12562306a36Sopenharmony_ci#define WMT_PIN_SD2CMD		WMT_PIN(6, 6)
12662306a36Sopenharmony_ci#define WMT_PIN_SD2CLK		WMT_PIN(6, 7)
12762306a36Sopenharmony_ci#define WMT_PIN_SD2PWR		WMT_PIN(6, 9)
12862306a36Sopenharmony_ci#define WMT_PIN_SD1CLK		WMT_PIN(7, 0)
12962306a36Sopenharmony_ci#define WMT_PIN_SD1CMD		WMT_PIN(7, 1)
13062306a36Sopenharmony_ci#define WMT_PIN_SD1PWR		WMT_PIN(7, 10)
13162306a36Sopenharmony_ci#define WMT_PIN_SD1WP		WMT_PIN(7, 11)
13262306a36Sopenharmony_ci#define WMT_PIN_SD1CD		WMT_PIN(7, 12)
13362306a36Sopenharmony_ci#define WMT_PIN_PWMOUT1		WMT_PIN(7, 26)
13462306a36Sopenharmony_ci#define WMT_PIN_PWMOUT0		WMT_PIN(7, 27)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_cistatic const struct pinctrl_pin_desc wm8850_pins[] = {
13762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
13862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
13962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
14062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
14162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
14262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
14362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
14462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
14562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"),
14662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"),
14762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"),
14862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"),
14962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"),
15062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SUSGPIO1, "susgpio1"),
15162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"),
15262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
15362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
15462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
15562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
15662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
15762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
15862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"),
15962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"),
16062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"),
16162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"),
16262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"),
16362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"),
16462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"),
16562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"),
16662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"),
16762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"),
16862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"),
16962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"),
17062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"),
17162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"),
17262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"),
17362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"),
17462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"),
17562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"),
17662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
17762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
17862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
17962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
18062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
18162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
18262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
18362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
18462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"),
18562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"),
18662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"),
18762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"),
18862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"),
18962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"),
19062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"),
19162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"),
19262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"),
19362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"),
19462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"),
19562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"),
19662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"),
19762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"),
19862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"),
19962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"),
20062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"),
20162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"),
20262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"),
20362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"),
20462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"),
20562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"),
20662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"),
20762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"),
20862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"),
20962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"),
21062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"),
21162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"),
21262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"),
21362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"),
21462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"),
21562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"),
21662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"),
21762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"),
21862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"),
21962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"),
22062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"),
22162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"),
22262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"),
22362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"),
22462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"),
22562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"),
22662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"),
22762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"),
22862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"),
22962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"),
23062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"),
23162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"),
23262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"),
23362306a36Sopenharmony_ci};
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci/* Order of these names must match the above list */
23662306a36Sopenharmony_cistatic const char * const wm8850_groups[] = {
23762306a36Sopenharmony_ci	"extgpio0",
23862306a36Sopenharmony_ci	"extgpio1",
23962306a36Sopenharmony_ci	"extgpio2",
24062306a36Sopenharmony_ci	"extgpio3",
24162306a36Sopenharmony_ci	"extgpio4",
24262306a36Sopenharmony_ci	"extgpio5",
24362306a36Sopenharmony_ci	"extgpio6",
24462306a36Sopenharmony_ci	"extgpio7",
24562306a36Sopenharmony_ci	"wakeup0",
24662306a36Sopenharmony_ci	"wakeup1",
24762306a36Sopenharmony_ci	"wakeup2",
24862306a36Sopenharmony_ci	"wakeup3",
24962306a36Sopenharmony_ci	"susgpio0",
25062306a36Sopenharmony_ci	"susgpio1",
25162306a36Sopenharmony_ci	"sd0_cd",
25262306a36Sopenharmony_ci	"vdout0",
25362306a36Sopenharmony_ci	"vdout1",
25462306a36Sopenharmony_ci	"vdout2",
25562306a36Sopenharmony_ci	"vdout3",
25662306a36Sopenharmony_ci	"vdout4",
25762306a36Sopenharmony_ci	"vdout5",
25862306a36Sopenharmony_ci	"vdout6",
25962306a36Sopenharmony_ci	"vdout7",
26062306a36Sopenharmony_ci	"vdout8",
26162306a36Sopenharmony_ci	"vdout9",
26262306a36Sopenharmony_ci	"vdout10",
26362306a36Sopenharmony_ci	"vdout11",
26462306a36Sopenharmony_ci	"vdout12",
26562306a36Sopenharmony_ci	"vdout13",
26662306a36Sopenharmony_ci	"vdout14",
26762306a36Sopenharmony_ci	"vdout15",
26862306a36Sopenharmony_ci	"vdout16",
26962306a36Sopenharmony_ci	"vdout17",
27062306a36Sopenharmony_ci	"vdout18",
27162306a36Sopenharmony_ci	"vdout19",
27262306a36Sopenharmony_ci	"vdout20",
27362306a36Sopenharmony_ci	"vdout21",
27462306a36Sopenharmony_ci	"vdout22",
27562306a36Sopenharmony_ci	"vdout23",
27662306a36Sopenharmony_ci	"vdin0",
27762306a36Sopenharmony_ci	"vdin1",
27862306a36Sopenharmony_ci	"vdin2",
27962306a36Sopenharmony_ci	"vdin3",
28062306a36Sopenharmony_ci	"vdin4",
28162306a36Sopenharmony_ci	"vdin5",
28262306a36Sopenharmony_ci	"vdin6",
28362306a36Sopenharmony_ci	"vdin7",
28462306a36Sopenharmony_ci	"spi0_mosi",
28562306a36Sopenharmony_ci	"spi0_miso",
28662306a36Sopenharmony_ci	"spi0_ss",
28762306a36Sopenharmony_ci	"spi0_clk",
28862306a36Sopenharmony_ci	"spi0_ssb",
28962306a36Sopenharmony_ci	"sd0_clk",
29062306a36Sopenharmony_ci	"sd0_cmd",
29162306a36Sopenharmony_ci	"sd0_wp",
29262306a36Sopenharmony_ci	"sd0_data0",
29362306a36Sopenharmony_ci	"sd0_data1",
29462306a36Sopenharmony_ci	"sd0_data2",
29562306a36Sopenharmony_ci	"sd0_data3",
29662306a36Sopenharmony_ci	"sd1_data0",
29762306a36Sopenharmony_ci	"sd1_data1",
29862306a36Sopenharmony_ci	"sd1_data2",
29962306a36Sopenharmony_ci	"sd1_data3",
30062306a36Sopenharmony_ci	"sd1_data4",
30162306a36Sopenharmony_ci	"sd1_data5",
30262306a36Sopenharmony_ci	"sd1_data6",
30362306a36Sopenharmony_ci	"sd1_data7",
30462306a36Sopenharmony_ci	"i2c0_scl",
30562306a36Sopenharmony_ci	"i2c0_sda",
30662306a36Sopenharmony_ci	"i2c1_scl",
30762306a36Sopenharmony_ci	"i2c1_sda",
30862306a36Sopenharmony_ci	"i2c2_scl",
30962306a36Sopenharmony_ci	"i2c2_sda",
31062306a36Sopenharmony_ci	"uart0_rts",
31162306a36Sopenharmony_ci	"uart0_txd",
31262306a36Sopenharmony_ci	"uart0_cts",
31362306a36Sopenharmony_ci	"uart0_rxd",
31462306a36Sopenharmony_ci	"uart1_rts",
31562306a36Sopenharmony_ci	"uart1_txd",
31662306a36Sopenharmony_ci	"uart1_cts",
31762306a36Sopenharmony_ci	"uart1_rxd",
31862306a36Sopenharmony_ci	"uart2_rts",
31962306a36Sopenharmony_ci	"uart2_txd",
32062306a36Sopenharmony_ci	"uart2_cts",
32162306a36Sopenharmony_ci	"uart2_rxd",
32262306a36Sopenharmony_ci	"sd2_wp",
32362306a36Sopenharmony_ci	"sd2_cmd",
32462306a36Sopenharmony_ci	"sd2_clk",
32562306a36Sopenharmony_ci	"sd2_pwr",
32662306a36Sopenharmony_ci	"sd1_clk",
32762306a36Sopenharmony_ci	"sd1_cmd",
32862306a36Sopenharmony_ci	"sd1_pwr",
32962306a36Sopenharmony_ci	"sd1_wp",
33062306a36Sopenharmony_ci	"sd1_cd",
33162306a36Sopenharmony_ci	"pwmout1",
33262306a36Sopenharmony_ci	"pwmout0",
33362306a36Sopenharmony_ci};
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_cistatic int wm8850_pinctrl_probe(struct platform_device *pdev)
33662306a36Sopenharmony_ci{
33762306a36Sopenharmony_ci	struct wmt_pinctrl_data *data;
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
34062306a36Sopenharmony_ci	if (!data)
34162306a36Sopenharmony_ci		return -ENOMEM;
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci	data->banks = wm8850_banks;
34462306a36Sopenharmony_ci	data->nbanks = ARRAY_SIZE(wm8850_banks);
34562306a36Sopenharmony_ci	data->pins = wm8850_pins;
34662306a36Sopenharmony_ci	data->npins = ARRAY_SIZE(wm8850_pins);
34762306a36Sopenharmony_ci	data->groups = wm8850_groups;
34862306a36Sopenharmony_ci	data->ngroups = ARRAY_SIZE(wm8850_groups);
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci	return wmt_pinctrl_probe(pdev, data);
35162306a36Sopenharmony_ci}
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_cistatic const struct of_device_id wmt_pinctrl_of_match[] = {
35462306a36Sopenharmony_ci	{ .compatible = "wm,wm8850-pinctrl" },
35562306a36Sopenharmony_ci	{ /* sentinel */ },
35662306a36Sopenharmony_ci};
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_cistatic struct platform_driver wmt_pinctrl_driver = {
35962306a36Sopenharmony_ci	.probe	= wm8850_pinctrl_probe,
36062306a36Sopenharmony_ci	.driver = {
36162306a36Sopenharmony_ci		.name	= "pinctrl-wm8850",
36262306a36Sopenharmony_ci		.of_match_table	= wmt_pinctrl_of_match,
36362306a36Sopenharmony_ci		.suppress_bind_attrs = true,
36462306a36Sopenharmony_ci	},
36562306a36Sopenharmony_ci};
36662306a36Sopenharmony_cibuiltin_platform_driver(wmt_pinctrl_driver);
367