1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright (C) 2018 Neil Armstrong <narmstrong@baylibre.com>
5 * Based on code from Linux kernel:
6 * Copyright (c) 2017 Amlogic, Inc. All rights reserved.
7 * Author: Xingyu Chen <xingyu.chen@amlogic.com>
12 #include <dm/pinctrl.h>
13 #include <dt-bindings/gpio/meson-axg-gpio.h>
15 #include "pinctrl-meson-axg.h"
20 static const unsigned int emmc_nand_d0_pins[] = { PIN(BOOT_0, EE_OFF) };
21 static const unsigned int emmc_nand_d1_pins[] = { PIN(BOOT_1, EE_OFF) };
22 static const unsigned int emmc_nand_d2_pins[] = { PIN(BOOT_2, EE_OFF) };
23 static const unsigned int emmc_nand_d3_pins[] = { PIN(BOOT_3, EE_OFF) };
24 static const unsigned int emmc_nand_d4_pins[] = { PIN(BOOT_4, EE_OFF) };
25 static const unsigned int emmc_nand_d5_pins[] = { PIN(BOOT_5, EE_OFF) };
26 static const unsigned int emmc_nand_d6_pins[] = { PIN(BOOT_6, EE_OFF) };
27 static const unsigned int emmc_nand_d7_pins[] = { PIN(BOOT_7, EE_OFF) };
29 static const unsigned int emmc_clk_pins[] = { PIN(BOOT_8, EE_OFF) };
30 static const unsigned int emmc_cmd_pins[] = { PIN(BOOT_10, EE_OFF) };
31 static const unsigned int emmc_ds_pins[] = { PIN(BOOT_13, EE_OFF) };
34 static const unsigned int nand_ce0_pins[] = { PIN(BOOT_8, EE_OFF) };
35 static const unsigned int nand_ale_pins[] = { PIN(BOOT_9, EE_OFF) };
36 static const unsigned int nand_cle_pins[] = { PIN(BOOT_10, EE_OFF) };
37 static const unsigned int nand_wen_clk_pins[] = { PIN(BOOT_11, EE_OFF) };
38 static const unsigned int nand_ren_wr_pins[] = { PIN(BOOT_12, EE_OFF) };
39 static const unsigned int nand_rb0_pins[] = { PIN(BOOT_13, EE_OFF) };
42 static const unsigned int nor_hold_pins[] = { PIN(BOOT_3, EE_OFF) };
43 static const unsigned int nor_d_pins[] = { PIN(BOOT_4, EE_OFF) };
44 static const unsigned int nor_q_pins[] = { PIN(BOOT_5, EE_OFF) };
45 static const unsigned int nor_c_pins[] = { PIN(BOOT_6, EE_OFF) };
46 static const unsigned int nor_wp_pins[] = { PIN(BOOT_9, EE_OFF) };
47 static const unsigned int nor_cs_pins[] = { PIN(BOOT_14, EE_OFF) };
50 static const unsigned int sdio_d0_pins[] = { PIN(GPIOX_0, EE_OFF) };
51 static const unsigned int sdio_d1_pins[] = { PIN(GPIOX_1, EE_OFF) };
52 static const unsigned int sdio_d2_pins[] = { PIN(GPIOX_2, EE_OFF) };
53 static const unsigned int sdio_d3_pins[] = { PIN(GPIOX_3, EE_OFF) };
54 static const unsigned int sdio_clk_pins[] = { PIN(GPIOX_4, EE_OFF) };
55 static const unsigned int sdio_cmd_pins[] = { PIN(GPIOX_5, EE_OFF) };
58 static const unsigned int spi0_clk_pins[] = { PIN(GPIOZ_0, EE_OFF) };
59 static const unsigned int spi0_mosi_pins[] = { PIN(GPIOZ_1, EE_OFF) };
60 static const unsigned int spi0_miso_pins[] = { PIN(GPIOZ_2, EE_OFF) };
61 static const unsigned int spi0_ss0_pins[] = { PIN(GPIOZ_3, EE_OFF) };
62 static const unsigned int spi0_ss1_pins[] = { PIN(GPIOZ_4, EE_OFF) };
63 static const unsigned int spi0_ss2_pins[] = { PIN(GPIOZ_5, EE_OFF) };
66 static const unsigned int spi1_clk_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
67 static const unsigned int spi1_mosi_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
68 static const unsigned int spi1_miso_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
69 static const unsigned int spi1_ss0_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
71 static const unsigned int spi1_clk_a_pins[] = { PIN(GPIOA_4, EE_OFF) };
72 static const unsigned int spi1_mosi_a_pins[] = { PIN(GPIOA_2, EE_OFF) };
73 static const unsigned int spi1_miso_a_pins[] = { PIN(GPIOA_3, EE_OFF) };
74 static const unsigned int spi1_ss0_a_pins[] = { PIN(GPIOA_5, EE_OFF) };
75 static const unsigned int spi1_ss1_pins[] = { PIN(GPIOA_6, EE_OFF) };
78 static const unsigned int i2c0_sck_pins[] = { PIN(GPIOZ_6, EE_OFF) };
79 static const unsigned int i2c0_sda_pins[] = { PIN(GPIOZ_7, EE_OFF) };
82 static const unsigned int i2c1_sck_z_pins[] = { PIN(GPIOZ_8, EE_OFF) };
83 static const unsigned int i2c1_sda_z_pins[] = { PIN(GPIOZ_9, EE_OFF) };
85 static const unsigned int i2c1_sck_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
86 static const unsigned int i2c1_sda_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
89 static const unsigned int i2c2_sck_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
90 static const unsigned int i2c2_sda_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
92 static const unsigned int i2c2_sda_a_pins[] = { PIN(GPIOA_17, EE_OFF) };
93 static const unsigned int i2c2_sck_a_pins[] = { PIN(GPIOA_18, EE_OFF) };
96 static const unsigned int i2c3_sda_a6_pins[] = { PIN(GPIOA_6, EE_OFF) };
97 static const unsigned int i2c3_sck_a7_pins[] = { PIN(GPIOA_7, EE_OFF) };
99 static const unsigned int i2c3_sda_a12_pins[] = { PIN(GPIOA_12, EE_OFF) };
100 static const unsigned int i2c3_sck_a13_pins[] = { PIN(GPIOA_13, EE_OFF) };
102 static const unsigned int i2c3_sda_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
103 static const unsigned int i2c3_sck_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
106 static const unsigned int uart_rts_a_pins[] = { PIN(GPIOX_11, EE_OFF) };
107 static const unsigned int uart_cts_a_pins[] = { PIN(GPIOX_10, EE_OFF) };
108 static const unsigned int uart_tx_a_pins[] = { PIN(GPIOX_8, EE_OFF) };
109 static const unsigned int uart_rx_a_pins[] = { PIN(GPIOX_9, EE_OFF) };
112 static const unsigned int uart_rts_b_z_pins[] = { PIN(GPIOZ_0, EE_OFF) };
113 static const unsigned int uart_cts_b_z_pins[] = { PIN(GPIOZ_1, EE_OFF) };
114 static const unsigned int uart_tx_b_z_pins[] = { PIN(GPIOZ_2, EE_OFF) };
115 static const unsigned int uart_rx_b_z_pins[] = { PIN(GPIOZ_3, EE_OFF) };
117 static const unsigned int uart_rts_b_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
118 static const unsigned int uart_cts_b_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
119 static const unsigned int uart_tx_b_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
120 static const unsigned int uart_rx_b_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
123 static const unsigned int uart_ao_tx_b_z_pins[] = { PIN(GPIOZ_8, EE_OFF) };
124 static const unsigned int uart_ao_rx_b_z_pins[] = { PIN(GPIOZ_9, EE_OFF) };
125 static const unsigned int uart_ao_cts_b_z_pins[] = { PIN(GPIOZ_6, EE_OFF) };
126 static const unsigned int uart_ao_rts_b_z_pins[] = { PIN(GPIOZ_7, EE_OFF) };
129 static const unsigned int pwm_a_z_pins[] = { PIN(GPIOZ_5, EE_OFF) };
131 static const unsigned int pwm_a_x18_pins[] = { PIN(GPIOX_18, EE_OFF) };
132 static const unsigned int pwm_a_x20_pins[] = { PIN(GPIOX_20, EE_OFF) };
134 static const unsigned int pwm_a_a_pins[] = { PIN(GPIOA_14, EE_OFF) };
137 static const unsigned int pwm_b_z_pins[] = { PIN(GPIOZ_4, EE_OFF) };
139 static const unsigned int pwm_b_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
141 static const unsigned int pwm_b_a_pins[] = { PIN(GPIOA_15, EE_OFF) };
144 static const unsigned int pwm_c_x10_pins[] = { PIN(GPIOX_10, EE_OFF) };
145 static const unsigned int pwm_c_x17_pins[] = { PIN(GPIOX_17, EE_OFF) };
147 static const unsigned int pwm_c_a_pins[] = { PIN(GPIOA_16, EE_OFF) };
150 static const unsigned int pwm_d_x11_pins[] = { PIN(GPIOX_11, EE_OFF) };
151 static const unsigned int pwm_d_x16_pins[] = { PIN(GPIOX_16, EE_OFF) };
154 static const unsigned int pwm_vs_pins[] = { PIN(GPIOA_0, EE_OFF) };
157 static const unsigned int spdif_in_z_pins[] = { PIN(GPIOZ_4, EE_OFF) };
159 static const unsigned int spdif_in_a1_pins[] = { PIN(GPIOA_1, EE_OFF) };
160 static const unsigned int spdif_in_a7_pins[] = { PIN(GPIOA_7, EE_OFF) };
161 static const unsigned int spdif_in_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
162 static const unsigned int spdif_in_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
165 static const unsigned int spdif_out_z_pins[] = { PIN(GPIOZ_5, EE_OFF) };
167 static const unsigned int spdif_out_a1_pins[] = { PIN(GPIOA_1, EE_OFF) };
168 static const unsigned int spdif_out_a11_pins[] = { PIN(GPIOA_11, EE_OFF) };
169 static const unsigned int spdif_out_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
170 static const unsigned int spdif_out_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
173 static const unsigned int jtag_tdo_x_pins[] = { PIN(GPIOX_0, EE_OFF) };
174 static const unsigned int jtag_tdi_x_pins[] = { PIN(GPIOX_1, EE_OFF) };
175 static const unsigned int jtag_clk_x_pins[] = { PIN(GPIOX_4, EE_OFF) };
176 static const unsigned int jtag_tms_x_pins[] = { PIN(GPIOX_5, EE_OFF) };
179 static const unsigned int eth_txd0_x_pins[] = { PIN(GPIOX_8, EE_OFF) };
180 static const unsigned int eth_txd1_x_pins[] = { PIN(GPIOX_9, EE_OFF) };
181 static const unsigned int eth_txen_x_pins[] = { PIN(GPIOX_10, EE_OFF) };
182 static const unsigned int eth_rgmii_rx_clk_x_pins[] = { PIN(GPIOX_12, EE_OFF) };
183 static const unsigned int eth_rxd0_x_pins[] = { PIN(GPIOX_13, EE_OFF) };
184 static const unsigned int eth_rxd1_x_pins[] = { PIN(GPIOX_14, EE_OFF) };
185 static const unsigned int eth_rx_dv_x_pins[] = { PIN(GPIOX_15, EE_OFF) };
186 static const unsigned int eth_mdio_x_pins[] = { PIN(GPIOX_21, EE_OFF) };
187 static const unsigned int eth_mdc_x_pins[] = { PIN(GPIOX_22, EE_OFF) };
189 static const unsigned int eth_txd0_y_pins[] = { PIN(GPIOY_10, EE_OFF) };
190 static const unsigned int eth_txd1_y_pins[] = { PIN(GPIOY_11, EE_OFF) };
191 static const unsigned int eth_txen_y_pins[] = { PIN(GPIOY_9, EE_OFF) };
192 static const unsigned int eth_rgmii_rx_clk_y_pins[] = { PIN(GPIOY_2, EE_OFF) };
193 static const unsigned int eth_rxd0_y_pins[] = { PIN(GPIOY_4, EE_OFF) };
194 static const unsigned int eth_rxd1_y_pins[] = { PIN(GPIOY_5, EE_OFF) };
195 static const unsigned int eth_rx_dv_y_pins[] = { PIN(GPIOY_3, EE_OFF) };
196 static const unsigned int eth_mdio_y_pins[] = { PIN(GPIOY_0, EE_OFF) };
197 static const unsigned int eth_mdc_y_pins[] = { PIN(GPIOY_1, EE_OFF) };
199 static const unsigned int eth_rxd2_rgmii_pins[] = { PIN(GPIOY_6, EE_OFF) };
200 static const unsigned int eth_rxd3_rgmii_pins[] = { PIN(GPIOY_7, EE_OFF) };
201 static const unsigned int eth_rgmii_tx_clk_pins[] = { PIN(GPIOY_8, EE_OFF) };
202 static const unsigned int eth_txd2_rgmii_pins[] = { PIN(GPIOY_12, EE_OFF) };
203 static const unsigned int eth_txd3_rgmii_pins[] = { PIN(GPIOY_13, EE_OFF) };
206 static const unsigned int pdm_dclk_a14_pins[] = { PIN(GPIOA_14, EE_OFF) };
207 static const unsigned int pdm_dclk_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
208 static const unsigned int pdm_din0_pins[] = { PIN(GPIOA_15, EE_OFF) };
209 static const unsigned int pdm_din1_pins[] = { PIN(GPIOA_16, EE_OFF) };
210 static const unsigned int pdm_din2_pins[] = { PIN(GPIOA_17, EE_OFF) };
211 static const unsigned int pdm_din3_pins[] = { PIN(GPIOA_18, EE_OFF) };
214 static const unsigned int mclk_c_pins[] = { PIN(GPIOA_0, EE_OFF) };
215 static const unsigned int mclk_b_pins[] = { PIN(GPIOA_1, EE_OFF) };
218 static const unsigned int tdma_sclk_pins[] = { PIN(GPIOX_12, EE_OFF) };
219 static const unsigned int tdma_sclk_slv_pins[] = { PIN(GPIOX_12, EE_OFF) };
220 static const unsigned int tdma_fs_pins[] = { PIN(GPIOX_13, EE_OFF) };
221 static const unsigned int tdma_fs_slv_pins[] = { PIN(GPIOX_13, EE_OFF) };
222 static const unsigned int tdma_din0_pins[] = { PIN(GPIOX_14, EE_OFF) };
223 static const unsigned int tdma_dout0_x14_pins[] = { PIN(GPIOX_14, EE_OFF) };
224 static const unsigned int tdma_dout0_x15_pins[] = { PIN(GPIOX_15, EE_OFF) };
225 static const unsigned int tdma_dout1_pins[] = { PIN(GPIOX_15, EE_OFF) };
226 static const unsigned int tdma_din1_pins[] = { PIN(GPIOX_15, EE_OFF) };
228 static const unsigned int tdmc_sclk_pins[] = { PIN(GPIOA_2, EE_OFF) };
229 static const unsigned int tdmc_sclk_slv_pins[] = { PIN(GPIOA_2, EE_OFF) };
230 static const unsigned int tdmc_fs_pins[] = { PIN(GPIOA_3, EE_OFF) };
231 static const unsigned int tdmc_fs_slv_pins[] = { PIN(GPIOA_3, EE_OFF) };
232 static const unsigned int tdmc_din0_pins[] = { PIN(GPIOA_4, EE_OFF) };
233 static const unsigned int tdmc_dout0_pins[] = { PIN(GPIOA_4, EE_OFF) };
234 static const unsigned int tdmc_din1_pins[] = { PIN(GPIOA_5, EE_OFF) };
235 static const unsigned int tdmc_dout1_pins[] = { PIN(GPIOA_5, EE_OFF) };
236 static const unsigned int tdmc_din2_pins[] = { PIN(GPIOA_6, EE_OFF) };
237 static const unsigned int tdmc_dout2_pins[] = { PIN(GPIOA_6, EE_OFF) };
238 static const unsigned int tdmc_din3_pins[] = { PIN(GPIOA_7, EE_OFF) };
239 static const unsigned int tdmc_dout3_pins[] = { PIN(GPIOA_7, EE_OFF) };
241 static const unsigned int tdmb_sclk_pins[] = { PIN(GPIOA_8, EE_OFF) };
242 static const unsigned int tdmb_sclk_slv_pins[] = { PIN(GPIOA_8, EE_OFF) };
243 static const unsigned int tdmb_fs_pins[] = { PIN(GPIOA_9, EE_OFF) };
244 static const unsigned int tdmb_fs_slv_pins[] = { PIN(GPIOA_9, EE_OFF) };
245 static const unsigned int tdmb_din0_pins[] = { PIN(GPIOA_10, EE_OFF) };
246 static const unsigned int tdmb_dout0_pins[] = { PIN(GPIOA_10, EE_OFF) };
247 static const unsigned int tdmb_din1_pins[] = { PIN(GPIOA_11, EE_OFF) };
248 static const unsigned int tdmb_dout1_pins[] = { PIN(GPIOA_11, EE_OFF) };
249 static const unsigned int tdmb_din2_pins[] = { PIN(GPIOA_12, EE_OFF) };
250 static const unsigned int tdmb_dout2_pins[] = { PIN(GPIOA_12, EE_OFF) };
251 static const unsigned int tdmb_din3_pins[] = { PIN(GPIOA_13, EE_OFF) };
252 static const unsigned int tdmb_dout3_pins[] = { PIN(GPIOA_13, EE_OFF) };
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),
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),
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),
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),
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),
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),
360 GROUP(nand_wen_clk, 2),
361 GROUP(nand_ren_wr, 2),
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),
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),
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),
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),
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),
438 GROUP(tdma_sclk_slv, 2),
440 GROUP(tdma_fs_slv, 2),
442 GROUP(tdma_dout0_x14, 2),
443 GROUP(tdma_dout0_x15, 1),
444 GROUP(tdma_dout1, 2),
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),
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),
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),
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),
498 GROUP(tdmc_sclk_slv, 2),
500 GROUP(tdmc_fs_slv, 2),
502 GROUP(tdmc_dout0, 1),
504 GROUP(tdmc_dout1, 1),
506 GROUP(tdmc_dout2, 1),
508 GROUP(tdmc_dout3, 1),
510 GROUP(tdmb_sclk_slv, 2),
512 GROUP(tdmb_fs_slv, 2),
514 GROUP(tdmb_dout0, 1),
516 GROUP(tdmb_dout1, 1),
518 GROUP(tdmb_dout2, 1),
520 GROUP(tdmb_dout3, 1),
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};
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};
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};
544 static const unsigned int i2c_ao_slave_sck_pins[] = {GPIOAO_10};
545 static const unsigned int i2c_ao_slave_sda_pins[] = {GPIOAO_11};
548 static const unsigned int remote_input_ao_pins[] = {GPIOAO_6};
551 static const unsigned int remote_out_ao_pins[] = {GPIOAO_7};
554 static const unsigned int pwm_ao_a_pins[] = {GPIOAO_3};
557 static const unsigned int pwm_ao_b_ao2_pins[] = {GPIOAO_2};
558 static const unsigned int pwm_ao_b_ao12_pins[] = {GPIOAO_12};
561 static const unsigned int pwm_ao_c_ao8_pins[] = {GPIOAO_8};
562 static const unsigned int pwm_ao_c_ao13_pins[] = {GPIOAO_13};
565 static const unsigned int pwm_ao_d_pins[] = {GPIOAO_9};
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};
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),
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),
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),
615 GROUP(jtag_ao_tdi, 4),
616 GROUP(jtag_ao_tdo, 4),
617 GROUP(jtag_ao_clk, 4),
618 GROUP(jtag_ao_tms, 4),
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",
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",
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",
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",
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",
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",
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",
663 static const char * const nor_groups[] = {
664 "nor_d", "nor_q", "nor_c", "nor_cs",
665 "nor_hold", "nor_wp",
668 static const char * const sdio_groups[] = {
669 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
670 "sdio_cmd", "sdio_clk",
673 static const char * const spi0_groups[] = {
674 "spi0_clk", "spi0_mosi", "spi0_miso", "spi0_ss0",
675 "spi0_ss1", "spi0_ss2"
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",
684 static const char * const uart_a_groups[] = {
685 "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a",
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",
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",
698 static const char * const i2c0_groups[] = {
699 "i2c0_sck", "i2c0_sda",
702 static const char * const i2c1_groups[] = {
703 "i2c1_sck_z", "i2c1_sda_z",
704 "i2c1_sck_x", "i2c1_sda_x",
707 static const char * const i2c2_groups[] = {
708 "i2c2_sck_x", "i2c2_sda_x",
709 "i2c2_sda_a", "i2c2_sck_a",
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",
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",
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",
729 static const char * const pwm_a_groups[] = {
730 "pwm_a_z", "pwm_a_x18", "pwm_a_x20", "pwm_a_a",
733 static const char * const pwm_b_groups[] = {
734 "pwm_b_z", "pwm_b_x", "pwm_b_a",
737 static const char * const pwm_c_groups[] = {
738 "pwm_c_x10", "pwm_c_x17", "pwm_c_a",
741 static const char * const pwm_d_groups[] = {
742 "pwm_d_x11", "pwm_d_x16",
745 static const char * const pwm_vs_groups[] = {
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",
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",
759 static const char * const jtag_ee_groups[] = {
760 "jtag_tdo_x", "jtag_tdi_x", "jtag_clk_x",
764 static const char * const pdm_groups[] = {
765 "pdm_din0", "pdm_din1", "pdm_din2", "pdm_din3",
766 "pdm_dclk_a14", "pdm_dclk_a19",
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",
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",
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",
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",
790 static const char * const i2c_ao_slave_groups[] = {
791 "i2c_ao_slave_sck", "i2c_ao_slave_sda",
794 static const char * const remote_input_ao_groups[] = {
798 static const char * const remote_out_ao_groups[] = {
802 static const char * const pwm_ao_a_groups[] = {
806 static const char * const pwm_ao_b_groups[] = {
807 "pwm_ao_b_ao2", "pwm_ao_b_ao12",
810 static const char * const pwm_ao_c_groups[] = {
811 "pwm_ao_c_ao8", "pwm_ao_c_ao13",
814 static const char * const pwm_ao_d_groups[] = {
818 static const char * const jtag_ao_groups[] = {
819 "jtag_ao_tdi", "jtag_ao_tdo", "jtag_ao_clk", "jtag_ao_tms",
822 static const char * const mclk_c_groups[] = {
826 static const char * const mclk_b_groups[] = {
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",
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",
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",
848 static struct meson_pmx_func meson_axg_periphs_functions[] = {
849 FUNCTION(gpio_periphs),
858 FUNCTION(uart_ao_b_z),
880 static struct meson_pmx_func meson_axg_aobus_functions[] = {
881 FUNCTION(gpio_aobus),
885 FUNCTION(i2c_ao_slave),
886 FUNCTION(remote_input_ao),
887 FUNCTION(remote_out_ao),
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),
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),
909 static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = {
910 /* name first last reg offset */
911 BANK_PMX("Z", PIN(GPIOZ_0, EE_OFF), PIN(GPIOZ_10, EE_OFF), 0x2, 0),
912 BANK_PMX("BOOT", PIN(BOOT_0, EE_OFF), PIN(BOOT_14, EE_OFF), 0x0, 0),
913 BANK_PMX("A", PIN(GPIOA_0, EE_OFF), PIN(GPIOA_20, EE_OFF), 0xb, 0),
914 BANK_PMX("X", PIN(GPIOX_0, EE_OFF), PIN(GPIOX_22, EE_OFF), 0x4, 0),
915 BANK_PMX("Y", PIN(GPIOY_0, EE_OFF), PIN(GPIOY_15, EE_OFF), 0x8, 0),
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),
923 static struct meson_pmx_bank meson_axg_aobus_pmx_banks[] = {
924 BANK_PMX("AO", GPIOAO_0, GPIOAO_13, 0x0, 0),
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),
932 struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
933 .name = "periphs-banks",
935 .groups = meson_axg_periphs_groups,
936 .funcs = meson_axg_periphs_functions,
937 .banks = meson_axg_periphs_banks,
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,
946 struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
947 .name = "aobus-banks",
949 .groups = meson_axg_aobus_groups,
950 .funcs = meson_axg_aobus_functions,
951 .banks = meson_axg_aobus_banks,
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,
960 static const struct udevice_id meson_axg_pinctrl_match[] = {
962 .compatible = "amlogic,meson-axg-periphs-pinctrl",
963 .data = (ulong)&meson_axg_periphs_pinctrl_data,
966 .compatible = "amlogic,meson-axg-aobus-pinctrl",
967 .data = (ulong)&meson_axg_aobus_pinctrl_data,
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,