xref: /linux/drivers/pinctrl/sunxi/pinctrl-sun50i-h616-r.c (revision 34dc1baba215b826e454b8d19e4f24adbeb7d00d)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Allwinner H616 R_PIO pin controller driver
4  *
5  * Copyright (C) 2020 Arm Ltd.
6  * Based on former work, which is:
7  *   Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
8  */
9 
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/of.h>
13 #include <linux/pinctrl/pinctrl.h>
14 
15 #include "pinctrl-sunxi.h"
16 
17 static const struct sunxi_desc_pin sun50i_h616_r_pins[] = {
18 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
19 		  SUNXI_FUNCTION(0x0, "gpio_in"),
20 		  SUNXI_FUNCTION(0x1, "gpio_out"),
21 		  SUNXI_FUNCTION(0x2, "s_rsb"),		/* SCK */
22 		  SUNXI_FUNCTION(0x3, "s_i2c")),	/* SCK */
23 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
24 		  SUNXI_FUNCTION(0x0, "gpio_in"),
25 		  SUNXI_FUNCTION(0x1, "gpio_out"),
26 		  SUNXI_FUNCTION(0x2, "s_rsb"),		/* SDA */
27 		  SUNXI_FUNCTION(0x3, "s_i2c")),	/* SDA */
28 };
29 
30 static const struct sunxi_pinctrl_desc sun50i_h616_r_pinctrl_data = {
31 	.pins = sun50i_h616_r_pins,
32 	.npins = ARRAY_SIZE(sun50i_h616_r_pins),
33 	.pin_base = PL_BASE,
34 };
35 
36 static int sun50i_h616_r_pinctrl_probe(struct platform_device *pdev)
37 {
38 	return sunxi_pinctrl_init(pdev,
39 				  &sun50i_h616_r_pinctrl_data);
40 }
41 
42 static const struct of_device_id sun50i_h616_r_pinctrl_match[] = {
43 	{ .compatible = "allwinner,sun50i-h616-r-pinctrl", },
44 	{}
45 };
46 
47 static struct platform_driver sun50i_h616_r_pinctrl_driver = {
48 	.probe	= sun50i_h616_r_pinctrl_probe,
49 	.driver	= {
50 		.name		= "sun50i-h616-r-pinctrl",
51 		.of_match_table	= sun50i_h616_r_pinctrl_match,
52 	},
53 };
54 builtin_platform_driver(sun50i_h616_r_pinctrl_driver);
55