• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: (GPL-2.0+ or MIT)
2 /*
3  * Copyright (c) 2020 frank@allwinnertech.com
4  */
5 
6 #include <linux/module.h>
7 #include <linux/platform_device.h>
8 #include <linux/of.h>
9 #include <linux/of_device.h>
10 #include <linux/pinctrl/pinctrl.h>
11 #include "pinctrl-sunxi.h"
12 
13 static const struct sunxi_desc_pin sun50iw9_r_pins[] = {
14 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
15 		SUNXI_FUNCTION(0x0, "gpio_in"),
16 		SUNXI_FUNCTION(0x1, "gpio_out"),
17 		SUNXI_FUNCTION(0x3, "s_twi0")),		/* SCK */
18 	SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
19 		SUNXI_FUNCTION(0x0, "gpio_in"),
20 		SUNXI_FUNCTION(0x1, "gpio_out"),
21 		SUNXI_FUNCTION(0x3, "s_twi0")),		/* SDA */
22 };
23 
24 static const struct sunxi_pinctrl_desc sun50iw9_r_pinctrl_data = {
25 	.pins = sun50iw9_r_pins,
26 	.npins = ARRAY_SIZE(sun50iw9_r_pins),
27 	.pin_base = SUNXI_PIN_BASE('L'),
28 	.hw_type = SUNXI_PCTL_HW_TYPE_0,
29 };
30 
sun50iw9_r_pinctrl_probe(struct platform_device * pdev)31 static int sun50iw9_r_pinctrl_probe(struct platform_device *pdev)
32 {
33 	return sunxi_bsp_pinctrl_init(pdev, &sun50iw9_r_pinctrl_data);
34 }
35 
36 static struct of_device_id sun50iw9_r_pinctrl_match[] = {
37 	{ .compatible = "allwinner,sun50iw9-r-pinctrl", },
38 	{}
39 };
40 MODULE_DEVICE_TABLE(of, sun50iw9_r_pinctrl_match);
41 
42 static struct platform_driver sun50iw9_r_pinctrl_driver = {
43 	.probe	= sun50iw9_r_pinctrl_probe,
44 	.driver	= {
45 		.name		= "sun50iw9-r-pinctrl",
46 		.of_match_table	= sun50iw9_r_pinctrl_match,
47 	},
48 };
49 
sun50iw9_r_pio_init(void)50 static int __init sun50iw9_r_pio_init(void)
51 {
52 	return platform_driver_register(&sun50iw9_r_pinctrl_driver);
53 }
54 postcore_initcall(sun50iw9_r_pio_init);
55 
56 MODULE_DESCRIPTION("Allwinner sun50iw9 R_PIO pinctrl driver");
57 MODULE_LICENSE("GPL");
58 MODULE_VERSION("1.0.0");
59