blob: b896f7ba606e7bf4e8d8ceb170e64dbb2c4291f4 [file] [log] [blame]
Maxime Ripard16c675f2014-04-18 20:12:50 +02001/*
2 * Allwinner A31 SoCs special pins pinctrl driver.
3 *
4 * Copyright (C) 2014 Boris Brezillon
5 * Boris Brezillon <boris.brezillon@free-electrons.com>
6 *
7 * Copyright (C) 2014 Maxime Ripard
8 * Maxime Ripard <maxime.ripard@free-electrons.com>
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/of.h>
18#include <linux/of_device.h>
19#include <linux/pinctrl/pinctrl.h>
20
21#include "pinctrl-sunxi.h"
22
23static const struct sunxi_desc_pin sun6i_a31_r_pins[] = {
24 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
25 SUNXI_FUNCTION(0x0, "gpio_in"),
26 SUNXI_FUNCTION(0x1, "gpio_out"),
27 SUNXI_FUNCTION(0x2, "s_twi"), /* SCK */
28 SUNXI_FUNCTION(0x3, "s_p2wi")), /* SCK */
29 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
30 SUNXI_FUNCTION(0x0, "gpio_in"),
31 SUNXI_FUNCTION(0x1, "gpio_out"),
32 SUNXI_FUNCTION(0x2, "s_twi"), /* SDA */
33 SUNXI_FUNCTION(0x3, "s_p2wi")), /* SDA */
34 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 2),
35 SUNXI_FUNCTION(0x0, "gpio_in"),
36 SUNXI_FUNCTION(0x1, "gpio_out"),
37 SUNXI_FUNCTION(0x2, "s_uart")), /* TX */
38 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 3),
39 SUNXI_FUNCTION(0x0, "gpio_in"),
40 SUNXI_FUNCTION(0x1, "gpio_out"),
41 SUNXI_FUNCTION(0x2, "s_uart")), /* RX */
42 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 4),
43 SUNXI_FUNCTION(0x0, "gpio_in"),
44 SUNXI_FUNCTION(0x1, "gpio_out"),
45 SUNXI_FUNCTION(0x2, "s_ir")), /* RX */
46 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 5),
47 SUNXI_FUNCTION(0x0, "gpio_in"),
48 SUNXI_FUNCTION(0x1, "gpio_out"),
49 SUNXI_FUNCTION(0x3, "s_jtag")), /* MS */
50 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 6),
51 SUNXI_FUNCTION(0x0, "gpio_in"),
52 SUNXI_FUNCTION(0x1, "gpio_out"),
53 SUNXI_FUNCTION(0x3, "s_jtag")), /* CK */
54 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 7),
55 SUNXI_FUNCTION(0x0, "gpio_in"),
56 SUNXI_FUNCTION(0x1, "gpio_out"),
57 SUNXI_FUNCTION(0x3, "s_jtag")), /* DO */
58 SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 8),
59 SUNXI_FUNCTION(0x0, "gpio_in"),
60 SUNXI_FUNCTION(0x1, "gpio_out"),
61 SUNXI_FUNCTION(0x3, "s_jtag")), /* DI */
62 /* Hole */
63 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 0),
64 SUNXI_FUNCTION(0x0, "gpio_in"),
65 SUNXI_FUNCTION(0x1, "gpio_out")),
66 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 1),
67 SUNXI_FUNCTION(0x0, "gpio_in"),
68 SUNXI_FUNCTION(0x1, "gpio_out")),
69 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 2),
70 SUNXI_FUNCTION(0x0, "gpio_in"),
71 SUNXI_FUNCTION(0x1, "gpio_out"),
72 SUNXI_FUNCTION(0x3, "1wire")),
73 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 3),
74 SUNXI_FUNCTION(0x0, "gpio_in"),
75 SUNXI_FUNCTION(0x1, "gpio_out")),
76 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 4),
77 SUNXI_FUNCTION(0x0, "gpio_in"),
78 SUNXI_FUNCTION(0x1, "gpio_out")),
79 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 5),
80 SUNXI_FUNCTION(0x0, "gpio_in"),
81 SUNXI_FUNCTION(0x1, "gpio_out")),
82 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 6),
83 SUNXI_FUNCTION(0x0, "gpio_in"),
84 SUNXI_FUNCTION(0x1, "gpio_out")),
85 SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 7),
86 SUNXI_FUNCTION(0x0, "gpio_in"),
87 SUNXI_FUNCTION(0x1, "gpio_out"),
88 SUNXI_FUNCTION(0x3, "rtc")), /* CLKO */
89};
90
91static const struct sunxi_pinctrl_desc sun6i_a31_r_pinctrl_data = {
92 .pins = sun6i_a31_r_pins,
93 .npins = ARRAY_SIZE(sun6i_a31_r_pins),
94 .pin_base = PL_BASE,
95};
96
97static int sun6i_a31_r_pinctrl_probe(struct platform_device *pdev)
98{
99 return sunxi_pinctrl_init(pdev,
100 &sun6i_a31_r_pinctrl_data);
101}
102
103static struct of_device_id sun6i_a31_r_pinctrl_match[] = {
104 { .compatible = "allwinner,sun6i-a31-r-pinctrl", },
105 {}
106};
107MODULE_DEVICE_TABLE(of, sun6i_a31_r_pinctrl_match);
108
109static struct platform_driver sun6i_a31_r_pinctrl_driver = {
110 .probe = sun6i_a31_r_pinctrl_probe,
111 .driver = {
112 .name = "sun6i-a31-r-pinctrl",
113 .owner = THIS_MODULE,
114 .of_match_table = sun6i_a31_r_pinctrl_match,
115 },
116};
117module_platform_driver(sun6i_a31_r_pinctrl_driver);
118
119MODULE_AUTHOR("Boris Brezillon <boris.brezillon@free-electrons.com");
120MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com");
121MODULE_DESCRIPTION("Allwinner A31 R_PIO pinctrl driver");
122MODULE_LICENSE("GPL");