1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Marvell Berlin BG2Q pinctrl driver
4  *
5  * Copyright (C) 2014 Marvell Technology Group Ltd.
6  *
7  * Antoine Ténart <antoine.tenart@free-electrons.com>
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 berlin2q_soc_pinctrl_groups[] = {
18 	/* G */
19 	BERLIN_PINCTRL_GROUP("G0", 0x18, 0x3, 0x00,
20 			BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
21 			BERLIN_PINCTRL_FUNCTION(0x1, "mmc"),
22 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
23 	BERLIN_PINCTRL_GROUP("G1", 0x18, 0x3, 0x03,
24 			BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
25 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
26 	BERLIN_PINCTRL_GROUP("G2", 0x18, 0x3, 0x06,
27 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
28 			BERLIN_PINCTRL_FUNCTION(0x2, "arc"),
29 			BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
30 	BERLIN_PINCTRL_GROUP("G3", 0x18, 0x3, 0x09,
31 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
32 			BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"),
33 			BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
34 	BERLIN_PINCTRL_GROUP("G4", 0x18, 0x3, 0x0c,
35 			BERLIN_PINCTRL_FUNCTION(0x0, "pll"),
36 			BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
37 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
38 			BERLIN_PINCTRL_FUNCTION(0x3, "gpio"),
39 			BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
40 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
41 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
42 	BERLIN_PINCTRL_GROUP("G5", 0x18, 0x3, 0x0f,
43 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
44 			BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
45 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
46 			BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
47 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
48 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
49 	BERLIN_PINCTRL_GROUP("G6", 0x18, 0x3, 0x12,
50 			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
51 			BERLIN_PINCTRL_FUNCTION(0x1, "twsi0"),
52 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
53 	BERLIN_PINCTRL_GROUP("G7", 0x18, 0x3, 0x15,
54 			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
55 			BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
56 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
57 			BERLIN_PINCTRL_FUNCTION(0x3, "eddc")),
58 	BERLIN_PINCTRL_GROUP("G8", 0x18, 0x3, 0x18,
59 			BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK/SDI/SDO */
60 			BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
61 	BERLIN_PINCTRL_GROUP("G9", 0x18, 0x3, 0x1b,
62 			BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n/SS1n */
63 			BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
64 			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
65 	BERLIN_PINCTRL_GROUP("G10", 0x1c, 0x3, 0x00,
66 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
67 			BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */
68 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
69 			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
70 			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
71 	BERLIN_PINCTRL_GROUP("G11", 0x1c, 0x3, 0x03,
72 			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
73 			BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */
74 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
75 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s1"),
76 			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
77 			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
78 	BERLIN_PINCTRL_GROUP("G12", 0x1c, 0x3, 0x06,
79 			BERLIN_PINCTRL_FUNCTION(0x0, "agc"),
80 			BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
81 	BERLIN_PINCTRL_GROUP("G13", 0x1c, 0x3, 0x09,
82 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
83 			BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
84 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
85 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
86 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
87 	BERLIN_PINCTRL_GROUP("G14", 0x1c, 0x3, 0x0c,
88 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
89 			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
90 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
91 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
92 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
93 	BERLIN_PINCTRL_GROUP("G15", 0x1c, 0x3, 0x0f,
94 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
95 			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
96 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
97 			BERLIN_PINCTRL_FUNCTION(0x5, "vdac"),
98 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
99 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
100 	BERLIN_PINCTRL_GROUP("G16", 0x1c, 0x3, 0x12,
101 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
102 			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
103 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
104 			BERLIN_PINCTRL_FUNCTION(0x5, "osco"),
105 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
106 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
107 	BERLIN_PINCTRL_GROUP("G17", 0x1c, 0x3, 0x15,
108 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
109 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
110 			BERLIN_PINCTRL_FUNCTION(0x3, "spdif"),
111 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
112 			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
113 			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
114 	BERLIN_PINCTRL_GROUP("G18", 0x1c, 0x3, 0x18,
115 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
116 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
117 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s2"),
118 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1")),
119 	BERLIN_PINCTRL_GROUP("G19", 0x1c, 0x3, 0x1b,
120 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
121 			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
122 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
123 			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
124 			BERLIN_PINCTRL_FUNCTION(0x5, "osco")),
125 	BERLIN_PINCTRL_GROUP("G20", 0x20, 0x3, 0x00,
126 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
127 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
128 			BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
129 			/*
130 			 * Mode 0x4 mux usb2_dbg *and* usb3_dbg:
131 			 * add two functions so it can be used with other groups
132 			 * within the same subnode in the device tree
133 			 */
134 			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg"),
135 			BERLIN_PINCTRL_FUNCTION(0x4, "usb3_dbg")),
136 	BERLIN_PINCTRL_GROUP("G21", 0x20, 0x3, 0x03,
137 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
138 			BERLIN_PINCTRL_FUNCTION(0x1, "sts2"),
139 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
140 			BERLIN_PINCTRL_FUNCTION(0x3, "demod")),
141 	BERLIN_PINCTRL_GROUP("G22", 0x20, 0x3, 0x06,
142 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
143 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
144 	BERLIN_PINCTRL_GROUP("G23", 0x20, 0x3, 0x09,
145 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
146 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
147 			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
148 			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
149 	BERLIN_PINCTRL_GROUP("G24", 0x20, 0x3, 0x0c,
150 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
151 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
152 			BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
153 			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
154 	BERLIN_PINCTRL_GROUP("G25", 0x20, 0x3, 0x0f,
155 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
156 			BERLIN_PINCTRL_FUNCTION(0x1, "vga"),
157 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
158 			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
159 			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
160 	BERLIN_PINCTRL_GROUP("G26", 0x20, 0x3, 0x12,
161 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
162 			BERLIN_PINCTRL_FUNCTION(0x1, "lvds"),
163 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
164 	BERLIN_PINCTRL_GROUP("G27", 0x20, 0x3, 0x15,
165 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
166 			BERLIN_PINCTRL_FUNCTION(0x1, "agc"),
167 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
168 	BERLIN_PINCTRL_GROUP("G28", 0x20, 0x3, 0x18,
169 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
170 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
171 			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
172 			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
173 	BERLIN_PINCTRL_GROUP("G29", 0x20, 0x3, 0x1b,
174 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
175 			BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
176 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
177 	BERLIN_PINCTRL_GROUP("G30", 0x24, 0x3, 0x00,
178 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
179 			BERLIN_PINCTRL_FUNCTION(0x1, "scrd1"),
180 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
181 	BERLIN_PINCTRL_GROUP("G31", 0x24, 0x3, 0x03,
182 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
183 			BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
184 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
185 	BERLIN_PINCTRL_GROUP("G32", 0x24, 0x3, 0x06,
186 			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
187 			BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
188 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
189 	/* GAV */
190 	BERLIN_PINCTRL_GROUP("GAV0", 0x24, 0x3, 0x09,
191 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
192 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
193 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
194 			BERLIN_PINCTRL_FUNCTION(0x4, "lvds")),
195 	BERLIN_PINCTRL_GROUP("GAV1", 0x24, 0x3, 0x0c,
196 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
197 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
198 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
199 			BERLIN_PINCTRL_FUNCTION(0x4, "vga")),
200 	BERLIN_PINCTRL_GROUP("GAV2", 0x24, 0x3, 0x0f,
201 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
202 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
203 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
204 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
205 			BERLIN_PINCTRL_FUNCTION(0x4, "pdm"),
206 			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
207 	BERLIN_PINCTRL_GROUP("GAV3", 0x24, 0x3, 0x12,
208 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
209 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
210 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
211 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
212 			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
213 	BERLIN_PINCTRL_GROUP("GAV4", 0x24, 0x3, 0x15,
214 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
215 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
216 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
217 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s1"),
218 			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
219 	BERLIN_PINCTRL_GROUP("GAV5", 0x24, 0x3, 0x18,
220 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
221 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
222 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
223 			BERLIN_PINCTRL_FUNCTION(0x4, "spdif")),
224 	BERLIN_PINCTRL_GROUP("GAV6", 0x24, 0x3, 0x1b,
225 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
226 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
227 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
228 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s2")),
229 	BERLIN_PINCTRL_GROUP("GAV7", 0x28, 0x3, 0x00,
230 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
231 			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
232 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
233 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3")),
234 	BERLIN_PINCTRL_GROUP("GAV8", 0x28, 0x3, 0x03,
235 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
236 			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
237 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
238 			BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
239 	BERLIN_PINCTRL_GROUP("GAV9", 0x28, 0x3, 0x06,
240 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
241 			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
242 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
243 			BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
244 	BERLIN_PINCTRL_GROUP("GAV10", 0x28, 0x3, 0x09,
245 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
246 			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
247 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
248 			BERLIN_PINCTRL_FUNCTION(0x4, "agc")),
249 	BERLIN_PINCTRL_GROUP("GAV11", 0x28, 0x3, 0x0c,
250 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
251 			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
252 			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
253 			BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
254 			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
255 			BERLIN_PINCTRL_FUNCTION(0x5, "vclki")),
256 	BERLIN_PINCTRL_GROUP("GAV12", 0x28, 0x3, 0x0f,
257 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
258 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
259 			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
260 	BERLIN_PINCTRL_GROUP("GAV13", 0x28, 0x3, 0x12,
261 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
262 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2")),
263 	BERLIN_PINCTRL_GROUP("GAV14", 0x28, 0x3, 0x15,
264 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
265 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
266 			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
267 	BERLIN_PINCTRL_GROUP("GAV15", 0x28, 0x3, 0x18,
268 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
269 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
270 			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
271 	BERLIN_PINCTRL_GROUP("GAV16", 0x28, 0x3, 0x1b,
272 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
273 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
274 			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
275 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
276 			BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
277 			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
278 	BERLIN_PINCTRL_GROUP("GAV17", 0x2c, 0x3, 0x00,
279 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
280 			BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
281 			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
282 			BERLIN_PINCTRL_FUNCTION(0x3, "pwm"),
283 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
284 			BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
285 			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
286 	BERLIN_PINCTRL_GROUP("GAV18", 0x2c, 0x3, 0x03,
287 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
288 			BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
289 			BERLIN_PINCTRL_FUNCTION(0x2, "arc")),
290 	BERLIN_PINCTRL_GROUP("GAV19", 0x2c, 0x3, 0x06,
291 			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
292 			BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
293 			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
294 			BERLIN_PINCTRL_FUNCTION(0x5, "pdm")),
295 };
296 
297 static const struct berlin_desc_group berlin2q_sysmgr_pinctrl_groups[] = {
298 	/* GSM */
299 	BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
300 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
301 			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS0n */
302 			BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
303 	BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
304 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
305 			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS1n */
306 			BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
307 	BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
308 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
309 			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS2n/SS3n */
310 			BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
311 	BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
312 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
313 			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* CLK/SDO */
314 			BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
315 	BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x1, 0x08,
316 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
317 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
318 	BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x1, 0x09,
319 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
320 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
321 	BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x1, 0x0a,
322 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
323 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
324 	BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0b,
325 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
326 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
327 	BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0c,
328 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
329 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
330 	BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x0d,
331 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
332 			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
333 	BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x0e,
334 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
335 			BERLIN_PINCTRL_FUNCTION(0x1, "led")),
336 	BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x0f,
337 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
338 			BERLIN_PINCTRL_FUNCTION(0x1, "led")),
339 	BERLIN_PINCTRL_GROUP("GSM12", 0x40, 0x2, 0x10,
340 			BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RX/TX */
341 			BERLIN_PINCTRL_FUNCTION(0x1, "irda0"),
342 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
343 	BERLIN_PINCTRL_GROUP("GSM13", 0x40, 0x2, 0x12,
344 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
345 			BERLIN_PINCTRL_FUNCTION(0x1, "uart0"), /* CTS/RTS */
346 			BERLIN_PINCTRL_FUNCTION(0x2, "uart1"), /* RX/TX */
347 			BERLIN_PINCTRL_FUNCTION(0x3, "twsi2")),
348 	BERLIN_PINCTRL_GROUP("GSM14", 0x40, 0x2, 0x14,
349 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
350 			BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RX/TX */
351 			BERLIN_PINCTRL_FUNCTION(0x2, "irda1"),
352 			BERLIN_PINCTRL_FUNCTION(0x3, "twsi3")),
353 	BERLIN_PINCTRL_GROUP("GSM15", 0x40, 0x2, 0x16,
354 			BERLIN_PINCTRL_FUNCTION(0x0, "pwr"),
355 			BERLIN_PINCTRL_FUNCTION(0x1, "led"),
356 			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
357 	BERLIN_PINCTRL_GROUP("GSM16", 0x40, 0x1, 0x18,
358 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
359 			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
360 	BERLIN_PINCTRL_GROUP("GSM17", 0x40, 0x1, 0x19,
361 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
362 			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
363 	BERLIN_PINCTRL_GROUP("GSM18", 0x40, 0x1, 0x1a,
364 			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
365 			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
366 };
367 
368 static const struct berlin_pinctrl_desc berlin2q_soc_pinctrl_data = {
369 	.groups = berlin2q_soc_pinctrl_groups,
370 	.ngroups = ARRAY_SIZE(berlin2q_soc_pinctrl_groups),
371 };
372 
373 static const struct berlin_pinctrl_desc berlin2q_sysmgr_pinctrl_data = {
374 	.groups = berlin2q_sysmgr_pinctrl_groups,
375 	.ngroups = ARRAY_SIZE(berlin2q_sysmgr_pinctrl_groups),
376 };
377 
378 static const struct of_device_id berlin2q_pinctrl_match[] = {
379 	{
380 		.compatible = "marvell,berlin2q-soc-pinctrl",
381 		.data = &berlin2q_soc_pinctrl_data,
382 	},
383 	{
384 		.compatible = "marvell,berlin2q-system-pinctrl",
385 		.data = &berlin2q_sysmgr_pinctrl_data,
386 	},
387 	{}
388 };
389 
390 static int berlin2q_pinctrl_probe(struct platform_device *pdev)
391 {
392 	const struct of_device_id *match =
393 		of_match_device(berlin2q_pinctrl_match, &pdev->dev);
394 
395 	return berlin_pinctrl_probe(pdev, match->data);
396 }
397 
398 static struct platform_driver berlin2q_pinctrl_driver = {
399 	.probe	= berlin2q_pinctrl_probe,
400 	.driver	= {
401 		.name = "berlin-bg2q-pinctrl",
402 		.of_match_table = berlin2q_pinctrl_match,
403 	},
404 };
405 builtin_platform_driver(berlin2q_pinctrl_driver);
406