Debian Codegraph @

drivers/pinctrl/meson/pinctrl-meson-gxl.c

raw
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Pin controller and GPIO driver for Amlogic Meson GXL.
4 *
5 * Copyright (C) 2016 Endless Mobile, Inc.
6 * Author: Carlo Caione <[email protected]>
7 */
8
9 #include <dt-bindings/gpio/meson-gxl-gpio.h>
10 #include "pinctrl-meson.h"
11 #include "pinctrl-meson8-pmx.h"
12
13 static const struct pinctrl_pin_desc meson_gxl_periphs_pins[] = {
14 MESON_PIN(GPIOZ_0),
15 MESON_PIN(GPIOZ_1),
16 MESON_PIN(GPIOZ_2),
17 MESON_PIN(GPIOZ_3),
18 MESON_PIN(GPIOZ_4),
19 MESON_PIN(GPIOZ_5),
20 MESON_PIN(GPIOZ_6),
21 MESON_PIN(GPIOZ_7),
22 MESON_PIN(GPIOZ_8),
23 MESON_PIN(GPIOZ_9),
24 MESON_PIN(GPIOZ_10),
25 MESON_PIN(GPIOZ_11),
26 MESON_PIN(GPIOZ_12),
27 MESON_PIN(GPIOZ_13),
28 MESON_PIN(GPIOZ_14),
29 MESON_PIN(GPIOZ_15),
30
31 MESON_PIN(GPIOH_0),
32 MESON_PIN(GPIOH_1),
33 MESON_PIN(GPIOH_2),
34 MESON_PIN(GPIOH_3),
35 MESON_PIN(GPIOH_4),
36 MESON_PIN(GPIOH_5),
37 MESON_PIN(GPIOH_6),
38 MESON_PIN(GPIOH_7),
39 MESON_PIN(GPIOH_8),
40 MESON_PIN(GPIOH_9),
41
42 MESON_PIN(BOOT_0),
43 MESON_PIN(BOOT_1),
44 MESON_PIN(BOOT_2),
45 MESON_PIN(BOOT_3),
46 MESON_PIN(BOOT_4),
47 MESON_PIN(BOOT_5),
48 MESON_PIN(BOOT_6),
49 MESON_PIN(BOOT_7),
50 MESON_PIN(BOOT_8),
51 MESON_PIN(BOOT_9),
52 MESON_PIN(BOOT_10),
53 MESON_PIN(BOOT_11),
54 MESON_PIN(BOOT_12),
55 MESON_PIN(BOOT_13),
56 MESON_PIN(BOOT_14),
57 MESON_PIN(BOOT_15),
58
59 MESON_PIN(CARD_0),
60 MESON_PIN(CARD_1),
61 MESON_PIN(CARD_2),
62 MESON_PIN(CARD_3),
63 MESON_PIN(CARD_4),
64 MESON_PIN(CARD_5),
65 MESON_PIN(CARD_6),
66
67 MESON_PIN(GPIODV_0),
68 MESON_PIN(GPIODV_1),
69 MESON_PIN(GPIODV_2),
70 MESON_PIN(GPIODV_3),
71 MESON_PIN(GPIODV_4),
72 MESON_PIN(GPIODV_5),
73 MESON_PIN(GPIODV_6),
74 MESON_PIN(GPIODV_7),
75 MESON_PIN(GPIODV_8),
76 MESON_PIN(GPIODV_9),
77 MESON_PIN(GPIODV_10),
78 MESON_PIN(GPIODV_11),
79 MESON_PIN(GPIODV_12),
80 MESON_PIN(GPIODV_13),
81 MESON_PIN(GPIODV_14),
82 MESON_PIN(GPIODV_15),
83 MESON_PIN(GPIODV_16),
84 MESON_PIN(GPIODV_17),
85 MESON_PIN(GPIODV_18),
86 MESON_PIN(GPIODV_19),
87 MESON_PIN(GPIODV_20),
88 MESON_PIN(GPIODV_21),
89 MESON_PIN(GPIODV_22),
90 MESON_PIN(GPIODV_23),
91 MESON_PIN(GPIODV_24),
92 MESON_PIN(GPIODV_25),
93 MESON_PIN(GPIODV_26),
94 MESON_PIN(GPIODV_27),
95 MESON_PIN(GPIODV_28),
96 MESON_PIN(GPIODV_29),
97
98 MESON_PIN(GPIOX_0),
99 MESON_PIN(GPIOX_1),
100 MESON_PIN(GPIOX_2),
101 MESON_PIN(GPIOX_3),
102 MESON_PIN(GPIOX_4),
103 MESON_PIN(GPIOX_5),
104 MESON_PIN(GPIOX_6),
105 MESON_PIN(GPIOX_7),
106 MESON_PIN(GPIOX_8),
107 MESON_PIN(GPIOX_9),
108 MESON_PIN(GPIOX_10),
109 MESON_PIN(GPIOX_11),
110 MESON_PIN(GPIOX_12),
111 MESON_PIN(GPIOX_13),
112 MESON_PIN(GPIOX_14),
113 MESON_PIN(GPIOX_15),
114 MESON_PIN(GPIOX_16),
115 MESON_PIN(GPIOX_17),
116 MESON_PIN(GPIOX_18),
117
118 MESON_PIN(GPIOCLK_0),
119 MESON_PIN(GPIOCLK_1),
120 };
121
122 static const unsigned int emmc_nand_d07_pins[] = {
123 BOOT_0, BOOT_1, BOOT_2, BOOT_3, BOOT_4, BOOT_5, BOOT_6, BOOT_7,
124 };
125 static const unsigned int emmc_clk_pins[] = { BOOT_8 };
126 static const unsigned int emmc_cmd_pins[] = { BOOT_10 };
127 static const unsigned int emmc_ds_pins[] = { BOOT_15 };
128
129 static const unsigned int nor_d_pins[] = { BOOT_11 };
130 static const unsigned int nor_q_pins[] = { BOOT_12 };
131 static const unsigned int nor_c_pins[] = { BOOT_13 };
132 static const unsigned int nor_cs_pins[] = { BOOT_15 };
133
134 static const unsigned int spi_mosi_pins[] = { GPIOX_8 };
135 static const unsigned int spi_miso_pins[] = { GPIOX_9 };
136 static const unsigned int spi_ss0_pins[] = { GPIOX_10 };
137 static const unsigned int spi_sclk_pins[] = { GPIOX_11 };
138
139 static const unsigned int sdcard_d0_pins[] = { CARD_1 };
140 static const unsigned int sdcard_d1_pins[] = { CARD_0 };
141 static const unsigned int sdcard_d2_pins[] = { CARD_5 };
142 static const unsigned int sdcard_d3_pins[] = { CARD_4 };
143 static const unsigned int sdcard_cmd_pins[] = { CARD_3 };
144 static const unsigned int sdcard_clk_pins[] = { CARD_2 };
145
146 static const unsigned int sdio_d0_pins[] = { GPIOX_0 };
147 static const unsigned int sdio_d1_pins[] = { GPIOX_1 };
148 static const unsigned int sdio_d2_pins[] = { GPIOX_2 };
149 static const unsigned int sdio_d3_pins[] = { GPIOX_3 };
150 static const unsigned int sdio_clk_pins[] = { GPIOX_4 };
151 static const unsigned int sdio_cmd_pins[] = { GPIOX_5 };
152 static const unsigned int sdio_irq_pins[] = { GPIOX_7 };
153
154 static const unsigned int nand_ce0_pins[] = { BOOT_8 };
155 static const unsigned int nand_ce1_pins[] = { BOOT_9 };
156 static const unsigned int nand_rb0_pins[] = { BOOT_10 };
157 static const unsigned int nand_ale_pins[] = { BOOT_11 };
158 static const unsigned int nand_cle_pins[] = { BOOT_12 };
159 static const unsigned int nand_wen_clk_pins[] = { BOOT_13 };
160 static const unsigned int nand_ren_wr_pins[] = { BOOT_14 };
161 static const unsigned int nand_dqs_pins[] = { BOOT_15 };
162
163 static const unsigned int uart_tx_a_pins[] = { GPIOX_12 };
164 static const unsigned int uart_rx_a_pins[] = { GPIOX_13 };
165 static const unsigned int uart_cts_a_pins[] = { GPIOX_14 };
166 static const unsigned int uart_rts_a_pins[] = { GPIOX_15 };
167
168 static const unsigned int uart_tx_b_pins[] = { GPIODV_24 };
169 static const unsigned int uart_rx_b_pins[] = { GPIODV_25 };
170 static const unsigned int uart_cts_b_pins[] = { GPIODV_26 };
171 static const unsigned int uart_rts_b_pins[] = { GPIODV_27 };
172
173 static const unsigned int uart_tx_c_pins[] = { GPIOX_8 };
174 static const unsigned int uart_rx_c_pins[] = { GPIOX_9 };
175 static const unsigned int uart_cts_c_pins[] = { GPIOX_10 };
176 static const unsigned int uart_rts_c_pins[] = { GPIOX_11 };
177
178 static const unsigned int i2c_sck_a_pins[] = { GPIODV_25 };
179 static const unsigned int i2c_sda_a_pins[] = { GPIODV_24 };
180
181 static const unsigned int i2c_sck_b_pins[] = { GPIODV_27 };
182 static const unsigned int i2c_sda_b_pins[] = { GPIODV_26 };
183
184 static const unsigned int i2c_sck_c_pins[] = { GPIODV_29 };
185 static const unsigned int i2c_sda_c_pins[] = { GPIODV_28 };
186
187 static const unsigned int i2c_sck_c_dv19_pins[] = { GPIODV_19 };
188 static const unsigned int i2c_sda_c_dv18_pins[] = { GPIODV_18 };
189
190 static const unsigned int i2c_sck_d_pins[] = { GPIOX_11 };
191 static const unsigned int i2c_sda_d_pins[] = { GPIOX_10 };
192
193 static const unsigned int eth_mdio_pins[] = { GPIOZ_0 };
194 static const unsigned int eth_mdc_pins[] = { GPIOZ_1 };
195 static const unsigned int eth_clk_rx_clk_pins[] = { GPIOZ_2 };
196 static const unsigned int eth_rx_dv_pins[] = { GPIOZ_3 };
197 static const unsigned int eth_rxd0_pins[] = { GPIOZ_4 };
198 static const unsigned int eth_rxd1_pins[] = { GPIOZ_5 };
199 static const unsigned int eth_rxd2_pins[] = { GPIOZ_6 };
200 static const unsigned int eth_rxd3_pins[] = { GPIOZ_7 };
201 static const unsigned int eth_rgmii_tx_clk_pins[] = { GPIOZ_8 };
202 static const unsigned int eth_tx_en_pins[] = { GPIOZ_9 };
203 static const unsigned int eth_txd0_pins[] = { GPIOZ_10 };
204 static const unsigned int eth_txd1_pins[] = { GPIOZ_11 };
205 static const unsigned int eth_txd2_pins[] = { GPIOZ_12 };
206 static const unsigned int eth_txd3_pins[] = { GPIOZ_13 };
207
208 static const unsigned int pwm_a_pins[] = { GPIOX_6 };
209
210 static const unsigned int pwm_b_pins[] = { GPIODV_29 };
211
212 static const unsigned int pwm_c_pins[] = { GPIOZ_15 };
213
214 static const unsigned int pwm_d_pins[] = { GPIODV_28 };
215
216 static const unsigned int pwm_e_pins[] = { GPIOX_16 };
217
218 static const unsigned int pwm_f_clk_pins[] = { GPIOCLK_1 };
219 static const unsigned int pwm_f_x_pins[] = { GPIOX_7 };
220
221 static const unsigned int hdmi_hpd_pins[] = { GPIOH_0 };
222 static const unsigned int hdmi_sda_pins[] = { GPIOH_1 };
223 static const unsigned int hdmi_scl_pins[] = { GPIOH_2 };
224
225 static const unsigned int i2s_am_clk_pins[] = { GPIOH_6 };
226 static const unsigned int i2s_out_ao_clk_pins[] = { GPIOH_7 };
227 static const unsigned int i2s_out_lr_clk_pins[] = { GPIOH_8 };
228 static const unsigned int i2s_out_ch01_pins[] = { GPIOH_9 };
229 static const unsigned int i2s_out_ch23_z_pins[] = { GPIOZ_5 };
230 static const unsigned int i2s_out_ch45_z_pins[] = { GPIOZ_6 };
231 static const unsigned int i2s_out_ch67_z_pins[] = { GPIOZ_7 };
232
233 static const unsigned int spdif_out_h_pins[] = { GPIOH_4 };
234
235 static const unsigned int eth_link_led_pins[] = { GPIOZ_14 };
236 static const unsigned int eth_act_led_pins[] = { GPIOZ_15 };
237
238 static const unsigned int tsin_a_d0_pins[] = { GPIODV_0 };
239 static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 };
240 static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 };
241 static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 };
242 static const unsigned int tsin_a_fail_pins[] = { GPIODV_11 };
243 static const unsigned int tsin_a_dp_pins[] = {
244 GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7,
245 };
246
247 static const unsigned int tsin_b_clk_pins[] = { GPIOH_6 };
248 static const unsigned int tsin_b_d0_pins[] = { GPIOH_7 };
249 static const unsigned int tsin_b_sop_pins[] = { GPIOH_8 };
250 static const unsigned int tsin_b_d_valid_pins[] = { GPIOH_9 };
251
252 static const unsigned int tsin_b_fail_z4_pins[] = { GPIOZ_4 };
253 static const unsigned int tsin_b_clk_z3_pins[] = { GPIOZ_3 };
254 static const unsigned int tsin_b_d0_z2_pins[] = { GPIOZ_2 };
255 static const unsigned int tsin_b_sop_z1_pins[] = { GPIOZ_1 };
256 static const unsigned int tsin_b_d_valid_z0_pins[] = { GPIOZ_0 };
257
258 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = {
259 MESON_PIN(GPIOAO_0),
260 MESON_PIN(GPIOAO_1),
261 MESON_PIN(GPIOAO_2),
262 MESON_PIN(GPIOAO_3),
263 MESON_PIN(GPIOAO_4),
264 MESON_PIN(GPIOAO_5),
265 MESON_PIN(GPIOAO_6),
266 MESON_PIN(GPIOAO_7),
267 MESON_PIN(GPIOAO_8),
268 MESON_PIN(GPIOAO_9),
269
270 MESON_PIN(GPIO_TEST_N),
271 };
272
273 static const unsigned int uart_tx_ao_a_pins[] = { GPIOAO_0 };
274 static const unsigned int uart_rx_ao_a_pins[] = { GPIOAO_1 };
275 static const unsigned int uart_tx_ao_b_0_pins[] = { GPIOAO_0 };
276 static const unsigned int uart_rx_ao_b_1_pins[] = { GPIOAO_1 };
277 static const unsigned int uart_cts_ao_a_pins[] = { GPIOAO_2 };
278 static const unsigned int uart_rts_ao_a_pins[] = { GPIOAO_3 };
279 static const unsigned int uart_tx_ao_b_pins[] = { GPIOAO_4 };
280 static const unsigned int uart_rx_ao_b_pins[] = { GPIOAO_5 };
281 static const unsigned int uart_cts_ao_b_pins[] = { GPIOAO_2 };
282 static const unsigned int uart_rts_ao_b_pins[] = { GPIOAO_3 };
283
284 static const unsigned int i2c_sck_ao_pins[] = {GPIOAO_4 };
285 static const unsigned int i2c_sda_ao_pins[] = {GPIOAO_5 };
286 static const unsigned int i2c_slave_sck_ao_pins[] = {GPIOAO_4 };
287 static const unsigned int i2c_slave_sda_ao_pins[] = {GPIOAO_5 };
288
289 static const unsigned int remote_input_ao_pins[] = {GPIOAO_7 };
290
291 static const unsigned int pwm_ao_a_3_pins[] = { GPIOAO_3 };
292 static const unsigned int pwm_ao_a_8_pins[] = { GPIOAO_8 };
293
294 static const unsigned int pwm_ao_b_pins[] = { GPIOAO_9 };
295 static const unsigned int pwm_ao_b_6_pins[] = { GPIOAO_6 };
296
297 static const unsigned int i2s_out_ch23_ao_pins[] = { GPIOAO_8 };
298 static const unsigned int i2s_out_ch45_ao_pins[] = { GPIOAO_9 };
299 static const unsigned int i2s_out_ch67_ao_pins[] = { GPIO_TEST_N };
300
301 static const unsigned int spdif_out_ao_6_pins[] = { GPIOAO_6 };
302 static const unsigned int spdif_out_ao_9_pins[] = { GPIOAO_9 };
303
304 static const unsigned int ao_cec_pins[] = { GPIOAO_8 };
305 static const unsigned int ee_cec_pins[] = { GPIOAO_8 };
306
307 static const struct meson_pmx_group meson_gxl_periphs_groups[] = {
308 GPIO_GROUP(GPIOZ_0),
309 GPIO_GROUP(GPIOZ_1),
310 GPIO_GROUP(GPIOZ_2),
311 GPIO_GROUP(GPIOZ_3),
312 GPIO_GROUP(GPIOZ_4),
313 GPIO_GROUP(GPIOZ_5),
314 GPIO_GROUP(GPIOZ_6),
315 GPIO_GROUP(GPIOZ_7),
316 GPIO_GROUP(GPIOZ_8),
317 GPIO_GROUP(GPIOZ_9),
318 GPIO_GROUP(GPIOZ_10),
319 GPIO_GROUP(GPIOZ_11),
320 GPIO_GROUP(GPIOZ_12),
321 GPIO_GROUP(GPIOZ_13),
322 GPIO_GROUP(GPIOZ_14),
323 GPIO_GROUP(GPIOZ_15),
324
325 GPIO_GROUP(GPIOH_0),
326 GPIO_GROUP(GPIOH_1),
327 GPIO_GROUP(GPIOH_2),
328 GPIO_GROUP(GPIOH_3),
329 GPIO_GROUP(GPIOH_4),
330 GPIO_GROUP(GPIOH_5),
331 GPIO_GROUP(GPIOH_6),
332 GPIO_GROUP(GPIOH_7),
333 GPIO_GROUP(GPIOH_8),
334 GPIO_GROUP(GPIOH_9),
335
336 GPIO_GROUP(BOOT_0),
337 GPIO_GROUP(BOOT_1),
338 GPIO_GROUP(BOOT_2),
339 GPIO_GROUP(BOOT_3),
340 GPIO_GROUP(BOOT_4),
341 GPIO_GROUP(BOOT_5),
342 GPIO_GROUP(BOOT_6),
343 GPIO_GROUP(BOOT_7),
344 GPIO_GROUP(BOOT_8),
345 GPIO_GROUP(BOOT_9),
346 GPIO_GROUP(BOOT_10),
347 GPIO_GROUP(BOOT_11),
348 GPIO_GROUP(BOOT_12),
349 GPIO_GROUP(BOOT_13),
350 GPIO_GROUP(BOOT_14),
351 GPIO_GROUP(BOOT_15),
352
353 GPIO_GROUP(CARD_0),
354 GPIO_GROUP(CARD_1),
355 GPIO_GROUP(CARD_2),
356 GPIO_GROUP(CARD_3),
357 GPIO_GROUP(CARD_4),
358 GPIO_GROUP(CARD_5),
359 GPIO_GROUP(CARD_6),
360
361 GPIO_GROUP(GPIODV_0),
362 GPIO_GROUP(GPIODV_1),
363 GPIO_GROUP(GPIODV_2),
364 GPIO_GROUP(GPIODV_3),
365 GPIO_GROUP(GPIODV_4),
366 GPIO_GROUP(GPIODV_5),
367 GPIO_GROUP(GPIODV_6),
368 GPIO_GROUP(GPIODV_7),
369 GPIO_GROUP(GPIODV_8),
370 GPIO_GROUP(GPIODV_9),
371 GPIO_GROUP(GPIODV_10),
372 GPIO_GROUP(GPIODV_11),
373 GPIO_GROUP(GPIODV_12),
374 GPIO_GROUP(GPIODV_13),
375 GPIO_GROUP(GPIODV_14),
376 GPIO_GROUP(GPIODV_15),
377 GPIO_GROUP(GPIODV_16),
378 GPIO_GROUP(GPIODV_17),
379 GPIO_GROUP(GPIODV_19),
380 GPIO_GROUP(GPIODV_20),
381 GPIO_GROUP(GPIODV_21),
382 GPIO_GROUP(GPIODV_22),
383 GPIO_GROUP(GPIODV_23),
384 GPIO_GROUP(GPIODV_24),
385 GPIO_GROUP(GPIODV_25),
386 GPIO_GROUP(GPIODV_26),
387 GPIO_GROUP(GPIODV_27),
388 GPIO_GROUP(GPIODV_28),
389 GPIO_GROUP(GPIODV_29),
390
391 GPIO_GROUP(GPIOX_0),
392 GPIO_GROUP(GPIOX_1),
393 GPIO_GROUP(GPIOX_2),
394 GPIO_GROUP(GPIOX_3),
395 GPIO_GROUP(GPIOX_4),
396 GPIO_GROUP(GPIOX_5),
397 GPIO_GROUP(GPIOX_6),
398 GPIO_GROUP(GPIOX_7),
399 GPIO_GROUP(GPIOX_8),
400 GPIO_GROUP(GPIOX_9),
401 GPIO_GROUP(GPIOX_10),
402 GPIO_GROUP(GPIOX_11),
403 GPIO_GROUP(GPIOX_12),
404 GPIO_GROUP(GPIOX_13),
405 GPIO_GROUP(GPIOX_14),
406 GPIO_GROUP(GPIOX_15),
407 GPIO_GROUP(GPIOX_16),
408 GPIO_GROUP(GPIOX_17),
409 GPIO_GROUP(GPIOX_18),
410
411 GPIO_GROUP(GPIOCLK_0),
412 GPIO_GROUP(GPIOCLK_1),
413
414 GPIO_GROUP(GPIO_TEST_N),
415
416 /* Bank X */
417 GROUP(i2c_sda_d, 5, 5),
418 GROUP(i2c_sck_d, 5, 4),
419 GROUP(sdio_d0, 5, 31),
420 GROUP(sdio_d1, 5, 30),
421 GROUP(sdio_d2, 5, 29),
422 GROUP(sdio_d3, 5, 28),
423 GROUP(sdio_clk, 5, 27),
424 GROUP(sdio_cmd, 5, 26),
425 GROUP(sdio_irq, 5, 24),
426 GROUP(uart_tx_a, 5, 19),
427 GROUP(uart_rx_a, 5, 18),
428 GROUP(uart_cts_a, 5, 17),
429 GROUP(uart_rts_a, 5, 16),
430 GROUP(uart_tx_c, 5, 13),
431 GROUP(uart_rx_c, 5, 12),
432 GROUP(uart_cts_c, 5, 11),
433 GROUP(uart_rts_c, 5, 10),
434 GROUP(pwm_a, 5, 25),
435 GROUP(pwm_e, 5, 15),
436 GROUP(pwm_f_x, 5, 14),
437 GROUP(spi_mosi, 5, 3),
438 GROUP(spi_miso, 5, 2),
439 GROUP(spi_ss0, 5, 1),
440 GROUP(spi_sclk, 5, 0),
441
442 /* Bank Z */
443 GROUP(eth_mdio, 4, 23),
444 GROUP(eth_mdc, 4, 22),
445 GROUP(eth_clk_rx_clk, 4, 21),
446 GROUP(eth_rx_dv, 4, 20),
447 GROUP(eth_rxd0, 4, 19),
448 GROUP(eth_rxd1, 4, 18),
449 GROUP(eth_rxd2, 4, 17),
450 GROUP(eth_rxd3, 4, 16),
451 GROUP(eth_rgmii_tx_clk, 4, 15),
452 GROUP(eth_tx_en, 4, 14),
453 GROUP(eth_txd0, 4, 13),
454 GROUP(eth_txd1, 4, 12),
455 GROUP(eth_txd2, 4, 11),
456 GROUP(eth_txd3, 4, 10),
457 GROUP(tsin_b_fail_z4, 3, 15),
458 GROUP(tsin_b_clk_z3, 3, 16),
459 GROUP(tsin_b_d0_z2, 3, 17),
460 GROUP(tsin_b_sop_z1, 3, 18),
461 GROUP(tsin_b_d_valid_z0, 3, 19),
462 GROUP(pwm_c, 3, 20),
463 GROUP(i2s_out_ch23_z, 3, 26),
464 GROUP(i2s_out_ch45_z, 3, 25),
465 GROUP(i2s_out_ch67_z, 3, 24),
466 GROUP(eth_link_led, 4, 25),
467 GROUP(eth_act_led, 4, 24),
468
469 /* Bank H */
470 GROUP(hdmi_hpd, 6, 31),
471 GROUP(hdmi_sda, 6, 30),
472 GROUP(hdmi_scl, 6, 29),
473 GROUP(i2s_am_clk, 6, 26),
474 GROUP(i2s_out_ao_clk, 6, 25),
475 GROUP(i2s_out_lr_clk, 6, 24),
476 GROUP(i2s_out_ch01, 6, 23),
477 GROUP(spdif_out_h, 6, 28),
478 GROUP(tsin_b_d0, 6, 17),
479 GROUP(tsin_b_sop, 6, 18),
480 GROUP(tsin_b_d_valid, 6, 19),
481 GROUP(tsin_b_clk, 6, 20),
482
483 /* Bank DV */
484 GROUP(uart_tx_b, 2, 16),
485 GROUP(uart_rx_b, 2, 15),
486 GROUP(uart_cts_b, 2, 14),
487 GROUP(uart_rts_b, 2, 13),
488 GROUP(i2c_sda_c_dv18, 1, 17),
489 GROUP(i2c_sck_c_dv19, 1, 16),
490 GROUP(i2c_sda_a, 1, 15),
491 GROUP(i2c_sck_a, 1, 14),
492 GROUP(i2c_sda_b, 1, 13),
493 GROUP(i2c_sck_b, 1, 12),
494 GROUP(i2c_sda_c, 1, 11),
495 GROUP(i2c_sck_c, 1, 10),
496 GROUP(pwm_b, 2, 11),
497 GROUP(pwm_d, 2, 12),
498 GROUP(tsin_a_d0, 2, 4),
499 GROUP(tsin_a_dp, 2, 3),
500 GROUP(tsin_a_clk, 2, 2),
501 GROUP(tsin_a_sop, 2, 1),
502 GROUP(tsin_a_d_valid, 2, 0),
503 GROUP(tsin_a_fail, 1, 31),
504
505 /* Bank BOOT */
506 GROUP(emmc_nand_d07, 7, 31),
507 GROUP(emmc_clk, 7, 30),
508 GROUP(emmc_cmd, 7, 29),
509 GROUP(emmc_ds, 7, 28),
510 GROUP(nor_d, 7, 13),
511 GROUP(nor_q, 7, 12),
512 GROUP(nor_c, 7, 11),
513 GROUP(nor_cs, 7, 10),
514 GROUP(nand_ce0, 7, 7),
515 GROUP(nand_ce1, 7, 6),
516 GROUP(nand_rb0, 7, 5),
517 GROUP(nand_ale, 7, 4),
518 GROUP(nand_cle, 7, 3),
519 GROUP(nand_wen_clk, 7, 2),
520 GROUP(nand_ren_wr, 7, 1),
521 GROUP(nand_dqs, 7, 0),
522
523 /* Bank CARD */
524 GROUP(sdcard_d1, 6, 5),
525 GROUP(sdcard_d0, 6, 4),
526 GROUP(sdcard_d3, 6, 1),
527 GROUP(sdcard_d2, 6, 0),
528 GROUP(sdcard_cmd, 6, 2),
529 GROUP(sdcard_clk, 6, 3),
530
531 /* Bank CLK */
532 GROUP(pwm_f_clk, 8, 30),
533 };
534
535 static const struct meson_pmx_group meson_gxl_aobus_groups[] = {
536 GPIO_GROUP(GPIOAO_0),
537 GPIO_GROUP(GPIOAO_1),
538 GPIO_GROUP(GPIOAO_2),
539 GPIO_GROUP(GPIOAO_3),
540 GPIO_GROUP(GPIOAO_4),
541 GPIO_GROUP(GPIOAO_5),
542 GPIO_GROUP(GPIOAO_6),
543 GPIO_GROUP(GPIOAO_7),
544 GPIO_GROUP(GPIOAO_8),
545 GPIO_GROUP(GPIOAO_9),
546
547 /* bank AO */
548 GROUP(uart_tx_ao_b_0, 0, 26),
549 GROUP(uart_rx_ao_b_1, 0, 25),
550 GROUP(uart_tx_ao_b, 0, 24),
551 GROUP(uart_rx_ao_b, 0, 23),
552 GROUP(uart_tx_ao_a, 0, 12),
553 GROUP(uart_rx_ao_a, 0, 11),
554 GROUP(uart_cts_ao_a, 0, 10),
555 GROUP(uart_rts_ao_a, 0, 9),
556 GROUP(uart_cts_ao_b, 0, 8),
557 GROUP(uart_rts_ao_b, 0, 7),
558 GROUP(i2c_sck_ao, 0, 6),
559 GROUP(i2c_sda_ao, 0, 5),
560 GROUP(i2c_slave_sck_ao, 0, 2),
561 GROUP(i2c_slave_sda_ao, 0, 1),
562 GROUP(remote_input_ao, 0, 0),
563 GROUP(pwm_ao_a_3, 0, 22),
564 GROUP(pwm_ao_b_6, 0, 18),
565 GROUP(pwm_ao_a_8, 0, 17),
566 GROUP(pwm_ao_b, 0, 3),
567 GROUP(i2s_out_ch23_ao, 1, 0),
568 GROUP(i2s_out_ch45_ao, 1, 1),
569 GROUP(spdif_out_ao_6, 0, 16),
570 GROUP(spdif_out_ao_9, 0, 4),
571 GROUP(ao_cec, 0, 15),
572 GROUP(ee_cec, 0, 14),
573
574 /* test n pin */
575 GROUP(i2s_out_ch67_ao, 1, 2),
576 };
577
578 static const char * const gpio_periphs_groups[] = {
579 "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
580 "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
581 "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14",
582 "GPIOZ_15",
583
584 "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4",
585 "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9",
586
587 "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
588 "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
589 "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
590 "BOOT_15",
591
592 "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4",
593 "CARD_5", "CARD_6",
594
595 "GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4",
596 "GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9",
597 "GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14",
598 "GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19",
599 "GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24",
600 "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29",
601
602 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
603 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
604 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
605 "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18",
606 };
607
608 static const char * const emmc_groups[] = {
609 "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds",
610 };
611
612 static const char * const nor_groups[] = {
613 "nor_d", "nor_q", "nor_c", "nor_cs",
614 };
615
616 static const char * const spi_groups[] = {
617 "spi_mosi", "spi_miso", "spi_ss0", "spi_sclk",
618 };
619
620 static const char * const sdcard_groups[] = {
621 "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3",
622 "sdcard_cmd", "sdcard_clk",
623 };
624
625 static const char * const sdio_groups[] = {
626 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
627 "sdio_cmd", "sdio_clk", "sdio_irq",
628 };
629
630 static const char * const nand_groups[] = {
631 "emmc_nand_d07", "nand_ce0", "nand_ce1", "nand_rb0", "nand_ale",
632 "nand_cle", "nand_wen_clk", "nand_ren_wr", "nand_dqs",
633 };
634
635 static const char * const uart_a_groups[] = {
636 "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a",
637 };
638
639 static const char * const uart_b_groups[] = {
640 "uart_tx_b", "uart_rx_b", "uart_cts_b", "uart_rts_b",
641 };
642
643 static const char * const uart_c_groups[] = {
644 "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c",
645 };
646
647 static const char * const i2c_a_groups[] = {
648 "i2c_sck_a", "i2c_sda_a",
649 };
650
651 static const char * const i2c_b_groups[] = {
652 "i2c_sck_b", "i2c_sda_b",
653 };
654
655 static const char * const i2c_c_groups[] = {
656 "i2c_sck_c", "i2c_sda_c", "i2c_sda_c_dv18", "i2c_sck_c_dv19",
657 };
658
659 static const char * const i2c_d_groups[] = {
660 "i2c_sck_d", "i2c_sda_d",
661 };
662
663 static const char * const eth_groups[] = {
664 "eth_mdio", "eth_mdc", "eth_clk_rx_clk", "eth_rx_dv",
665 "eth_rxd0", "eth_rxd1", "eth_rxd2", "eth_rxd3",
666 "eth_rgmii_tx_clk", "eth_tx_en",
667 "eth_txd0", "eth_txd1", "eth_txd2", "eth_txd3",
668 };
669
670 static const char * const pwm_a_groups[] = {
671 "pwm_a",
672 };
673
674 static const char * const pwm_b_groups[] = {
675 "pwm_b",
676 };
677
678 static const char * const pwm_c_groups[] = {
679 "pwm_c",
680 };
681
682 static const char * const pwm_d_groups[] = {
683 "pwm_d",
684 };
685
686 static const char * const pwm_e_groups[] = {
687 "pwm_e",
688 };
689
690 static const char * const pwm_f_groups[] = {
691 "pwm_f_clk", "pwm_f_x",
692 };
693
694 static const char * const hdmi_hpd_groups[] = {
695 "hdmi_hpd",
696 };
697
698 static const char * const hdmi_i2c_groups[] = {
699 "hdmi_sda", "hdmi_scl",
700 };
701
702 static const char * const i2s_out_groups[] = {
703 "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk",
704 "i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z",
705 };
706
707 static const char * const spdif_out_groups[] = {
708 "spdif_out_h",
709 };
710
711 static const char * const eth_led_groups[] = {
712 "eth_link_led", "eth_act_led",
713 };
714
715 static const char * const tsin_a_groups[] = {
716 "tsin_a_clk", "tsin_a_sop",
717 "tsin_a_d_valid", "tsin_a_d0",
718 "tsin_a_dp", "tsin_a_fail",
719 };
720
721 static const char * const tsin_b_groups[] = {
722 "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0",
723 "tsin_b_clk_z3", "tsin_b_sop_z1", "tsin_b_d_valid_z0", "tsin_b_d0_z2",
724 "tsin_b_fail_z4",
725 };
726
727 static const char * const gpio_aobus_groups[] = {
728 "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
729 "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
730
731 "GPIO_TEST_N",
732 };
733
734 static const char * const uart_ao_groups[] = {
735 "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a",
736 };
737
738 static const char * const uart_ao_b_groups[] = {
739 "uart_tx_ao_b", "uart_rx_ao_b", "uart_cts_ao_b", "uart_rts_ao_b",
740 "uart_tx_ao_b_0", "uart_rx_ao_b_1",
741 };
742
743 static const char * const i2c_ao_groups[] = {
744 "i2c_sck_ao", "i2c_sda_ao",
745 };
746
747 static const char * const i2c_slave_ao_groups[] = {
748 "i2c_slave_sck_ao", "i2c_slave_sda_ao",
749 };
750
751 static const char * const remote_input_ao_groups[] = {
752 "remote_input_ao",
753 };
754
755 static const char * const pwm_ao_a_groups[] = {
756 "pwm_ao_a_3", "pwm_ao_a_8",
757 };
758
759 static const char * const pwm_ao_b_groups[] = {
760 "pwm_ao_b", "pwm_ao_b_6",
761 };
762
763 static const char * const i2s_out_ao_groups[] = {
764 "i2s_out_ch23_ao", "i2s_out_ch45_ao", "i2s_out_ch67_ao",
765 };
766
767 static const char * const spdif_out_ao_groups[] = {
768 "spdif_out_ao_6", "spdif_out_ao_9",
769 };
770
771 static const char * const cec_ao_groups[] = {
772 "ao_cec", "ee_cec",
773 };
774
775 static const struct meson_pmx_func meson_gxl_periphs_functions[] = {
776 FUNCTION(gpio_periphs),
777 FUNCTION(emmc),
778 FUNCTION(nor),
779 FUNCTION(spi),
780 FUNCTION(sdcard),
781 FUNCTION(sdio),
782 FUNCTION(nand),
783 FUNCTION(uart_a),
784 FUNCTION(uart_b),
785 FUNCTION(uart_c),
786 FUNCTION(i2c_a),
787 FUNCTION(i2c_b),
788 FUNCTION(i2c_c),
789 FUNCTION(i2c_d),
790 FUNCTION(eth),
791 FUNCTION(pwm_a),
792 FUNCTION(pwm_b),
793 FUNCTION(pwm_c),
794 FUNCTION(pwm_d),
795 FUNCTION(pwm_e),
796 FUNCTION(pwm_f),
797 FUNCTION(hdmi_hpd),
798 FUNCTION(hdmi_i2c),
799 FUNCTION(i2s_out),
800 FUNCTION(spdif_out),
801 FUNCTION(eth_led),
802 FUNCTION(tsin_a),
803 FUNCTION(tsin_b),
804 };
805
806 static const struct meson_pmx_func meson_gxl_aobus_functions[] = {
807 FUNCTION(gpio_aobus),
808 FUNCTION(uart_ao),
809 FUNCTION(uart_ao_b),
810 FUNCTION(i2c_ao),
811 FUNCTION(i2c_slave_ao),
812 FUNCTION(remote_input_ao),
813 FUNCTION(pwm_ao_a),
814 FUNCTION(pwm_ao_b),
815 FUNCTION(i2s_out_ao),
816 FUNCTION(spdif_out_ao),
817 FUNCTION(cec_ao),
818 };
819
820 static const struct meson_bank meson_gxl_periphs_banks[] = {
821 /* name first last irq pullen pull dir out in */
822 BANK("X", GPIOX_0, GPIOX_18, 89, 107, 4, 0, 4, 0, 12, 0, 13, 0, 14, 0),
823 BANK("DV", GPIODV_0, GPIODV_29, 83, 88, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0),
824 BANK("H", GPIOH_0, GPIOH_9, 26, 35, 1, 20, 1, 20, 3, 20, 4, 20, 5, 20),
825 BANK("Z", GPIOZ_0, GPIOZ_15, 10, 25, 3, 0, 3, 0, 9, 0, 10, 0, 11, 0),
826 BANK("CARD", CARD_0, CARD_6, 52, 58, 2, 20, 2, 20, 6, 20, 7, 20, 8, 20),
827 BANK("BOOT", BOOT_0, BOOT_15, 36, 51, 2, 0, 2, 0, 6, 0, 7, 0, 8, 0),
828 BANK("CLK", GPIOCLK_0, GPIOCLK_1, 108, 109, 3, 28, 3, 28, 9, 28, 10, 28, 11, 28),
829 };
830
831 static const struct meson_bank meson_gxl_aobus_banks[] = {
832 /* name first last irq pullen pull dir out in */
833 BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0),
834 };
835
836 static const struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
837 .name = "periphs-banks",
838 .pins = meson_gxl_periphs_pins,
839 .groups = meson_gxl_periphs_groups,
840 .funcs = meson_gxl_periphs_functions,
841 .banks = meson_gxl_periphs_banks,
842 .num_pins = ARRAY_SIZE(meson_gxl_periphs_pins),
843 .num_groups = ARRAY_SIZE(meson_gxl_periphs_groups),
844 .num_funcs = ARRAY_SIZE(meson_gxl_periphs_functions),
845 .num_banks = ARRAY_SIZE(meson_gxl_periphs_banks),
846 .pmx_ops = &meson8_pmx_ops,
847 };
848
849 static const struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = {
850 .name = "aobus-banks",
851 .pins = meson_gxl_aobus_pins,
852 .groups = meson_gxl_aobus_groups,
853 .funcs = meson_gxl_aobus_functions,
854 .banks = meson_gxl_aobus_banks,
855 .num_pins = ARRAY_SIZE(meson_gxl_aobus_pins),
856 .num_groups = ARRAY_SIZE(meson_gxl_aobus_groups),
857 .num_funcs = ARRAY_SIZE(meson_gxl_aobus_functions),
858 .num_banks = ARRAY_SIZE(meson_gxl_aobus_banks),
859 .pmx_ops = &meson8_pmx_ops,
860 .parse_dt = meson8_aobus_parse_dt_extra,
861 };
862
863 static const struct of_device_id meson_gxl_pinctrl_dt_match[] = {
864 {
865 .compatible = "amlogic,meson-gxl-periphs-pinctrl",
866 .data = &meson_gxl_periphs_pinctrl_data,
867 },
868 {
869 .compatible = "amlogic,meson-gxl-aobus-pinctrl",
870 .data = &meson_gxl_aobus_pinctrl_data,
871 },
872 { },
873 };
874 MODULE_DEVICE_TABLE(of, meson_gxl_pinctrl_dt_match);
875
876 static struct platform_driver meson_gxl_pinctrl_driver = {
877 .probe = meson_pinctrl_probe,
878 .driver = {
879 .name = "meson-gxl-pinctrl",
880 .of_match_table = meson_gxl_pinctrl_dt_match,
881 },
882 };
883 module_platform_driver(meson_gxl_pinctrl_driver);
884 MODULE_DESCRIPTION("Amlogic Meson GXL pinctrl driver");
885 MODULE_LICENSE("GPL v2");