This source file includes following definitions.
- berlin4ct_pinctrl_probe
1
2
3
4
5
6
7
8
9
10 #include <linux/init.h>
11 #include <linux/of_device.h>
12 #include <linux/platform_device.h>
13 #include <linux/regmap.h>
14
15 #include "berlin.h"
16
17 static const struct berlin_desc_group berlin4ct_soc_pinctrl_groups[] = {
18 BERLIN_PINCTRL_GROUP("EMMC_RSTn", 0x0, 0x3, 0x00,
19 BERLIN_PINCTRL_FUNCTION(0x0, "emmc"),
20 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
21 BERLIN_PINCTRL_GROUP("NAND_IO0", 0x0, 0x3, 0x03,
22 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
23 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
24 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
25 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
26 BERLIN_PINCTRL_GROUP("NAND_IO1", 0x0, 0x3, 0x06,
27 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
28 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
29 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
30 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
31 BERLIN_PINCTRL_GROUP("NAND_IO2", 0x0, 0x3, 0x09,
32 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
33 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
34 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
35 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
36 BERLIN_PINCTRL_GROUP("NAND_IO3", 0x0, 0x3, 0x0c,
37 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
38 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
39 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
40 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
41 BERLIN_PINCTRL_GROUP("NAND_IO4", 0x0, 0x3, 0x0f,
42 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
43 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
44 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
45 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
46 BERLIN_PINCTRL_GROUP("NAND_IO5", 0x0, 0x3, 0x12,
47 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
48 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
49 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
50 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
51 BERLIN_PINCTRL_GROUP("NAND_IO6", 0x0, 0x3, 0x15,
52 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
53 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
54 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
55 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
56 BERLIN_PINCTRL_GROUP("NAND_IO7", 0x0, 0x3, 0x18,
57 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
58 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
59 BERLIN_PINCTRL_FUNCTION(0x2, "sd1"),
60 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
61 BERLIN_PINCTRL_GROUP("NAND_ALE", 0x0, 0x3, 0x1b,
62 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
63 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
64 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
65 BERLIN_PINCTRL_GROUP("NAND_CLE", 0x4, 0x3, 0x00,
66 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
67 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
68 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
69 BERLIN_PINCTRL_GROUP("NAND_WEn", 0x4, 0x3, 0x03,
70 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
71 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
72 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
73 BERLIN_PINCTRL_GROUP("NAND_REn", 0x4, 0x3, 0x06,
74 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
75 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
76 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
77 BERLIN_PINCTRL_GROUP("NAND_WPn", 0x4, 0x3, 0x09,
78 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
79 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
80 BERLIN_PINCTRL_GROUP("NAND_CEn", 0x4, 0x3, 0x0c,
81 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
82 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
83 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
84 BERLIN_PINCTRL_GROUP("NAND_RDY", 0x4, 0x3, 0x0f,
85 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
86 BERLIN_PINCTRL_FUNCTION(0x1, "rgmii"),
87 BERLIN_PINCTRL_FUNCTION(0x3, "gpio")),
88 BERLIN_PINCTRL_GROUP("SD0_CLK", 0x4, 0x3, 0x12,
89 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
90 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
91 BERLIN_PINCTRL_FUNCTION(0x2, "sts4"),
92 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
93 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
94 BERLIN_PINCTRL_GROUP("SD0_DAT0", 0x4, 0x3, 0x15,
95 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
96 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
97 BERLIN_PINCTRL_FUNCTION(0x2, "sts4"),
98 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
99 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
100 BERLIN_PINCTRL_GROUP("SD0_DAT1", 0x4, 0x3, 0x18,
101 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
102 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
103 BERLIN_PINCTRL_FUNCTION(0x2, "sts4"),
104 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
105 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
106 BERLIN_PINCTRL_GROUP("SD0_DAT2", 0x4, 0x3, 0x1b,
107 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
108 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
109 BERLIN_PINCTRL_FUNCTION(0x2, "sts4"),
110 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
111 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
112 BERLIN_PINCTRL_GROUP("SD0_DAT3", 0x8, 0x3, 0x00,
113 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
114 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
115 BERLIN_PINCTRL_FUNCTION(0x2, "sts5"),
116 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
117 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
118 BERLIN_PINCTRL_GROUP("SD0_CDn", 0x8, 0x3, 0x03,
119 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
120 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
121 BERLIN_PINCTRL_FUNCTION(0x2, "sts5"),
122 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
123 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
124 BERLIN_PINCTRL_GROUP("SD0_CMD", 0x8, 0x3, 0x06,
125 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
126 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
127 BERLIN_PINCTRL_FUNCTION(0x2, "sts5"),
128 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
129 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
130 BERLIN_PINCTRL_GROUP("SD0_WP", 0x8, 0x3, 0x09,
131 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
132 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
133 BERLIN_PINCTRL_FUNCTION(0x2, "sts5"),
134 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
135 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
136 BERLIN_PINCTRL_GROUP("STS0_CLK", 0x8, 0x3, 0x0c,
137 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
138 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
139 BERLIN_PINCTRL_FUNCTION(0x2, "cpupll"),
140 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
141 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
142 BERLIN_PINCTRL_GROUP("STS0_SOP", 0x8, 0x3, 0x0f,
143 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
144 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
145 BERLIN_PINCTRL_FUNCTION(0x2, "syspll"),
146 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
147 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
148 BERLIN_PINCTRL_GROUP("STS0_SD", 0x8, 0x3, 0x12,
149 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
150 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
151 BERLIN_PINCTRL_FUNCTION(0x2, "mempll"),
152 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
153 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
154 BERLIN_PINCTRL_GROUP("STS0_VALD", 0x8, 0x3, 0x15,
155 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
156 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
157 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
158 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
159 BERLIN_PINCTRL_GROUP("STS1_CLK", 0x8, 0x3, 0x18,
160 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
161 BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
162 BERLIN_PINCTRL_FUNCTION(0x2, "pwm0"),
163 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
164 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
165 BERLIN_PINCTRL_GROUP("STS1_SOP", 0x8, 0x3, 0x1b,
166 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
167 BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
168 BERLIN_PINCTRL_FUNCTION(0x2, "pwm1"),
169 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
170 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
171 BERLIN_PINCTRL_GROUP("STS1_SD", 0xc, 0x3, 0x00,
172 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
173 BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
174 BERLIN_PINCTRL_FUNCTION(0x2, "pwm2"),
175 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
176 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
177 BERLIN_PINCTRL_GROUP("STS1_VALD", 0xc, 0x3, 0x03,
178 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
179 BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
180 BERLIN_PINCTRL_FUNCTION(0x2, "pwm3"),
181 BERLIN_PINCTRL_FUNCTION(0x5, "v4g"),
182 BERLIN_PINCTRL_FUNCTION(0x7, "phy")),
183 BERLIN_PINCTRL_GROUP("SCRD0_RST", 0xc, 0x3, 0x06,
184 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
185 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
186 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
187 BERLIN_PINCTRL_GROUP("SCRD0_DCLK", 0xc, 0x3, 0x09,
188 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
189 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
190 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
191 BERLIN_PINCTRL_GROUP("SCRD0_GPIO0", 0xc, 0x3, 0x0c,
192 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
193 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
194 BERLIN_PINCTRL_FUNCTION(0x2, "sif"),
195 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
196 BERLIN_PINCTRL_GROUP("SCRD0_GPIO1", 0xc, 0x3, 0x0f,
197 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
198 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
199 BERLIN_PINCTRL_FUNCTION(0x2, "sif"),
200 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
201 BERLIN_PINCTRL_GROUP("SCRD0_DIO", 0xc, 0x3, 0x12,
202 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
203 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
204 BERLIN_PINCTRL_FUNCTION(0x2, "sif"),
205 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
206 BERLIN_PINCTRL_GROUP("SCRD0_CRD_PRES", 0xc, 0x3, 0x15,
207 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
208 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
209 BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")),
210 BERLIN_PINCTRL_GROUP("SPI1_SS0n", 0xc, 0x3, 0x18,
211 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
212 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
213 BERLIN_PINCTRL_FUNCTION(0x2, "sts2")),
214 BERLIN_PINCTRL_GROUP("SPI1_SS1n", 0xc, 0x3, 0x1b,
215 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
216 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
217 BERLIN_PINCTRL_FUNCTION(0x2, "sts2"),
218 BERLIN_PINCTRL_FUNCTION(0x4, "pwm1")),
219 BERLIN_PINCTRL_GROUP("SPI1_SS2n", 0x10, 0x3, 0x00,
220 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
221 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
222 BERLIN_PINCTRL_FUNCTION(0x2, "sts2"),
223 BERLIN_PINCTRL_FUNCTION(0x4, "pwm0")),
224 BERLIN_PINCTRL_GROUP("SPI1_SS3n", 0x10, 0x3, 0x03,
225 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
226 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
227 BERLIN_PINCTRL_FUNCTION(0x2, "sts2")),
228 BERLIN_PINCTRL_GROUP("SPI1_SCLK", 0x10, 0x3, 0x06,
229 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
230 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
231 BERLIN_PINCTRL_FUNCTION(0x2, "sts3")),
232 BERLIN_PINCTRL_GROUP("SPI1_SDO", 0x10, 0x3, 0x09,
233 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
234 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
235 BERLIN_PINCTRL_FUNCTION(0x2, "sts3")),
236 BERLIN_PINCTRL_GROUP("SPI1_SDI", 0x10, 0x3, 0x0c,
237 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
238 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
239 BERLIN_PINCTRL_FUNCTION(0x2, "sts3")),
240 BERLIN_PINCTRL_GROUP("USB0_DRV_VBUS", 0x10, 0x3, 0x0f,
241 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
242 BERLIN_PINCTRL_FUNCTION(0x1, "usb0"),
243 BERLIN_PINCTRL_FUNCTION(0x2, "sts3")),
244 BERLIN_PINCTRL_GROUP("TW0_SCL", 0x10, 0x3, 0x12,
245 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
246 BERLIN_PINCTRL_FUNCTION(0x1, "tw0")),
247 BERLIN_PINCTRL_GROUP("TW0_SDA", 0x10, 0x3, 0x15,
248 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
249 BERLIN_PINCTRL_FUNCTION(0x1, "tw0")),
250 };
251
252 static const struct berlin_desc_group berlin4ct_avio_pinctrl_groups[] = {
253 BERLIN_PINCTRL_GROUP("TX_EDDC_SCL", 0x0, 0x3, 0x00,
254 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
255 BERLIN_PINCTRL_FUNCTION(0x1, "tx_eddc"),
256 BERLIN_PINCTRL_FUNCTION(0x2, "tw1")),
257 BERLIN_PINCTRL_GROUP("TX_EDDC_SDA", 0x0, 0x3, 0x03,
258 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
259 BERLIN_PINCTRL_FUNCTION(0x1, "tx_eddc"),
260 BERLIN_PINCTRL_FUNCTION(0x2, "tw1")),
261 BERLIN_PINCTRL_GROUP("I2S1_LRCKO", 0x0, 0x3, 0x06,
262 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
263 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
264 BERLIN_PINCTRL_FUNCTION(0x3, "sts6"),
265 BERLIN_PINCTRL_FUNCTION(0x4, "adac"),
266 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b"),
267 BERLIN_PINCTRL_FUNCTION(0x7, "avio")),
268 BERLIN_PINCTRL_GROUP("I2S1_BCLKO", 0x0, 0x3, 0x09,
269 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
270 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
271 BERLIN_PINCTRL_FUNCTION(0x3, "sts6"),
272 BERLIN_PINCTRL_FUNCTION(0x4, "adac"),
273 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b"),
274 BERLIN_PINCTRL_FUNCTION(0x7, "avio")),
275 BERLIN_PINCTRL_GROUP("I2S1_DO", 0x0, 0x3, 0x0c,
276 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
277 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
278 BERLIN_PINCTRL_FUNCTION(0x3, "sts6"),
279 BERLIN_PINCTRL_FUNCTION(0x4, "adac"),
280 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b"),
281 BERLIN_PINCTRL_FUNCTION(0x7, "avio")),
282 BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x0f,
283 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
284 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
285 BERLIN_PINCTRL_FUNCTION(0x3, "sts6"),
286 BERLIN_PINCTRL_FUNCTION(0x4, "adac_test"),
287 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b"),
288 BERLIN_PINCTRL_FUNCTION(0x7, "avio")),
289 BERLIN_PINCTRL_GROUP("SPDIFO", 0x0, 0x3, 0x12,
290 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
291 BERLIN_PINCTRL_FUNCTION(0x1, "spdifo"),
292 BERLIN_PINCTRL_FUNCTION(0x2, "avpll"),
293 BERLIN_PINCTRL_FUNCTION(0x4, "adac")),
294 BERLIN_PINCTRL_GROUP("I2S2_MCLK", 0x0, 0x3, 0x15,
295 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
296 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
297 BERLIN_PINCTRL_FUNCTION(0x4, "hdmi"),
298 BERLIN_PINCTRL_FUNCTION(0x5, "pdm")),
299 BERLIN_PINCTRL_GROUP("I2S2_LRCKI", 0x0, 0x3, 0x18,
300 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
301 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
302 BERLIN_PINCTRL_FUNCTION(0x2, "pwm0"),
303 BERLIN_PINCTRL_FUNCTION(0x3, "sts7"),
304 BERLIN_PINCTRL_FUNCTION(0x4, "adac_test"),
305 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b")),
306 BERLIN_PINCTRL_GROUP("I2S2_BCLKI", 0x0, 0x3, 0x1b,
307 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
308 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
309 BERLIN_PINCTRL_FUNCTION(0x2, "pwm1"),
310 BERLIN_PINCTRL_FUNCTION(0x3, "sts7"),
311 BERLIN_PINCTRL_FUNCTION(0x4, "adac_test"),
312 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b")),
313 BERLIN_PINCTRL_GROUP("I2S2_DI0", 0x4, 0x3, 0x00,
314 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
315 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
316 BERLIN_PINCTRL_FUNCTION(0x2, "pwm2"),
317 BERLIN_PINCTRL_FUNCTION(0x3, "sts7"),
318 BERLIN_PINCTRL_FUNCTION(0x4, "adac_test"),
319 BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
320 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b")),
321 BERLIN_PINCTRL_GROUP("I2S2_DI1", 0x4, 0x3, 0x03,
322 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
323 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
324 BERLIN_PINCTRL_FUNCTION(0x2, "pwm3"),
325 BERLIN_PINCTRL_FUNCTION(0x3, "sts7"),
326 BERLIN_PINCTRL_FUNCTION(0x4, "adac_test"),
327 BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
328 BERLIN_PINCTRL_FUNCTION(0x6, "sd1b")),
329 };
330
331 static const struct berlin_desc_group berlin4ct_sysmgr_pinctrl_groups[] = {
332 BERLIN_PINCTRL_GROUP("SM_TW2_SCL", 0x0, 0x3, 0x00,
333 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
334 BERLIN_PINCTRL_FUNCTION(0x1, "tw2")),
335 BERLIN_PINCTRL_GROUP("SM_TW2_SDA", 0x0, 0x3, 0x03,
336 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
337 BERLIN_PINCTRL_FUNCTION(0x1, "tw2")),
338 BERLIN_PINCTRL_GROUP("SM_TW3_SCL", 0x0, 0x3, 0x06,
339 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
340 BERLIN_PINCTRL_FUNCTION(0x1, "tw3")),
341 BERLIN_PINCTRL_GROUP("SM_TW3_SDA", 0x0, 0x3, 0x09,
342 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
343 BERLIN_PINCTRL_FUNCTION(0x1, "tw3")),
344 BERLIN_PINCTRL_GROUP("SM_TMS", 0x0, 0x3, 0x0c,
345 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
346 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
347 BERLIN_PINCTRL_FUNCTION(0x2, "pwm0")),
348 BERLIN_PINCTRL_GROUP("SM_TDI", 0x0, 0x3, 0x0f,
349 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
350 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
351 BERLIN_PINCTRL_FUNCTION(0x2, "pwm1")),
352 BERLIN_PINCTRL_GROUP("SM_TDO", 0x0, 0x3, 0x12,
353 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
354 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
355 BERLIN_PINCTRL_GROUP("SM_URT0_TXD", 0x0, 0x3, 0x15,
356 BERLIN_PINCTRL_FUNCTION(0x0, "uart0"),
357 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
358 BERLIN_PINCTRL_GROUP("SM_URT0_RXD", 0x0, 0x3, 0x18,
359 BERLIN_PINCTRL_FUNCTION(0x0, "uart0"),
360 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
361 BERLIN_PINCTRL_GROUP("SM_URT1_TXD", 0x0, 0x3, 0x1b,
362 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
363 BERLIN_PINCTRL_FUNCTION(0x1, "uart1"),
364 BERLIN_PINCTRL_FUNCTION(0x2, "eth1"),
365 BERLIN_PINCTRL_FUNCTION(0x3, "pwm2"),
366 BERLIN_PINCTRL_FUNCTION(0x4, "timer0"),
367 BERLIN_PINCTRL_FUNCTION(0x5, "clk_25m")),
368 BERLIN_PINCTRL_GROUP("SM_URT1_RXD", 0x4, 0x3, 0x00,
369 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
370 BERLIN_PINCTRL_FUNCTION(0x1, "uart1"),
371 BERLIN_PINCTRL_FUNCTION(0x3, "pwm3"),
372 BERLIN_PINCTRL_FUNCTION(0x4, "timer1")),
373 BERLIN_PINCTRL_GROUP("SM_SPI2_SS0n", 0x4, 0x3, 0x03,
374 BERLIN_PINCTRL_FUNCTION(0x0, "spi2"),
375 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
376 BERLIN_PINCTRL_GROUP("SM_SPI2_SS1n", 0x4, 0x3, 0x06,
377 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
378 BERLIN_PINCTRL_FUNCTION(0x1, "spi2")),
379 BERLIN_PINCTRL_GROUP("SM_SPI2_SS2n", 0x4, 0x3, 0x09,
380 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
381 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
382 BERLIN_PINCTRL_FUNCTION(0x2, "eth1"),
383 BERLIN_PINCTRL_FUNCTION(0x3, "pwm0"),
384 BERLIN_PINCTRL_FUNCTION(0x4, "timer0"),
385 BERLIN_PINCTRL_FUNCTION(0x5, "clk_25m")),
386 BERLIN_PINCTRL_GROUP("SM_SPI2_SS3n", 0x4, 0x3, 0x0c,
387 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
388 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
389 BERLIN_PINCTRL_FUNCTION(0x2, "eth1"),
390 BERLIN_PINCTRL_FUNCTION(0x3, "pwm1"),
391 BERLIN_PINCTRL_FUNCTION(0x4, "timer1")),
392 BERLIN_PINCTRL_GROUP("SM_SPI2_SDO", 0x4, 0x3, 0x0f,
393 BERLIN_PINCTRL_FUNCTION(0x0, "spi2"),
394 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
395 BERLIN_PINCTRL_GROUP("SM_SPI2_SDI", 0x4, 0x3, 0x12,
396 BERLIN_PINCTRL_FUNCTION(0x0, "spi2"),
397 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
398 BERLIN_PINCTRL_GROUP("SM_SPI2_SCLK", 0x4, 0x3, 0x15,
399 BERLIN_PINCTRL_FUNCTION(0x0, "spi2"),
400 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
401 BERLIN_PINCTRL_GROUP("SM_FE_LED0", 0x4, 0x3, 0x18,
402 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
403 BERLIN_PINCTRL_FUNCTION(0x2, "led")),
404 BERLIN_PINCTRL_GROUP("SM_FE_LED1", 0x4, 0x3, 0x1b,
405 BERLIN_PINCTRL_FUNCTION(0x0, "pwr"),
406 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
407 BERLIN_PINCTRL_FUNCTION(0x2, "led")),
408 BERLIN_PINCTRL_GROUP("SM_FE_LED2", 0x8, 0x3, 0x00,
409 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
410 BERLIN_PINCTRL_FUNCTION(0x2, "led")),
411 BERLIN_PINCTRL_GROUP("SM_HDMI_HPD", 0x8, 0x3, 0x03,
412 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
413 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
414 BERLIN_PINCTRL_GROUP("SM_HDMI_CEC", 0x8, 0x3, 0x06,
415 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
416 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
417 };
418
419 static const struct berlin_pinctrl_desc berlin4ct_soc_pinctrl_data = {
420 .groups = berlin4ct_soc_pinctrl_groups,
421 .ngroups = ARRAY_SIZE(berlin4ct_soc_pinctrl_groups),
422 };
423
424 static const struct berlin_pinctrl_desc berlin4ct_avio_pinctrl_data = {
425 .groups = berlin4ct_avio_pinctrl_groups,
426 .ngroups = ARRAY_SIZE(berlin4ct_avio_pinctrl_groups),
427 };
428
429 static const struct berlin_pinctrl_desc berlin4ct_sysmgr_pinctrl_data = {
430 .groups = berlin4ct_sysmgr_pinctrl_groups,
431 .ngroups = ARRAY_SIZE(berlin4ct_sysmgr_pinctrl_groups),
432 };
433
434 static const struct of_device_id berlin4ct_pinctrl_match[] = {
435 {
436 .compatible = "marvell,berlin4ct-soc-pinctrl",
437 .data = &berlin4ct_soc_pinctrl_data,
438 },
439 {
440 .compatible = "marvell,berlin4ct-avio-pinctrl",
441 .data = &berlin4ct_avio_pinctrl_data,
442 },
443 {
444 .compatible = "marvell,berlin4ct-system-pinctrl",
445 .data = &berlin4ct_sysmgr_pinctrl_data,
446 },
447 {}
448 };
449
450 static int berlin4ct_pinctrl_probe(struct platform_device *pdev)
451 {
452 const struct of_device_id *match =
453 of_match_device(berlin4ct_pinctrl_match, &pdev->dev);
454 struct regmap_config *rmconfig;
455 struct regmap *regmap;
456 struct resource *res;
457 void __iomem *base;
458
459 rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL);
460 if (!rmconfig)
461 return -ENOMEM;
462
463 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
464 base = devm_ioremap_resource(&pdev->dev, res);
465 if (IS_ERR(base))
466 return PTR_ERR(base);
467
468 rmconfig->reg_bits = 32,
469 rmconfig->val_bits = 32,
470 rmconfig->reg_stride = 4,
471 rmconfig->max_register = resource_size(res);
472
473 regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig);
474 if (IS_ERR(regmap))
475 return PTR_ERR(regmap);
476
477 return berlin_pinctrl_probe_regmap(pdev, match->data, regmap);
478 }
479
480 static struct platform_driver berlin4ct_pinctrl_driver = {
481 .probe = berlin4ct_pinctrl_probe,
482 .driver = {
483 .name = "berlin4ct-pinctrl",
484 .of_match_table = berlin4ct_pinctrl_match,
485 },
486 };
487 builtin_platform_driver(berlin4ct_pinctrl_driver);