xref: /linux/drivers/pinctrl/sunxi/pinctrl-sun8i-v3s.c (revision 35817d34bd07b4e1cd597e054fa2bd9c9c111aab)
156d9e4a7SIcenowy Zheng /*
256d9e4a7SIcenowy Zheng  * Allwinner V3s SoCs pinctrl driver.
356d9e4a7SIcenowy Zheng  *
456d9e4a7SIcenowy Zheng  * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
556d9e4a7SIcenowy Zheng  *
656d9e4a7SIcenowy Zheng  * Based on pinctrl-sun8i-h3.c, which is:
756d9e4a7SIcenowy Zheng  * Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
856d9e4a7SIcenowy Zheng  *
956d9e4a7SIcenowy Zheng  * Based on pinctrl-sun8i-a23.c, which is:
1056d9e4a7SIcenowy Zheng  * Copyright (C) 2014 Chen-Yu Tsai <wens@csie.org>
1156d9e4a7SIcenowy Zheng  * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
1256d9e4a7SIcenowy Zheng  *
1356d9e4a7SIcenowy Zheng  * This file is licensed under the terms of the GNU General Public
1456d9e4a7SIcenowy Zheng  * License version 2.  This program is licensed "as is" without any
1556d9e4a7SIcenowy Zheng  * warranty of any kind, whether express or implied.
1656d9e4a7SIcenowy Zheng  */
1756d9e4a7SIcenowy Zheng 
1856d9e4a7SIcenowy Zheng #include <linux/module.h>
1956d9e4a7SIcenowy Zheng #include <linux/platform_device.h>
2056d9e4a7SIcenowy Zheng #include <linux/of.h>
2156d9e4a7SIcenowy Zheng #include <linux/of_device.h>
2256d9e4a7SIcenowy Zheng #include <linux/pinctrl/pinctrl.h>
2356d9e4a7SIcenowy Zheng 
2456d9e4a7SIcenowy Zheng #include "pinctrl-sunxi.h"
2556d9e4a7SIcenowy Zheng 
2656d9e4a7SIcenowy Zheng static const struct sunxi_desc_pin sun8i_v3s_pins[] = {
2756d9e4a7SIcenowy Zheng 	/* Hole */
2856d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 0),
2956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
3056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
3156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "uart2"),		/* TX */
3256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)),	/* PB_EINT0 */
3356d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 1),
3456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
3556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
3656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "uart2"),		/* RX */
3756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)),	/* PB_EINT1 */
3856d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2),
3956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
4056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
4156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "uart2"),		/* RTS */
4256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)),	/* PB_EINT2 */
4356d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
4456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
4556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
4656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "uart2"),		/* D1 */
4756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)),	/* PB_EINT3 */
4856d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
4956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
5056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
5156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "pwm0"),
5256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)),	/* PB_EINT4 */
5356d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 5),
5456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
5556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
5656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "pwm1"),
5756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)),	/* PB_EINT5 */
5856d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 6),
5956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
6056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
6156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "i2c0"),		/* SCK */
6256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)),	/* PB_EINT6 */
6356d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 7),
6456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
6556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
6656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "i2c0"),		/* SDA */
6756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)),	/* PB_EINT7 */
6856d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 8),
6956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
7056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
7156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "i2c1"),		/* SDA */
7256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "uart0"),		/* TX */
7356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)),	/* PB_EINT8 */
7456d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 9),
7556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
7656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
7756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "i2c1"),		/* SCK */
7856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "uart0"),		/* RX */
7956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)),	/* PB_EINT9 */
8056d9e4a7SIcenowy Zheng 	/* Hole */
8156d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
8256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
8356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
8456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc2"),		/* CLK */
8556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "spi0")),		/* MISO */
8656d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
8756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
8856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
8956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc2"),		/* CMD */
9056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "spi0")),		/* CLK */
9156d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
9256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
9356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
9456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc2"),		/* RST */
9556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "spi0")),		/* CS */
9656d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
9756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
9856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
9956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc2"),		/* D0 */
10056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "spi0")),		/* MOSI */
10156d9e4a7SIcenowy Zheng 	/* Hole */
10256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
10356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
10456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
10556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* PCLK */
10656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* CLK */
10756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
10856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
10956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
11056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* MCLK */
11156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* DE */
11256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
11356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
11456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
11556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* HSYNC */
11656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* HSYNC */
11756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
11856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
11956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
12056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* VSYNC */
12156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* VSYNC */
12256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
12356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
12456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
12556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D0 */
12656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D2 */
12756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
12856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
12956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
13056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D1 */
13156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D3 */
13256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
13356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
13456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
13556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D2 */
13656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D4 */
13756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
13856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
13956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
14056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D3 */
14156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D5 */
14256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
14356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
14456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
14556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D4 */
14656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D6 */
14756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
14856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
14956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
15056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D5 */
15156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D7 */
15256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
15356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
15456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
15556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D6 */
15656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D10 */
15756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
15856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
15956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
16056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D7 */
16156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D11 */
16256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
16356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
16456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
16556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D8 */
16656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D12 */
16756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
16856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
16956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
17056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D9 */
17156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D13 */
17256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
17356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
17456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
17556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D10 */
17656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D14 */
17756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
17856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
17956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
18056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D11 */
18156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D15 */
18256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 16),
18356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
18456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
18556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D12 */
18656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D18 */
18756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 17),
18856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
18956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
19056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D13 */
19156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D19 */
19256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 18),
19356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
19456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
19556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D14 */
19656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D20 */
19756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 19),
19856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
19956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
20056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* D15 */
20156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd")),		/* D21 */
20256d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 20),
20356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
20456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
20556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* FIELD */
20656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "csi_mipi")),	/* MCLK */
20756d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 21),
20856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
20956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
21056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* SCK */
21156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "i2c1"),		/* SCK */
21256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x4, "uart1")),	/* TX */
21356d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 22),
21456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
21556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
21656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "csi"),		/* SDA */
21756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "i2c1"),		/* SDA */
21856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x4, "uart1")),	/* RX */
21956d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 23),
22056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
22156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
22256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd"),		/* D22 */
22356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x4, "uart1")),	/* RTS */
22456d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 24),
22556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
22656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
22756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "lcd"),		/* D23 */
22856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x4, "uart1")),	/* CTS */
22956d9e4a7SIcenowy Zheng 	/* Hole */
23056d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
23156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
23256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
23356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* D1 */
23456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "jtag")),		/* MS */
23556d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
23656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
23756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
23856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* D0 */
23956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "jtag")),		/* DI */
24056d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
24156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
24256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
24356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* CLK */
24456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "uart0")),	/* TX */
24556d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
24656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
24756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
24856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* CMD */
24956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "jtag")),		/* DO */
25056d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
25156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
25256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
25356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* D3 */
25456d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "uart0")),	/* RX */
25556d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
25656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
25756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
25856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc0"),		/* D2 */
25956d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x3, "jtag")),		/* CK */
26056d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6),
26156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
26256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out")),
26356d9e4a7SIcenowy Zheng 	/* Hole */
26456d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
26556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
26656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
26756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* CLK */
26856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 0)),	/* PG_EINT0 */
26956d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
27056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
27156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
27256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* CMD */
27356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 1)),	/* PG_EINT1 */
27456d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
27556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
27656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
27756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* D0 */
27856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 2)),	/* PG_EINT2 */
27956d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
28056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
28156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
28256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* D1 */
28356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 3)),	/* PG_EINT3 */
28456d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
28556d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
28656d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
28756d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* D2 */
28856d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 4)),	/* PG_EINT4 */
28956d9e4a7SIcenowy Zheng 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
29056d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x0, "gpio_in"),
29156d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x1, "gpio_out"),
29256d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION(0x2, "mmc1"),		/* D3 */
29356d9e4a7SIcenowy Zheng 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)),	/* PG_EINT5 */
29456d9e4a7SIcenowy Zheng };
29556d9e4a7SIcenowy Zheng 
296*35817d34SIcenowy Zheng static const unsigned int sun8i_v3s_pinctrl_irq_bank_map[] = { 1, 2 };
297*35817d34SIcenowy Zheng 
29856d9e4a7SIcenowy Zheng static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
29956d9e4a7SIcenowy Zheng 	.pins = sun8i_v3s_pins,
30056d9e4a7SIcenowy Zheng 	.npins = ARRAY_SIZE(sun8i_v3s_pins),
30156d9e4a7SIcenowy Zheng 	.irq_banks = 2,
302*35817d34SIcenowy Zheng 	.irq_bank_map = sun8i_v3s_pinctrl_irq_bank_map,
30356d9e4a7SIcenowy Zheng 	.irq_read_needs_mux = true
30456d9e4a7SIcenowy Zheng };
30556d9e4a7SIcenowy Zheng 
30656d9e4a7SIcenowy Zheng static int sun8i_v3s_pinctrl_probe(struct platform_device *pdev)
30756d9e4a7SIcenowy Zheng {
30856d9e4a7SIcenowy Zheng 	return sunxi_pinctrl_init(pdev,
30956d9e4a7SIcenowy Zheng 				  &sun8i_v3s_pinctrl_data);
31056d9e4a7SIcenowy Zheng }
31156d9e4a7SIcenowy Zheng 
31256d9e4a7SIcenowy Zheng static const struct of_device_id sun8i_v3s_pinctrl_match[] = {
31356d9e4a7SIcenowy Zheng 	{ .compatible = "allwinner,sun8i-v3s-pinctrl", },
31456d9e4a7SIcenowy Zheng 	{}
31556d9e4a7SIcenowy Zheng };
31656d9e4a7SIcenowy Zheng 
31756d9e4a7SIcenowy Zheng static struct platform_driver sun8i_v3s_pinctrl_driver = {
31856d9e4a7SIcenowy Zheng 	.probe	= sun8i_v3s_pinctrl_probe,
31956d9e4a7SIcenowy Zheng 	.driver	= {
32056d9e4a7SIcenowy Zheng 		.name		= "sun8i-v3s-pinctrl",
32156d9e4a7SIcenowy Zheng 		.of_match_table	= sun8i_v3s_pinctrl_match,
32256d9e4a7SIcenowy Zheng 	},
32356d9e4a7SIcenowy Zheng };
32456d9e4a7SIcenowy Zheng builtin_platform_driver(sun8i_v3s_pinctrl_driver);
325