aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-05-19 13:36:30 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-05-22 18:05:30 -0400
commit626eea8706b2cf88588d1c8ec2d95edcf126667d (patch)
tree28b2784408129ae3b9a4e6de1894cf0c21d7a100 /drivers/pinctrl
parent3de68d331c24e8136da147801c2d090c3038eb32 (diff)
pinctrl: berlin: add the BG2Q pinctrl driver
Add the pin-controller driver for the Berlin BG2Q SoC, with definition of its groups and functions. Pin control registers are part of chip/ system control registers, which will be represented by a single node. Until a proper driver for the chip/system control is available, register the corresponding regmap in pinctrl driver probe. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/berlin/Kconfig4
-rw-r--r--drivers/pinctrl/berlin/Makefile1
-rw-r--r--drivers/pinctrl/berlin/berlin-bg2q.c436
3 files changed, 441 insertions, 0 deletions
diff --git a/drivers/pinctrl/berlin/Kconfig b/drivers/pinctrl/berlin/Kconfig
index d81c1bb13697..3579244931e9 100644
--- a/drivers/pinctrl/berlin/Kconfig
+++ b/drivers/pinctrl/berlin/Kconfig
@@ -5,4 +5,8 @@ config PINCTRL_BERLIN
5 select PINMUX 5 select PINMUX
6 select REGMAP_MMIO 6 select REGMAP_MMIO
7 7
8config PINCTRL_BERLIN_BG2Q
9 bool
10 select PINCTRL_BERLIN
11
8endif 12endif
diff --git a/drivers/pinctrl/berlin/Makefile b/drivers/pinctrl/berlin/Makefile
index 251a2b4e1057..1866b1f2d1cf 100644
--- a/drivers/pinctrl/berlin/Makefile
+++ b/drivers/pinctrl/berlin/Makefile
@@ -1 +1,2 @@
1obj-$(CONFIG_PINCTRL_BERLIN) += berlin.o 1obj-$(CONFIG_PINCTRL_BERLIN) += berlin.o
2obj-$(CONFIG_PINCTRL_BERLIN_BG2Q) += berlin-bg2q.o
diff --git a/drivers/pinctrl/berlin/berlin-bg2q.c b/drivers/pinctrl/berlin/berlin-bg2q.c
new file mode 100644
index 000000000000..ab33a3b60056
--- /dev/null
+++ b/drivers/pinctrl/berlin/berlin-bg2q.c
@@ -0,0 +1,436 @@
1/*
2 * Marvell Berlin BG2Q pinctrl driver
3 *
4 * Copyright (C) 2014 Marvell Technology Group Ltd.
5 *
6 * Antoine Ténart <antoine.tenart@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/module.h>
14#include <linux/of_device.h>
15#include <linux/platform_device.h>
16#include <linux/regmap.h>
17
18#include "berlin.h"
19
20static const struct berlin_desc_group berlin2q_soc_pinctrl_groups[] = {
21 /* G */
22 BERLIN_PINCTRL_GROUP("G0", 0x18, 0x3, 0x00,
23 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
24 BERLIN_PINCTRL_FUNCTION(0x1, "mmc"),
25 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
26 BERLIN_PINCTRL_GROUP("G1", 0x18, 0x3, 0x03,
27 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
28 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
29 BERLIN_PINCTRL_GROUP("G2", 0x18, 0x3, 0x06,
30 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
31 BERLIN_PINCTRL_FUNCTION(0x2, "arc"),
32 BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
33 BERLIN_PINCTRL_GROUP("G3", 0x18, 0x3, 0x09,
34 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
35 BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"),
36 BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
37 BERLIN_PINCTRL_GROUP("G4", 0x18, 0x3, 0x0c,
38 BERLIN_PINCTRL_FUNCTION(0x0, "pll"),
39 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
40 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
41 BERLIN_PINCTRL_FUNCTION(0x3, "gpio"),
42 BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
43 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
44 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
45 BERLIN_PINCTRL_GROUP("G5", 0x18, 0x3, 0x0f,
46 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
47 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
48 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
49 BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
50 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
51 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
52 BERLIN_PINCTRL_GROUP("G6", 0x18, 0x3, 0x12,
53 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
54 BERLIN_PINCTRL_FUNCTION(0x1, "twsi0"),
55 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
56 BERLIN_PINCTRL_GROUP("G7", 0x18, 0x3, 0x15,
57 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
58 BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
59 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
60 BERLIN_PINCTRL_FUNCTION(0x3, "eddc")),
61 BERLIN_PINCTRL_GROUP("G8", 0x18, 0x3, 0x18,
62 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
63 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
64 BERLIN_PINCTRL_GROUP("G9", 0x18, 0x3, 0x1b,
65 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"),
66 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
67 BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
68 BERLIN_PINCTRL_GROUP("G10", 0x1c, 0x3, 0x00,
69 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
70 BERLIN_PINCTRL_FUNCTION(0x1, "spi1"),
71 BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
72 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
73 BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
74 BERLIN_PINCTRL_GROUP("G11", 0x1c, 0x3, 0x03,
75 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
76 BERLIN_PINCTRL_FUNCTION(0x1, "spi1"),
77 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
78 BERLIN_PINCTRL_FUNCTION(0x3, "i2s1"),
79 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
80 BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
81 BERLIN_PINCTRL_GROUP("G12", 0x1c, 0x3, 0x06,
82 BERLIN_PINCTRL_FUNCTION(0x0, "agc"),
83 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
84 BERLIN_PINCTRL_GROUP("G13", 0x1c, 0x3, 0x09,
85 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
86 BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
87 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
88 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
89 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
90 BERLIN_PINCTRL_GROUP("G14", 0x1c, 0x3, 0x0c,
91 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
92 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
93 BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
94 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
95 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
96 BERLIN_PINCTRL_GROUP("G15", 0x1c, 0x3, 0x0f,
97 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
98 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
99 BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
100 BERLIN_PINCTRL_FUNCTION(0x5, "vdac"),
101 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
102 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
103 BERLIN_PINCTRL_GROUP("G16", 0x1c, 0x3, 0x12,
104 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
105 BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
106 BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
107 BERLIN_PINCTRL_FUNCTION(0x5, "osco"),
108 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
109 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
110 BERLIN_PINCTRL_GROUP("G17", 0x1c, 0x3, 0x15,
111 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
112 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
113 BERLIN_PINCTRL_FUNCTION(0x3, "spdif"),
114 BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
115 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
116 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
117 BERLIN_PINCTRL_GROUP("G18", 0x1c, 0x3, 0x18,
118 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
119 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
120 BERLIN_PINCTRL_FUNCTION(0x3, "i2s2"),
121 BERLIN_PINCTRL_FUNCTION(0x4, "sts1")),
122 BERLIN_PINCTRL_GROUP("G19", 0x1c, 0x3, 0x1b,
123 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
124 BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
125 BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
126 BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
127 BERLIN_PINCTRL_FUNCTION(0x5, "osco")),
128 BERLIN_PINCTRL_GROUP("G20", 0x20, 0x3, 0x00,
129 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
130 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
131 BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
132 /*
133 * Mode 0x4 mux usb2_dbg *and* usb3_dbg:
134 * add two functions so it can be used with other groups
135 * within the same subnode in the device tree
136 */
137 BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg"),
138 BERLIN_PINCTRL_FUNCTION(0x4, "usb3_dbg")),
139 BERLIN_PINCTRL_GROUP("G21", 0x20, 0x3, 0x03,
140 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
141 BERLIN_PINCTRL_FUNCTION(0x1, "sts2"),
142 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
143 BERLIN_PINCTRL_FUNCTION(0x3, "demod")),
144 BERLIN_PINCTRL_GROUP("G22", 0x20, 0x3, 0x06,
145 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
146 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
147 BERLIN_PINCTRL_GROUP("G23", 0x20, 0x3, 0x09,
148 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
149 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
150 BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
151 BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
152 BERLIN_PINCTRL_GROUP("G24", 0x20, 0x3, 0x0c,
153 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
154 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
155 BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
156 BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
157 BERLIN_PINCTRL_GROUP("G25", 0x20, 0x3, 0x0f,
158 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
159 BERLIN_PINCTRL_FUNCTION(0x1, "vga"),
160 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
161 BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
162 BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
163 BERLIN_PINCTRL_GROUP("G26", 0x20, 0x3, 0x12,
164 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
165 BERLIN_PINCTRL_FUNCTION(0x1, "lvds"),
166 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
167 BERLIN_PINCTRL_GROUP("G27", 0x20, 0x3, 0x15,
168 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
169 BERLIN_PINCTRL_FUNCTION(0x1, "agc"),
170 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
171 BERLIN_PINCTRL_GROUP("G28", 0x20, 0x3, 0x18,
172 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
173 BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
174 BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
175 BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
176 BERLIN_PINCTRL_GROUP("G29", 0x20, 0x3, 0x1b,
177 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
178 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
179 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
180 BERLIN_PINCTRL_GROUP("G30", 0x24, 0x3, 0x00,
181 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
182 BERLIN_PINCTRL_FUNCTION(0x1, "scrd1"),
183 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
184 BERLIN_PINCTRL_GROUP("G31", 0x24, 0x3, 0x03,
185 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
186 BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
187 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
188 BERLIN_PINCTRL_GROUP("G32", 0x24, 0x3, 0x06,
189 BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
190 BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
191 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
192 /* GAV */
193 BERLIN_PINCTRL_GROUP("GAV0", 0x24, 0x3, 0x09,
194 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
195 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
196 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
197 BERLIN_PINCTRL_FUNCTION(0x4, "lvds")),
198 BERLIN_PINCTRL_GROUP("GAV1", 0x24, 0x3, 0x0c,
199 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
200 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
201 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
202 BERLIN_PINCTRL_FUNCTION(0x4, "vga")),
203 BERLIN_PINCTRL_GROUP("GAV2", 0x24, 0x3, 0x0f,
204 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
205 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
206 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
207 BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
208 BERLIN_PINCTRL_FUNCTION(0x4, "pdm"),
209 BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
210 BERLIN_PINCTRL_GROUP("GAV3", 0x24, 0x3, 0x12,
211 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
212 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
213 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
214 BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
215 BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
216 BERLIN_PINCTRL_GROUP("GAV4", 0x24, 0x3, 0x15,
217 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
218 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
219 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
220 BERLIN_PINCTRL_FUNCTION(0x4, "i2s1"),
221 BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
222 BERLIN_PINCTRL_GROUP("GAV5", 0x24, 0x3, 0x18,
223 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
224 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
225 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
226 BERLIN_PINCTRL_FUNCTION(0x4, "spdif")),
227 BERLIN_PINCTRL_GROUP("GAV6", 0x24, 0x3, 0x1b,
228 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
229 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
230 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
231 BERLIN_PINCTRL_FUNCTION(0x4, "i2s2")),
232 BERLIN_PINCTRL_GROUP("GAV7", 0x28, 0x3, 0x00,
233 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
234 BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
235 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
236 BERLIN_PINCTRL_FUNCTION(0x4, "i2s3")),
237 BERLIN_PINCTRL_GROUP("GAV8", 0x28, 0x3, 0x03,
238 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
239 BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
240 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
241 BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
242 BERLIN_PINCTRL_GROUP("GAV9", 0x28, 0x3, 0x06,
243 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
244 BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
245 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
246 BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
247 BERLIN_PINCTRL_GROUP("GAV10", 0x28, 0x3, 0x09,
248 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
249 BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
250 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
251 BERLIN_PINCTRL_FUNCTION(0x4, "agc")),
252 BERLIN_PINCTRL_GROUP("GAV11", 0x28, 0x3, 0x0c,
253 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
254 BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
255 BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
256 BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
257 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
258 BERLIN_PINCTRL_FUNCTION(0x5, "vclki")),
259 BERLIN_PINCTRL_GROUP("GAV12", 0x28, 0x3, 0x0f,
260 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
261 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
262 BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
263 BERLIN_PINCTRL_GROUP("GAV13", 0x28, 0x3, 0x12,
264 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
265 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2")),
266 BERLIN_PINCTRL_GROUP("GAV14", 0x28, 0x3, 0x15,
267 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
268 BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
269 BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
270 BERLIN_PINCTRL_GROUP("GAV15", 0x28, 0x3, 0x18,
271 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
272 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
273 BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
274 BERLIN_PINCTRL_GROUP("GAV16", 0x28, 0x3, 0x1b,
275 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
276 BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
277 BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
278 BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
279 BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
280 BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
281 BERLIN_PINCTRL_GROUP("GAV17", 0x2c, 0x3, 0x00,
282 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
283 BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
284 BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
285 BERLIN_PINCTRL_FUNCTION(0x3, "pwm"),
286 BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
287 BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
288 BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
289 BERLIN_PINCTRL_GROUP("GAV18", 0x2c, 0x3, 0x03,
290 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
291 BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
292 BERLIN_PINCTRL_FUNCTION(0x2, "arc")),
293 BERLIN_PINCTRL_GROUP("GAV19", 0x2c, 0x3, 0x06,
294 BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
295 BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
296 BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
297 BERLIN_PINCTRL_FUNCTION(0x5, "pdm")),
298};
299
300static const struct berlin_desc_group berlin2q_sysmgr_pinctrl_groups[] = {
301 /* GSM */
302 BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
303 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
304 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
305 BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
306 BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
307 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
308 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
309 BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
310 BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
311 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
312 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
313 BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
314 BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
315 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
316 BERLIN_PINCTRL_FUNCTION(0x1, "spi2"),
317 BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
318 BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x1, 0x08,
319 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
320 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
321 BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x1, 0x09,
322 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
323 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
324 BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x1, 0x0a,
325 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
326 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
327 BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0b,
328 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
329 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
330 BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0c,
331 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
332 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
333 BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x0d,
334 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
335 BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
336 BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x0e,
337 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
338 BERLIN_PINCTRL_FUNCTION(0x1, "led")),
339 BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x0f,
340 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
341 BERLIN_PINCTRL_FUNCTION(0x1, "led")),
342 BERLIN_PINCTRL_GROUP("GSM12", 0x40, 0x2, 0x10,
343 BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RX/TX */
344 BERLIN_PINCTRL_FUNCTION(0x1, "irda0"),
345 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
346 BERLIN_PINCTRL_GROUP("GSM13", 0x40, 0x2, 0x12,
347 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
348 BERLIN_PINCTRL_FUNCTION(0x1, "uart0"), /* CTS/RTS */
349 BERLIN_PINCTRL_FUNCTION(0x2, "uart1"), /* RX/TX */
350 BERLIN_PINCTRL_FUNCTION(0x3, "twsi2")),
351 BERLIN_PINCTRL_GROUP("GSM14", 0x40, 0x2, 0x14,
352 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
353 BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RX/TX */
354 BERLIN_PINCTRL_FUNCTION(0x2, "irda1"),
355 BERLIN_PINCTRL_FUNCTION(0x3, "twsi3")),
356 BERLIN_PINCTRL_GROUP("GSM15", 0x40, 0x2, 0x16,
357 BERLIN_PINCTRL_FUNCTION(0x0, "pwr"),
358 BERLIN_PINCTRL_FUNCTION(0x1, "led"),
359 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
360 BERLIN_PINCTRL_GROUP("GSM16", 0x40, 0x1, 0x18,
361 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
362 BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
363 BERLIN_PINCTRL_GROUP("GSM17", 0x40, 0x1, 0x19,
364 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
365 BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
366 BERLIN_PINCTRL_GROUP("GSM18", 0x40, 0x1, 0x1a,
367 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
368 BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
369};
370
371static const struct berlin_pinctrl_desc berlin2q_soc_pinctrl_data = {
372 .groups = berlin2q_soc_pinctrl_groups,
373 .ngroups = ARRAY_SIZE(berlin2q_soc_pinctrl_groups),
374};
375
376static const struct berlin_pinctrl_desc berlin2q_sysmgr_pinctrl_data = {
377 .groups = berlin2q_sysmgr_pinctrl_groups,
378 .ngroups = ARRAY_SIZE(berlin2q_sysmgr_pinctrl_groups),
379};
380
381static const struct of_device_id berlin2q_pinctrl_match[] = {
382 {
383 .compatible = "marvell,berlin2q-chip-ctrl",
384 .data = &berlin2q_soc_pinctrl_data,
385 },
386 {
387 .compatible = "marvell,berlin2q-system-ctrl",
388 .data = &berlin2q_sysmgr_pinctrl_data,
389 },
390 {}
391};
392MODULE_DEVICE_TABLE(of, berlin2q_pinctrl_match);
393
394static int berlin2q_pinctrl_probe(struct platform_device *pdev)
395{
396 const struct of_device_id *match =
397 of_match_device(berlin2q_pinctrl_match, &pdev->dev);
398 struct regmap_config *rmconfig;
399 struct regmap *regmap;
400 struct resource *res;
401 void __iomem *base;
402
403 rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL);
404 if (!rmconfig)
405 return -ENOMEM;
406
407 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
408 base = devm_request_and_ioremap(&pdev->dev, res);
409 if (!base)
410 return -EADDRNOTAVAIL;
411
412 rmconfig->reg_bits = 32,
413 rmconfig->val_bits = 32,
414 rmconfig->reg_stride = 4,
415 rmconfig->max_register = resource_size(res);
416
417 regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig);
418 if (IS_ERR(regmap))
419 return PTR_ERR(regmap);
420
421 return berlin_pinctrl_probe(pdev, match->data);
422}
423
424static struct platform_driver berlin2q_pinctrl_driver = {
425 .probe = berlin2q_pinctrl_probe,
426 .driver = {
427 .name = "berlin-bg2q-pinctrl",
428 .owner = THIS_MODULE,
429 .of_match_table = berlin2q_pinctrl_match,
430 },
431};
432module_platform_driver(berlin2q_pinctrl_driver);
433
434MODULE_AUTHOR("Antoine Ténart <antoine.tenart@free-electrons.com>");
435MODULE_DESCRIPTION("Marvell Berlin BG2Q pinctrl driver");
436MODULE_LICENSE("GPL");