Merge tag 'selinux-pr-20190726' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / drivers / pinctrl / meson / pinctrl-meson-g12a.c
CommitLineData
29ae0952
YL
1// SPDX-License-Identifier: (GPL-2.0+ or MIT)
2/*
3 * Pin controller and GPIO driver for Amlogic Meson G12A SoC.
4 *
5 * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
6 * Author: Xingyu Chen <xingyu.chen@amlogic.com>
7 * Author: Yixun Lan <yixun.lan@amlogic.com>
8 */
9
10#include <dt-bindings/gpio/meson-g12a-gpio.h>
11#include "pinctrl-meson.h"
12#include "pinctrl-meson-axg-pmx.h"
13
14static const struct pinctrl_pin_desc meson_g12a_periphs_pins[] = {
15 MESON_PIN(GPIOZ_0),
16 MESON_PIN(GPIOZ_1),
17 MESON_PIN(GPIOZ_2),
18 MESON_PIN(GPIOZ_3),
19 MESON_PIN(GPIOZ_4),
20 MESON_PIN(GPIOZ_5),
21 MESON_PIN(GPIOZ_6),
22 MESON_PIN(GPIOZ_7),
23 MESON_PIN(GPIOZ_8),
24 MESON_PIN(GPIOZ_9),
25 MESON_PIN(GPIOZ_10),
26 MESON_PIN(GPIOZ_11),
27 MESON_PIN(GPIOZ_12),
28 MESON_PIN(GPIOZ_13),
29 MESON_PIN(GPIOZ_14),
30 MESON_PIN(GPIOZ_15),
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(BOOT_0),
41 MESON_PIN(BOOT_1),
42 MESON_PIN(BOOT_2),
43 MESON_PIN(BOOT_3),
44 MESON_PIN(BOOT_4),
45 MESON_PIN(BOOT_5),
46 MESON_PIN(BOOT_6),
47 MESON_PIN(BOOT_7),
48 MESON_PIN(BOOT_8),
49 MESON_PIN(BOOT_9),
50 MESON_PIN(BOOT_10),
51 MESON_PIN(BOOT_11),
52 MESON_PIN(BOOT_12),
53 MESON_PIN(BOOT_13),
54 MESON_PIN(BOOT_14),
55 MESON_PIN(BOOT_15),
56 MESON_PIN(GPIOC_0),
57 MESON_PIN(GPIOC_1),
58 MESON_PIN(GPIOC_2),
59 MESON_PIN(GPIOC_3),
60 MESON_PIN(GPIOC_4),
61 MESON_PIN(GPIOC_5),
62 MESON_PIN(GPIOC_6),
63 MESON_PIN(GPIOC_7),
64 MESON_PIN(GPIOA_0),
65 MESON_PIN(GPIOA_1),
66 MESON_PIN(GPIOA_2),
67 MESON_PIN(GPIOA_3),
68 MESON_PIN(GPIOA_4),
69 MESON_PIN(GPIOA_5),
70 MESON_PIN(GPIOA_6),
71 MESON_PIN(GPIOA_7),
72 MESON_PIN(GPIOA_8),
73 MESON_PIN(GPIOA_9),
74 MESON_PIN(GPIOA_10),
75 MESON_PIN(GPIOA_11),
76 MESON_PIN(GPIOA_12),
77 MESON_PIN(GPIOA_13),
78 MESON_PIN(GPIOA_14),
79 MESON_PIN(GPIOA_15),
80 MESON_PIN(GPIOX_0),
81 MESON_PIN(GPIOX_1),
82 MESON_PIN(GPIOX_2),
83 MESON_PIN(GPIOX_3),
84 MESON_PIN(GPIOX_4),
85 MESON_PIN(GPIOX_5),
86 MESON_PIN(GPIOX_6),
87 MESON_PIN(GPIOX_7),
88 MESON_PIN(GPIOX_8),
89 MESON_PIN(GPIOX_9),
90 MESON_PIN(GPIOX_10),
91 MESON_PIN(GPIOX_11),
92 MESON_PIN(GPIOX_12),
93 MESON_PIN(GPIOX_13),
94 MESON_PIN(GPIOX_14),
95 MESON_PIN(GPIOX_15),
96 MESON_PIN(GPIOX_16),
97 MESON_PIN(GPIOX_17),
98 MESON_PIN(GPIOX_18),
99 MESON_PIN(GPIOX_19),
100};
101
102static const struct pinctrl_pin_desc meson_g12a_aobus_pins[] = {
103 MESON_PIN(GPIOAO_0),
104 MESON_PIN(GPIOAO_1),
105 MESON_PIN(GPIOAO_2),
106 MESON_PIN(GPIOAO_3),
107 MESON_PIN(GPIOAO_4),
108 MESON_PIN(GPIOAO_5),
109 MESON_PIN(GPIOAO_6),
110 MESON_PIN(GPIOAO_7),
111 MESON_PIN(GPIOAO_8),
112 MESON_PIN(GPIOAO_9),
113 MESON_PIN(GPIOAO_10),
114 MESON_PIN(GPIOAO_11),
115 MESON_PIN(GPIOE_0),
116 MESON_PIN(GPIOE_1),
117 MESON_PIN(GPIOE_2),
118};
119
120/* emmc */
121static const unsigned int emmc_nand_d0_pins[] = { BOOT_0 };
122static const unsigned int emmc_nand_d1_pins[] = { BOOT_1 };
123static const unsigned int emmc_nand_d2_pins[] = { BOOT_2 };
124static const unsigned int emmc_nand_d3_pins[] = { BOOT_3 };
125static const unsigned int emmc_nand_d4_pins[] = { BOOT_4 };
126static const unsigned int emmc_nand_d5_pins[] = { BOOT_5 };
127static const unsigned int emmc_nand_d6_pins[] = { BOOT_6 };
128static const unsigned int emmc_nand_d7_pins[] = { BOOT_7 };
129static const unsigned int emmc_clk_pins[] = { BOOT_8 };
130static const unsigned int emmc_cmd_pins[] = { BOOT_10 };
131static const unsigned int emmc_nand_ds_pins[] = { BOOT_13 };
132
133/* nand */
134static const unsigned int nand_wen_clk_pins[] = { BOOT_8 };
135static const unsigned int nand_ale_pins[] = { BOOT_9 };
136static const unsigned int nand_cle_pins[] = { BOOT_10 };
137static const unsigned int nand_ce0_pins[] = { BOOT_11 };
138static const unsigned int nand_ren_wr_pins[] = { BOOT_12 };
139static const unsigned int nand_rb0_pins[] = { BOOT_14 };
140static const unsigned int nand_ce1_pins[] = { BOOT_15 };
141
142/* nor */
143static const unsigned int nor_hold_pins[] = { BOOT_3 };
144static const unsigned int nor_d_pins[] = { BOOT_4 };
145static const unsigned int nor_q_pins[] = { BOOT_5 };
146static const unsigned int nor_c_pins[] = { BOOT_6 };
147static const unsigned int nor_wp_pins[] = { BOOT_7 };
148static const unsigned int nor_cs_pins[] = { BOOT_14 };
149
150/* sdio */
151static const unsigned int sdio_d0_pins[] = { GPIOX_0 };
152static const unsigned int sdio_d1_pins[] = { GPIOX_1 };
153static const unsigned int sdio_d2_pins[] = { GPIOX_2 };
154static const unsigned int sdio_d3_pins[] = { GPIOX_3 };
155static const unsigned int sdio_clk_pins[] = { GPIOX_4 };
156static const unsigned int sdio_cmd_pins[] = { GPIOX_5 };
157
158/* sdcard */
159static const unsigned int sdcard_d0_c_pins[] = { GPIOC_0 };
160static const unsigned int sdcard_d1_c_pins[] = { GPIOC_1 };
161static const unsigned int sdcard_d2_c_pins[] = { GPIOC_2 };
162static const unsigned int sdcard_d3_c_pins[] = { GPIOC_3 };
163static const unsigned int sdcard_clk_c_pins[] = { GPIOC_4 };
164static const unsigned int sdcard_cmd_c_pins[] = { GPIOC_5 };
165
166static const unsigned int sdcard_d0_z_pins[] = { GPIOZ_2 };
167static const unsigned int sdcard_d1_z_pins[] = { GPIOZ_3 };
168static const unsigned int sdcard_d2_z_pins[] = { GPIOZ_4 };
169static const unsigned int sdcard_d3_z_pins[] = { GPIOZ_5 };
170static const unsigned int sdcard_clk_z_pins[] = { GPIOZ_6 };
171static const unsigned int sdcard_cmd_z_pins[] = { GPIOZ_7 };
172
173/* spi0 */
174static const unsigned int spi0_mosi_c_pins[] = { GPIOC_0 };
175static const unsigned int spi0_miso_c_pins[] = { GPIOC_1 };
176static const unsigned int spi0_ss0_c_pins[] = { GPIOC_2 };
177static const unsigned int spi0_clk_c_pins[] = { GPIOC_3 };
178
179static const unsigned int spi0_mosi_x_pins[] = { GPIOX_8 };
180static const unsigned int spi0_miso_x_pins[] = { GPIOX_9 };
181static const unsigned int spi0_ss0_x_pins[] = { GPIOX_10 };
182static const unsigned int spi0_clk_x_pins[] = { GPIOX_11 };
183
184/* spi1 */
185static const unsigned int spi1_mosi_pins[] = { GPIOH_4 };
186static const unsigned int spi1_miso_pins[] = { GPIOH_5 };
187static const unsigned int spi1_ss0_pins[] = { GPIOH_6 };
188static const unsigned int spi1_clk_pins[] = { GPIOH_7 };
189
190/* i2c0 */
191static const unsigned int i2c0_sda_c_pins[] = { GPIOC_5 };
192static const unsigned int i2c0_sck_c_pins[] = { GPIOC_6 };
193static const unsigned int i2c0_sda_z0_pins[] = { GPIOZ_0 };
194static const unsigned int i2c0_sck_z1_pins[] = { GPIOZ_1 };
195static const unsigned int i2c0_sda_z7_pins[] = { GPIOZ_7 };
196static const unsigned int i2c0_sck_z8_pins[] = { GPIOZ_8 };
197
198/* i2c1 */
199static const unsigned int i2c1_sda_x_pins[] = { GPIOX_10 };
200static const unsigned int i2c1_sck_x_pins[] = { GPIOX_11 };
201static const unsigned int i2c1_sda_h2_pins[] = { GPIOH_2 };
202static const unsigned int i2c1_sck_h3_pins[] = { GPIOH_3 };
203static const unsigned int i2c1_sda_h6_pins[] = { GPIOH_6 };
204static const unsigned int i2c1_sck_h7_pins[] = { GPIOH_7 };
205
206/* i2c2 */
207static const unsigned int i2c2_sda_x_pins[] = { GPIOX_17 };
208static const unsigned int i2c2_sck_x_pins[] = { GPIOX_18 };
209static const unsigned int i2c2_sda_z_pins[] = { GPIOZ_14 };
210static const unsigned int i2c2_sck_z_pins[] = { GPIOZ_15 };
211
212/* i2c3 */
213static const unsigned int i2c3_sda_h_pins[] = { GPIOH_0 };
214static const unsigned int i2c3_sck_h_pins[] = { GPIOH_1 };
215static const unsigned int i2c3_sda_a_pins[] = { GPIOA_14 };
216static const unsigned int i2c3_sck_a_pins[] = { GPIOA_15 };
217
218/* uart_a */
219static const unsigned int uart_a_tx_pins[] = { GPIOX_12 };
220static const unsigned int uart_a_rx_pins[] = { GPIOX_13 };
221static const unsigned int uart_a_cts_pins[] = { GPIOX_14 };
222static const unsigned int uart_a_rts_pins[] = { GPIOX_15 };
223
224/* uart_b */
225static const unsigned int uart_b_tx_pins[] = { GPIOX_6 };
226static const unsigned int uart_b_rx_pins[] = { GPIOX_7 };
227
228/* uart_c */
229static const unsigned int uart_c_rts_pins[] = { GPIOH_4 };
230static const unsigned int uart_c_cts_pins[] = { GPIOH_5 };
231static const unsigned int uart_c_rx_pins[] = { GPIOH_6 };
232static const unsigned int uart_c_tx_pins[] = { GPIOH_7 };
233
234/* uart_ao_a_c */
235static const unsigned int uart_ao_a_rx_c_pins[] = { GPIOC_2 };
236static const unsigned int uart_ao_a_tx_c_pins[] = { GPIOC_3 };
237
238/* iso7816 */
239static const unsigned int iso7816_clk_c_pins[] = { GPIOC_5 };
240static const unsigned int iso7816_data_c_pins[] = { GPIOC_6 };
241static const unsigned int iso7816_clk_x_pins[] = { GPIOX_8 };
242static const unsigned int iso7816_data_x_pins[] = { GPIOX_9 };
243static const unsigned int iso7816_clk_h_pins[] = { GPIOH_6 };
244static const unsigned int iso7816_data_h_pins[] = { GPIOH_7 };
245static const unsigned int iso7816_clk_z_pins[] = { GPIOZ_0 };
246static const unsigned int iso7816_data_z_pins[] = { GPIOZ_1 };
247
248/* eth */
249static const unsigned int eth_mdio_pins[] = { GPIOZ_0 };
250static const unsigned int eth_mdc_pins[] = { GPIOZ_1 };
251static const unsigned int eth_rgmii_rx_clk_pins[] = { GPIOZ_2 };
252static const unsigned int eth_rx_dv_pins[] = { GPIOZ_3 };
253static const unsigned int eth_rxd0_pins[] = { GPIOZ_4 };
254static const unsigned int eth_rxd1_pins[] = { GPIOZ_5 };
255static const unsigned int eth_rxd2_rgmii_pins[] = { GPIOZ_6 };
256static const unsigned int eth_rxd3_rgmii_pins[] = { GPIOZ_7 };
257static const unsigned int eth_rgmii_tx_clk_pins[] = { GPIOZ_8 };
258static const unsigned int eth_txen_pins[] = { GPIOZ_9 };
259static const unsigned int eth_txd0_pins[] = { GPIOZ_10 };
260static const unsigned int eth_txd1_pins[] = { GPIOZ_11 };
261static const unsigned int eth_txd2_rgmii_pins[] = { GPIOZ_12 };
262static const unsigned int eth_txd3_rgmii_pins[] = { GPIOZ_13 };
263static const unsigned int eth_link_led_pins[] = { GPIOZ_14 };
264static const unsigned int eth_act_led_pins[] = { GPIOZ_15 };
265
266/* pwm_a */
267static const unsigned int pwm_a_pins[] = { GPIOX_6 };
268
269/* pwm_b */
270static const unsigned int pwm_b_x7_pins[] = { GPIOX_7 };
271static const unsigned int pwm_b_x19_pins[] = { GPIOX_19 };
272
273/* pwm_c */
274static const unsigned int pwm_c_c_pins[] = { GPIOC_4 };
275static const unsigned int pwm_c_x5_pins[] = { GPIOX_5 };
276static const unsigned int pwm_c_x8_pins[] = { GPIOX_8 };
277
278/* pwm_d */
279static const unsigned int pwm_d_x3_pins[] = { GPIOX_3 };
280static const unsigned int pwm_d_x6_pins[] = { GPIOX_6 };
281
282/* pwm_e */
283static const unsigned int pwm_e_pins[] = { GPIOX_16 };
284
285/* pwm_f */
286static const unsigned int pwm_f_x_pins[] = { GPIOX_7 };
287static const unsigned int pwm_f_h_pins[] = { GPIOH_5 };
288
289/* cec_ao */
290static const unsigned int cec_ao_a_h_pins[] = { GPIOH_3 };
291static const unsigned int cec_ao_b_h_pins[] = { GPIOH_3 };
292
293/* jtag_b */
294static const unsigned int jtag_b_tdo_pins[] = { GPIOC_0 };
295static const unsigned int jtag_b_tdi_pins[] = { GPIOC_1 };
296static const unsigned int jtag_b_clk_pins[] = { GPIOC_4 };
297static const unsigned int jtag_b_tms_pins[] = { GPIOC_5 };
298
299/* bt565_a */
300static const unsigned int bt565_a_vs_pins[] = { GPIOZ_0 };
301static const unsigned int bt565_a_hs_pins[] = { GPIOZ_1 };
302static const unsigned int bt565_a_clk_pins[] = { GPIOZ_3 };
303static const unsigned int bt565_a_din0_pins[] = { GPIOZ_4 };
304static const unsigned int bt565_a_din1_pins[] = { GPIOZ_5 };
305static const unsigned int bt565_a_din2_pins[] = { GPIOZ_6 };
306static const unsigned int bt565_a_din3_pins[] = { GPIOZ_7 };
307static const unsigned int bt565_a_din4_pins[] = { GPIOZ_8 };
308static const unsigned int bt565_a_din5_pins[] = { GPIOZ_9 };
309static const unsigned int bt565_a_din6_pins[] = { GPIOZ_10 };
310static const unsigned int bt565_a_din7_pins[] = { GPIOZ_11 };
311
312/* tsin_a */
313static const unsigned int tsin_a_valid_pins[] = { GPIOX_2 };
314static const unsigned int tsin_a_sop_pins[] = { GPIOX_1 };
315static const unsigned int tsin_a_din0_pins[] = { GPIOX_0 };
316static const unsigned int tsin_a_clk_pins[] = { GPIOX_3 };
317
318/* tsin_b */
319static const unsigned int tsin_b_valid_x_pins[] = { GPIOX_9 };
320static const unsigned int tsin_b_sop_x_pins[] = { GPIOX_8 };
321static const unsigned int tsin_b_din0_x_pins[] = { GPIOX_10 };
322static const unsigned int tsin_b_clk_x_pins[] = { GPIOX_11 };
323
324static const unsigned int tsin_b_valid_z_pins[] = { GPIOZ_2 };
325static const unsigned int tsin_b_sop_z_pins[] = { GPIOZ_3 };
326static const unsigned int tsin_b_din0_z_pins[] = { GPIOZ_4 };
327static const unsigned int tsin_b_clk_z_pins[] = { GPIOZ_5 };
328
329static const unsigned int tsin_b_fail_pins[] = { GPIOZ_6 };
330static const unsigned int tsin_b_din1_pins[] = { GPIOZ_7 };
331static const unsigned int tsin_b_din2_pins[] = { GPIOZ_8 };
332static const unsigned int tsin_b_din3_pins[] = { GPIOZ_9 };
333static const unsigned int tsin_b_din4_pins[] = { GPIOZ_10 };
334static const unsigned int tsin_b_din5_pins[] = { GPIOZ_11 };
335static const unsigned int tsin_b_din6_pins[] = { GPIOZ_12 };
336static const unsigned int tsin_b_din7_pins[] = { GPIOZ_13 };
337
338/* hdmitx */
339static const unsigned int hdmitx_sda_pins[] = { GPIOH_0 };
340static const unsigned int hdmitx_sck_pins[] = { GPIOH_1 };
341static const unsigned int hdmitx_hpd_in_pins[] = { GPIOH_2 };
342
343/* pdm */
344static const unsigned int pdm_din0_c_pins[] = { GPIOC_0 };
345static const unsigned int pdm_din1_c_pins[] = { GPIOC_1 };
346static const unsigned int pdm_din2_c_pins[] = { GPIOC_2 };
347static const unsigned int pdm_din3_c_pins[] = { GPIOC_3 };
348static const unsigned int pdm_dclk_c_pins[] = { GPIOC_4 };
349
350static const unsigned int pdm_din0_x_pins[] = { GPIOX_0 };
351static const unsigned int pdm_din1_x_pins[] = { GPIOX_1 };
352static const unsigned int pdm_din2_x_pins[] = { GPIOX_2 };
353static const unsigned int pdm_din3_x_pins[] = { GPIOX_3 };
354static const unsigned int pdm_dclk_x_pins[] = { GPIOX_4 };
355
356static const unsigned int pdm_din0_z_pins[] = { GPIOZ_2 };
357static const unsigned int pdm_din1_z_pins[] = { GPIOZ_3 };
358static const unsigned int pdm_din2_z_pins[] = { GPIOZ_4 };
359static const unsigned int pdm_din3_z_pins[] = { GPIOZ_5 };
360static const unsigned int pdm_dclk_z_pins[] = { GPIOZ_6 };
361
362static const unsigned int pdm_din0_a_pins[] = { GPIOA_8 };
363static const unsigned int pdm_din1_a_pins[] = { GPIOA_9 };
364static const unsigned int pdm_din2_a_pins[] = { GPIOA_6 };
365static const unsigned int pdm_din3_a_pins[] = { GPIOA_5 };
366static const unsigned int pdm_dclk_a_pins[] = { GPIOA_7 };
367
368/* spdif_in */
369static const unsigned int spdif_in_h_pins[] = { GPIOH_5 };
370static const unsigned int spdif_in_a10_pins[] = { GPIOA_10 };
371static const unsigned int spdif_in_a12_pins[] = { GPIOA_12 };
372
373/* spdif_out */
374static const unsigned int spdif_out_h_pins[] = { GPIOH_4 };
375static const unsigned int spdif_out_a11_pins[] = { GPIOA_11 };
376static const unsigned int spdif_out_a13_pins[] = { GPIOA_13 };
377
378/* mclk0 */
379static const unsigned int mclk0_a_pins[] = { GPIOA_0 };
380
381/* mclk1 */
382static const unsigned int mclk1_x_pins[] = { GPIOX_5 };
383static const unsigned int mclk1_z_pins[] = { GPIOZ_8 };
384static const unsigned int mclk1_a_pins[] = { GPIOA_11 };
385
386/* tdm */
387static const unsigned int tdm_a_slv_sclk_pins[] = { GPIOX_11 };
388static const unsigned int tdm_a_slv_fs_pins[] = { GPIOX_10 };
389static const unsigned int tdm_a_sclk_pins[] = { GPIOX_11 };
390static const unsigned int tdm_a_fs_pins[] = { GPIOX_10 };
391static const unsigned int tdm_a_din0_pins[] = { GPIOX_9 };
392static const unsigned int tdm_a_din1_pins[] = { GPIOX_8 };
393static const unsigned int tdm_a_dout0_pins[] = { GPIOX_9 };
394static const unsigned int tdm_a_dout1_pins[] = { GPIOX_8 };
395
396static const unsigned int tdm_b_slv_sclk_pins[] = { GPIOA_1 };
397static const unsigned int tdm_b_slv_fs_pins[] = { GPIOA_2 };
398static const unsigned int tdm_b_sclk_pins[] = { GPIOA_1 };
399static const unsigned int tdm_b_fs_pins[] = { GPIOA_2 };
400static const unsigned int tdm_b_din0_pins[] = { GPIOA_3 };
401static const unsigned int tdm_b_din1_pins[] = { GPIOA_4 };
402static const unsigned int tdm_b_din2_pins[] = { GPIOA_5 };
403static const unsigned int tdm_b_din3_a_pins[] = { GPIOA_6 };
404static const unsigned int tdm_b_din3_h_pins[] = { GPIOH_5 };
405static const unsigned int tdm_b_dout0_pins[] = { GPIOA_3 };
406static const unsigned int tdm_b_dout1_pins[] = { GPIOA_4 };
407static const unsigned int tdm_b_dout2_pins[] = { GPIOA_5 };
408static const unsigned int tdm_b_dout3_a_pins[] = { GPIOA_6 };
409static const unsigned int tdm_b_dout3_h_pins[] = { GPIOH_5 };
410
411static const unsigned int tdm_c_slv_sclk_a_pins[] = { GPIOA_12 };
412static const unsigned int tdm_c_slv_fs_a_pins[] = { GPIOA_13 };
413static const unsigned int tdm_c_slv_sclk_z_pins[] = { GPIOZ_7 };
414static const unsigned int tdm_c_slv_fs_z_pins[] = { GPIOZ_6 };
415static const unsigned int tdm_c_sclk_a_pins[] = { GPIOA_12 };
416static const unsigned int tdm_c_fs_a_pins[] = { GPIOA_13 };
417static const unsigned int tdm_c_sclk_z_pins[] = { GPIOZ_7 };
418static const unsigned int tdm_c_fs_z_pins[] = { GPIOZ_6 };
419static const unsigned int tdm_c_din0_a_pins[] = { GPIOA_10 };
420static const unsigned int tdm_c_din1_a_pins[] = { GPIOA_9 };
421static const unsigned int tdm_c_din2_a_pins[] = { GPIOA_8 };
422static const unsigned int tdm_c_din3_a_pins[] = { GPIOA_7 };
423static const unsigned int tdm_c_din0_z_pins[] = { GPIOZ_2 };
424static const unsigned int tdm_c_din1_z_pins[] = { GPIOZ_3 };
425static const unsigned int tdm_c_din2_z_pins[] = { GPIOZ_4 };
426static const unsigned int tdm_c_din3_z_pins[] = { GPIOZ_5 };
427static const unsigned int tdm_c_dout0_a_pins[] = { GPIOA_10 };
428static const unsigned int tdm_c_dout1_a_pins[] = { GPIOA_9 };
429static const unsigned int tdm_c_dout2_a_pins[] = { GPIOA_8 };
430static const unsigned int tdm_c_dout3_a_pins[] = { GPIOA_7 };
431static const unsigned int tdm_c_dout0_z_pins[] = { GPIOZ_2 };
432static const unsigned int tdm_c_dout1_z_pins[] = { GPIOZ_3 };
433static const unsigned int tdm_c_dout2_z_pins[] = { GPIOZ_4 };
434static const unsigned int tdm_c_dout3_z_pins[] = { GPIOZ_5 };
435
436static struct meson_pmx_group meson_g12a_periphs_groups[] = {
437 GPIO_GROUP(GPIOZ_0),
438 GPIO_GROUP(GPIOZ_1),
439 GPIO_GROUP(GPIOZ_2),
440 GPIO_GROUP(GPIOZ_3),
441 GPIO_GROUP(GPIOZ_4),
442 GPIO_GROUP(GPIOZ_5),
443 GPIO_GROUP(GPIOZ_6),
444 GPIO_GROUP(GPIOZ_7),
445 GPIO_GROUP(GPIOZ_8),
446 GPIO_GROUP(GPIOZ_9),
447 GPIO_GROUP(GPIOZ_10),
448 GPIO_GROUP(GPIOZ_11),
449 GPIO_GROUP(GPIOZ_12),
450 GPIO_GROUP(GPIOZ_13),
451 GPIO_GROUP(GPIOZ_14),
452 GPIO_GROUP(GPIOZ_15),
453 GPIO_GROUP(GPIOH_0),
454 GPIO_GROUP(GPIOH_1),
455 GPIO_GROUP(GPIOH_2),
456 GPIO_GROUP(GPIOH_3),
457 GPIO_GROUP(GPIOH_4),
458 GPIO_GROUP(GPIOH_5),
459 GPIO_GROUP(GPIOH_6),
460 GPIO_GROUP(GPIOH_7),
461 GPIO_GROUP(GPIOH_8),
462 GPIO_GROUP(BOOT_0),
463 GPIO_GROUP(BOOT_1),
464 GPIO_GROUP(BOOT_2),
465 GPIO_GROUP(BOOT_3),
466 GPIO_GROUP(BOOT_4),
467 GPIO_GROUP(BOOT_5),
468 GPIO_GROUP(BOOT_6),
469 GPIO_GROUP(BOOT_7),
470 GPIO_GROUP(BOOT_8),
471 GPIO_GROUP(BOOT_9),
472 GPIO_GROUP(BOOT_10),
473 GPIO_GROUP(BOOT_11),
474 GPIO_GROUP(BOOT_12),
475 GPIO_GROUP(BOOT_13),
476 GPIO_GROUP(BOOT_14),
477 GPIO_GROUP(BOOT_15),
478 GPIO_GROUP(GPIOC_0),
479 GPIO_GROUP(GPIOC_1),
480 GPIO_GROUP(GPIOC_2),
481 GPIO_GROUP(GPIOC_3),
482 GPIO_GROUP(GPIOC_4),
483 GPIO_GROUP(GPIOC_5),
484 GPIO_GROUP(GPIOC_6),
485 GPIO_GROUP(GPIOC_7),
486 GPIO_GROUP(GPIOA_0),
487 GPIO_GROUP(GPIOA_1),
488 GPIO_GROUP(GPIOA_2),
489 GPIO_GROUP(GPIOA_3),
490 GPIO_GROUP(GPIOA_4),
491 GPIO_GROUP(GPIOA_5),
492 GPIO_GROUP(GPIOA_6),
493 GPIO_GROUP(GPIOA_7),
494 GPIO_GROUP(GPIOA_8),
495 GPIO_GROUP(GPIOA_9),
496 GPIO_GROUP(GPIOA_10),
497 GPIO_GROUP(GPIOA_11),
498 GPIO_GROUP(GPIOA_12),
499 GPIO_GROUP(GPIOA_13),
500 GPIO_GROUP(GPIOA_14),
501 GPIO_GROUP(GPIOA_15),
502 GPIO_GROUP(GPIOX_0),
503 GPIO_GROUP(GPIOX_1),
504 GPIO_GROUP(GPIOX_2),
505 GPIO_GROUP(GPIOX_3),
506 GPIO_GROUP(GPIOX_4),
507 GPIO_GROUP(GPIOX_5),
508 GPIO_GROUP(GPIOX_6),
509 GPIO_GROUP(GPIOX_7),
510 GPIO_GROUP(GPIOX_8),
511 GPIO_GROUP(GPIOX_9),
512 GPIO_GROUP(GPIOX_10),
513 GPIO_GROUP(GPIOX_11),
514 GPIO_GROUP(GPIOX_12),
515 GPIO_GROUP(GPIOX_13),
516 GPIO_GROUP(GPIOX_14),
517 GPIO_GROUP(GPIOX_15),
518 GPIO_GROUP(GPIOX_16),
519 GPIO_GROUP(GPIOX_17),
520 GPIO_GROUP(GPIOX_18),
521 GPIO_GROUP(GPIOX_19),
522
523 /* bank BOOT */
524 GROUP(emmc_nand_d0, 1),
525 GROUP(emmc_nand_d1, 1),
526 GROUP(emmc_nand_d2, 1),
527 GROUP(emmc_nand_d3, 1),
528 GROUP(emmc_nand_d4, 1),
529 GROUP(emmc_nand_d5, 1),
530 GROUP(emmc_nand_d6, 1),
531 GROUP(emmc_nand_d7, 1),
532 GROUP(emmc_clk, 1),
533 GROUP(emmc_cmd, 1),
534 GROUP(emmc_nand_ds, 1),
535 GROUP(nand_ce0, 2),
536 GROUP(nand_ale, 2),
537 GROUP(nand_cle, 2),
538 GROUP(nand_wen_clk, 2),
539 GROUP(nand_ren_wr, 2),
540 GROUP(nand_rb0, 2),
541 GROUP(nand_ce1, 2),
542 GROUP(nor_hold, 3),
543 GROUP(nor_d, 3),
544 GROUP(nor_q, 3),
545 GROUP(nor_c, 3),
546 GROUP(nor_wp, 3),
547 GROUP(nor_cs, 3),
548
549 /* bank GPIOZ */
550 GROUP(sdcard_d0_z, 5),
551 GROUP(sdcard_d1_z, 5),
552 GROUP(sdcard_d2_z, 5),
553 GROUP(sdcard_d3_z, 5),
554 GROUP(sdcard_clk_z, 5),
555 GROUP(sdcard_cmd_z, 5),
556 GROUP(i2c0_sda_z0, 4),
557 GROUP(i2c0_sck_z1, 4),
558 GROUP(i2c0_sda_z7, 7),
559 GROUP(i2c0_sck_z8, 7),
560 GROUP(i2c2_sda_z, 3),
561 GROUP(i2c2_sck_z, 3),
562 GROUP(iso7816_clk_z, 3),
563 GROUP(iso7816_data_z, 3),
564 GROUP(eth_mdio, 1),
565 GROUP(eth_mdc, 1),
566 GROUP(eth_rgmii_rx_clk, 1),
567 GROUP(eth_rx_dv, 1),
568 GROUP(eth_rxd0, 1),
569 GROUP(eth_rxd1, 1),
570 GROUP(eth_rxd2_rgmii, 1),
571 GROUP(eth_rxd3_rgmii, 1),
572 GROUP(eth_rgmii_tx_clk, 1),
573 GROUP(eth_txen, 1),
574 GROUP(eth_txd0, 1),
575 GROUP(eth_txd1, 1),
576 GROUP(eth_txd2_rgmii, 1),
577 GROUP(eth_txd3_rgmii, 1),
578 GROUP(eth_link_led, 1),
579 GROUP(eth_act_led, 1),
580 GROUP(bt565_a_vs, 2),
581 GROUP(bt565_a_hs, 2),
582 GROUP(bt565_a_clk, 2),
583 GROUP(bt565_a_din0, 2),
584 GROUP(bt565_a_din1, 2),
585 GROUP(bt565_a_din2, 2),
586 GROUP(bt565_a_din3, 2),
587 GROUP(bt565_a_din4, 2),
588 GROUP(bt565_a_din5, 2),
589 GROUP(bt565_a_din6, 2),
590 GROUP(bt565_a_din7, 2),
591 GROUP(tsin_b_valid_z, 3),
592 GROUP(tsin_b_sop_z, 3),
593 GROUP(tsin_b_din0_z, 3),
594 GROUP(tsin_b_clk_z, 3),
595 GROUP(tsin_b_fail, 3),
596 GROUP(tsin_b_din1, 3),
597 GROUP(tsin_b_din2, 3),
598 GROUP(tsin_b_din3, 3),
599 GROUP(tsin_b_din4, 3),
600 GROUP(tsin_b_din5, 3),
601 GROUP(tsin_b_din6, 3),
602 GROUP(tsin_b_din7, 3),
603 GROUP(pdm_din0_z, 7),
604 GROUP(pdm_din1_z, 7),
605 GROUP(pdm_din2_z, 7),
606 GROUP(pdm_din3_z, 7),
607 GROUP(pdm_dclk_z, 7),
608 GROUP(tdm_c_slv_sclk_z, 6),
609 GROUP(tdm_c_slv_fs_z, 6),
610 GROUP(tdm_c_din0_z, 6),
611 GROUP(tdm_c_din1_z, 6),
612 GROUP(tdm_c_din2_z, 6),
613 GROUP(tdm_c_din3_z, 6),
614 GROUP(tdm_c_sclk_z, 4),
615 GROUP(tdm_c_fs_z, 4),
616 GROUP(tdm_c_dout0_z, 4),
617 GROUP(tdm_c_dout1_z, 4),
618 GROUP(tdm_c_dout2_z, 4),
619 GROUP(tdm_c_dout3_z, 4),
620 GROUP(mclk1_z, 4),
621
622 /* bank GPIOX */
623 GROUP(sdio_d0, 1),
624 GROUP(sdio_d1, 1),
625 GROUP(sdio_d2, 1),
626 GROUP(sdio_d3, 1),
627 GROUP(sdio_clk, 1),
628 GROUP(sdio_cmd, 1),
629 GROUP(spi0_mosi_x, 4),
630 GROUP(spi0_miso_x, 4),
631 GROUP(spi0_ss0_x, 4),
632 GROUP(spi0_clk_x, 4),
633 GROUP(i2c1_sda_x, 5),
634 GROUP(i2c1_sck_x, 5),
635 GROUP(i2c2_sda_x, 1),
636 GROUP(i2c2_sck_x, 1),
637 GROUP(uart_a_tx, 1),
638 GROUP(uart_a_rx, 1),
639 GROUP(uart_a_cts, 1),
640 GROUP(uart_a_rts, 1),
641 GROUP(uart_b_tx, 2),
642 GROUP(uart_b_rx, 2),
643 GROUP(iso7816_clk_x, 6),
644 GROUP(iso7816_data_x, 6),
645 GROUP(pwm_a, 1),
646 GROUP(pwm_b_x7, 4),
647 GROUP(pwm_b_x19, 1),
648 GROUP(pwm_c_x5, 4),
649 GROUP(pwm_c_x8, 5),
650 GROUP(pwm_d_x3, 4),
651 GROUP(pwm_d_x6, 4),
652 GROUP(pwm_e, 1),
653 GROUP(pwm_f_x, 1),
654 GROUP(tsin_a_valid, 3),
655 GROUP(tsin_a_sop, 3),
656 GROUP(tsin_a_din0, 3),
657 GROUP(tsin_a_clk, 3),
658 GROUP(tsin_b_valid_x, 3),
659 GROUP(tsin_b_sop_x, 3),
660 GROUP(tsin_b_din0_x, 3),
661 GROUP(tsin_b_clk_x, 3),
662 GROUP(pdm_din0_x, 2),
663 GROUP(pdm_din1_x, 2),
664 GROUP(pdm_din2_x, 2),
665 GROUP(pdm_din3_x, 2),
666 GROUP(pdm_dclk_x, 2),
667 GROUP(tdm_a_slv_sclk, 2),
668 GROUP(tdm_a_slv_fs, 2),
669 GROUP(tdm_a_din0, 2),
670 GROUP(tdm_a_din1, 2),
671 GROUP(tdm_a_sclk, 1),
672 GROUP(tdm_a_fs, 1),
673 GROUP(tdm_a_dout0, 1),
674 GROUP(tdm_a_dout1, 1),
675 GROUP(mclk1_x, 2),
676
677 /* bank GPIOC */
678 GROUP(sdcard_d0_c, 1),
679 GROUP(sdcard_d1_c, 1),
680 GROUP(sdcard_d2_c, 1),
681 GROUP(sdcard_d3_c, 1),
682 GROUP(sdcard_clk_c, 1),
683 GROUP(sdcard_cmd_c, 1),
684 GROUP(spi0_mosi_c, 5),
685 GROUP(spi0_miso_c, 5),
686 GROUP(spi0_ss0_c, 5),
687 GROUP(spi0_clk_c, 5),
688 GROUP(i2c0_sda_c, 3),
689 GROUP(i2c0_sck_c, 3),
690 GROUP(uart_ao_a_rx_c, 2),
691 GROUP(uart_ao_a_tx_c, 2),
692 GROUP(iso7816_clk_c, 5),
693 GROUP(iso7816_data_c, 5),
694 GROUP(pwm_c_c, 5),
695 GROUP(jtag_b_tdo, 2),
696 GROUP(jtag_b_tdi, 2),
697 GROUP(jtag_b_clk, 2),
698 GROUP(jtag_b_tms, 2),
699 GROUP(pdm_din0_c, 4),
700 GROUP(pdm_din1_c, 4),
701 GROUP(pdm_din2_c, 4),
702 GROUP(pdm_din3_c, 4),
703 GROUP(pdm_dclk_c, 4),
704
705 /* bank GPIOH */
706 GROUP(spi1_mosi, 3),
707 GROUP(spi1_miso, 3),
708 GROUP(spi1_ss0, 3),
709 GROUP(spi1_clk, 3),
710 GROUP(i2c1_sda_h2, 2),
711 GROUP(i2c1_sck_h3, 2),
712 GROUP(i2c1_sda_h6, 4),
713 GROUP(i2c1_sck_h7, 4),
714 GROUP(i2c3_sda_h, 2),
715 GROUP(i2c3_sck_h, 2),
716 GROUP(uart_c_tx, 2),
717 GROUP(uart_c_rx, 2),
718 GROUP(uart_c_cts, 2),
719 GROUP(uart_c_rts, 2),
720 GROUP(iso7816_clk_h, 1),
721 GROUP(iso7816_data_h, 1),
722 GROUP(pwm_f_h, 4),
723 GROUP(cec_ao_a_h, 4),
724 GROUP(cec_ao_b_h, 5),
725 GROUP(hdmitx_sda, 1),
726 GROUP(hdmitx_sck, 1),
727 GROUP(hdmitx_hpd_in, 1),
728 GROUP(spdif_out_h, 1),
729 GROUP(spdif_in_h, 1),
730 GROUP(tdm_b_din3_h, 6),
731 GROUP(tdm_b_dout3_h, 5),
732
733 /* bank GPIOA */
734 GROUP(i2c3_sda_a, 2),
735 GROUP(i2c3_sck_a, 2),
736 GROUP(pdm_din0_a, 1),
737 GROUP(pdm_din1_a, 1),
738 GROUP(pdm_din2_a, 1),
739 GROUP(pdm_din3_a, 1),
740 GROUP(pdm_dclk_a, 1),
741 GROUP(spdif_in_a10, 1),
742 GROUP(spdif_in_a12, 1),
743 GROUP(spdif_out_a11, 1),
744 GROUP(spdif_out_a13, 1),
745 GROUP(tdm_b_slv_sclk, 2),
746 GROUP(tdm_b_slv_fs, 2),
747 GROUP(tdm_b_din0, 2),
748 GROUP(tdm_b_din1, 2),
749 GROUP(tdm_b_din2, 2),
750 GROUP(tdm_b_din3_a, 2),
751 GROUP(tdm_b_sclk, 1),
752 GROUP(tdm_b_fs, 1),
753 GROUP(tdm_b_dout0, 1),
754 GROUP(tdm_b_dout1, 1),
755 GROUP(tdm_b_dout2, 3),
756 GROUP(tdm_b_dout3_a, 3),
757 GROUP(tdm_c_slv_sclk_a, 3),
758 GROUP(tdm_c_slv_fs_a, 3),
759 GROUP(tdm_c_din0_a, 3),
760 GROUP(tdm_c_din1_a, 3),
761 GROUP(tdm_c_din2_a, 3),
762 GROUP(tdm_c_din3_a, 3),
763 GROUP(tdm_c_sclk_a, 2),
764 GROUP(tdm_c_fs_a, 2),
765 GROUP(tdm_c_dout0_a, 2),
766 GROUP(tdm_c_dout1_a, 2),
767 GROUP(tdm_c_dout2_a, 2),
768 GROUP(tdm_c_dout3_a, 2),
769 GROUP(mclk0_a, 1),
770 GROUP(mclk1_a, 2),
771};
772
773/* uart_ao_a */
774static const unsigned int uart_ao_a_tx_pins[] = { GPIOAO_0 };
775static const unsigned int uart_ao_a_rx_pins[] = { GPIOAO_1 };
776static const unsigned int uart_ao_a_cts_pins[] = { GPIOE_0 };
777static const unsigned int uart_ao_a_rts_pins[] = { GPIOE_1 };
778
779/* uart_ao_b */
780static const unsigned int uart_ao_b_tx_2_pins[] = { GPIOAO_2 };
781static const unsigned int uart_ao_b_rx_3_pins[] = { GPIOAO_3 };
782static const unsigned int uart_ao_b_tx_8_pins[] = { GPIOAO_8 };
783static const unsigned int uart_ao_b_rx_9_pins[] = { GPIOAO_9 };
784static const unsigned int uart_ao_b_cts_pins[] = { GPIOE_0 };
785static const unsigned int uart_ao_b_rts_pins[] = { GPIOE_1 };
786
787/* i2c_ao */
788static const unsigned int i2c_ao_sck_pins[] = { GPIOAO_2 };
789static const unsigned int i2c_ao_sda_pins[] = { GPIOAO_3 };
790
791static const unsigned int i2c_ao_sck_e_pins[] = { GPIOE_0 };
792static const unsigned int i2c_ao_sda_e_pins[] = { GPIOE_1 };
793
794/* i2c_ao_slave */
795static const unsigned int i2c_ao_slave_sck_pins[] = { GPIOAO_2 };
796static const unsigned int i2c_ao_slave_sda_pins[] = { GPIOAO_3 };
797
798/* ir_in */
799static const unsigned int remote_ao_input_pins[] = { GPIOAO_5 };
800
801/* ir_out */
802static const unsigned int remote_ao_out_pins[] = { GPIOAO_4 };
803
804/* pwm_ao_a */
805static const unsigned int pwm_ao_a_pins[] = { GPIOAO_11 };
806static const unsigned int pwm_ao_a_hiz_pins[] = { GPIOAO_11 };
807
808/* pwm_ao_b */
809static const unsigned int pwm_ao_b_pins[] = { GPIOE_0 };
810
811/* pwm_ao_c */
812static const unsigned int pwm_ao_c_4_pins[] = { GPIOAO_4 };
813static const unsigned int pwm_ao_c_hiz_pins[] = { GPIOAO_4 };
814static const unsigned int pwm_ao_c_6_pins[] = { GPIOAO_6 };
815
816/* pwm_ao_d */
817static const unsigned int pwm_ao_d_5_pins[] = { GPIOAO_5 };
818static const unsigned int pwm_ao_d_10_pins[] = { GPIOAO_10 };
819static const unsigned int pwm_ao_d_e_pins[] = { GPIOE_1 };
820
821/* jtag_a */
822static const unsigned int jtag_a_tdi_pins[] = { GPIOAO_8 };
823static const unsigned int jtag_a_tdo_pins[] = { GPIOAO_9 };
824static const unsigned int jtag_a_clk_pins[] = { GPIOAO_6 };
825static const unsigned int jtag_a_tms_pins[] = { GPIOAO_7 };
826
827/* cec_ao */
828static const unsigned int cec_ao_a_pins[] = { GPIOAO_10 };
829static const unsigned int cec_ao_b_pins[] = { GPIOAO_10 };
830
831/* tsin_ao_a */
832static const unsigned int tsin_ao_asop_pins[] = { GPIOAO_6 };
833static const unsigned int tsin_ao_adin0_pins[] = { GPIOAO_7 };
834static const unsigned int tsin_ao_aclk_pins[] = { GPIOAO_8 };
835static const unsigned int tsin_ao_a_valid_pins[] = { GPIOAO_9 };
836
837/* spdif_ao_out */
838static const unsigned int spdif_ao_out_pins[] = { GPIOAO_10 };
839
840/* tdm_ao_b */
841static const unsigned int tdm_ao_b_slv_fs_pins[] = { GPIOAO_7 };
842static const unsigned int tdm_ao_b_slv_sclk_pins[] = { GPIOAO_8 };
843static const unsigned int tdm_ao_b_fs_pins[] = { GPIOAO_7 };
844static const unsigned int tdm_ao_b_sclk_pins[] = { GPIOAO_8 };
845static const unsigned int tdm_ao_b_din0_pins[] = { GPIOAO_4 };
846static const unsigned int tdm_ao_b_din1_pins[] = { GPIOAO_10 };
847static const unsigned int tdm_ao_b_din2_pins[] = { GPIOAO_6 };
848static const unsigned int tdm_ao_b_dout0_pins[] = { GPIOAO_4 };
849static const unsigned int tdm_ao_b_dout1_pins[] = { GPIOAO_10 };
850static const unsigned int tdm_ao_b_dout2_pins[] = { GPIOAO_6 };
851
852/* mclk0_ao */
853static const unsigned int mclk0_ao_pins[] = { GPIOAO_9 };
854
855static struct meson_pmx_group meson_g12a_aobus_groups[] = {
856 GPIO_GROUP(GPIOAO_0),
857 GPIO_GROUP(GPIOAO_1),
858 GPIO_GROUP(GPIOAO_2),
859 GPIO_GROUP(GPIOAO_3),
860 GPIO_GROUP(GPIOAO_4),
861 GPIO_GROUP(GPIOAO_5),
862 GPIO_GROUP(GPIOAO_6),
863 GPIO_GROUP(GPIOAO_7),
864 GPIO_GROUP(GPIOAO_8),
865 GPIO_GROUP(GPIOAO_9),
866 GPIO_GROUP(GPIOAO_10),
867 GPIO_GROUP(GPIOAO_11),
868 GPIO_GROUP(GPIOE_0),
869 GPIO_GROUP(GPIOE_1),
870 GPIO_GROUP(GPIOE_2),
871
872 /* bank AO */
873 GROUP(uart_ao_a_tx, 1),
874 GROUP(uart_ao_a_rx, 1),
875 GROUP(uart_ao_a_cts, 1),
876 GROUP(uart_ao_a_rts, 1),
877 GROUP(uart_ao_b_tx_2, 2),
878 GROUP(uart_ao_b_rx_3, 2),
879 GROUP(uart_ao_b_tx_8, 3),
880 GROUP(uart_ao_b_rx_9, 3),
881 GROUP(uart_ao_b_cts, 2),
882 GROUP(uart_ao_b_rts, 2),
883 GROUP(i2c_ao_sck, 1),
884 GROUP(i2c_ao_sda, 1),
885 GROUP(i2c_ao_sck_e, 4),
886 GROUP(i2c_ao_sda_e, 4),
887 GROUP(i2c_ao_slave_sck, 3),
888 GROUP(i2c_ao_slave_sda, 3),
889 GROUP(remote_ao_input, 1),
890 GROUP(remote_ao_out, 1),
891 GROUP(pwm_ao_a, 3),
892 GROUP(pwm_ao_a_hiz, 2),
893 GROUP(pwm_ao_b, 3),
894 GROUP(pwm_ao_c_4, 3),
895 GROUP(pwm_ao_c_hiz, 4),
896 GROUP(pwm_ao_c_6, 3),
897 GROUP(pwm_ao_d_5, 3),
898 GROUP(pwm_ao_d_10, 3),
899 GROUP(pwm_ao_d_e, 3),
900 GROUP(jtag_a_tdi, 1),
901 GROUP(jtag_a_tdo, 1),
902 GROUP(jtag_a_clk, 1),
903 GROUP(jtag_a_tms, 1),
904 GROUP(cec_ao_a, 1),
905 GROUP(cec_ao_b, 2),
906 GROUP(tsin_ao_asop, 4),
907 GROUP(tsin_ao_adin0, 4),
908 GROUP(tsin_ao_aclk, 4),
909 GROUP(tsin_ao_a_valid, 4),
910 GROUP(spdif_ao_out, 4),
911 GROUP(tdm_ao_b_dout0, 5),
912 GROUP(tdm_ao_b_dout1, 5),
913 GROUP(tdm_ao_b_dout2, 5),
914 GROUP(tdm_ao_b_fs, 5),
915 GROUP(tdm_ao_b_sclk, 5),
916 GROUP(tdm_ao_b_din0, 6),
917 GROUP(tdm_ao_b_din1, 6),
918 GROUP(tdm_ao_b_din2, 6),
919 GROUP(tdm_ao_b_slv_fs, 6),
920 GROUP(tdm_ao_b_slv_sclk, 6),
921 GROUP(mclk0_ao, 5),
922};
923
924static const char * const gpio_periphs_groups[] = {
925 "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
926 "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
927 "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14",
928 "GPIOZ_15",
929
930 "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4",
931 "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8",
932
933 "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
934 "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
935 "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
936 "BOOT_15",
937
938 "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4",
939 "GPIOC_5", "GPIOC_6", "GPIOC_7",
940
941 "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
942 "GPIOA_5", "GPIOA_6", "GPIOA_7", "GPIOA_8", "GPIOA_9",
943 "GPIOA_10", "GPIOA_11", "GPIOA_12", "GPIOA_13", "GPIOA_14",
944 "GPIOA_15",
945
946 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
947 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
948 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
949 "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19",
950};
951
952static const char * const emmc_groups[] = {
953 "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
954 "emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
955 "emmc_nand_d6", "emmc_nand_d7",
956 "emmc_clk", "emmc_cmd", "emmc_nand_ds",
957};
958
959static const char * const nand_groups[] = {
960 "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
961 "emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
962 "emmc_nand_d6", "emmc_nand_d7",
963 "nand_ce0", "nand_ale", "nand_cle",
964 "nand_wen_clk", "nand_ren_wr", "nand_rb0",
965 "emmc_nand_ds", "nand_ce1",
966};
967
968static const char * const nor_groups[] = {
969 "nor_d", "nor_q", "nor_c", "nor_cs",
970 "nor_hold", "nor_wp",
971};
972
973static const char * const sdio_groups[] = {
974 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
975 "sdio_cmd", "sdio_clk", "sdio_dummy",
976};
977
978static const char * const sdcard_groups[] = {
979 "sdcard_d0_c", "sdcard_d1_c", "sdcard_d2_c", "sdcard_d3_c",
980 "sdcard_clk_c", "sdcard_cmd_c",
981 "sdcard_d0_z", "sdcard_d1_z", "sdcard_d2_z", "sdcard_d3_z",
982 "sdcard_clk_z", "sdcard_cmd_z",
983};
984
985static const char * const spi0_groups[] = {
986 "spi0_mosi_c", "spi0_miso_c", "spi0_ss0_c", "spi0_clk_c",
987 "spi0_mosi_x", "spi0_miso_x", "spi0_ss0_x", "spi0_clk_x",
988};
989
990static const char * const spi1_groups[] = {
991 "spi1_mosi", "spi1_miso", "spi1_ss0", "spi1_clk",
992};
993
994static const char * const i2c0_groups[] = {
995 "i2c0_sda_c", "i2c0_sck_c",
996 "i2c0_sda_z0", "i2c0_sck_z1",
997 "i2c0_sda_z7", "i2c0_sck_z8",
998};
999
1000static const char * const i2c1_groups[] = {
1001 "i2c1_sda_x", "i2c1_sck_x",
1002 "i2c1_sda_h2", "i2c1_sck_h3",
1003 "i2c1_sda_h6", "i2c1_sck_h7",
1004};
1005
1006static const char * const i2c2_groups[] = {
1007 "i2c2_sda_x", "i2c2_sck_x",
1008 "i2c2_sda_z", "i2c2_sck_z",
1009};
1010
1011static const char * const i2c3_groups[] = {
1012 "i2c3_sda_h", "i2c3_sck_h",
1013 "i2c3_sda_a", "i2c3_sck_a",
1014};
1015
1016static const char * const uart_a_groups[] = {
1017 "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts",
1018};
1019
1020static const char * const uart_b_groups[] = {
1021 "uart_b_tx", "uart_b_rx",
1022};
1023
1024static const char * const uart_c_groups[] = {
1025 "uart_c_tx", "uart_c_rx", "uart_c_cts", "uart_c_rts",
1026};
1027
1028static const char * const uart_ao_a_c_groups[] = {
1029 "uart_ao_a_rx_c", "uart_ao_a_tx_c",
1030};
1031
1032static const char * const iso7816_groups[] = {
1033 "iso7816_clk_c", "iso7816_data_c",
1034 "iso7816_clk_x", "iso7816_data_x",
1035 "iso7816_clk_h", "iso7816_data_h",
1036 "iso7816_clk_z", "iso7816_data_z",
1037};
1038
1039static const char * const eth_groups[] = {
1040 "eth_rxd2_rgmii", "eth_rxd3_rgmii", "eth_rgmii_tx_clk",
1041 "eth_txd2_rgmii", "eth_txd3_rgmii", "eth_rgmii_rx_clk",
1042 "eth_txd0", "eth_txd1", "eth_txen", "eth_mdc",
1043 "eth_rxd0", "eth_rxd1", "eth_rx_dv", "eth_mdio",
1044 "eth_link_led", "eth_act_led",
1045};
1046
1047static const char * const pwm_a_groups[] = {
1048 "pwm_a",
1049};
1050
1051static const char * const pwm_b_groups[] = {
1052 "pwm_b_x7", "pwm_b_x19",
1053};
1054
1055static const char * const pwm_c_groups[] = {
1056 "pwm_c_c", "pwm_c_x5", "pwm_c_x8",
1057};
1058
1059static const char * const pwm_d_groups[] = {
1060 "pwm_d_x3", "pwm_d_x6",
1061};
1062
1063static const char * const pwm_e_groups[] = {
1064 "pwm_e",
1065};
1066
1067static const char * const pwm_f_groups[] = {
1068 "pwm_f_x", "pwm_f_h",
1069};
1070
1071static const char * const cec_ao_a_h_groups[] = {
1072 "cec_ao_a_h",
1073};
1074
1075static const char * const cec_ao_b_h_groups[] = {
1076 "cec_ao_b_h",
1077};
1078
1079static const char * const jtag_b_groups[] = {
1080 "jtag_b_tdi", "jtag_b_tdo", "jtag_b_clk", "jtag_b_tms",
1081};
1082
1083static const char * const bt565_a_groups[] = {
1084 "bt565_a_vs", "bt565_a_hs", "bt565_a_clk",
1085 "bt565_a_din0", "bt565_a_din1", "bt565_a_din2",
1086 "bt565_a_din3", "bt565_a_din4", "bt565_a_din5",
1087 "bt565_a_din6", "bt565_a_din7",
1088};
1089
1090static const char * const tsin_a_groups[] = {
1091 "tsin_a_valid", "tsin_a_sop", "tsin_a_din0",
1092 "tsin_a_clk",
1093};
1094
1095static const char * const tsin_b_groups[] = {
1096 "tsin_b_valid_x", "tsin_b_sop_x", "tsin_b_din0_x", "tsin_b_clk_x",
1097 "tsin_b_valid_z", "tsin_b_sop_z", "tsin_b_din0_z", "tsin_b_clk_z",
1098 "tsin_b_fail", "tsin_b_din1", "tsin_b_din2", "tsin_b_din3",
1099 "tsin_b_din4", "tsin_b_din5", "tsin_b_din6", "tsin_b_din7",
1100};
1101
1102static const char * const hdmitx_groups[] = {
1103 "hdmitx_sda", "hdmitx_sck", "hdmitx_hpd_in",
1104};
1105
1106static const char * const pdm_groups[] = {
1107 "pdm_din0_c", "pdm_din1_c", "pdm_din2_c", "pdm_din3_c",
1108 "pdm_dclk_c",
1109 "pdm_din0_x", "pdm_din1_x", "pdm_din2_x", "pdm_din3_x",
1110 "pdm_dclk_x",
1111 "pdm_din0_z", "pdm_din1_z", "pdm_din2_z", "pdm_din3_z",
1112 "pdm_dclk_z",
1113 "pdm_din0_a", "pdm_din1_a", "pdm_din2_a", "pdm_din3_a",
1114 "pdm_dclk_a",
1115};
1116
1117static const char * const spdif_in_groups[] = {
1118 "spdif_in_h", "spdif_in_a10", "spdif_in_a12",
1119};
1120
1121static const char * const spdif_out_groups[] = {
1122 "spdif_out_h", "spdif_out_a11", "spdif_out_a13",
1123};
1124
1125static const char * const mclk0_groups[] = {
1126 "mclk0_a",
1127};
1128
1129static const char * const mclk1_groups[] = {
1130 "mclk1_x", "mclk1_z", "mclk1_a",
1131};
1132
1133static const char * const tdm_a_groups[] = {
1134 "tdm_a_slv_sclk", "tdm_a_slv_fs", "tdm_a_sclk", "tdm_a_fs",
1135 "tdm_a_din0", "tdm_a_din1", "tdm_a_dout0", "tdm_a_dout1",
1136};
1137
1138static const char * const tdm_b_groups[] = {
1139 "tdm_b_slv_sclk", "tdm_b_slv_fs", "tdm_b_sclk", "tdm_b_fs",
1140 "tdm_b_din0", "tdm_b_din1", "tdm_b_din2",
1141 "tdm_b_din3_a", "tdm_b_din3_h",
1142 "tdm_b_dout0", "tdm_b_dout1", "tdm_b_dout2",
1143 "tdm_b_dout3_a", "tdm_b_dout3_h",
1144};
1145
1146static const char * const tdm_c_groups[] = {
1147 "tdm_c_slv_sclk_a", "tdm_c_slv_fs_a",
1148 "tdm_c_slv_sclk_z", "tdm_c_slv_fs_z",
1149 "tdm_c_sclk_a", "tdm_c_fs_a",
1150 "tdm_c_sclk_z", "tdm_c_fs_z",
1151 "tdm_c_din0_a", "tdm_c_din1_a",
1152 "tdm_c_din2_a", "tdm_c_din3_a",
1153 "tdm_c_din0_z", "tdm_c_din1_z",
1154 "tdm_c_din2_z", "tdm_c_din3_z",
1155 "tdm_c_dout0_a", "tdm_c_dout1_a",
1156 "tdm_c_dout2_a", "tdm_c_dout3_a",
1157 "tdm_c_dout0_z", "tdm_c_dout1_z",
1158 "tdm_c_dout2_z", "tdm_c_dout3_z",
1159};
1160
1161static const char * const gpio_aobus_groups[] = {
1162 "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
1163 "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
1164 "GPIOAO_10", "GPIOAO_11", "GPIOE_0", "GPIOE_1", "GPIOE_2",
1165};
1166
1167static const char * const uart_ao_a_groups[] = {
1168 "uart_ao_a_tx", "uart_ao_a_rx",
1169 "uart_ao_a_cts", "uart_ao_a_rts",
1170};
1171
1172static const char * const uart_ao_b_groups[] = {
1173 "uart_ao_b_tx_2", "uart_ao_b_rx_3",
1174 "uart_ao_b_tx_8", "uart_ao_b_rx_9",
1175 "uart_ao_b_cts", "uart_ao_b_rts",
1176};
1177
1178static const char * const i2c_ao_groups[] = {
1179 "i2c_ao_sck", "i2c_ao_sda",
1180 "i2c_ao_sck_e", "i2c_ao_sda_e",
1181};
1182
1183static const char * const i2c_ao_slave_groups[] = {
1184 "i2c_ao_slave_sck", "i2c_ao_slave_sda",
1185};
1186
1187static const char * const remote_ao_input_groups[] = {
1188 "remote_ao_input",
1189};
1190
1191static const char * const remote_ao_out_groups[] = {
1192 "remote_ao_out",
1193};
1194
1195static const char * const pwm_ao_a_groups[] = {
1196 "pwm_ao_a", "pwm_ao_a_hiz",
1197};
1198
1199static const char * const pwm_ao_b_groups[] = {
1200 "pwm_ao_b",
1201};
1202
1203static const char * const pwm_ao_c_groups[] = {
1204 "pwm_ao_c_4", "pwm_ao_c_hiz",
1205 "pwm_ao_c_6",
1206};
1207
1208static const char * const pwm_ao_d_groups[] = {
1209 "pwm_ao_d_5", "pwm_ao_d_10", "pwm_ao_d_e",
1210};
1211
1212static const char * const jtag_a_groups[] = {
1213 "jtag_a_tdi", "jtag_a_tdo", "jtag_a_clk", "jtag_a_tms",
1214};
1215
1216static const char * const cec_ao_a_groups[] = {
1217 "cec_ao_a",
1218};
1219
1220static const char * const cec_ao_b_groups[] = {
1221 "cec_ao_b",
1222};
1223
1224static const char * const tsin_ao_a_groups[] = {
1225 "tsin_ao_asop", "tsin_ao_adin0", "tsin_ao_aclk", "tsin_ao_a_valid",
1226};
1227
1228static const char * const spdif_ao_out_groups[] = {
1229 "spdif_ao_out",
1230};
1231
1232static const char * const tdm_ao_b_groups[] = {
1233 "tdm_ao_b_dout0", "tdm_ao_b_dout1", "tdm_ao_b_dout2",
1234 "tdm_ao_b_fs", "tdm_ao_b_sclk",
1235 "tdm_ao_b_din0", "tdm_ao_b_din1", "tdm_ao_b_din2",
1236 "tdm_ao_b_slv_fs", "tdm_ao_b_slv_sclk",
1237};
1238
1239static const char * const mclk0_ao_groups[] = {
1240 "mclk0_ao",
1241};
1242
1243static struct meson_pmx_func meson_g12a_periphs_functions[] = {
1244 FUNCTION(gpio_periphs),
1245 FUNCTION(emmc),
1246 FUNCTION(nor),
1247 FUNCTION(spi0),
1248 FUNCTION(spi1),
1249 FUNCTION(sdio),
1250 FUNCTION(nand),
1251 FUNCTION(sdcard),
1252 FUNCTION(i2c0),
1253 FUNCTION(i2c1),
1254 FUNCTION(i2c2),
1255 FUNCTION(i2c3),
1256 FUNCTION(uart_a),
1257 FUNCTION(uart_b),
1258 FUNCTION(uart_c),
1259 FUNCTION(uart_ao_a_c),
1260 FUNCTION(iso7816),
1261 FUNCTION(eth),
1262 FUNCTION(pwm_a),
1263 FUNCTION(pwm_b),
1264 FUNCTION(pwm_c),
1265 FUNCTION(pwm_d),
1266 FUNCTION(pwm_e),
1267 FUNCTION(pwm_f),
1268 FUNCTION(cec_ao_a_h),
1269 FUNCTION(cec_ao_b_h),
1270 FUNCTION(jtag_b),
1271 FUNCTION(bt565_a),
1272 FUNCTION(tsin_a),
1273 FUNCTION(tsin_b),
1274 FUNCTION(hdmitx),
1275 FUNCTION(pdm),
1276 FUNCTION(spdif_out),
1277 FUNCTION(spdif_in),
1278 FUNCTION(mclk0),
1279 FUNCTION(mclk1),
1280 FUNCTION(tdm_a),
1281 FUNCTION(tdm_b),
1282 FUNCTION(tdm_c),
1283};
1284
1285static struct meson_pmx_func meson_g12a_aobus_functions[] = {
1286 FUNCTION(gpio_aobus),
1287 FUNCTION(uart_ao_a),
1288 FUNCTION(uart_ao_b),
1289 FUNCTION(i2c_ao),
1290 FUNCTION(i2c_ao_slave),
1291 FUNCTION(remote_ao_input),
1292 FUNCTION(remote_ao_out),
1293 FUNCTION(pwm_ao_a),
1294 FUNCTION(pwm_ao_b),
1295 FUNCTION(pwm_ao_c),
1296 FUNCTION(pwm_ao_d),
1297 FUNCTION(jtag_a),
1298 FUNCTION(cec_ao_a),
1299 FUNCTION(cec_ao_b),
1300 FUNCTION(tsin_ao_a),
1301 FUNCTION(spdif_ao_out),
1302 FUNCTION(tdm_ao_b),
1303 FUNCTION(mclk0_ao),
1304};
1305
1306static struct meson_bank meson_g12a_periphs_banks[] = {
2484ae57
GLR
1307 /* name first last irq pullen pull dir out in ds */
1308 BANK_DS("Z", GPIOZ_0, GPIOZ_15, 12, 27,
1309 4, 0, 4, 0, 12, 0, 13, 0, 14, 0, 5, 0),
1310 BANK_DS("H", GPIOH_0, GPIOH_8, 28, 36,
1311 3, 0, 3, 0, 9, 0, 10, 0, 11, 0, 4, 0),
1312 BANK_DS("BOOT", BOOT_0, BOOT_15, 37, 52,
1313 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0),
1314 BANK_DS("C", GPIOC_0, GPIOC_7, 53, 60,
1315 1, 0, 1, 0, 3, 0, 4, 0, 5, 0, 1, 0),
1316 BANK_DS("A", GPIOA_0, GPIOA_15, 61, 76,
1317 5, 0, 5, 0, 16, 0, 17, 0, 18, 0, 6, 0),
1318 BANK_DS("X", GPIOX_0, GPIOX_19, 77, 96,
1319 2, 0, 2, 0, 6, 0, 7, 0, 8, 0, 2, 0),
29ae0952
YL
1320};
1321
1322static struct meson_bank meson_g12a_aobus_banks[] = {
2484ae57
GLR
1323 /* name first last irq pullen pull dir out in ds */
1324 BANK_DS("AO", GPIOAO_0, GPIOAO_11, 0, 11, 3, 0, 2, 0, 0, 0, 4, 0, 1, 0,
1325 0, 0),
29ae0952 1326 /* GPIOE actually located in the AO bank */
2484ae57
GLR
1327 BANK_DS("E", GPIOE_0, GPIOE_2, 97, 99, 3, 16, 2, 16, 0, 16, 4, 16, 1,
1328 16, 1, 0),
29ae0952
YL
1329};
1330
1331static struct meson_pmx_bank meson_g12a_periphs_pmx_banks[] = {
1332 /* name first lask reg offset */
1333 BANK_PMX("Z", GPIOZ_0, GPIOZ_15, 0x6, 0),
1334 BANK_PMX("H", GPIOH_0, GPIOH_8, 0xb, 0),
1335 BANK_PMX("BOOT", BOOT_0, BOOT_15, 0x0, 0),
1336 BANK_PMX("C", GPIOC_0, GPIOC_7, 0x9, 0),
1337 BANK_PMX("A", GPIOA_0, GPIOA_15, 0xd, 0),
1338 BANK_PMX("X", GPIOX_0, GPIOX_19, 0x3, 0),
1339};
1340
1341static struct meson_axg_pmx_data meson_g12a_periphs_pmx_banks_data = {
1342 .pmx_banks = meson_g12a_periphs_pmx_banks,
1343 .num_pmx_banks = ARRAY_SIZE(meson_g12a_periphs_pmx_banks),
1344};
1345
1346static struct meson_pmx_bank meson_g12a_aobus_pmx_banks[] = {
1347 BANK_PMX("AO", GPIOAO_0, GPIOAO_11, 0x0, 0),
1348 BANK_PMX("E", GPIOE_0, GPIOE_2, 0x1, 16),
1349};
1350
1351static struct meson_axg_pmx_data meson_g12a_aobus_pmx_banks_data = {
1352 .pmx_banks = meson_g12a_aobus_pmx_banks,
1353 .num_pmx_banks = ARRAY_SIZE(meson_g12a_aobus_pmx_banks),
1354};
1355
1356static struct meson_pinctrl_data meson_g12a_periphs_pinctrl_data = {
1357 .name = "periphs-banks",
1358 .pins = meson_g12a_periphs_pins,
1359 .groups = meson_g12a_periphs_groups,
1360 .funcs = meson_g12a_periphs_functions,
1361 .banks = meson_g12a_periphs_banks,
1362 .num_pins = ARRAY_SIZE(meson_g12a_periphs_pins),
1363 .num_groups = ARRAY_SIZE(meson_g12a_periphs_groups),
1364 .num_funcs = ARRAY_SIZE(meson_g12a_periphs_functions),
1365 .num_banks = ARRAY_SIZE(meson_g12a_periphs_banks),
1366 .pmx_ops = &meson_axg_pmx_ops,
1367 .pmx_data = &meson_g12a_periphs_pmx_banks_data,
1368};
1369
1370static struct meson_pinctrl_data meson_g12a_aobus_pinctrl_data = {
1371 .name = "aobus-banks",
1372 .pins = meson_g12a_aobus_pins,
1373 .groups = meson_g12a_aobus_groups,
1374 .funcs = meson_g12a_aobus_functions,
1375 .banks = meson_g12a_aobus_banks,
1376 .num_pins = ARRAY_SIZE(meson_g12a_aobus_pins),
1377 .num_groups = ARRAY_SIZE(meson_g12a_aobus_groups),
1378 .num_funcs = ARRAY_SIZE(meson_g12a_aobus_functions),
1379 .num_banks = ARRAY_SIZE(meson_g12a_aobus_banks),
1380 .pmx_ops = &meson_axg_pmx_ops,
1381 .pmx_data = &meson_g12a_aobus_pmx_banks_data,
1382};
1383
1384static const struct of_device_id meson_g12a_pinctrl_dt_match[] = {
1385 {
1386 .compatible = "amlogic,meson-g12a-periphs-pinctrl",
1387 .data = &meson_g12a_periphs_pinctrl_data,
1388 },
1389 {
1390 .compatible = "amlogic,meson-g12a-aobus-pinctrl",
1391 .data = &meson_g12a_aobus_pinctrl_data,
1392 },
1393 { },
1394};
1395
1396static struct platform_driver meson_g12a_pinctrl_driver = {
1397 .probe = meson_pinctrl_probe,
1398 .driver = {
1399 .name = "meson-g12a-pinctrl",
1400 .of_match_table = meson_g12a_pinctrl_dt_match,
1401 },
1402};
1403
1404builtin_platform_driver(meson_g12a_pinctrl_driver);