1 /*
2  * Pin controller and GPIO driver for Amlogic Meson8 and Meson8m2.
3  *
4  * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
10  * You should have received a copy of the GNU General Public License
11  * along with this program. If not, see <http://www.gnu.org/licenses/>.
12  */
13 
14 #include <dt-bindings/gpio/meson8-gpio.h>
15 #include "pinctrl-meson.h"
16 #include "pinctrl-meson8-pmx.h"
17 
18 static const struct pinctrl_pin_desc meson8_cbus_pins[] = {
19 	MESON_PIN(GPIOX_0),
20 	MESON_PIN(GPIOX_1),
21 	MESON_PIN(GPIOX_2),
22 	MESON_PIN(GPIOX_3),
23 	MESON_PIN(GPIOX_4),
24 	MESON_PIN(GPIOX_5),
25 	MESON_PIN(GPIOX_6),
26 	MESON_PIN(GPIOX_7),
27 	MESON_PIN(GPIOX_8),
28 	MESON_PIN(GPIOX_9),
29 	MESON_PIN(GPIOX_10),
30 	MESON_PIN(GPIOX_11),
31 	MESON_PIN(GPIOX_12),
32 	MESON_PIN(GPIOX_13),
33 	MESON_PIN(GPIOX_14),
34 	MESON_PIN(GPIOX_15),
35 	MESON_PIN(GPIOX_16),
36 	MESON_PIN(GPIOX_17),
37 	MESON_PIN(GPIOX_18),
38 	MESON_PIN(GPIOX_19),
39 	MESON_PIN(GPIOX_20),
40 	MESON_PIN(GPIOX_21),
41 	MESON_PIN(GPIOY_0),
42 	MESON_PIN(GPIOY_1),
43 	MESON_PIN(GPIOY_2),
44 	MESON_PIN(GPIOY_3),
45 	MESON_PIN(GPIOY_4),
46 	MESON_PIN(GPIOY_5),
47 	MESON_PIN(GPIOY_6),
48 	MESON_PIN(GPIOY_7),
49 	MESON_PIN(GPIOY_8),
50 	MESON_PIN(GPIOY_9),
51 	MESON_PIN(GPIOY_10),
52 	MESON_PIN(GPIOY_11),
53 	MESON_PIN(GPIOY_12),
54 	MESON_PIN(GPIOY_13),
55 	MESON_PIN(GPIOY_14),
56 	MESON_PIN(GPIOY_15),
57 	MESON_PIN(GPIOY_16),
58 	MESON_PIN(GPIODV_0),
59 	MESON_PIN(GPIODV_1),
60 	MESON_PIN(GPIODV_2),
61 	MESON_PIN(GPIODV_3),
62 	MESON_PIN(GPIODV_4),
63 	MESON_PIN(GPIODV_5),
64 	MESON_PIN(GPIODV_6),
65 	MESON_PIN(GPIODV_7),
66 	MESON_PIN(GPIODV_8),
67 	MESON_PIN(GPIODV_9),
68 	MESON_PIN(GPIODV_10),
69 	MESON_PIN(GPIODV_11),
70 	MESON_PIN(GPIODV_12),
71 	MESON_PIN(GPIODV_13),
72 	MESON_PIN(GPIODV_14),
73 	MESON_PIN(GPIODV_15),
74 	MESON_PIN(GPIODV_16),
75 	MESON_PIN(GPIODV_17),
76 	MESON_PIN(GPIODV_18),
77 	MESON_PIN(GPIODV_19),
78 	MESON_PIN(GPIODV_20),
79 	MESON_PIN(GPIODV_21),
80 	MESON_PIN(GPIODV_22),
81 	MESON_PIN(GPIODV_23),
82 	MESON_PIN(GPIODV_24),
83 	MESON_PIN(GPIODV_25),
84 	MESON_PIN(GPIODV_26),
85 	MESON_PIN(GPIODV_27),
86 	MESON_PIN(GPIODV_28),
87 	MESON_PIN(GPIODV_29),
88 	MESON_PIN(GPIOH_0),
89 	MESON_PIN(GPIOH_1),
90 	MESON_PIN(GPIOH_2),
91 	MESON_PIN(GPIOH_3),
92 	MESON_PIN(GPIOH_4),
93 	MESON_PIN(GPIOH_5),
94 	MESON_PIN(GPIOH_6),
95 	MESON_PIN(GPIOH_7),
96 	MESON_PIN(GPIOH_8),
97 	MESON_PIN(GPIOH_9),
98 	MESON_PIN(GPIOZ_0),
99 	MESON_PIN(GPIOZ_1),
100 	MESON_PIN(GPIOZ_2),
101 	MESON_PIN(GPIOZ_3),
102 	MESON_PIN(GPIOZ_4),
103 	MESON_PIN(GPIOZ_5),
104 	MESON_PIN(GPIOZ_6),
105 	MESON_PIN(GPIOZ_7),
106 	MESON_PIN(GPIOZ_8),
107 	MESON_PIN(GPIOZ_9),
108 	MESON_PIN(GPIOZ_10),
109 	MESON_PIN(GPIOZ_11),
110 	MESON_PIN(GPIOZ_12),
111 	MESON_PIN(GPIOZ_13),
112 	MESON_PIN(GPIOZ_14),
113 	MESON_PIN(CARD_0),
114 	MESON_PIN(CARD_1),
115 	MESON_PIN(CARD_2),
116 	MESON_PIN(CARD_3),
117 	MESON_PIN(CARD_4),
118 	MESON_PIN(CARD_5),
119 	MESON_PIN(CARD_6),
120 	MESON_PIN(BOOT_0),
121 	MESON_PIN(BOOT_1),
122 	MESON_PIN(BOOT_2),
123 	MESON_PIN(BOOT_3),
124 	MESON_PIN(BOOT_4),
125 	MESON_PIN(BOOT_5),
126 	MESON_PIN(BOOT_6),
127 	MESON_PIN(BOOT_7),
128 	MESON_PIN(BOOT_8),
129 	MESON_PIN(BOOT_9),
130 	MESON_PIN(BOOT_10),
131 	MESON_PIN(BOOT_11),
132 	MESON_PIN(BOOT_12),
133 	MESON_PIN(BOOT_13),
134 	MESON_PIN(BOOT_14),
135 	MESON_PIN(BOOT_15),
136 	MESON_PIN(BOOT_16),
137 	MESON_PIN(BOOT_17),
138 	MESON_PIN(BOOT_18),
139 };
140 
141 static const struct pinctrl_pin_desc meson8_aobus_pins[] = {
142 	MESON_PIN(GPIOAO_0),
143 	MESON_PIN(GPIOAO_1),
144 	MESON_PIN(GPIOAO_2),
145 	MESON_PIN(GPIOAO_3),
146 	MESON_PIN(GPIOAO_4),
147 	MESON_PIN(GPIOAO_5),
148 	MESON_PIN(GPIOAO_6),
149 	MESON_PIN(GPIOAO_7),
150 	MESON_PIN(GPIOAO_8),
151 	MESON_PIN(GPIOAO_9),
152 	MESON_PIN(GPIOAO_10),
153 	MESON_PIN(GPIOAO_11),
154 	MESON_PIN(GPIOAO_12),
155 	MESON_PIN(GPIOAO_13),
156 	MESON_PIN(GPIO_BSD_EN),
157 	MESON_PIN(GPIO_TEST_N),
158 };
159 
160 /* bank X */
161 static const unsigned int sd_d0_a_pins[]	= { GPIOX_0 };
162 static const unsigned int sd_d1_a_pins[]	= { GPIOX_1 };
163 static const unsigned int sd_d2_a_pins[]	= { GPIOX_2 };
164 static const unsigned int sd_d3_a_pins[]	= { GPIOX_3 };
165 static const unsigned int sd_clk_a_pins[]	= { GPIOX_8 };
166 static const unsigned int sd_cmd_a_pins[]	= { GPIOX_9 };
167 
168 static const unsigned int sdxc_d0_a_pins[]	= { GPIOX_0 };
169 static const unsigned int sdxc_d13_a_pins[]	= { GPIOX_1, GPIOX_2, GPIOX_3 };
170 static const unsigned int sdxc_d47_a_pins[]	= { GPIOX_4, GPIOX_5, GPIOX_6,
171 						    GPIOX_7 };
172 static const unsigned int sdxc_clk_a_pins[]	= { GPIOX_8 };
173 static const unsigned int sdxc_cmd_a_pins[]	= { GPIOX_9 };
174 
175 static const unsigned int pcm_out_a_pins[]	= { GPIOX_4 };
176 static const unsigned int pcm_in_a_pins[]	= { GPIOX_5 };
177 static const unsigned int pcm_fs_a_pins[]	= { GPIOX_6 };
178 static const unsigned int pcm_clk_a_pins[]	= { GPIOX_7 };
179 
180 static const unsigned int uart_tx_a0_pins[]	= { GPIOX_4 };
181 static const unsigned int uart_rx_a0_pins[]	= { GPIOX_5 };
182 static const unsigned int uart_cts_a0_pins[]	= { GPIOX_6 };
183 static const unsigned int uart_rts_a0_pins[]	= { GPIOX_7 };
184 
185 static const unsigned int uart_tx_a1_pins[]	= { GPIOX_12 };
186 static const unsigned int uart_rx_a1_pins[]	= { GPIOX_13 };
187 static const unsigned int uart_cts_a1_pins[]	= { GPIOX_14 };
188 static const unsigned int uart_rts_a1_pins[]	= { GPIOX_15 };
189 
190 static const unsigned int uart_tx_b0_pins[]	= { GPIOX_16 };
191 static const unsigned int uart_rx_b0_pins[]	= { GPIOX_17 };
192 static const unsigned int uart_cts_b0_pins[]	= { GPIOX_18 };
193 static const unsigned int uart_rts_b0_pins[]	= { GPIOX_19 };
194 
195 static const unsigned int iso7816_det_pins[]	= { GPIOX_16 };
196 static const unsigned int iso7816_reset_pins[]	= { GPIOX_17 };
197 static const unsigned int iso7816_clk_pins[]	= { GPIOX_18 };
198 static const unsigned int iso7816_data_pins[]	= { GPIOX_19 };
199 
200 static const unsigned int i2c_sda_d0_pins[]	= { GPIOX_16 };
201 static const unsigned int i2c_sck_d0_pins[]	= { GPIOX_17 };
202 
203 static const unsigned int xtal_32k_out_pins[]	= { GPIOX_10 };
204 static const unsigned int xtal_24m_out_pins[]	= { GPIOX_11 };
205 
206 static const unsigned int pwm_e_pins[]		= { GPIOX_10 };
207 static const unsigned int pwm_b_x_pins[]	= { GPIOX_11 };
208 
209 /* bank Y */
210 static const unsigned int uart_tx_c_pins[]	= { GPIOY_0 };
211 static const unsigned int uart_rx_c_pins[]	= { GPIOY_1 };
212 static const unsigned int uart_cts_c_pins[]	= { GPIOY_2 };
213 static const unsigned int uart_rts_c_pins[]	= { GPIOY_3 };
214 
215 static const unsigned int pcm_out_b_pins[]	= { GPIOY_4 };
216 static const unsigned int pcm_in_b_pins[]	= { GPIOY_5 };
217 static const unsigned int pcm_fs_b_pins[]	= { GPIOY_6 };
218 static const unsigned int pcm_clk_b_pins[]	= { GPIOY_7 };
219 
220 static const unsigned int i2c_sda_c0_pins[]	= { GPIOY_0 };
221 static const unsigned int i2c_sck_c0_pins[]	= { GPIOY_1 };
222 
223 static const unsigned int pwm_a_y_pins[]	= { GPIOY_16 };
224 
225 static const unsigned int i2s_out_ch45_pins[]	= { GPIOY_0 };
226 static const unsigned int i2s_out_ch23_pins[]	= { GPIOY_1 };
227 static const unsigned int i2s_out_ch01_pins[]	= { GPIOY_4 };
228 static const unsigned int i2s_in_ch01_pins[]	= { GPIOY_5 };
229 static const unsigned int i2s_lr_clk_in_pins[]	= { GPIOY_6 };
230 static const unsigned int i2s_ao_clk_in_pins[]	= { GPIOY_7 };
231 static const unsigned int i2s_am_clk_pins[]	= { GPIOY_8 };
232 static const unsigned int i2s_out_ch78_pins[]	= { GPIOY_9 };
233 
234 static const unsigned int spdif_in_pins[]	= { GPIOY_2 };
235 static const unsigned int spdif_out_pins[]	= { GPIOY_3 };
236 
237 /* bank DV */
238 static const unsigned int dvin_rgb_pins[] = {
239 	GPIODV_0, GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5,
240 	GPIODV_6, GPIODV_7, GPIODV_8, GPIODV_9, GPIODV_10, GPIODV_11,
241 	GPIODV_12, GPIODV_13, GPIODV_14, GPIODV_15, GPIODV_16, GPIODV_17,
242 	GPIODV_18, GPIODV_19, GPIODV_20, GPIODV_21, GPIODV_22, GPIODV_23
243 };
244 static const unsigned int dvin_vs_pins[]	= { GPIODV_24 };
245 static const unsigned int dvin_hs_pins[]	= { GPIODV_25 };
246 static const unsigned int dvin_clk_pins[]	= { GPIODV_26 };
247 static const unsigned int dvin_de_pins[]	= { GPIODV_27 };
248 
249 static const unsigned int enc_0_pins[]		= { GPIODV_0 };
250 static const unsigned int enc_1_pins[]		= { GPIODV_1 };
251 static const unsigned int enc_2_pins[]		= { GPIODV_2 };
252 static const unsigned int enc_3_pins[]		= { GPIODV_3 };
253 static const unsigned int enc_4_pins[]		= { GPIODV_4 };
254 static const unsigned int enc_5_pins[]		= { GPIODV_5 };
255 static const unsigned int enc_6_pins[]		= { GPIODV_6 };
256 static const unsigned int enc_7_pins[]		= { GPIODV_7 };
257 static const unsigned int enc_8_pins[]		= { GPIODV_8 };
258 static const unsigned int enc_9_pins[]		= { GPIODV_9 };
259 static const unsigned int enc_10_pins[]		= { GPIODV_10 };
260 static const unsigned int enc_11_pins[]		= { GPIODV_11 };
261 static const unsigned int enc_12_pins[]		= { GPIODV_12 };
262 static const unsigned int enc_13_pins[]		= { GPIODV_13 };
263 static const unsigned int enc_14_pins[]		= { GPIODV_14 };
264 static const unsigned int enc_15_pins[]		= { GPIODV_15 };
265 static const unsigned int enc_16_pins[]		= { GPIODV_16 };
266 static const unsigned int enc_17_pins[]		= { GPIODV_17 };
267 
268 static const unsigned int uart_tx_b1_pins[]	= { GPIODV_24 };
269 static const unsigned int uart_rx_b1_pins[]	= { GPIODV_25 };
270 static const unsigned int uart_cts_b1_pins[]	= { GPIODV_26 };
271 static const unsigned int uart_rts_b1_pins[]	= { GPIODV_27 };
272 
273 static const unsigned int vga_vs_pins[]		= { GPIODV_24 };
274 static const unsigned int vga_hs_pins[]		= { GPIODV_25 };
275 
276 static const unsigned int pwm_c_dv9_pins[]	= { GPIODV_9 };
277 static const unsigned int pwm_c_dv29_pins[]	= { GPIODV_29 };
278 static const unsigned int pwm_d_pins[]		= { GPIODV_28 };
279 
280 /* bank H */
281 static const unsigned int hdmi_hpd_pins[]	= { GPIOH_0 };
282 static const unsigned int hdmi_sda_pins[]	= { GPIOH_1 };
283 static const unsigned int hdmi_scl_pins[]	= { GPIOH_2 };
284 static const unsigned int hdmi_cec_pins[]	= { GPIOH_3 };
285 
286 static const unsigned int spi_ss0_0_pins[]	= { GPIOH_3 };
287 static const unsigned int spi_miso_0_pins[]	= { GPIOH_4 };
288 static const unsigned int spi_mosi_0_pins[]	= { GPIOH_5 };
289 static const unsigned int spi_sclk_0_pins[]	= { GPIOH_6 };
290 
291 static const unsigned int i2c_sda_d1_pins[]	= { GPIOH_7 };
292 static const unsigned int i2c_sck_d1_pins[]	= { GPIOH_8 };
293 
294 /* bank Z */
295 static const unsigned int spi_ss0_1_pins[]	= { GPIOZ_9 };
296 static const unsigned int spi_ss1_1_pins[]	= { GPIOZ_10 };
297 static const unsigned int spi_sclk_1_pins[]	= { GPIOZ_11 };
298 static const unsigned int spi_mosi_1_pins[]	= { GPIOZ_12 };
299 static const unsigned int spi_miso_1_pins[]	= { GPIOZ_13 };
300 static const unsigned int spi_ss2_1_pins[]	= { GPIOZ_14 };
301 
302 static const unsigned int eth_tx_clk_50m_pins[]	= { GPIOZ_4 };
303 static const unsigned int eth_tx_en_pins[]	= { GPIOZ_5 };
304 static const unsigned int eth_txd1_pins[]	= { GPIOZ_6 };
305 static const unsigned int eth_txd0_pins[]	= { GPIOZ_7 };
306 static const unsigned int eth_rx_clk_in_pins[]	= { GPIOZ_8 };
307 static const unsigned int eth_rx_dv_pins[]	= { GPIOZ_9 };
308 static const unsigned int eth_rxd1_pins[]	= { GPIOZ_10 };
309 static const unsigned int eth_rxd0_pins[]	= { GPIOZ_11 };
310 static const unsigned int eth_mdio_pins[]	= { GPIOZ_12 };
311 static const unsigned int eth_mdc_pins[]	= { GPIOZ_13 };
312 
313 static const unsigned int i2c_sda_a0_pins[]	= { GPIOZ_0 };
314 static const unsigned int i2c_sck_a0_pins[]	= { GPIOZ_1 };
315 
316 static const unsigned int i2c_sda_b_pins[]	= { GPIOZ_2 };
317 static const unsigned int i2c_sck_b_pins[]	= { GPIOZ_3 };
318 
319 static const unsigned int i2c_sda_c1_pins[]	= { GPIOZ_4 };
320 static const unsigned int i2c_sck_c1_pins[]	= { GPIOZ_5 };
321 
322 static const unsigned int i2c_sda_a1_pins[]	= { GPIOZ_0 };
323 static const unsigned int i2c_sck_a1_pins[]	= { GPIOZ_1 };
324 
325 static const unsigned int i2c_sda_a2_pins[]	= { GPIOZ_0 };
326 static const unsigned int i2c_sck_a2_pins[]	= { GPIOZ_1 };
327 
328 static const unsigned int pwm_a_z0_pins[]	= { GPIOZ_0 };
329 static const unsigned int pwm_a_z7_pins[]	= { GPIOZ_7 };
330 static const unsigned int pwm_b_z_pins[]	= { GPIOZ_1 };
331 static const unsigned int pwm_c_z_pins[]	= { GPIOZ_8 };
332 
333 /* bank BOOT */
334 static const unsigned int sd_d0_c_pins[]	= { BOOT_0 };
335 static const unsigned int sd_d1_c_pins[]	= { BOOT_1 };
336 static const unsigned int sd_d2_c_pins[]	= { BOOT_2 };
337 static const unsigned int sd_d3_c_pins[]	= { BOOT_3 };
338 static const unsigned int sd_cmd_c_pins[]	= { BOOT_16 };
339 static const unsigned int sd_clk_c_pins[]	= { BOOT_17 };
340 
341 static const unsigned int sdxc_d0_c_pins[]	= { BOOT_0};
342 static const unsigned int sdxc_d13_c_pins[]	= { BOOT_1, BOOT_2, BOOT_3 };
343 static const unsigned int sdxc_d47_c_pins[]	= { BOOT_4, BOOT_5, BOOT_6,
344 						    BOOT_7 };
345 static const unsigned int sdxc_cmd_c_pins[]	= { BOOT_16 };
346 static const unsigned int sdxc_clk_c_pins[]	= { BOOT_17 };
347 
348 static const unsigned int nand_io_pins[] = {
349 	BOOT_0, BOOT_1, BOOT_2, BOOT_3, BOOT_4, BOOT_5, BOOT_6, BOOT_7
350 };
351 static const unsigned int nand_io_ce0_pins[]	= { BOOT_8 };
352 static const unsigned int nand_io_ce1_pins[]	= { BOOT_9 };
353 static const unsigned int nand_io_rb0_pins[]	= { BOOT_10 };
354 static const unsigned int nand_ale_pins[]	= { BOOT_11 };
355 static const unsigned int nand_cle_pins[]	= { BOOT_12 };
356 static const unsigned int nand_wen_clk_pins[]	= { BOOT_13 };
357 static const unsigned int nand_ren_clk_pins[]	= { BOOT_14 };
358 static const unsigned int nand_dqs_pins[]	= { BOOT_15 };
359 static const unsigned int nand_ce2_pins[]	= { BOOT_16 };
360 static const unsigned int nand_ce3_pins[]	= { BOOT_17 };
361 
362 static const unsigned int nor_d_pins[]		= { BOOT_11 };
363 static const unsigned int nor_q_pins[]		= { BOOT_12 };
364 static const unsigned int nor_c_pins[]		= { BOOT_13 };
365 static const unsigned int nor_cs_pins[]		= { BOOT_18 };
366 
367 /* bank CARD */
368 static const unsigned int sd_d1_b_pins[]	= { CARD_0 };
369 static const unsigned int sd_d0_b_pins[]	= { CARD_1 };
370 static const unsigned int sd_clk_b_pins[]	= { CARD_2 };
371 static const unsigned int sd_cmd_b_pins[]	= { CARD_3 };
372 static const unsigned int sd_d3_b_pins[]	= { CARD_4 };
373 static const unsigned int sd_d2_b_pins[]	= { CARD_5 };
374 
375 static const unsigned int sdxc_d13_b_pins[]	= { CARD_0, CARD_4, CARD_5 };
376 static const unsigned int sdxc_d0_b_pins[]	= { CARD_1 };
377 static const unsigned int sdxc_clk_b_pins[]	= { CARD_2 };
378 static const unsigned int sdxc_cmd_b_pins[]	= { CARD_3 };
379 
380 /* bank AO */
381 static const unsigned int uart_tx_ao_a_pins[]	= { GPIOAO_0 };
382 static const unsigned int uart_rx_ao_a_pins[]	= { GPIOAO_1 };
383 static const unsigned int uart_cts_ao_a_pins[]	= { GPIOAO_2 };
384 static const unsigned int uart_rts_ao_a_pins[]	= { GPIOAO_3 };
385 
386 static const unsigned int remote_input_pins[]	= { GPIOAO_7 };
387 static const unsigned int remote_output_ao_pins[] = { GPIOAO_13 };
388 
389 static const unsigned int i2c_slave_sck_ao_pins[] = { GPIOAO_4 };
390 static const unsigned int i2c_slave_sda_ao_pins[] = { GPIOAO_5 };
391 
392 static const unsigned int uart_tx_ao_b0_pins[]	= { GPIOAO_0 };
393 static const unsigned int uart_rx_ao_b0_pins[]	= { GPIOAO_1 };
394 
395 static const unsigned int uart_tx_ao_b1_pins[]	= { GPIOAO_4 };
396 static const unsigned int uart_rx_ao_b1_pins[]	= { GPIOAO_5 };
397 
398 static const unsigned int i2c_mst_sck_ao_pins[]	= { GPIOAO_4 };
399 static const unsigned int i2c_mst_sda_ao_pins[]	= { GPIOAO_5 };
400 
401 static const unsigned int pwm_f_ao_pins[]	= { GPIO_TEST_N };
402 
403 static const unsigned int i2s_am_clk_out_ao_pins[] = { GPIOAO_8 };
404 static const unsigned int i2s_ao_clk_out_ao_pins[] = { GPIOAO_9 };
405 static const unsigned int i2s_lr_clk_out_ao_pins[] = { GPIOAO_10 };
406 static const unsigned int i2s_out_ch01_ao_pins[] = { GPIOAO_11 };
407 
408 static const unsigned int hdmi_cec_ao_pins[]	= { GPIOAO_12 };
409 
410 static struct meson_pmx_group meson8_cbus_groups[] = {
411 	GPIO_GROUP(GPIOX_0),
412 	GPIO_GROUP(GPIOX_1),
413 	GPIO_GROUP(GPIOX_2),
414 	GPIO_GROUP(GPIOX_3),
415 	GPIO_GROUP(GPIOX_4),
416 	GPIO_GROUP(GPIOX_5),
417 	GPIO_GROUP(GPIOX_6),
418 	GPIO_GROUP(GPIOX_7),
419 	GPIO_GROUP(GPIOX_8),
420 	GPIO_GROUP(GPIOX_9),
421 	GPIO_GROUP(GPIOX_10),
422 	GPIO_GROUP(GPIOX_11),
423 	GPIO_GROUP(GPIOX_12),
424 	GPIO_GROUP(GPIOX_13),
425 	GPIO_GROUP(GPIOX_14),
426 	GPIO_GROUP(GPIOX_15),
427 	GPIO_GROUP(GPIOX_16),
428 	GPIO_GROUP(GPIOX_17),
429 	GPIO_GROUP(GPIOX_18),
430 	GPIO_GROUP(GPIOX_19),
431 	GPIO_GROUP(GPIOX_20),
432 	GPIO_GROUP(GPIOX_21),
433 	GPIO_GROUP(GPIOY_0),
434 	GPIO_GROUP(GPIOY_1),
435 	GPIO_GROUP(GPIOY_2),
436 	GPIO_GROUP(GPIOY_3),
437 	GPIO_GROUP(GPIOY_4),
438 	GPIO_GROUP(GPIOY_5),
439 	GPIO_GROUP(GPIOY_6),
440 	GPIO_GROUP(GPIOY_7),
441 	GPIO_GROUP(GPIOY_8),
442 	GPIO_GROUP(GPIOY_9),
443 	GPIO_GROUP(GPIOY_10),
444 	GPIO_GROUP(GPIOY_11),
445 	GPIO_GROUP(GPIOY_12),
446 	GPIO_GROUP(GPIOY_13),
447 	GPIO_GROUP(GPIOY_14),
448 	GPIO_GROUP(GPIOY_15),
449 	GPIO_GROUP(GPIOY_16),
450 	GPIO_GROUP(GPIODV_0),
451 	GPIO_GROUP(GPIODV_1),
452 	GPIO_GROUP(GPIODV_2),
453 	GPIO_GROUP(GPIODV_3),
454 	GPIO_GROUP(GPIODV_4),
455 	GPIO_GROUP(GPIODV_5),
456 	GPIO_GROUP(GPIODV_6),
457 	GPIO_GROUP(GPIODV_7),
458 	GPIO_GROUP(GPIODV_8),
459 	GPIO_GROUP(GPIODV_9),
460 	GPIO_GROUP(GPIODV_10),
461 	GPIO_GROUP(GPIODV_11),
462 	GPIO_GROUP(GPIODV_12),
463 	GPIO_GROUP(GPIODV_13),
464 	GPIO_GROUP(GPIODV_14),
465 	GPIO_GROUP(GPIODV_15),
466 	GPIO_GROUP(GPIODV_16),
467 	GPIO_GROUP(GPIODV_17),
468 	GPIO_GROUP(GPIODV_18),
469 	GPIO_GROUP(GPIODV_19),
470 	GPIO_GROUP(GPIODV_20),
471 	GPIO_GROUP(GPIODV_21),
472 	GPIO_GROUP(GPIODV_22),
473 	GPIO_GROUP(GPIODV_23),
474 	GPIO_GROUP(GPIODV_24),
475 	GPIO_GROUP(GPIODV_25),
476 	GPIO_GROUP(GPIODV_26),
477 	GPIO_GROUP(GPIODV_27),
478 	GPIO_GROUP(GPIODV_28),
479 	GPIO_GROUP(GPIODV_29),
480 	GPIO_GROUP(GPIOH_0),
481 	GPIO_GROUP(GPIOH_1),
482 	GPIO_GROUP(GPIOH_2),
483 	GPIO_GROUP(GPIOH_3),
484 	GPIO_GROUP(GPIOH_4),
485 	GPIO_GROUP(GPIOH_5),
486 	GPIO_GROUP(GPIOH_6),
487 	GPIO_GROUP(GPIOH_7),
488 	GPIO_GROUP(GPIOH_8),
489 	GPIO_GROUP(GPIOH_9),
490 	GPIO_GROUP(GPIOZ_0),
491 	GPIO_GROUP(GPIOZ_1),
492 	GPIO_GROUP(GPIOZ_2),
493 	GPIO_GROUP(GPIOZ_3),
494 	GPIO_GROUP(GPIOZ_4),
495 	GPIO_GROUP(GPIOZ_5),
496 	GPIO_GROUP(GPIOZ_6),
497 	GPIO_GROUP(GPIOZ_7),
498 	GPIO_GROUP(GPIOZ_8),
499 	GPIO_GROUP(GPIOZ_9),
500 	GPIO_GROUP(GPIOZ_10),
501 	GPIO_GROUP(GPIOZ_11),
502 	GPIO_GROUP(GPIOZ_12),
503 	GPIO_GROUP(GPIOZ_13),
504 	GPIO_GROUP(GPIOZ_14),
505 
506 	/* bank X */
507 	GROUP(sd_d0_a,		8,	5),
508 	GROUP(sd_d1_a,		8,	4),
509 	GROUP(sd_d2_a,		8,	3),
510 	GROUP(sd_d3_a,		8,	2),
511 	GROUP(sd_clk_a,		8,	1),
512 	GROUP(sd_cmd_a,		8,	0),
513 
514 	GROUP(sdxc_d0_a,	5,	14),
515 	GROUP(sdxc_d13_a,	5,	13),
516 	GROUP(sdxc_d47_a,	5,	12),
517 	GROUP(sdxc_clk_a,	5,	11),
518 	GROUP(sdxc_cmd_a,	5,	10),
519 
520 	GROUP(pcm_out_a,	3,	30),
521 	GROUP(pcm_in_a,		3,	29),
522 	GROUP(pcm_fs_a,		3,	28),
523 	GROUP(pcm_clk_a,	3,	27),
524 
525 	GROUP(uart_tx_a0,	4,	17),
526 	GROUP(uart_rx_a0,	4,	16),
527 	GROUP(uart_cts_a0,	4,	15),
528 	GROUP(uart_rts_a0,	4,	14),
529 
530 	GROUP(uart_tx_a1,	4,	13),
531 	GROUP(uart_rx_a1,	4,	12),
532 	GROUP(uart_cts_a1,	4,	11),
533 	GROUP(uart_rts_a1,	4,	10),
534 
535 	GROUP(uart_tx_b0,	4,	9),
536 	GROUP(uart_rx_b0,	4,	8),
537 	GROUP(uart_cts_b0,	4,	7),
538 	GROUP(uart_rts_b0,	4,	6),
539 
540 	GROUP(iso7816_det,	4,	21),
541 	GROUP(iso7816_reset,	4,	20),
542 	GROUP(iso7816_clk,	4,	19),
543 	GROUP(iso7816_data,	4,	18),
544 
545 	GROUP(i2c_sda_d0,	4,	5),
546 	GROUP(i2c_sck_d0,	4,	4),
547 
548 	GROUP(xtal_32k_out,	3,	22),
549 	GROUP(xtal_24m_out,	3,	23),
550 
551 	GROUP(pwm_e,		9,	19),
552 	GROUP(pwm_b_x,		2,	3),
553 
554 	/* bank Y */
555 	GROUP(uart_tx_c,	1,	19),
556 	GROUP(uart_rx_c,	1,	18),
557 	GROUP(uart_cts_c,	1,	17),
558 	GROUP(uart_rts_c,	1,	16),
559 
560 	GROUP(pcm_out_b,	4,	25),
561 	GROUP(pcm_in_b,		4,	24),
562 	GROUP(pcm_fs_b,		4,	23),
563 	GROUP(pcm_clk_b,	4,	22),
564 
565 	GROUP(i2c_sda_c0,	1,	15),
566 	GROUP(i2c_sck_c0,	1,	14),
567 
568 	GROUP(pwm_a_y,		9,	14),
569 
570 	GROUP(i2s_out_ch45,	1,	10),
571 	GROUP(i2s_out_ch23,	1,	19),
572 	GROUP(i2s_out_ch01,	1,	6),
573 	GROUP(i2s_in_ch01,	1,	5),
574 	GROUP(i2s_lr_clk_in,	1,	4),
575 	GROUP(i2s_ao_clk_in,	1,	2),
576 	GROUP(i2s_am_clk,	1,	0),
577 	GROUP(i2s_out_ch78,	1,	11),
578 
579 	GROUP(spdif_in,		1,	8),
580 	GROUP(spdif_out,	1,	7),
581 
582 	/* bank DV */
583 	GROUP(dvin_rgb,		0,	6),
584 	GROUP(dvin_vs,		0,	9),
585 	GROUP(dvin_hs,		0,	8),
586 	GROUP(dvin_clk,		0,	7),
587 	GROUP(dvin_de,		0,	10),
588 
589 	GROUP(enc_0,		7,	0),
590 	GROUP(enc_1,		7,	1),
591 	GROUP(enc_2,		7,	2),
592 	GROUP(enc_3,		7,	3),
593 	GROUP(enc_4,		7,	4),
594 	GROUP(enc_5,		7,	5),
595 	GROUP(enc_6,		7,	6),
596 	GROUP(enc_7,		7,	7),
597 	GROUP(enc_8,		7,	8),
598 	GROUP(enc_9,		7,	9),
599 	GROUP(enc_10,		7,	10),
600 	GROUP(enc_11,		7,	11),
601 	GROUP(enc_12,		7,	12),
602 	GROUP(enc_13,		7,	13),
603 	GROUP(enc_14,		7,	14),
604 	GROUP(enc_15,		7,	15),
605 	GROUP(enc_16,		7,	16),
606 	GROUP(enc_17,		7,	17),
607 
608 	GROUP(uart_tx_b1,	6,	23),
609 	GROUP(uart_rx_b1,	6,	22),
610 	GROUP(uart_cts_b1,	6,	21),
611 	GROUP(uart_rts_b1,	6,	20),
612 
613 	GROUP(vga_vs,		0,	21),
614 	GROUP(vga_hs,		0,	20),
615 
616 	GROUP(pwm_c_dv9,	3,	24),
617 	GROUP(pwm_c_dv29,	3,	25),
618 	GROUP(pwm_d,		3,	26),
619 
620 	/* bank H */
621 	GROUP(hdmi_hpd,		1,	26),
622 	GROUP(hdmi_sda,		1,	25),
623 	GROUP(hdmi_scl,		1,	24),
624 	GROUP(hdmi_cec,		1,	23),
625 
626 	GROUP(spi_ss0_0,	9,	13),
627 	GROUP(spi_miso_0,	9,	12),
628 	GROUP(spi_mosi_0,	9,	11),
629 	GROUP(spi_sclk_0,	9,	10),
630 
631 	GROUP(i2c_sda_d1,	4,	3),
632 	GROUP(i2c_sck_d1,	4,	2),
633 
634 	/* bank Z */
635 	GROUP(spi_ss0_1,	8,	16),
636 	GROUP(spi_ss1_1,	8,	12),
637 	GROUP(spi_sclk_1,	8,	15),
638 	GROUP(spi_mosi_1,	8,	14),
639 	GROUP(spi_miso_1,	8,	13),
640 	GROUP(spi_ss2_1,	8,	17),
641 
642 	GROUP(eth_tx_clk_50m,	6,	15),
643 	GROUP(eth_tx_en,	6,	14),
644 	GROUP(eth_txd1,		6,	13),
645 	GROUP(eth_txd0,		6,	12),
646 	GROUP(eth_rx_clk_in,	6,	10),
647 	GROUP(eth_rx_dv,	6,	11),
648 	GROUP(eth_rxd1,		6,	8),
649 	GROUP(eth_rxd0,		6,	7),
650 	GROUP(eth_mdio,		6,	6),
651 	GROUP(eth_mdc,		6,	5),
652 
653 	GROUP(i2c_sda_a0,	5,	31),
654 	GROUP(i2c_sck_a0,	5,	30),
655 
656 	GROUP(i2c_sda_b,	5,	27),
657 	GROUP(i2c_sck_b,	5,	26),
658 
659 	GROUP(i2c_sda_c1,	5,	25),
660 	GROUP(i2c_sck_c1,	5,	24),
661 
662 	GROUP(i2c_sda_a1,	5,	9),
663 	GROUP(i2c_sck_a1,	5,	8),
664 
665 	GROUP(i2c_sda_a2,	5,	7),
666 	GROUP(i2c_sck_a2,	5,	6),
667 
668 	GROUP(pwm_a_z0,		9,	16),
669 	GROUP(pwm_a_z7,		2,	0),
670 	GROUP(pwm_b_z,		9,	15),
671 	GROUP(pwm_c_z,		2,	1),
672 
673 	/* bank BOOT */
674 	GROUP(sd_d0_c,		6,	29),
675 	GROUP(sd_d1_c,		6,	28),
676 	GROUP(sd_d2_c,		6,	27),
677 	GROUP(sd_d3_c,		6,	26),
678 	GROUP(sd_cmd_c,		6,	25),
679 	GROUP(sd_clk_c,		6,	24),
680 
681 	GROUP(sdxc_d0_c,	4,	30),
682 	GROUP(sdxc_d13_c,	4,	29),
683 	GROUP(sdxc_d47_c,	4,	28),
684 	GROUP(sdxc_cmd_c,	4,	27),
685 	GROUP(sdxc_clk_c,	4,	26),
686 
687 	GROUP(nand_io,		2,	26),
688 	GROUP(nand_io_ce0,	2,	25),
689 	GROUP(nand_io_ce1,	2,	24),
690 	GROUP(nand_io_rb0,	2,	17),
691 	GROUP(nand_ale,		2,	21),
692 	GROUP(nand_cle,		2,	20),
693 	GROUP(nand_wen_clk,	2,	19),
694 	GROUP(nand_ren_clk,	2,	18),
695 	GROUP(nand_dqs,		2,	27),
696 	GROUP(nand_ce2,		2,	23),
697 	GROUP(nand_ce3,		2,	22),
698 
699 	GROUP(nor_d,		5,	1),
700 	GROUP(nor_q,		5,	3),
701 	GROUP(nor_c,		5,	2),
702 	GROUP(nor_cs,		5,	0),
703 
704 	/* bank CARD */
705 	GROUP(sd_d1_b,		2,	14),
706 	GROUP(sd_d0_b,		2,	15),
707 	GROUP(sd_clk_b,		2,	11),
708 	GROUP(sd_cmd_b,		2,	10),
709 	GROUP(sd_d3_b,		2,	12),
710 	GROUP(sd_d2_b,		2,	13),
711 
712 	GROUP(sdxc_d13_b,	2,	6),
713 	GROUP(sdxc_d0_b,	2,	7),
714 	GROUP(sdxc_clk_b,	2,	5),
715 	GROUP(sdxc_cmd_b,	2,	4),
716 };
717 
718 static struct meson_pmx_group meson8_aobus_groups[] = {
719 	GPIO_GROUP(GPIOAO_0),
720 	GPIO_GROUP(GPIOAO_1),
721 	GPIO_GROUP(GPIOAO_2),
722 	GPIO_GROUP(GPIOAO_3),
723 	GPIO_GROUP(GPIOAO_4),
724 	GPIO_GROUP(GPIOAO_5),
725 	GPIO_GROUP(GPIOAO_6),
726 	GPIO_GROUP(GPIOAO_7),
727 	GPIO_GROUP(GPIOAO_8),
728 	GPIO_GROUP(GPIOAO_9),
729 	GPIO_GROUP(GPIOAO_10),
730 	GPIO_GROUP(GPIOAO_11),
731 	GPIO_GROUP(GPIOAO_12),
732 	GPIO_GROUP(GPIOAO_13),
733 	GPIO_GROUP(GPIO_BSD_EN),
734 	GPIO_GROUP(GPIO_TEST_N),
735 
736 	/* bank AO */
737 	GROUP(uart_tx_ao_a,		0,	12),
738 	GROUP(uart_rx_ao_a,		0,	11),
739 	GROUP(uart_cts_ao_a,		0,	10),
740 	GROUP(uart_rts_ao_a,		0,	9),
741 
742 	GROUP(remote_input,		0,	0),
743 	GROUP(remote_output_ao,		0,	31),
744 
745 	GROUP(i2c_slave_sck_ao,		0,	2),
746 	GROUP(i2c_slave_sda_ao,		0,	1),
747 
748 	GROUP(uart_tx_ao_b0,		0,	26),
749 	GROUP(uart_rx_ao_b0,		0,	25),
750 
751 	GROUP(uart_tx_ao_b1,		0,	24),
752 	GROUP(uart_rx_ao_b1,		0,	23),
753 
754 	GROUP(i2c_mst_sck_ao,		0,	6),
755 	GROUP(i2c_mst_sda_ao,		0,	5),
756 
757 	GROUP(pwm_f_ao,			0,	19),
758 
759 	GROUP(i2s_am_clk_out_ao,	0,	30),
760 	GROUP(i2s_ao_clk_out_ao,	0,	29),
761 	GROUP(i2s_lr_clk_out_ao,	0,	28),
762 	GROUP(i2s_out_ch01_ao,		0,	27),
763 
764 	GROUP(hdmi_cec_ao,		0,	17),
765 };
766 
767 static const char * const gpio_groups[] = {
768 	"GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
769 	"GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
770 	"GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
771 	"GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19",
772 	"GPIOX_20", "GPIOX_21",
773 
774 	"GPIOY_0", "GPIOY_1", "GPIOY_2", "GPIOY_3", "GPIOY_4",
775 	"GPIOY_5", "GPIOY_6", "GPIOY_7", "GPIOY_8", "GPIOY_9",
776 	"GPIOY_10", "GPIOY_11", "GPIOY_12", "GPIOY_13", "GPIOY_14",
777 	"GPIOY_15", "GPIOY_16",
778 
779 	"GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4",
780 	"GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9",
781 	"GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14",
782 	"GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19",
783 	"GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24",
784 	"GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29",
785 
786 	"GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4",
787 	"GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9",
788 
789 	"GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
790 	"GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
791 	"GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14",
792 
793 	"CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4",
794 	"CARD_5", "CARD_6",
795 
796 	"BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
797 	"BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
798 	"BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
799 	"BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18",
800 
801 	"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3",
802 	"GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7",
803 	"GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11",
804 	"GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N"
805 };
806 
807 static const char * const sd_a_groups[] = {
808 	"sd_d0_a", "sd_d1_a", "sd_d2_a", "sd_d3_a", "sd_clk_a", "sd_cmd_a"
809 };
810 
811 static const char * const sdxc_a_groups[] = {
812 	"sdxc_d0_a", "sdxc_d13_a", "sdxc_d47_a", "sdxc_clk_a", "sdxc_cmd_a"
813 };
814 
815 static const char * const pcm_a_groups[] = {
816 	"pcm_out_a", "pcm_in_a", "pcm_fs_a", "pcm_clk_a"
817 };
818 
819 static const char * const uart_a_groups[] = {
820 	"uart_tx_a0", "uart_rx_a0", "uart_cts_a0", "uart_rts_a0",
821 	"uart_tx_a1", "uart_rx_a1", "uart_cts_a1", "uart_rts_a1"
822 };
823 
824 static const char * const uart_b_groups[] = {
825 	"uart_tx_b0", "uart_rx_b0", "uart_cts_b0", "uart_rts_b0",
826 	"uart_tx_b1", "uart_rx_b1", "uart_cts_b1", "uart_rts_b1"
827 };
828 
829 static const char * const iso7816_groups[] = {
830 	"iso7816_det", "iso7816_reset", "iso7816_clk", "iso7816_data"
831 };
832 
833 static const char * const i2c_d_groups[] = {
834 	"i2c_sda_d0", "i2c_sck_d0", "i2c_sda_d1", "i2c_sck_d1"
835 };
836 
837 static const char * const xtal_groups[] = {
838 	"xtal_32k_out", "xtal_24m_out"
839 };
840 
841 static const char * const uart_c_groups[] = {
842 	"uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c"
843 };
844 
845 static const char * const pcm_b_groups[] = {
846 	"pcm_out_b", "pcm_in_b", "pcm_fs_b", "pcm_clk_b"
847 };
848 
849 static const char * const i2c_c_groups[] = {
850 	"i2c_sda_c0", "i2c_sck_c0", "i2c_sda_c1", "i2c_sck_c1"
851 };
852 
853 static const char * const dvin_groups[] = {
854 	"dvin_rgb", "dvin_vs", "dvin_hs", "dvin_clk", "dvin_de"
855 };
856 
857 static const char * const enc_groups[] = {
858 	"enc_0", "enc_1", "enc_2", "enc_3", "enc_4", "enc_5",
859 	"enc_6", "enc_7", "enc_8", "enc_9", "enc_10", "enc_11",
860 	"enc_12", "enc_13", "enc_14", "enc_15", "enc_16", "enc_17"
861 };
862 
863 static const char * const vga_groups[] = {
864 	"vga_vs", "vga_hs"
865 };
866 
867 static const char * const hdmi_groups[] = {
868 	"hdmi_hpd", "hdmi_sda", "hdmi_scl", "hdmi_cec"
869 };
870 
871 static const char * const spi_groups[] = {
872 	"spi_ss0_0", "spi_miso_0", "spi_mosi_0", "spi_sclk_0",
873 	"spi_ss0_1", "spi_ss1_1", "spi_sclk_1", "spi_mosi_1",
874 	"spi_miso_1", "spi_ss2_1"
875 };
876 
877 static const char * const ethernet_groups[] = {
878 	"eth_tx_clk_50m", "eth_tx_en", "eth_txd1",
879 	"eth_txd0", "eth_rx_clk_in", "eth_rx_dv",
880 	"eth_rxd1", "eth_rxd0", "eth_mdio", "eth_mdc"
881 };
882 
883 static const char * const i2c_a_groups[] = {
884 	"i2c_sda_a0", "i2c_sck_a0", "i2c_sda_a1", "i2c_sck_a1",
885 	"i2c_sda_a2", "i2c_sck_a2"
886 };
887 
888 static const char * const i2c_b_groups[] = {
889 	"i2c_sda_b", "i2c_sck_b"
890 };
891 
892 static const char * const i2s_groups[] = {
893 	"i2s_out_ch45", "i2s_out_ch23_pins", "i2s_out_ch01_pins",
894 	"i2s_in_ch01_pins", "i2s_lr_clk_in_pins", "i2s_ao_clk_in_pins",
895 	"i2s_am_clk_pins", "i2s_out_ch78_pins"
896 };
897 
898 static const char * const sd_c_groups[] = {
899 	"sd_d0_c", "sd_d1_c", "sd_d2_c", "sd_d3_c",
900 	"sd_cmd_c", "sd_clk_c"
901 };
902 
903 static const char * const sdxc_c_groups[] = {
904 	"sdxc_d0_c", "sdxc_d13_c", "sdxc_d47_c", "sdxc_cmd_c",
905 	"sdxc_clk_c"
906 };
907 
908 static const char * const nand_groups[] = {
909 	"nand_io", "nand_io_ce0", "nand_io_ce1",
910 	"nand_io_rb0", "nand_ale", "nand_cle",
911 	"nand_wen_clk", "nand_ren_clk", "nand_dqs",
912 	"nand_ce2", "nand_ce3"
913 };
914 
915 static const char * const nor_groups[] = {
916 	"nor_d", "nor_q", "nor_c", "nor_cs"
917 };
918 
919 static const char * const pwm_a_groups[] = {
920 	"pwm_a_y", "pwm_a_z0", "pwm_a_z7"
921 };
922 
923 static const char * const pwm_b_groups[] = {
924 	"pwm_b_x", "pwm_b_z"
925 };
926 
927 static const char * const pwm_c_groups[] = {
928 	"pwm_c_dv9", "pwm_c_dv29", "pwm_c_z"
929 };
930 
931 static const char * const pwm_d_groups[] = {
932 	"pwm_d"
933 };
934 
935 static const char * const pwm_e_groups[] = {
936 	"pwm_e"
937 };
938 
939 static const char * const sd_b_groups[] = {
940 	"sd_d1_b", "sd_d0_b", "sd_clk_b", "sd_cmd_b",
941 	"sd_d3_b", "sd_d2_b"
942 };
943 
944 static const char * const sdxc_b_groups[] = {
945 	"sdxc_d13_b", "sdxc_d0_b", "sdxc_clk_b", "sdxc_cmd_b"
946 };
947 
948 static const char * const spdif_groups[] = {
949 	"spdif_in", "spdif_out"
950 };
951 
952 static const char * const uart_ao_groups[] = {
953 	"uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a"
954 };
955 
956 static const char * const remote_groups[] = {
957 	"remote_input", "remote_output_ao"
958 };
959 
960 static const char * const i2c_slave_ao_groups[] = {
961 	"i2c_slave_sck_ao", "i2c_slave_sda_ao"
962 };
963 
964 static const char * const uart_ao_b_groups[] = {
965 	"uart_tx_ao_b0", "uart_rx_ao_b0", "uart_tx_ao_b1", "uart_rx_ao_b1"
966 };
967 
968 static const char * const i2c_mst_ao_groups[] = {
969 	"i2c_mst_sck_ao", "i2c_mst_sda_ao"
970 };
971 
972 static const char * const pwm_f_ao_groups[] = {
973 	"pwm_f_ao"
974 };
975 
976 static const char * const i2s_ao_groups[] = {
977 	"i2s_am_clk_out_ao", "i2s_ao_clk_out_ao", "i2s_lr_clk_out_ao",
978 	"i2s_out_ch01_ao"
979 };
980 
981 static const char * const hdmi_cec_ao_groups[] = {
982 	"hdmi_cec_ao"
983 };
984 
985 static struct meson_pmx_func meson8_cbus_functions[] = {
986 	FUNCTION(gpio),
987 	FUNCTION(sd_a),
988 	FUNCTION(sdxc_a),
989 	FUNCTION(pcm_a),
990 	FUNCTION(uart_a),
991 	FUNCTION(uart_b),
992 	FUNCTION(iso7816),
993 	FUNCTION(i2c_d),
994 	FUNCTION(xtal),
995 	FUNCTION(uart_c),
996 	FUNCTION(pcm_b),
997 	FUNCTION(i2c_c),
998 	FUNCTION(dvin),
999 	FUNCTION(enc),
1000 	FUNCTION(vga),
1001 	FUNCTION(hdmi),
1002 	FUNCTION(spi),
1003 	FUNCTION(ethernet),
1004 	FUNCTION(i2c_a),
1005 	FUNCTION(i2c_b),
1006 	FUNCTION(sd_c),
1007 	FUNCTION(sdxc_c),
1008 	FUNCTION(nand),
1009 	FUNCTION(nor),
1010 	FUNCTION(sd_b),
1011 	FUNCTION(sdxc_b),
1012 	FUNCTION(pwm_a),
1013 	FUNCTION(pwm_b),
1014 	FUNCTION(pwm_c),
1015 	FUNCTION(pwm_d),
1016 	FUNCTION(pwm_e),
1017 	FUNCTION(i2s),
1018 	FUNCTION(spdif),
1019 };
1020 
1021 static struct meson_pmx_func meson8_aobus_functions[] = {
1022 	FUNCTION(uart_ao),
1023 	FUNCTION(remote),
1024 	FUNCTION(i2c_slave_ao),
1025 	FUNCTION(uart_ao_b),
1026 	FUNCTION(i2c_mst_ao),
1027 	FUNCTION(pwm_f_ao),
1028 	FUNCTION(i2s_ao),
1029 	FUNCTION(hdmi_cec_ao),
1030 };
1031 
1032 static struct meson_bank meson8_cbus_banks[] = {
1033 	/*   name    first     last         irq       pullen  pull    dir     out     in  */
1034 	BANK("X",    GPIOX_0,  GPIOX_21,    112, 133, 4,  0,  4,  0,  0,  0,  1,  0,  2,  0),
1035 	BANK("Y",    GPIOY_0,  GPIOY_16,    95,  111, 3,  0,  3,  0,  3,  0,  4,  0,  5,  0),
1036 	BANK("DV",   GPIODV_0, GPIODV_29,   65,   94, 0,  0,  0,  0,  7,  0,  8,  0,  9,  0),
1037 	BANK("H",    GPIOH_0,  GPIOH_9,     29,   38, 1, 16,  1, 16,  9, 19, 10, 19, 11, 19),
1038 	BANK("Z",    GPIOZ_0,  GPIOZ_14,    14,   28, 1,  0,  1,  0,  3, 17,  4, 17,  5, 17),
1039 	BANK("CARD", CARD_0,   CARD_6,      58,   64, 2, 20,  2, 20,  0, 22,  1, 22,  2, 22),
1040 	BANK("BOOT", BOOT_0,   BOOT_18,     39,   57, 2,  0,  2,  0,  9,  0, 10,  0, 11,  0),
1041 };
1042 
1043 static struct meson_bank meson8_aobus_banks[] = {
1044 	/*   name    first     last         irq    pullen  pull    dir     out     in  */
1045 	BANK("AO",   GPIOAO_0, GPIO_TEST_N, 0, 13, 0,  0,  0, 16,  0,  0,  0, 16,  1,  0),
1046 };
1047 
1048 static struct meson_pinctrl_data meson8_cbus_pinctrl_data = {
1049 	.name		= "cbus-banks",
1050 	.pins		= meson8_cbus_pins,
1051 	.groups		= meson8_cbus_groups,
1052 	.funcs		= meson8_cbus_functions,
1053 	.banks		= meson8_cbus_banks,
1054 	.num_pins	= ARRAY_SIZE(meson8_cbus_pins),
1055 	.num_groups	= ARRAY_SIZE(meson8_cbus_groups),
1056 	.num_funcs	= ARRAY_SIZE(meson8_cbus_functions),
1057 	.num_banks	= ARRAY_SIZE(meson8_cbus_banks),
1058 	.pmx_ops	= &meson8_pmx_ops,
1059 };
1060 
1061 static struct meson_pinctrl_data meson8_aobus_pinctrl_data = {
1062 	.name		= "ao-bank",
1063 	.pins		= meson8_aobus_pins,
1064 	.groups		= meson8_aobus_groups,
1065 	.funcs		= meson8_aobus_functions,
1066 	.banks		= meson8_aobus_banks,
1067 	.num_pins	= ARRAY_SIZE(meson8_aobus_pins),
1068 	.num_groups	= ARRAY_SIZE(meson8_aobus_groups),
1069 	.num_funcs	= ARRAY_SIZE(meson8_aobus_functions),
1070 	.num_banks	= ARRAY_SIZE(meson8_aobus_banks),
1071 	.pmx_ops	= &meson8_pmx_ops,
1072 };
1073 
1074 static const struct of_device_id meson8_pinctrl_dt_match[] = {
1075 	{
1076 		.compatible = "amlogic,meson8-cbus-pinctrl",
1077 		.data = &meson8_cbus_pinctrl_data,
1078 	},
1079 	{
1080 		.compatible = "amlogic,meson8-aobus-pinctrl",
1081 		.data = &meson8_aobus_pinctrl_data,
1082 	},
1083 	{
1084 		.compatible = "amlogic,meson8m2-cbus-pinctrl",
1085 		.data = &meson8_cbus_pinctrl_data,
1086 	},
1087 	{
1088 		.compatible = "amlogic,meson8m2-aobus-pinctrl",
1089 		.data = &meson8_aobus_pinctrl_data,
1090 	},
1091 	{ },
1092 };
1093 
1094 static struct platform_driver meson8_pinctrl_driver = {
1095 	.probe		= meson_pinctrl_probe,
1096 	.driver = {
1097 		.name	= "meson8-pinctrl",
1098 		.of_match_table = meson8_pinctrl_dt_match,
1099 	},
1100 };
1101 builtin_platform_driver(meson8_pinctrl_driver);
1102