1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Marvell ac5 pinctrl driver based on mvebu pinctrl core
*
* Copyright (C) 2021 Marvell
*
* Noam Liron <lnoam@marvell.com>
*/
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/pinctrl/pinctrl.h>
#include "pinctrl-mvebu.h"
static struct mvebu_mpp_mode ac5_mpp_modes[] = {
MPP_MODE(0,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d0"),
MPP_FUNCTION(2, "nand", "io4")),
MPP_MODE(1,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d1"),
MPP_FUNCTION(2, "nand", "io3")),
MPP_MODE(2,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d2"),
MPP_FUNCTION(2, "nand", "io2")),
MPP_MODE(3,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d3"),
MPP_FUNCTION(2, "nand", "io7")),
MPP_MODE(4,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d4"),
MPP_FUNCTION(2, "nand", "io6"),
MPP_FUNCTION(3, "uart3", "txd"),
MPP_FUNCTION(4, "uart2", "txd")),
MPP_MODE(5,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d5"),
MPP_FUNCTION(2, "nand", "io5"),
MPP_FUNCTION(3, "uart3", "rxd"),
MPP_FUNCTION(4, "uart2", "rxd")),
MPP_MODE(6,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d6"),
MPP_FUNCTION(2, "nand", "io0"),
MPP_FUNCTION(3, "i2c1", "sck")),
MPP_MODE(7,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "d7"),
MPP_FUNCTION(2, "nand", "io1"),
MPP_FUNCTION(3, "i2c1", "sda")),
MPP_MODE(8,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "clk"),
MPP_FUNCTION(2, "nand", "wen")),
MPP_MODE(9,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "cmd"),
MPP_FUNCTION(2, "nand", "ale")),
MPP_MODE(10,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "ds"),
MPP_FUNCTION(2, "nand", "cle")),
MPP_MODE(11,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "sdio", "rst"),
MPP_FUNCTION(2, "nand", "cen")),
MPP_MODE(12,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "clk")),
MPP_MODE(13,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "csn")),
MPP_MODE(14,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "mosi")),
MPP_MODE(15,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "miso")),
MPP_MODE(16,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "wpn"),
MPP_FUNCTION(2, "nand", "ren"),
MPP_FUNCTION(3, "uart1", "txd")),
MPP_MODE(17,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "spi0", "hold"),
MPP_FUNCTION(2, "nand", "rb"),
MPP_FUNCTION(3, "uart1", "rxd")),
MPP_MODE(18,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "tsen_int", NULL),
MPP_FUNCTION(2, "uart2", "rxd"),
MPP_FUNCTION(3, "wd_int", NULL)),
MPP_MODE(19,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "dev_init_done", NULL),
MPP_FUNCTION(2, "uart2", "txd")),
MPP_MODE(20,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(2, "i2c1", "sck"),
MPP_FUNCTION(3, "spi1", "clk"),
MPP_FUNCTION(4, "uart3", "txd")),
MPP_MODE(21,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(2, "i2c1", "sda"),
MPP_FUNCTION(3, "spi1", "csn"),
MPP_FUNCTION(4, "uart3", "rxd")),
MPP_MODE(22,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(3, "spi1", "mosi")),
MPP_MODE(23,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(3, "spi1", "miso")),
MPP_MODE(24,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "wd_int", NULL),
MPP_FUNCTION(2, "uart2", "txd"),
MPP_FUNCTION(3, "uartsd", "txd")),
MPP_MODE(25,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "int_out", NULL),
MPP_FUNCTION(2, "uart2", "rxd"),
MPP_FUNCTION(3, "uartsd", "rxd")),
MPP_MODE(26,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "i2c0", "sck"),
MPP_FUNCTION(2, "ptp", "clk1"),
MPP_FUNCTION(3, "uart3", "txd")),
MPP_MODE(27,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "i2c0", "sda"),
MPP_FUNCTION(2, "ptp", "pulse"),
MPP_FUNCTION(3, "uart3", "rxd")),
MPP_MODE(28,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "xg", "mdio"),
MPP_FUNCTION(2, "ge", "mdio"),
MPP_FUNCTION(3, "uart3", "txd")),
MPP_MODE(29,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "xg", "mdio"),
MPP_FUNCTION(2, "ge", "mdio"),
MPP_FUNCTION(3, "uart3", "rxd")),
MPP_MODE(30,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "xg", "mdio"),
MPP_FUNCTION(2, "ge", "mdio"),
MPP_FUNCTION(3, "ge", "mdio")),
MPP_MODE(31,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "xg", "mdio"),
MPP_FUNCTION(2, "ge", "mdio"),
MPP_FUNCTION(3, "ge", "mdio")),
MPP_MODE(32,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "uart0", "txd")),
MPP_MODE(33,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "uart0", "rxd"),
MPP_FUNCTION(2, "ptp", "clk1"),
MPP_FUNCTION(3, "ptp", "pulse")),
MPP_MODE(34,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ge", "mdio"),
MPP_FUNCTION(2, "uart3", "rxd")),
MPP_MODE(35,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ge", "mdio"),
MPP_FUNCTION(2, "uart3", "txd"),
MPP_FUNCTION(3, "pcie", "rstoutn")),
MPP_MODE(36,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ptp", "clk0_tp"),
MPP_FUNCTION(2, "ptp", "clk1_tp")),
MPP_MODE(37,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ptp", "pulse_tp"),
MPP_FUNCTION(2, "wd_int", NULL)),
MPP_MODE(38,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "synce", "clk_out0")),
MPP_MODE(39,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "synce", "clk_out1")),
MPP_MODE(40,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ptp", "pclk_out0"),
MPP_FUNCTION(2, "ptp", "pclk_out1")),
MPP_MODE(41,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ptp", "ref_clk"),
MPP_FUNCTION(2, "ptp", "clk1"),
MPP_FUNCTION(3, "ptp", "pulse"),
MPP_FUNCTION(4, "uart2", "txd"),
MPP_FUNCTION(5, "i2c1", "sck")),
MPP_MODE(42,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "ptp", "clk0"),
MPP_FUNCTION(2, "ptp", "clk1"),
MPP_FUNCTION(3, "ptp", "pulse"),
MPP_FUNCTION(4, "uart2", "rxd"),
MPP_FUNCTION(5, "i2c1", "sda")),
MPP_MODE(43,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "led", "clk")),
MPP_MODE(44,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "led", "stb")),
MPP_MODE(45,
MPP_FUNCTION(0, "gpio", NULL),
MPP_FUNCTION(1, "led", "data")),
};
static struct mvebu_pinctrl_soc_info ac5_pinctrl_info;
static const struct of_device_id ac5_pinctrl_of_match[] = {
{
.compatible = "marvell,ac5-pinctrl",
},
{ },
};
static const struct mvebu_mpp_ctrl ac5_mpp_controls[] = {
MPP_FUNC_CTRL(0, 45, NULL, mvebu_mmio_mpp_ctrl), };
static struct pinctrl_gpio_range ac5_mpp_gpio_ranges[] = {
MPP_GPIO_RANGE(0, 0, 0, 46), };
static int ac5_pinctrl_probe(struct platform_device *pdev)
{
struct mvebu_pinctrl_soc_info *soc = &ac5_pinctrl_info;
soc->variant = 0; /* no variants for ac5 */
soc->controls = ac5_mpp_controls;
soc->ncontrols = ARRAY_SIZE(ac5_mpp_controls);
soc->gpioranges = ac5_mpp_gpio_ranges;
soc->ngpioranges = ARRAY_SIZE(ac5_mpp_gpio_ranges);
soc->modes = ac5_mpp_modes;
soc->nmodes = ac5_mpp_controls[0].npins;
pdev->dev.platform_data = soc;
return mvebu_pinctrl_simple_mmio_probe(pdev);
}
static struct platform_driver ac5_pinctrl_driver = {
.driver = {
.name = "ac5-pinctrl",
.of_match_table = of_match_ptr(ac5_pinctrl_of_match),
},
.probe = ac5_pinctrl_probe,
};
builtin_platform_driver(ac5_pinctrl_driver);
|