1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright (C) 2018 Neil Armstrong <narmstrong@baylibre.com>
4  *
5  * Based on code from Linux kernel:
6  *  Copyright (c) 2017 Amlogic, Inc. All rights reserved.
7  *  Author: Xingyu Chen <xingyu.chen@amlogic.com>
8  */
9 
10 #include <common.h>
11 #include <dm.h>
12 #include <dm/pinctrl.h>
13 #include <dt-bindings/gpio/meson-axg-gpio.h>
14 
15 #include "pinctrl-meson-axg.h"
16 
17 #define EE_OFF	15
18 
19 /* emmc */
20 static const unsigned int emmc_nand_d0_pins[] = {BOOT_0};
21 static const unsigned int emmc_nand_d1_pins[] = {BOOT_1};
22 static const unsigned int emmc_nand_d2_pins[] = {BOOT_2};
23 static const unsigned int emmc_nand_d3_pins[] = {BOOT_3};
24 static const unsigned int emmc_nand_d4_pins[] = {BOOT_4};
25 static const unsigned int emmc_nand_d5_pins[] = {BOOT_5};
26 static const unsigned int emmc_nand_d6_pins[] = {BOOT_6};
27 static const unsigned int emmc_nand_d7_pins[] = {BOOT_7};
28 
29 static const unsigned int emmc_clk_pins[] = {BOOT_8};
30 static const unsigned int emmc_cmd_pins[] = {BOOT_10};
31 static const unsigned int emmc_ds_pins[]  = {BOOT_13};
32 
33 /* nand */
34 static const unsigned int nand_ce0_pins[] = {BOOT_8};
35 static const unsigned int nand_ale_pins[] = {BOOT_9};
36 static const unsigned int nand_cle_pins[] = {BOOT_10};
37 static const unsigned int nand_wen_clk_pins[] = {BOOT_11};
38 static const unsigned int nand_ren_wr_pins[] = {BOOT_12};
39 static const unsigned int nand_rb0_pins[] = {BOOT_13};
40 
41 /* nor */
42 static const unsigned int nor_hold_pins[] = {BOOT_3};
43 static const unsigned int nor_d_pins[] = {BOOT_4};
44 static const unsigned int nor_q_pins[] = {BOOT_5};
45 static const unsigned int nor_c_pins[] = {BOOT_6};
46 static const unsigned int nor_wp_pins[] = {BOOT_9};
47 static const unsigned int nor_cs_pins[] = {BOOT_14};
48 
49 /* sdio */
50 static const unsigned int sdio_d0_pins[] = {GPIOX_0};
51 static const unsigned int sdio_d1_pins[] = {GPIOX_1};
52 static const unsigned int sdio_d2_pins[] = {GPIOX_2};
53 static const unsigned int sdio_d3_pins[] = {GPIOX_3};
54 static const unsigned int sdio_clk_pins[] = {GPIOX_4};
55 static const unsigned int sdio_cmd_pins[] = {GPIOX_5};
56 
57 /* spi0 */
58 static const unsigned int spi0_clk_pins[] = {GPIOZ_0};
59 static const unsigned int spi0_mosi_pins[] = {GPIOZ_1};
60 static const unsigned int spi0_miso_pins[] = {GPIOZ_2};
61 static const unsigned int spi0_ss0_pins[] = {GPIOZ_3};
62 static const unsigned int spi0_ss1_pins[] = {GPIOZ_4};
63 static const unsigned int spi0_ss2_pins[] = {GPIOZ_5};
64 
65 /* spi1 */
66 static const unsigned int spi1_clk_x_pins[] = {GPIOX_19};
67 static const unsigned int spi1_mosi_x_pins[] = {GPIOX_17};
68 static const unsigned int spi1_miso_x_pins[] = {GPIOX_18};
69 static const unsigned int spi1_ss0_x_pins[] = {GPIOX_16};
70 
71 static const unsigned int spi1_clk_a_pins[] = {GPIOA_4};
72 static const unsigned int spi1_mosi_a_pins[] = {GPIOA_2};
73 static const unsigned int spi1_miso_a_pins[] = {GPIOA_3};
74 static const unsigned int spi1_ss0_a_pins[] = {GPIOA_5};
75 static const unsigned int spi1_ss1_pins[] = {GPIOA_6};
76 
77 /* i2c0 */
78 static const unsigned int i2c0_sck_pins[] = {GPIOZ_6};
79 static const unsigned int i2c0_sda_pins[] = {GPIOZ_7};
80 
81 /* i2c1 */
82 static const unsigned int i2c1_sck_z_pins[] = {GPIOZ_8};
83 static const unsigned int i2c1_sda_z_pins[] = {GPIOZ_9};
84 
85 static const unsigned int i2c1_sck_x_pins[] = {GPIOX_16};
86 static const unsigned int i2c1_sda_x_pins[] = {GPIOX_17};
87 
88 /* i2c2 */
89 static const unsigned int i2c2_sck_x_pins[] = {GPIOX_18};
90 static const unsigned int i2c2_sda_x_pins[] = {GPIOX_19};
91 
92 static const unsigned int i2c2_sda_a_pins[] = {GPIOA_17};
93 static const unsigned int i2c2_sck_a_pins[] = {GPIOA_18};
94 
95 /* i2c3 */
96 static const unsigned int i2c3_sda_a6_pins[] = {GPIOA_6};
97 static const unsigned int i2c3_sck_a7_pins[] = {GPIOA_7};
98 
99 static const unsigned int i2c3_sda_a12_pins[] = {GPIOA_12};
100 static const unsigned int i2c3_sck_a13_pins[] = {GPIOA_13};
101 
102 static const unsigned int i2c3_sda_a19_pins[] = {GPIOA_19};
103 static const unsigned int i2c3_sck_a20_pins[] = {GPIOA_20};
104 
105 /* uart_a */
106 static const unsigned int uart_rts_a_pins[] = {GPIOX_11};
107 static const unsigned int uart_cts_a_pins[] = {GPIOX_10};
108 static const unsigned int uart_tx_a_pins[] = {GPIOX_8};
109 static const unsigned int uart_rx_a_pins[] = {GPIOX_9};
110 
111 /* uart_b */
112 static const unsigned int uart_rts_b_z_pins[] = {GPIOZ_0};
113 static const unsigned int uart_cts_b_z_pins[] = {GPIOZ_1};
114 static const unsigned int uart_tx_b_z_pins[] = {GPIOZ_2};
115 static const unsigned int uart_rx_b_z_pins[] = {GPIOZ_3};
116 
117 static const unsigned int uart_rts_b_x_pins[] = {GPIOX_18};
118 static const unsigned int uart_cts_b_x_pins[] = {GPIOX_19};
119 static const unsigned int uart_tx_b_x_pins[] = {GPIOX_16};
120 static const unsigned int uart_rx_b_x_pins[] = {GPIOX_17};
121 
122 /* uart_ao_b */
123 static const unsigned int uart_ao_tx_b_z_pins[] = {GPIOZ_8};
124 static const unsigned int uart_ao_rx_b_z_pins[] = {GPIOZ_9};
125 static const unsigned int uart_ao_cts_b_z_pins[] = {GPIOZ_6};
126 static const unsigned int uart_ao_rts_b_z_pins[] = {GPIOZ_7};
127 
128 /* pwm_a */
129 static const unsigned int pwm_a_z_pins[] = {GPIOZ_5};
130 
131 static const unsigned int pwm_a_x18_pins[] = {GPIOX_18};
132 static const unsigned int pwm_a_x20_pins[] = {GPIOX_20};
133 
134 static const unsigned int pwm_a_a_pins[] = {GPIOA_14};
135 
136 /* pwm_b */
137 static const unsigned int pwm_b_z_pins[] = {GPIOZ_4};
138 
139 static const unsigned int pwm_b_x_pins[] = {GPIOX_19};
140 
141 static const unsigned int pwm_b_a_pins[] = {GPIOA_15};
142 
143 /* pwm_c */
144 static const unsigned int pwm_c_x10_pins[] = {GPIOX_10};
145 static const unsigned int pwm_c_x17_pins[] = {GPIOX_17};
146 
147 static const unsigned int pwm_c_a_pins[] = {GPIOA_16};
148 
149 /* pwm_d */
150 static const unsigned int pwm_d_x11_pins[] = {GPIOX_11};
151 static const unsigned int pwm_d_x16_pins[] = {GPIOX_16};
152 
153 /* pwm_vs */
154 static const unsigned int pwm_vs_pins[] = {GPIOA_0};
155 
156 /* spdif_in */
157 static const unsigned int spdif_in_z_pins[] = {GPIOZ_4};
158 
159 static const unsigned int spdif_in_a1_pins[] = {GPIOA_1};
160 static const unsigned int spdif_in_a7_pins[] = {GPIOA_7};
161 static const unsigned int spdif_in_a19_pins[] = {GPIOA_19};
162 static const unsigned int spdif_in_a20_pins[] = {GPIOA_20};
163 
164 /* spdif_out */
165 static const unsigned int spdif_out_z_pins[] = {GPIOZ_5};
166 
167 static const unsigned int spdif_out_a1_pins[] = {GPIOA_1};
168 static const unsigned int spdif_out_a11_pins[] = {GPIOA_11};
169 static const unsigned int spdif_out_a19_pins[] = {GPIOA_19};
170 static const unsigned int spdif_out_a20_pins[] = {GPIOA_20};
171 
172 /* jtag_ee */
173 static const unsigned int jtag_tdo_x_pins[] = {GPIOX_0};
174 static const unsigned int jtag_tdi_x_pins[] = {GPIOX_1};
175 static const unsigned int jtag_clk_x_pins[] = {GPIOX_4};
176 static const unsigned int jtag_tms_x_pins[] = {GPIOX_5};
177 
178 /* eth */
179 static const unsigned int eth_txd0_x_pins[] = {GPIOX_8};
180 static const unsigned int eth_txd1_x_pins[] = {GPIOX_9};
181 static const unsigned int eth_txen_x_pins[] = {GPIOX_10};
182 static const unsigned int eth_rgmii_rx_clk_x_pins[] = {GPIOX_12};
183 static const unsigned int eth_rxd0_x_pins[] = {GPIOX_13};
184 static const unsigned int eth_rxd1_x_pins[] = {GPIOX_14};
185 static const unsigned int eth_rx_dv_x_pins[] = {GPIOX_15};
186 static const unsigned int eth_mdio_x_pins[] = {GPIOX_21};
187 static const unsigned int eth_mdc_x_pins[] = {GPIOX_22};
188 
189 static const unsigned int eth_txd0_y_pins[] = {GPIOY_10};
190 static const unsigned int eth_txd1_y_pins[] = {GPIOY_11};
191 static const unsigned int eth_txen_y_pins[] = {GPIOY_9};
192 static const unsigned int eth_rgmii_rx_clk_y_pins[] = {GPIOY_2};
193 static const unsigned int eth_rxd0_y_pins[] = {GPIOY_4};
194 static const unsigned int eth_rxd1_y_pins[] = {GPIOY_5};
195 static const unsigned int eth_rx_dv_y_pins[] = {GPIOY_3};
196 static const unsigned int eth_mdio_y_pins[] = {GPIOY_0};
197 static const unsigned int eth_mdc_y_pins[] = {GPIOY_1};
198 
199 static const unsigned int eth_rxd2_rgmii_pins[] = {GPIOY_6};
200 static const unsigned int eth_rxd3_rgmii_pins[] = {GPIOY_7};
201 static const unsigned int eth_rgmii_tx_clk_pins[] = {GPIOY_8};
202 static const unsigned int eth_txd2_rgmii_pins[] = {GPIOY_12};
203 static const unsigned int eth_txd3_rgmii_pins[] = {GPIOY_13};
204 
205 /* pdm */
206 static const unsigned int pdm_dclk_a14_pins[] = {GPIOA_14};
207 static const unsigned int pdm_dclk_a19_pins[] = {GPIOA_19};
208 static const unsigned int pdm_din0_pins[] = {GPIOA_15};
209 static const unsigned int pdm_din1_pins[] = {GPIOA_16};
210 static const unsigned int pdm_din2_pins[] = {GPIOA_17};
211 static const unsigned int pdm_din3_pins[] = {GPIOA_18};
212 
213 /* mclk */
214 static const unsigned int mclk_c_pins[] = {GPIOA_0};
215 static const unsigned int mclk_b_pins[] = {GPIOA_1};
216 
217 /* tdm */
218 static const unsigned int tdma_sclk_pins[] = {GPIOX_12};
219 static const unsigned int tdma_sclk_slv_pins[] = {GPIOX_12};
220 static const unsigned int tdma_fs_pins[] = {GPIOX_13};
221 static const unsigned int tdma_fs_slv_pins[] = {GPIOX_13};
222 static const unsigned int tdma_din0_pins[] = {GPIOX_14};
223 static const unsigned int tdma_dout0_x14_pins[] = {GPIOX_14};
224 static const unsigned int tdma_dout0_x15_pins[] = {GPIOX_15};
225 static const unsigned int tdma_dout1_pins[] = {GPIOX_15};
226 static const unsigned int tdma_din1_pins[] = {GPIOX_15};
227 
228 static const unsigned int tdmc_sclk_pins[] = {GPIOA_2};
229 static const unsigned int tdmc_sclk_slv_pins[] = {GPIOA_2};
230 static const unsigned int tdmc_fs_pins[] = {GPIOA_3};
231 static const unsigned int tdmc_fs_slv_pins[] = {GPIOA_3};
232 static const unsigned int tdmc_din0_pins[] = {GPIOA_4};
233 static const unsigned int tdmc_dout0_pins[] = {GPIOA_4};
234 static const unsigned int tdmc_din1_pins[] = {GPIOA_5};
235 static const unsigned int tdmc_dout1_pins[] = {GPIOA_5};
236 static const unsigned int tdmc_din2_pins[] = {GPIOA_6};
237 static const unsigned int tdmc_dout2_pins[] = {GPIOA_6};
238 static const unsigned int tdmc_din3_pins[] = {GPIOA_7};
239 static const unsigned int tdmc_dout3_pins[] = {GPIOA_7};
240 
241 static const unsigned int tdmb_sclk_pins[] = {GPIOA_8};
242 static const unsigned int tdmb_sclk_slv_pins[] = {GPIOA_8};
243 static const unsigned int tdmb_fs_pins[] = {GPIOA_9};
244 static const unsigned int tdmb_fs_slv_pins[] = {GPIOA_9};
245 static const unsigned int tdmb_din0_pins[] = {GPIOA_10};
246 static const unsigned int tdmb_dout0_pins[] = {GPIOA_10};
247 static const unsigned int tdmb_din1_pins[] = {GPIOA_11};
248 static const unsigned int tdmb_dout1_pins[] = {GPIOA_11};
249 static const unsigned int tdmb_din2_pins[] = {GPIOA_12};
250 static const unsigned int tdmb_dout2_pins[] = {GPIOA_12};
251 static const unsigned int tdmb_din3_pins[] = {GPIOA_13};
252 static const unsigned int tdmb_dout3_pins[] = {GPIOA_13};
253 
254 static struct meson_pmx_group meson_axg_periphs_groups[] = {
255 	GPIO_GROUP(GPIOZ_0, EE_OFF),
256 	GPIO_GROUP(GPIOZ_1, EE_OFF),
257 	GPIO_GROUP(GPIOZ_2, EE_OFF),
258 	GPIO_GROUP(GPIOZ_3, EE_OFF),
259 	GPIO_GROUP(GPIOZ_4, EE_OFF),
260 	GPIO_GROUP(GPIOZ_5, EE_OFF),
261 	GPIO_GROUP(GPIOZ_6, EE_OFF),
262 	GPIO_GROUP(GPIOZ_7, EE_OFF),
263 	GPIO_GROUP(GPIOZ_8, EE_OFF),
264 	GPIO_GROUP(GPIOZ_9, EE_OFF),
265 	GPIO_GROUP(GPIOZ_10, EE_OFF),
266 
267 	GPIO_GROUP(BOOT_0, EE_OFF),
268 	GPIO_GROUP(BOOT_1, EE_OFF),
269 	GPIO_GROUP(BOOT_2, EE_OFF),
270 	GPIO_GROUP(BOOT_3, EE_OFF),
271 	GPIO_GROUP(BOOT_4, EE_OFF),
272 	GPIO_GROUP(BOOT_5, EE_OFF),
273 	GPIO_GROUP(BOOT_6, EE_OFF),
274 	GPIO_GROUP(BOOT_7, EE_OFF),
275 	GPIO_GROUP(BOOT_8, EE_OFF),
276 	GPIO_GROUP(BOOT_9, EE_OFF),
277 	GPIO_GROUP(BOOT_10, EE_OFF),
278 	GPIO_GROUP(BOOT_11, EE_OFF),
279 	GPIO_GROUP(BOOT_12, EE_OFF),
280 	GPIO_GROUP(BOOT_13, EE_OFF),
281 	GPIO_GROUP(BOOT_14, EE_OFF),
282 
283 	GPIO_GROUP(GPIOA_0, EE_OFF),
284 	GPIO_GROUP(GPIOA_1, EE_OFF),
285 	GPIO_GROUP(GPIOA_2, EE_OFF),
286 	GPIO_GROUP(GPIOA_3, EE_OFF),
287 	GPIO_GROUP(GPIOA_4, EE_OFF),
288 	GPIO_GROUP(GPIOA_5, EE_OFF),
289 	GPIO_GROUP(GPIOA_6, EE_OFF),
290 	GPIO_GROUP(GPIOA_7, EE_OFF),
291 	GPIO_GROUP(GPIOA_8, EE_OFF),
292 	GPIO_GROUP(GPIOA_9, EE_OFF),
293 	GPIO_GROUP(GPIOA_10, EE_OFF),
294 	GPIO_GROUP(GPIOA_11, EE_OFF),
295 	GPIO_GROUP(GPIOA_12, EE_OFF),
296 	GPIO_GROUP(GPIOA_13, EE_OFF),
297 	GPIO_GROUP(GPIOA_14, EE_OFF),
298 	GPIO_GROUP(GPIOA_15, EE_OFF),
299 	GPIO_GROUP(GPIOA_16, EE_OFF),
300 	GPIO_GROUP(GPIOA_17, EE_OFF),
301 	GPIO_GROUP(GPIOA_19, EE_OFF),
302 	GPIO_GROUP(GPIOA_20, EE_OFF),
303 
304 	GPIO_GROUP(GPIOX_0, EE_OFF),
305 	GPIO_GROUP(GPIOX_1, EE_OFF),
306 	GPIO_GROUP(GPIOX_2, EE_OFF),
307 	GPIO_GROUP(GPIOX_3, EE_OFF),
308 	GPIO_GROUP(GPIOX_4, EE_OFF),
309 	GPIO_GROUP(GPIOX_5, EE_OFF),
310 	GPIO_GROUP(GPIOX_6, EE_OFF),
311 	GPIO_GROUP(GPIOX_7, EE_OFF),
312 	GPIO_GROUP(GPIOX_8, EE_OFF),
313 	GPIO_GROUP(GPIOX_9, EE_OFF),
314 	GPIO_GROUP(GPIOX_10, EE_OFF),
315 	GPIO_GROUP(GPIOX_11, EE_OFF),
316 	GPIO_GROUP(GPIOX_12, EE_OFF),
317 	GPIO_GROUP(GPIOX_13, EE_OFF),
318 	GPIO_GROUP(GPIOX_14, EE_OFF),
319 	GPIO_GROUP(GPIOX_15, EE_OFF),
320 	GPIO_GROUP(GPIOX_16, EE_OFF),
321 	GPIO_GROUP(GPIOX_17, EE_OFF),
322 	GPIO_GROUP(GPIOX_18, EE_OFF),
323 	GPIO_GROUP(GPIOX_19, EE_OFF),
324 	GPIO_GROUP(GPIOX_20, EE_OFF),
325 	GPIO_GROUP(GPIOX_21, EE_OFF),
326 	GPIO_GROUP(GPIOX_22, EE_OFF),
327 
328 	GPIO_GROUP(GPIOY_0, EE_OFF),
329 	GPIO_GROUP(GPIOY_1, EE_OFF),
330 	GPIO_GROUP(GPIOY_2, EE_OFF),
331 	GPIO_GROUP(GPIOY_3, EE_OFF),
332 	GPIO_GROUP(GPIOY_4, EE_OFF),
333 	GPIO_GROUP(GPIOY_5, EE_OFF),
334 	GPIO_GROUP(GPIOY_6, EE_OFF),
335 	GPIO_GROUP(GPIOY_7, EE_OFF),
336 	GPIO_GROUP(GPIOY_8, EE_OFF),
337 	GPIO_GROUP(GPIOY_9, EE_OFF),
338 	GPIO_GROUP(GPIOY_10, EE_OFF),
339 	GPIO_GROUP(GPIOY_11, EE_OFF),
340 	GPIO_GROUP(GPIOY_12, EE_OFF),
341 	GPIO_GROUP(GPIOY_13, EE_OFF),
342 	GPIO_GROUP(GPIOY_14, EE_OFF),
343 	GPIO_GROUP(GPIOY_15, EE_OFF),
344 
345 	/* bank BOOT */
346 	GROUP(emmc_nand_d0, 1),
347 	GROUP(emmc_nand_d1, 1),
348 	GROUP(emmc_nand_d2, 1),
349 	GROUP(emmc_nand_d3, 1),
350 	GROUP(emmc_nand_d4, 1),
351 	GROUP(emmc_nand_d5, 1),
352 	GROUP(emmc_nand_d6, 1),
353 	GROUP(emmc_nand_d7, 1),
354 	GROUP(emmc_clk, 1),
355 	GROUP(emmc_cmd, 1),
356 	GROUP(emmc_ds, 1),
357 	GROUP(nand_ce0, 2),
358 	GROUP(nand_ale, 2),
359 	GROUP(nand_cle, 2),
360 	GROUP(nand_wen_clk, 2),
361 	GROUP(nand_ren_wr, 2),
362 	GROUP(nand_rb0, 2),
363 	GROUP(nor_hold, 3),
364 	GROUP(nor_d, 3),
365 	GROUP(nor_q, 3),
366 	GROUP(nor_c, 3),
367 	GROUP(nor_wp, 3),
368 	GROUP(nor_cs, 3),
369 
370 	/* bank GPIOZ */
371 	GROUP(spi0_clk, 1),
372 	GROUP(spi0_mosi, 1),
373 	GROUP(spi0_miso, 1),
374 	GROUP(spi0_ss0, 1),
375 	GROUP(spi0_ss1, 1),
376 	GROUP(spi0_ss2, 1),
377 	GROUP(i2c0_sck, 1),
378 	GROUP(i2c0_sda, 1),
379 	GROUP(i2c1_sck_z, 1),
380 	GROUP(i2c1_sda_z, 1),
381 	GROUP(uart_rts_b_z, 2),
382 	GROUP(uart_cts_b_z, 2),
383 	GROUP(uart_tx_b_z, 2),
384 	GROUP(uart_rx_b_z, 2),
385 	GROUP(pwm_a_z, 2),
386 	GROUP(pwm_b_z, 2),
387 	GROUP(spdif_in_z, 3),
388 	GROUP(spdif_out_z, 3),
389 	GROUP(uart_ao_tx_b_z, 2),
390 	GROUP(uart_ao_rx_b_z, 2),
391 	GROUP(uart_ao_cts_b_z, 2),
392 	GROUP(uart_ao_rts_b_z, 2),
393 
394 	/* bank GPIOX */
395 	GROUP(sdio_d0, 1),
396 	GROUP(sdio_d1, 1),
397 	GROUP(sdio_d2, 1),
398 	GROUP(sdio_d3, 1),
399 	GROUP(sdio_clk, 1),
400 	GROUP(sdio_cmd, 1),
401 	GROUP(i2c1_sck_x, 1),
402 	GROUP(i2c1_sda_x, 1),
403 	GROUP(i2c2_sck_x, 1),
404 	GROUP(i2c2_sda_x, 1),
405 	GROUP(uart_rts_a, 1),
406 	GROUP(uart_cts_a, 1),
407 	GROUP(uart_tx_a, 1),
408 	GROUP(uart_rx_a, 1),
409 	GROUP(uart_rts_b_x, 2),
410 	GROUP(uart_cts_b_x, 2),
411 	GROUP(uart_tx_b_x, 2),
412 	GROUP(uart_rx_b_x, 2),
413 	GROUP(jtag_tdo_x, 2),
414 	GROUP(jtag_tdi_x, 2),
415 	GROUP(jtag_clk_x, 2),
416 	GROUP(jtag_tms_x, 2),
417 	GROUP(spi1_clk_x, 4),
418 	GROUP(spi1_mosi_x, 4),
419 	GROUP(spi1_miso_x, 4),
420 	GROUP(spi1_ss0_x, 4),
421 	GROUP(pwm_a_x18, 3),
422 	GROUP(pwm_a_x20, 1),
423 	GROUP(pwm_b_x, 3),
424 	GROUP(pwm_c_x10, 3),
425 	GROUP(pwm_c_x17, 3),
426 	GROUP(pwm_d_x11, 3),
427 	GROUP(pwm_d_x16, 3),
428 	GROUP(eth_txd0_x, 4),
429 	GROUP(eth_txd1_x, 4),
430 	GROUP(eth_txen_x, 4),
431 	GROUP(eth_rgmii_rx_clk_x, 4),
432 	GROUP(eth_rxd0_x, 4),
433 	GROUP(eth_rxd1_x, 4),
434 	GROUP(eth_rx_dv_x, 4),
435 	GROUP(eth_mdio_x, 4),
436 	GROUP(eth_mdc_x, 4),
437 	GROUP(tdma_sclk, 1),
438 	GROUP(tdma_sclk_slv, 2),
439 	GROUP(tdma_fs, 1),
440 	GROUP(tdma_fs_slv, 2),
441 	GROUP(tdma_din0, 1),
442 	GROUP(tdma_dout0_x14, 2),
443 	GROUP(tdma_dout0_x15, 1),
444 	GROUP(tdma_dout1, 2),
445 	GROUP(tdma_din1, 3),
446 
447 	/* bank GPIOY */
448 	GROUP(eth_txd0_y, 1),
449 	GROUP(eth_txd1_y, 1),
450 	GROUP(eth_txen_y, 1),
451 	GROUP(eth_rgmii_rx_clk_y, 1),
452 	GROUP(eth_rxd0_y, 1),
453 	GROUP(eth_rxd1_y, 1),
454 	GROUP(eth_rx_dv_y, 1),
455 	GROUP(eth_mdio_y, 1),
456 	GROUP(eth_mdc_y, 1),
457 	GROUP(eth_rxd2_rgmii, 1),
458 	GROUP(eth_rxd3_rgmii, 1),
459 	GROUP(eth_rgmii_tx_clk, 1),
460 	GROUP(eth_txd2_rgmii, 1),
461 	GROUP(eth_txd3_rgmii, 1),
462 
463 	/* bank GPIOA */
464 	GROUP(spdif_out_a1, 4),
465 	GROUP(spdif_out_a11, 3),
466 	GROUP(spdif_out_a19, 2),
467 	GROUP(spdif_out_a20, 1),
468 	GROUP(spdif_in_a1, 3),
469 	GROUP(spdif_in_a7, 3),
470 	GROUP(spdif_in_a19, 1),
471 	GROUP(spdif_in_a20, 2),
472 	GROUP(spi1_clk_a, 3),
473 	GROUP(spi1_mosi_a, 3),
474 	GROUP(spi1_miso_a, 3),
475 	GROUP(spi1_ss0_a, 3),
476 	GROUP(spi1_ss1, 3),
477 	GROUP(pwm_a_a, 3),
478 	GROUP(pwm_b_a, 3),
479 	GROUP(pwm_c_a, 3),
480 	GROUP(pwm_vs, 2),
481 	GROUP(i2c2_sda_a, 3),
482 	GROUP(i2c2_sck_a, 3),
483 	GROUP(i2c3_sda_a6, 4),
484 	GROUP(i2c3_sck_a7, 4),
485 	GROUP(i2c3_sda_a12, 4),
486 	GROUP(i2c3_sck_a13, 4),
487 	GROUP(i2c3_sda_a19, 4),
488 	GROUP(i2c3_sck_a20, 4),
489 	GROUP(pdm_dclk_a14, 1),
490 	GROUP(pdm_dclk_a19, 3),
491 	GROUP(pdm_din0, 1),
492 	GROUP(pdm_din1, 1),
493 	GROUP(pdm_din2, 1),
494 	GROUP(pdm_din3, 1),
495 	GROUP(mclk_c, 1),
496 	GROUP(mclk_b, 1),
497 	GROUP(tdmc_sclk, 1),
498 	GROUP(tdmc_sclk_slv, 2),
499 	GROUP(tdmc_fs, 1),
500 	GROUP(tdmc_fs_slv, 2),
501 	GROUP(tdmc_din0, 2),
502 	GROUP(tdmc_dout0, 1),
503 	GROUP(tdmc_din1, 2),
504 	GROUP(tdmc_dout1, 1),
505 	GROUP(tdmc_din2, 2),
506 	GROUP(tdmc_dout2, 1),
507 	GROUP(tdmc_din3, 2),
508 	GROUP(tdmc_dout3, 1),
509 	GROUP(tdmb_sclk, 1),
510 	GROUP(tdmb_sclk_slv, 2),
511 	GROUP(tdmb_fs, 1),
512 	GROUP(tdmb_fs_slv, 2),
513 	GROUP(tdmb_din0, 2),
514 	GROUP(tdmb_dout0, 1),
515 	GROUP(tdmb_din1, 2),
516 	GROUP(tdmb_dout1, 1),
517 	GROUP(tdmb_din2, 2),
518 	GROUP(tdmb_dout2, 1),
519 	GROUP(tdmb_din3, 2),
520 	GROUP(tdmb_dout3, 1),
521 };
522 
523 /* uart_ao_a */
524 static const unsigned int uart_ao_tx_a_pins[] = {GPIOAO_0};
525 static const unsigned int uart_ao_rx_a_pins[] = {GPIOAO_1};
526 static const unsigned int uart_ao_cts_a_pins[] = {GPIOAO_2};
527 static const unsigned int uart_ao_rts_a_pins[] = {GPIOAO_3};
528 
529 /* uart_ao_b */
530 static const unsigned int uart_ao_tx_b_pins[] = {GPIOAO_4};
531 static const unsigned int uart_ao_rx_b_pins[] = {GPIOAO_5};
532 static const unsigned int uart_ao_cts_b_pins[] = {GPIOAO_2};
533 static const unsigned int uart_ao_rts_b_pins[] = {GPIOAO_3};
534 
535 /* i2c_ao */
536 static const unsigned int i2c_ao_sck_4_pins[] = {GPIOAO_4};
537 static const unsigned int i2c_ao_sda_5_pins[] = {GPIOAO_5};
538 static const unsigned int i2c_ao_sck_8_pins[] = {GPIOAO_8};
539 static const unsigned int i2c_ao_sda_9_pins[] = {GPIOAO_9};
540 static const unsigned int i2c_ao_sck_10_pins[] = {GPIOAO_10};
541 static const unsigned int i2c_ao_sda_11_pins[] = {GPIOAO_11};
542 
543 /* i2c_ao_slave */
544 static const unsigned int i2c_ao_slave_sck_pins[] = {GPIOAO_10};
545 static const unsigned int i2c_ao_slave_sda_pins[] = {GPIOAO_11};
546 
547 /* ir_in */
548 static const unsigned int remote_input_ao_pins[] = {GPIOAO_6};
549 
550 /* ir_out */
551 static const unsigned int remote_out_ao_pins[] = {GPIOAO_7};
552 
553 /* pwm_ao_a */
554 static const unsigned int pwm_ao_a_pins[] = {GPIOAO_3};
555 
556 /* pwm_ao_b */
557 static const unsigned int pwm_ao_b_ao2_pins[] = {GPIOAO_2};
558 static const unsigned int pwm_ao_b_ao12_pins[] = {GPIOAO_12};
559 
560 /* pwm_ao_c */
561 static const unsigned int pwm_ao_c_ao8_pins[] = {GPIOAO_8};
562 static const unsigned int pwm_ao_c_ao13_pins[] = {GPIOAO_13};
563 
564 /* pwm_ao_d */
565 static const unsigned int pwm_ao_d_pins[] = {GPIOAO_9};
566 
567 /* jtag_ao */
568 static const unsigned int jtag_ao_tdi_pins[] = {GPIOAO_3};
569 static const unsigned int jtag_ao_tdo_pins[] = {GPIOAO_4};
570 static const unsigned int jtag_ao_clk_pins[] = {GPIOAO_5};
571 static const unsigned int jtag_ao_tms_pins[] = {GPIOAO_7};
572 
573 static struct meson_pmx_group meson_axg_aobus_groups[] = {
574 	GPIO_GROUP(GPIOAO_0, 0),
575 	GPIO_GROUP(GPIOAO_1, 0),
576 	GPIO_GROUP(GPIOAO_2, 0),
577 	GPIO_GROUP(GPIOAO_3, 0),
578 	GPIO_GROUP(GPIOAO_4, 0),
579 	GPIO_GROUP(GPIOAO_5, 0),
580 	GPIO_GROUP(GPIOAO_6, 0),
581 	GPIO_GROUP(GPIOAO_7, 0),
582 	GPIO_GROUP(GPIOAO_8, 0),
583 	GPIO_GROUP(GPIOAO_9, 0),
584 	GPIO_GROUP(GPIOAO_10, 0),
585 	GPIO_GROUP(GPIOAO_11, 0),
586 	GPIO_GROUP(GPIOAO_12, 0),
587 	GPIO_GROUP(GPIOAO_13, 0),
588 	GPIO_GROUP(GPIO_TEST_N, 0),
589 
590 	/* bank AO */
591 	GROUP(uart_ao_tx_a, 1),
592 	GROUP(uart_ao_rx_a, 1),
593 	GROUP(uart_ao_cts_a, 2),
594 	GROUP(uart_ao_rts_a, 2),
595 	GROUP(uart_ao_tx_b, 1),
596 	GROUP(uart_ao_rx_b, 1),
597 	GROUP(uart_ao_cts_b, 1),
598 	GROUP(uart_ao_rts_b, 1),
599 	GROUP(i2c_ao_sck_4, 2),
600 	GROUP(i2c_ao_sda_5, 2),
601 	GROUP(i2c_ao_sck_8, 2),
602 	GROUP(i2c_ao_sda_9, 2),
603 	GROUP(i2c_ao_sck_10, 2),
604 	GROUP(i2c_ao_sda_11, 2),
605 	GROUP(i2c_ao_slave_sck, 1),
606 	GROUP(i2c_ao_slave_sda, 1),
607 	GROUP(remote_input_ao, 1),
608 	GROUP(remote_out_ao, 1),
609 	GROUP(pwm_ao_a, 3),
610 	GROUP(pwm_ao_b_ao2, 3),
611 	GROUP(pwm_ao_b_ao12, 3),
612 	GROUP(pwm_ao_c_ao8, 3),
613 	GROUP(pwm_ao_c_ao13, 3),
614 	GROUP(pwm_ao_d, 3),
615 	GROUP(jtag_ao_tdi, 4),
616 	GROUP(jtag_ao_tdo, 4),
617 	GROUP(jtag_ao_clk, 4),
618 	GROUP(jtag_ao_tms, 4),
619 };
620 
621 static const char * const gpio_periphs_groups[] = {
622 	"GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
623 	"GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
624 	"GPIOZ_10",
625 
626 	"BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
627 	"BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
628 	"BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
629 
630 	"GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
631 	"GPIOA_5", "GPIOA_6", "GPIOA_7", "GPIOA_8", "GPIOA_9",
632 	"GPIOA_10", "GPIOA_11", "GPIOA_12", "GPIOA_13", "GPIOA_14",
633 	"GPIOA_15", "GPIOA_16", "GPIOA_17", "GPIOA_18", "GPIOA_19",
634 	"GPIOA_20",
635 
636 	"GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
637 	"GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
638 	"GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
639 	"GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19",
640 	"GPIOX_20", "GPIOX_21", "GPIOX_22",
641 
642 	"GPIOY_0", "GPIOY_1", "GPIOY_2", "GPIOY_3", "GPIOY_4",
643 	"GPIOY_5", "GPIOY_6", "GPIOY_7", "GPIOY_8", "GPIOY_9",
644 	"GPIOY_10", "GPIOY_11", "GPIOY_12", "GPIOY_13", "GPIOY_14",
645 	"GPIOY_15",
646 };
647 
648 static const char * const emmc_groups[] = {
649 	"emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
650 	"emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
651 	"emmc_nand_d6", "emmc_nand_d7",
652 	"emmc_clk", "emmc_cmd", "emmc_ds",
653 };
654 
655 static const char * const nand_groups[] = {
656 	"emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
657 	"emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
658 	"emmc_nand_d6", "emmc_nand_d7",
659 	"nand_ce0", "nand_ale", "nand_cle",
660 	"nand_wen_clk", "nand_ren_wr", "nand_rb0",
661 };
662 
663 static const char * const nor_groups[] = {
664 	"nor_d", "nor_q", "nor_c", "nor_cs",
665 	"nor_hold", "nor_wp",
666 };
667 
668 static const char * const sdio_groups[] = {
669 	"sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
670 	"sdio_cmd", "sdio_clk",
671 };
672 
673 static const char * const spi0_groups[] = {
674 	"spi0_clk", "spi0_mosi", "spi0_miso", "spi0_ss0",
675 	"spi0_ss1", "spi0_ss2"
676 };
677 
678 static const char * const spi1_groups[] = {
679 	"spi1_clk_x", "spi1_mosi_x", "spi1_miso_x", "spi1_ss0_x",
680 	"spi1_clk_a", "spi1_mosi_a", "spi1_miso_a", "spi1_ss0_a",
681 	"spi1_ss1"
682 };
683 
684 static const char * const uart_a_groups[] = {
685 	"uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a",
686 };
687 
688 static const char * const uart_b_groups[] = {
689 	"uart_tx_b_z", "uart_rx_b_z", "uart_cts_b_z", "uart_rts_b_z",
690 	"uart_tx_b_x", "uart_rx_b_x", "uart_cts_b_x", "uart_rts_b_x",
691 };
692 
693 static const char * const uart_ao_b_z_groups[] = {
694 	"uart_ao_tx_b_z", "uart_ao_rx_b_z",
695 	"uart_ao_cts_b_z", "uart_ao_rts_b_z",
696 };
697 
698 static const char * const i2c0_groups[] = {
699 	"i2c0_sck", "i2c0_sda",
700 };
701 
702 static const char * const i2c1_groups[] = {
703 	"i2c1_sck_z", "i2c1_sda_z",
704 	"i2c1_sck_x", "i2c1_sda_x",
705 };
706 
707 static const char * const i2c2_groups[] = {
708 	"i2c2_sck_x", "i2c2_sda_x",
709 	"i2c2_sda_a", "i2c2_sck_a",
710 };
711 
712 static const char * const i2c3_groups[] = {
713 	"i2c3_sda_a6", "i2c3_sck_a7",
714 	"i2c3_sda_a12", "i2c3_sck_a13",
715 	"i2c3_sda_a19", "i2c3_sck_a20",
716 };
717 
718 static const char * const eth_groups[] = {
719 	"eth_rxd2_rgmii", "eth_rxd3_rgmii", "eth_rgmii_tx_clk",
720 	"eth_txd2_rgmii", "eth_txd3_rgmii",
721 	"eth_txd0_x", "eth_txd1_x", "eth_txen_x", "eth_rgmii_rx_clk_x",
722 	"eth_rxd0_x", "eth_rxd1_x", "eth_rx_dv_x", "eth_mdio_x",
723 	"eth_mdc_x",
724 	"eth_txd0_y", "eth_txd1_y", "eth_txen_y", "eth_rgmii_rx_clk_y",
725 	"eth_rxd0_y", "eth_rxd1_y", "eth_rx_dv_y", "eth_mdio_y",
726 	"eth_mdc_y",
727 };
728 
729 static const char * const pwm_a_groups[] = {
730 	"pwm_a_z", "pwm_a_x18", "pwm_a_x20", "pwm_a_a",
731 };
732 
733 static const char * const pwm_b_groups[] = {
734 	"pwm_b_z", "pwm_b_x", "pwm_b_a",
735 };
736 
737 static const char * const pwm_c_groups[] = {
738 	"pwm_c_x10", "pwm_c_x17", "pwm_c_a",
739 };
740 
741 static const char * const pwm_d_groups[] = {
742 	"pwm_d_x11", "pwm_d_x16",
743 };
744 
745 static const char * const pwm_vs_groups[] = {
746 	"pwm_vs",
747 };
748 
749 static const char * const spdif_out_groups[] = {
750 	"spdif_out_z", "spdif_out_a1", "spdif_out_a11",
751 	"spdif_out_a19", "spdif_out_a20",
752 };
753 
754 static const char * const spdif_in_groups[] = {
755 	"spdif_in_z", "spdif_in_a1", "spdif_in_a7",
756 	"spdif_in_a19", "spdif_in_a20",
757 };
758 
759 static const char * const jtag_ee_groups[] = {
760 	"jtag_tdo_x", "jtag_tdi_x", "jtag_clk_x",
761 	"jtag_tms_x",
762 };
763 
764 static const char * const pdm_groups[] = {
765 	"pdm_din0", "pdm_din1", "pdm_din2", "pdm_din3",
766 	"pdm_dclk_a14", "pdm_dclk_a19",
767 };
768 
769 static const char * const gpio_aobus_groups[] = {
770 	"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
771 	"GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
772 	"GPIOAO_10", "GPIOAO_11", "GPIOAO_12", "GPIOAO_13",
773 	"GPIO_TEST_N",
774 };
775 
776 static const char * const uart_ao_a_groups[] = {
777 	"uart_ao_tx_a", "uart_ao_rx_a", "uart_ao_cts_a", "uart_ao_rts_a",
778 };
779 
780 static const char * const uart_ao_b_groups[] = {
781 	"uart_ao_tx_b", "uart_ao_rx_b", "uart_ao_cts_b", "uart_ao_rts_b",
782 };
783 
784 static const char * const i2c_ao_groups[] = {
785 	"i2c_ao_sck_4", "i2c_ao_sda_5",
786 	"i2c_ao_sck_8", "i2c_ao_sda_9",
787 	"i2c_ao_sck_10", "i2c_ao_sda_11",
788 };
789 
790 static const char * const i2c_ao_slave_groups[] = {
791 	"i2c_ao_slave_sck", "i2c_ao_slave_sda",
792 };
793 
794 static const char * const remote_input_ao_groups[] = {
795 	"remote_input_ao",
796 };
797 
798 static const char * const remote_out_ao_groups[] = {
799 	"remote_out_ao",
800 };
801 
802 static const char * const pwm_ao_a_groups[] = {
803 	"pwm_ao_a",
804 };
805 
806 static const char * const pwm_ao_b_groups[] = {
807 	"pwm_ao_b_ao2", "pwm_ao_b_ao12",
808 };
809 
810 static const char * const pwm_ao_c_groups[] = {
811 	"pwm_ao_c_ao8", "pwm_ao_c_ao13",
812 };
813 
814 static const char * const pwm_ao_d_groups[] = {
815 	"pwm_ao_d",
816 };
817 
818 static const char * const jtag_ao_groups[] = {
819 	"jtag_ao_tdi", "jtag_ao_tdo", "jtag_ao_clk", "jtag_ao_tms",
820 };
821 
822 static const char * const mclk_c_groups[] = {
823 	"mclk_c",
824 };
825 
826 static const char * const mclk_b_groups[] = {
827 	"mclk_b",
828 };
829 
830 static const char * const tdma_groups[] = {
831 	"tdma_sclk", "tdma_sclk_slv", "tdma_fs", "tdma_fs_slv",
832 	"tdma_din0", "tdma_dout0_x14", "tdma_dout0_x15", "tdma_dout1",
833 	"tdma_din1",
834 };
835 
836 static const char * const tdmc_groups[] = {
837 	"tdmc_sclk", "tdmc_sclk_slv", "tdmc_fs", "tdmc_fs_slv",
838 	"tdmc_din0", "tdmc_dout0", "tdmc_din1",	"tdmc_dout1",
839 	"tdmc_din2", "tdmc_dout2", "tdmc_din3",	"tdmc_dout3",
840 };
841 
842 static const char * const tdmb_groups[] = {
843 	"tdmb_sclk", "tdmb_sclk_slv", "tdmb_fs", "tdmb_fs_slv",
844 	"tdmb_din0", "tdmb_dout0", "tdmb_din1",	"tdmb_dout1",
845 	"tdmb_din2", "tdmb_dout2", "tdmb_din3",	"tdmb_dout3",
846 };
847 
848 static struct meson_pmx_func meson_axg_periphs_functions[] = {
849 	FUNCTION(gpio_periphs),
850 	FUNCTION(emmc),
851 	FUNCTION(nor),
852 	FUNCTION(spi0),
853 	FUNCTION(spi1),
854 	FUNCTION(sdio),
855 	FUNCTION(nand),
856 	FUNCTION(uart_a),
857 	FUNCTION(uart_b),
858 	FUNCTION(uart_ao_b_z),
859 	FUNCTION(i2c0),
860 	FUNCTION(i2c1),
861 	FUNCTION(i2c2),
862 	FUNCTION(i2c3),
863 	FUNCTION(eth),
864 	FUNCTION(pwm_a),
865 	FUNCTION(pwm_b),
866 	FUNCTION(pwm_c),
867 	FUNCTION(pwm_d),
868 	FUNCTION(pwm_vs),
869 	FUNCTION(spdif_out),
870 	FUNCTION(spdif_in),
871 	FUNCTION(jtag_ee),
872 	FUNCTION(pdm),
873 	FUNCTION(mclk_b),
874 	FUNCTION(mclk_c),
875 	FUNCTION(tdma),
876 	FUNCTION(tdmb),
877 	FUNCTION(tdmc),
878 };
879 
880 static struct meson_pmx_func meson_axg_aobus_functions[] = {
881 	FUNCTION(gpio_aobus),
882 	FUNCTION(uart_ao_a),
883 	FUNCTION(uart_ao_b),
884 	FUNCTION(i2c_ao),
885 	FUNCTION(i2c_ao_slave),
886 	FUNCTION(remote_input_ao),
887 	FUNCTION(remote_out_ao),
888 	FUNCTION(pwm_ao_a),
889 	FUNCTION(pwm_ao_b),
890 	FUNCTION(pwm_ao_c),
891 	FUNCTION(pwm_ao_d),
892 	FUNCTION(jtag_ao),
893 };
894 
895 static struct meson_bank meson_axg_periphs_banks[] = {
896 	/*   name    first                      last                    pullen  pull    dir     out     in  */
897 	BANK("Z",    PIN(GPIOZ_0, EE_OFF),	PIN(GPIOZ_10, EE_OFF), 3,  0,  3,  0,  9,  0,  10, 0,  11, 0),
898 	BANK("BOOT", PIN(BOOT_0, EE_OFF),	PIN(BOOT_14, EE_OFF),  4,  0,  4,  0,  12, 0,  13, 0,  14, 0),
899 	BANK("A",    PIN(GPIOA_0, EE_OFF),	PIN(GPIOA_20, EE_OFF), 0,  0,  0,  0,  0,  0,  1,  0,  2,  0),
900 	BANK("X",    PIN(GPIOX_0, EE_OFF),	PIN(GPIOX_22, EE_OFF), 2,  0,  2,  0,  6,  0,  7,  0,  8,  0),
901 	BANK("Y",    PIN(GPIOY_0, EE_OFF),	PIN(GPIOY_15, EE_OFF), 1,  0,  1,  0,  3,  0,  4,  0,  5,  0),
902 };
903 
904 static struct meson_bank meson_axg_aobus_banks[] = {
905 	/*   name    first              last              pullen  pull    dir     out     in  */
906 	BANK("AO",   PIN(GPIOAO_0, 0),  PIN(GPIOAO_13, 0), 0,  16,  0, 0,  0,  0,  0, 16,  1,  0),
907 };
908 
909 static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = {
910 	/*	 name	 first		lask	   reg	offset  */
911 	BANK_PMX("Z",	 GPIOZ_0, GPIOZ_10, 0x2, 0),
912 	BANK_PMX("BOOT", BOOT_0,  BOOT_14,  0x0, 0),
913 	BANK_PMX("A",	 GPIOA_0, GPIOA_20, 0xb, 0),
914 	BANK_PMX("X",	 GPIOX_0, GPIOX_22, 0x4, 0),
915 	BANK_PMX("Y",	 GPIOY_0, GPIOY_15, 0x8, 0),
916 };
917 
918 static struct meson_axg_pmx_data meson_axg_periphs_pmx_banks_data = {
919 	.pmx_banks	= meson_axg_periphs_pmx_banks,
920 	.num_pmx_banks = ARRAY_SIZE(meson_axg_periphs_pmx_banks),
921 };
922 
923 static struct meson_pmx_bank meson_axg_aobus_pmx_banks[] = {
924 	BANK_PMX("AO", GPIOAO_0, GPIOAO_13, 0x0, 0),
925 };
926 
927 static struct meson_axg_pmx_data meson_axg_aobus_pmx_banks_data = {
928 	.pmx_banks	= meson_axg_aobus_pmx_banks,
929 	.num_pmx_banks = ARRAY_SIZE(meson_axg_aobus_pmx_banks),
930 };
931 
932 struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
933 	.name		= "periphs-banks",
934 	.pin_base	= 15,
935 	.groups		= meson_axg_periphs_groups,
936 	.funcs		= meson_axg_periphs_functions,
937 	.banks		= meson_axg_periphs_banks,
938 	.num_pins	= 86,
939 	.num_groups	= ARRAY_SIZE(meson_axg_periphs_groups),
940 	.num_funcs	= ARRAY_SIZE(meson_axg_periphs_functions),
941 	.num_banks	= ARRAY_SIZE(meson_axg_periphs_banks),
942 	.gpio_driver	= &meson_axg_gpio_driver,
943 	.pmx_data	= &meson_axg_periphs_pmx_banks_data,
944 };
945 
946 struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
947 	.name		= "aobus-banks",
948 	.pin_base	= 0,
949 	.groups		= meson_axg_aobus_groups,
950 	.funcs		= meson_axg_aobus_functions,
951 	.banks		= meson_axg_aobus_banks,
952 	.num_pins	= 14,
953 	.num_groups	= ARRAY_SIZE(meson_axg_aobus_groups),
954 	.num_funcs	= ARRAY_SIZE(meson_axg_aobus_functions),
955 	.num_banks	= ARRAY_SIZE(meson_axg_aobus_banks),
956 	.gpio_driver	= &meson_axg_gpio_driver,
957 	.pmx_data	= &meson_axg_aobus_pmx_banks_data,
958 };
959 
960 static const struct udevice_id meson_axg_pinctrl_match[] = {
961 	{
962 		.compatible = "amlogic,meson-axg-periphs-pinctrl",
963 		.data = (ulong)&meson_axg_periphs_pinctrl_data,
964 	},
965 	{
966 		.compatible = "amlogic,meson-axg-aobus-pinctrl",
967 		.data = (ulong)&meson_axg_aobus_pinctrl_data,
968 	},
969 	{ /* sentinel */ }
970 };
971 
972 U_BOOT_DRIVER(meson_axg_pinctrl) = {
973 	.name = "meson-axg-pinctrl",
974 	.id = UCLASS_PINCTRL,
975 	.of_match = of_match_ptr(meson_axg_pinctrl_match),
976 	.probe = meson_pinctrl_probe,
977 	.priv_auto_alloc_size = sizeof(struct meson_pinctrl),
978 	.ops = &meson_axg_pinctrl_ops,
979 };
980