xref: /linux/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
1473436e7SYangtao Li // SPDX-License-Identifier: GPL-2.0
2473436e7SYangtao Li /*
3473436e7SYangtao Li  * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
4473436e7SYangtao Li  *
5473436e7SYangtao Li  * Based on:
6473436e7SYangtao Li  * huangshuosheng <huangshuosheng@allwinnertech.com>
7473436e7SYangtao Li  */
8473436e7SYangtao Li 
9473436e7SYangtao Li #include <linux/module.h>
10473436e7SYangtao Li #include <linux/of.h>
11473436e7SYangtao Li #include <linux/pinctrl/pinctrl.h>
12473436e7SYangtao Li #include <linux/platform_device.h>
13473436e7SYangtao Li 
14473436e7SYangtao Li #include "pinctrl-sunxi.h"
15473436e7SYangtao Li 
16473436e7SYangtao Li static const struct sunxi_desc_pin a100_r_pins[] = {
17473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
18473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
19473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
20473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_i2c0"),	/* SCK */
21473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)),
22473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
23473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
24473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
25473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_i2c0"),	/* SDA */
26473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)),
27473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 2),
28473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
29473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
30473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_uart0"),	/* TX */
31473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)),
32473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 3),
33473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
34473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
35473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_uart0"),	/* RX */
36473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)),
37473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 4),
38473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
39473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
40473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_jtag"),	/* MS */
41473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)),
42473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 5),
43473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
44473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
45473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_jtag"),	/* CK */
46473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)),
47473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 6),
48473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
49473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
50473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_jtag"),	/* DO */
51473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)),
52473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 7),
53473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
54473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
55473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_jtag"),	/* DI */
56473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)),
57473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 8),
58473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
59473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
60473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_i2c1"),	/* SCK */
61473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)),
62473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 9),
63473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
64473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
65473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_i2c1"),	/* SDA */
66473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)),
67473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 10),
68473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
69473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
70473436e7SYangtao Li 		  SUNXI_FUNCTION(0x2, "s_pwm"),
71473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)),
72473436e7SYangtao Li 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 11),
73473436e7SYangtao Li 		  SUNXI_FUNCTION(0x0, "gpio_in"),
74473436e7SYangtao Li 		  SUNXI_FUNCTION(0x1, "gpio_out"),
75473436e7SYangtao Li 		  SUNXI_FUNCTION(0x3, "s_cir"),		/* IN */
76473436e7SYangtao Li 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)),
77473436e7SYangtao Li };
78473436e7SYangtao Li 
79473436e7SYangtao Li static const struct sunxi_pinctrl_desc a100_r_pinctrl_data = {
80473436e7SYangtao Li 	.pins = a100_r_pins,
81473436e7SYangtao Li 	.npins = ARRAY_SIZE(a100_r_pins),
82473436e7SYangtao Li 	.pin_base = PL_BASE,
83473436e7SYangtao Li 	.irq_banks = 1,
8488df36f2SSamuel Holland 	.io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL,
85473436e7SYangtao Li };
86473436e7SYangtao Li 
a100_r_pinctrl_probe(struct platform_device * pdev)87473436e7SYangtao Li static int a100_r_pinctrl_probe(struct platform_device *pdev)
88473436e7SYangtao Li {
89473436e7SYangtao Li 	return sunxi_pinctrl_init(pdev, &a100_r_pinctrl_data);
90473436e7SYangtao Li }
91473436e7SYangtao Li 
92473436e7SYangtao Li static const struct of_device_id a100_r_pinctrl_match[] = {
93473436e7SYangtao Li 	{ .compatible = "allwinner,sun50i-a100-r-pinctrl", },
94473436e7SYangtao Li 	{}
95473436e7SYangtao Li };
96473436e7SYangtao Li MODULE_DEVICE_TABLE(of, a100_r_pinctrl_match);
97473436e7SYangtao Li 
98473436e7SYangtao Li static struct platform_driver a100_r_pinctrl_driver = {
99473436e7SYangtao Li 	.probe	= a100_r_pinctrl_probe,
100473436e7SYangtao Li 	.driver	= {
101*76648c86SMichael Wu 		.name		= "sun50i-a100-r-pinctrl",
102473436e7SYangtao Li 		.of_match_table	= a100_r_pinctrl_match,
103473436e7SYangtao Li 	},
104473436e7SYangtao Li };
105473436e7SYangtao Li module_platform_driver(a100_r_pinctrl_driver);
106