1 // SPDX-License-Identifier: (GPL-2.0-only OR MIT)
3 * Pin controller and GPIO driver for Amlogic C3 SoC.
5 * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
6 * Author: Huqiang Qin <huqiang.qin@amlogic.com>
9 #include <dt-bindings/gpio/amlogic-c3-gpio.h>
10 #include "pinctrl-meson.h"
11 #include "pinctrl-meson-axg-pmx.h"
13 static const struct pinctrl_pin_desc c3_periphs_pins
[] = {
68 MESON_PIN(GPIO_TEST_N
),
72 static const unsigned int pwm_a_pins
[] = { GPIOE_0
};
73 static const unsigned int pwm_b_pins
[] = { GPIOE_1
};
74 static const unsigned int i2c2_sda_pins
[] = { GPIOE_2
};
75 static const unsigned int i2c2_scl_pins
[] = { GPIOE_3
};
76 static const unsigned int gen_clk_e_pins
[] = { GPIOE_4
};
79 static const unsigned int i2c0_sda_e_pins
[] = { GPIOE_0
};
80 static const unsigned int i2c0_scl_e_pins
[] = { GPIOE_1
};
81 static const unsigned int clk_32k_in_pins
[] = { GPIOE_4
};
84 static const unsigned int i2c_slave_scl_pins
[] = { GPIOE_0
};
85 static const unsigned int i2c_slave_sda_pins
[] = { GPIOE_1
};
86 static const unsigned int clk12_24_e_pins
[] = { GPIOE_4
};
89 static const unsigned int emmc_nand_d0_pins
[] = { GPIOB_0
};
90 static const unsigned int emmc_nand_d1_pins
[] = { GPIOB_1
};
91 static const unsigned int emmc_nand_d2_pins
[] = { GPIOB_2
};
92 static const unsigned int emmc_nand_d3_pins
[] = { GPIOB_3
};
93 static const unsigned int emmc_nand_d4_pins
[] = { GPIOB_4
};
94 static const unsigned int emmc_nand_d5_pins
[] = { GPIOB_5
};
95 static const unsigned int emmc_nand_d6_pins
[] = { GPIOB_6
};
96 static const unsigned int emmc_nand_d7_pins
[] = { GPIOB_7
};
97 static const unsigned int emmc_clk_pins
[] = { GPIOB_8
};
98 static const unsigned int emmc_rst_pins
[] = { GPIOB_9
};
99 static const unsigned int emmc_cmd_pins
[] = { GPIOB_10
};
100 static const unsigned int emmc_nand_ds_pins
[] = { GPIOB_11
};
103 static const unsigned int nand_wen_clk_pins
[] = { GPIOB_8
};
104 static const unsigned int nand_ale_pins
[] = { GPIOB_9
};
105 static const unsigned int nand_ren_wr_pins
[] = { GPIOB_10
};
106 static const unsigned int nand_cle_pins
[] = { GPIOB_11
};
107 static const unsigned int nand_ce0_pins
[] = { GPIOB_12
};
110 static const unsigned int pwm_g_b_pins
[] = { GPIOB_0
};
111 static const unsigned int pwm_h_b_pins
[] = { GPIOB_1
};
112 static const unsigned int pwm_i_b_pins
[] = { GPIOB_2
};
113 static const unsigned int spif_hold_pins
[] = { GPIOB_3
};
114 static const unsigned int spif_mo_pins
[] = { GPIOB_4
};
115 static const unsigned int spif_mi_pins
[] = { GPIOB_5
};
116 static const unsigned int spif_clk_pins
[] = { GPIOB_6
};
117 static const unsigned int spif_wp_pins
[] = { GPIOB_7
};
118 static const unsigned int pwm_j_b_pins
[] = { GPIOB_8
};
119 static const unsigned int pwm_k_b_pins
[] = { GPIOB_9
};
120 static const unsigned int pwm_l_b_pins
[] = { GPIOB_10
};
121 static const unsigned int pwm_m_b_pins
[] = { GPIOB_11
};
122 static const unsigned int pwm_n_b_pins
[] = { GPIOB_12
};
123 static const unsigned int spif_cs_pins
[] = { GPIOB_13
};
124 static const unsigned int spif_clk_loop_pins
[] = { GPIOB_14
};
127 static const unsigned int lcd_d0_pins
[] = { GPIOB_0
};
128 static const unsigned int lcd_d1_pins
[] = { GPIOB_1
};
129 static const unsigned int lcd_d2_pins
[] = { GPIOB_2
};
130 static const unsigned int lcd_d3_pins
[] = { GPIOB_8
};
131 static const unsigned int lcd_d4_pins
[] = { GPIOB_9
};
132 static const unsigned int lcd_d5_pins
[] = { GPIOB_10
};
133 static const unsigned int lcd_d6_pins
[] = { GPIOB_11
};
134 static const unsigned int lcd_d7_pins
[] = { GPIOB_12
};
137 static const unsigned int spi_a_mosi_b_pins
[] = { GPIOB_0
};
138 static const unsigned int spi_a_miso_b_pins
[] = { GPIOB_1
};
139 static const unsigned int spi_a_clk_b_pins
[] = { GPIOB_2
};
140 static const unsigned int spi_a_ss0_b_pins
[] = { GPIOB_8
};
141 static const unsigned int spi_a_ss1_b_pins
[] = { GPIOB_9
};
142 static const unsigned int spi_a_ss2_b_pins
[] = { GPIOB_10
};
143 static const unsigned int i2c1_sda_b_pins
[] = { GPIOB_11
};
144 static const unsigned int i2c1_scl_b_pins
[] = { GPIOB_12
};
147 static const unsigned int uart_a_tx_b_pins
[] = { GPIOB_0
};
148 static const unsigned int uart_a_rx_b_pins
[] = { GPIOB_1
};
149 static const unsigned int uart_a_cts_b_pins
[] = { GPIOB_2
};
150 static const unsigned int uart_a_rts_b_pins
[] = { GPIOB_8
};
151 static const unsigned int uart_d_tx_b_pins
[] = { GPIOB_9
};
152 static const unsigned int uart_d_rx_b_pins
[] = { GPIOB_10
};
153 static const unsigned int pdm_dclk_b_pins
[] = { GPIOB_11
};
154 static const unsigned int pdm_din0_b_pins
[] = { GPIOB_12
};
157 static const unsigned int sdcard_d0_pins
[] = { GPIOC_0
};
158 static const unsigned int sdcard_d1_pins
[] = { GPIOC_1
};
159 static const unsigned int sdcard_d2_pins
[] = { GPIOC_2
};
160 static const unsigned int sdcard_d3_pins
[] = { GPIOC_3
};
161 static const unsigned int sdcard_clk_pins
[] = { GPIOC_4
};
162 static const unsigned int sdcard_cmd_pins
[] = { GPIOC_5
};
163 static const unsigned int sdcard_cd_pins
[] = { GPIOC_6
};
166 static const unsigned int jtag_b_tdo_pins
[] = { GPIOC_0
};
167 static const unsigned int jtag_b_tdi_pins
[] = { GPIOC_1
};
168 static const unsigned int uart_b_rx_c_pins
[] = { GPIOC_2
};
169 static const unsigned int uart_b_tx_c_pins
[] = { GPIOC_3
};
170 static const unsigned int jtag_b_clk_pins
[] = { GPIOC_4
};
171 static const unsigned int jtag_b_tms_pins
[] = { GPIOC_5
};
172 static const unsigned int gen_clk_c_pins
[] = { GPIOC_6
};
175 static const unsigned int tdm_d3_pins
[] = { GPIOC_0
};
176 static const unsigned int tdm_d2_pins
[] = { GPIOC_1
};
177 static const unsigned int mclk_1_pins
[] = { GPIOC_2
};
178 static const unsigned int tdm_sclk1_pins
[] = { GPIOC_3
};
179 static const unsigned int tdm_fs1_pins
[] = { GPIOC_4
};
180 static const unsigned int pdm_dclk_c_pins
[] = { GPIOC_5
};
181 static const unsigned int pdm_din0_c_pins
[] = { GPIOC_6
};
184 static const unsigned int spi_a_mosi_c_pins
[] = { GPIOC_0
};
185 static const unsigned int spi_a_miso_c_pins
[] = { GPIOC_1
};
186 static const unsigned int spi_a_clk_c_pins
[] = { GPIOC_2
};
187 static const unsigned int spi_a_ss0_c_pins
[] = { GPIOC_3
};
188 static const unsigned int spi_a_ss1_c_pins
[] = { GPIOC_4
};
191 static const unsigned int pwm_g_c_pins
[] = { GPIOC_0
};
192 static const unsigned int pwm_h_c_pins
[] = { GPIOC_1
};
193 static const unsigned int pwm_i_c_pins
[] = { GPIOC_2
};
194 static const unsigned int pwm_j_c_pins
[] = { GPIOC_3
};
195 static const unsigned int pwm_k_c_pins
[] = { GPIOC_4
};
196 static const unsigned int pwm_l_c_pins
[] = { GPIOC_5
};
197 static const unsigned int pwm_m_c_pins
[] = { GPIOC_6
};
200 static const unsigned int uart_a_rx_c_pins
[] = { GPIOC_0
};
201 static const unsigned int uart_a_tx_c_pins
[] = { GPIOC_1
};
202 static const unsigned int uart_c_rx_c_pins
[] = { GPIOC_2
};
203 static const unsigned int uart_c_tx_c_pins
[] = { GPIOC_3
};
204 static const unsigned int i2c3_sda_c_pins
[] = { GPIOC_4
};
205 static const unsigned int i2c3_scl_c_pins
[] = { GPIOC_5
};
206 static const unsigned int clk12_24_c_pins
[] = { GPIOC_6
};
209 static const unsigned int sdio_d0_pins
[] = { GPIOX_0
};
210 static const unsigned int sdio_d1_pins
[] = { GPIOX_1
};
211 static const unsigned int sdio_d2_pins
[] = { GPIOX_2
};
212 static const unsigned int sdio_d3_pins
[] = { GPIOX_3
};
213 static const unsigned int sdio_clk_pins
[] = { GPIOX_4
};
214 static const unsigned int sdio_cmd_pins
[] = { GPIOX_5
};
215 static const unsigned int clk12_24_x_pins
[] = { GPIOX_6
};
216 static const unsigned int uart_e_tx_x_pins
[] = { GPIOX_7
};
217 static const unsigned int uart_e_rx_x_pins
[] = { GPIOX_8
};
218 static const unsigned int uart_e_cts_pins
[] = { GPIOX_9
};
219 static const unsigned int uart_e_rts_pins
[] = { GPIOX_10
};
220 static const unsigned int pwm_e_pins
[] = { GPIOX_11
};
221 static const unsigned int pwm_j_x12_pins
[] = { GPIOX_12
};
222 static const unsigned int pwm_k_x13_pins
[] = { GPIOX_13
};
225 static const unsigned int spi_a_mosi_x_pins
[] = { GPIOX_0
};
226 static const unsigned int spi_a_miso_x_pins
[] = { GPIOX_1
};
227 static const unsigned int spi_a_clk_x_pins
[] = { GPIOX_2
};
228 static const unsigned int spi_a_ss0_x_pins
[] = { GPIOX_3
};
229 static const unsigned int spi_a_ss1_x_pins
[] = { GPIOX_4
};
230 static const unsigned int spi_a_ss2_x_pins
[] = { GPIOX_5
};
231 static const unsigned int spi_b_ss2_x6_pins
[] = { GPIOX_6
};
232 static const unsigned int spi_b_miso_x_pins
[] = { GPIOX_7
};
233 static const unsigned int spi_b_clk_x_pins
[] = { GPIOX_8
};
234 static const unsigned int spi_b_mosi_x_pins
[] = { GPIOX_9
};
235 static const unsigned int spi_b_ss0_x_pins
[] = { GPIOX_10
};
236 static const unsigned int spi_b_ss1_x_pins
[] = { GPIOX_11
};
237 static const unsigned int spi_b_ss2_x12_pins
[] = { GPIOX_12
};
238 static const unsigned int gen_clk_x_pins
[] = { GPIOX_13
};
241 static const unsigned int tdm_d1_x_pins
[] = { GPIOX_0
};
242 static const unsigned int tdm_d0_x_pins
[] = { GPIOX_1
};
243 static const unsigned int mclk_0_x_pins
[] = { GPIOX_2
};
244 static const unsigned int tdm_sclk0_x_pins
[] = { GPIOX_3
};
245 static const unsigned int tdm_fs0_x_pins
[] = { GPIOX_4
};
246 static const unsigned int pdm_dclk_x5_pins
[] = { GPIOX_5
};
247 static const unsigned int pdm_din0_x6_pins
[] = { GPIOX_6
};
248 static const unsigned int pdm_din0_x9_pins
[] = { GPIOX_9
};
249 static const unsigned int pdm_dclk_x10_pins
[] = { GPIOX_10
};
250 static const unsigned int clk12_24_x13_pins
[] = { GPIOX_13
};
253 static const unsigned int lcd_d8_pins
[] = { GPIOX_0
};
254 static const unsigned int lcd_d9_pins
[] = { GPIOX_1
};
255 static const unsigned int lcd_d10_pins
[] = { GPIOX_2
};
256 static const unsigned int lcd_d11_pins
[] = { GPIOX_3
};
257 static const unsigned int lcd_d12_pins
[] = { GPIOX_4
};
258 static const unsigned int lcd_d13_pins
[] = { GPIOX_5
};
259 static const unsigned int lcd_d14_pins
[] = { GPIOX_6
};
260 static const unsigned int lcd_d15_pins
[] = { GPIOX_7
};
261 static const unsigned int lcd_vs_pins
[] = { GPIOX_8
};
262 static const unsigned int lcd_hs_pins
[] = { GPIOX_9
};
263 static const unsigned int lcd_den_pins
[] = { GPIOX_10
};
264 static const unsigned int lcd_d16_pins
[] = { GPIOX_11
};
265 static const unsigned int lcd_clk_x_pins
[] = { GPIOX_12
};
266 static const unsigned int lcd_d17_pins
[] = { GPIOX_13
};
269 static const unsigned int pwm_g_x0_pins
[] = { GPIOX_0
};
270 static const unsigned int pwm_h_x1_pins
[] = { GPIOX_1
};
271 static const unsigned int pwm_i_x2_pins
[] = { GPIOX_2
};
272 static const unsigned int pwm_j_x3_pins
[] = { GPIOX_3
};
273 static const unsigned int pwm_k_x4_pins
[] = { GPIOX_4
};
274 static const unsigned int pwm_l_x_pins
[] = { GPIOX_5
};
275 static const unsigned int pwm_m_x_pins
[] = { GPIOX_6
};
276 static const unsigned int pwm_n_x_pins
[] = { GPIOX_7
};
277 static const unsigned int pwm_g_x8_pins
[] = { GPIOX_8
};
278 static const unsigned int pwm_h_x9_pins
[] = { GPIOX_9
};
279 static const unsigned int pwm_i_x10_pins
[] = { GPIOX_10
};
280 static const unsigned int clk12_24_x11_pins
[] = { GPIOX_11
};
283 static const unsigned int uart_a_rx_x_pins
[] = { GPIOX_0
};
284 static const unsigned int uart_a_tx_x_pins
[] = { GPIOX_1
};
285 static const unsigned int uart_c_rx_x_pins
[] = { GPIOX_2
};
286 static const unsigned int uart_c_tx_x_pins
[] = { GPIOX_3
};
287 static const unsigned int i2c3_sda_x_pins
[] = { GPIOX_4
};
288 static const unsigned int i2c3_scl_x_pins
[] = { GPIOX_5
};
289 static const unsigned int i2c1_sda_x_pins
[] = { GPIOX_7
};
290 static const unsigned int i2c1_scl_x_pins
[] = { GPIOX_8
};
291 static const unsigned int uart_d_tx_x_pins
[] = { GPIOX_9
};
292 static const unsigned int uart_d_rx_x_pins
[] = { GPIOX_10
};
295 static const unsigned int pwm_g_d_pins
[] = { GPIOD_0
};
296 static const unsigned int pwm_h_d_pins
[] = { GPIOD_1
};
297 static const unsigned int eth_led_act_pins
[] = { GPIOD_2
};
298 static const unsigned int eth_led_link_pins
[] = { GPIOD_3
};
299 static const unsigned int pwm_d_pins
[] = { GPIOD_4
};
300 static const unsigned int pwm_f_pins
[] = { GPIOD_5
};
301 static const unsigned int pwm_k_d_pins
[] = { GPIOD_6
};
304 static const unsigned int uart_a_tx_d_pins
[] = { GPIOD_0
};
305 static const unsigned int uart_a_rx_d_pins
[] = { GPIOD_1
};
306 static const unsigned int spi_b_miso_d_pins
[] = { GPIOD_2
};
307 static const unsigned int spi_b_clk_d_pins
[] = { GPIOD_3
};
308 static const unsigned int spi_b_mosi_d_pins
[] = { GPIOD_4
};
309 static const unsigned int spi_b_ss0_d_pins
[] = { GPIOD_5
};
310 static const unsigned int spi_b_ss1_d_pins
[] = { GPIOD_6
};
313 static const unsigned int i2c0_sda_d_pins
[] = { GPIOD_0
};
314 static const unsigned int i2c0_scl_d_pins
[] = { GPIOD_1
};
315 static const unsigned int i2c1_sda_d_pins
[] = { GPIOD_2
};
316 static const unsigned int i2c1_scl_d_pins
[] = { GPIOD_3
};
317 static const unsigned int pdm_dclk_d_pins
[] = { GPIOD_4
};
318 static const unsigned int pdm_din0_d_pins
[] = { GPIOD_5
};
319 static const unsigned int ir_in_d6_pins
[] = { GPIOD_6
};
322 static const unsigned int ir_in_d0_pins
[] = { GPIOD_0
};
323 static const unsigned int ir_out_pins
[] = { GPIOD_1
};
324 static const unsigned int pwm_i_d_pins
[] = { GPIOD_2
};
325 static const unsigned int pwm_j_d_pins
[] = { GPIOD_3
};
326 static const unsigned int i2c3_sda_d_pins
[] = { GPIOD_4
};
327 static const unsigned int i2c3_scl_d_pins
[] = { GPIOD_5
};
330 static const unsigned int tdm_fs0_d_pins
[] = { GPIOD_2
};
331 static const unsigned int tdm_sclk0_d_pins
[] = { GPIOD_3
};
332 static const unsigned int mclk_0_d_pins
[] = { GPIOD_4
};
333 static const unsigned int tdm_d1_d_pins
[] = { GPIOD_5
};
334 static const unsigned int tdm_d0_d_pins
[] = { GPIOD_6
};
337 static const unsigned int uart_d_tx_d_pins
[] = { GPIOD_0
};
338 static const unsigned int uart_d_rx_d_pins
[] = { GPIOD_1
};
339 static const unsigned int uart_c_tx_d_pins
[] = { GPIOD_2
};
340 static const unsigned int uart_c_rx_d_pins
[] = { GPIOD_3
};
343 static const unsigned int uart_b_tx_a_pins
[] = { GPIOA_0
};
344 static const unsigned int uart_b_rx_a_pins
[] = { GPIOA_1
};
345 static const unsigned int pwm_c_pins
[] = { GPIOA_2
};
346 static const unsigned int pwm_l_a_pins
[] = { GPIOA_3
};
347 static const unsigned int i2c1_sda_a_pins
[] = { GPIOA_4
};
348 static const unsigned int i2c1_scl_a_pins
[] = { GPIOA_5
};
351 static const unsigned int pwm_c_hiz_pins
[] = { GPIOA_2
};
352 static const unsigned int gen_clk_a_pins
[] = { GPIOA_3
};
353 static const unsigned int pdm_dclk_z_pins
[] = { GPIOA_4
};
354 static const unsigned int pdm_din0_a_pins
[] = { GPIOA_5
};
357 static const unsigned int jtag_a_clk_pins
[] = { GPIOA_2
};
358 static const unsigned int jtag_a_tms_pins
[] = { GPIOA_3
};
359 static const unsigned int jtag_a_tdi_pins
[] = { GPIOA_4
};
360 static const unsigned int jtag_a_tdo_pins
[] = { GPIOA_5
};
363 static const unsigned int lcd_clk_a_pins
[] = { GPIOA_3
};
364 static const unsigned int uart_f_tx_a_pins
[] = { GPIOA_4
};
365 static const unsigned int uart_f_rx_a_pins
[] = { GPIOA_5
};
368 static const unsigned int uart_e_tx_a_pins
[] = { GPIOA_2
};
369 static const unsigned int uart_e_rx_a_pins
[] = { GPIOA_3
};
370 static const unsigned int pwm_m_a_pins
[] = { GPIOA_4
};
371 static const unsigned int pwm_n_a_pins
[] = { GPIOA_5
};
374 static const unsigned int spi_a_mosi_a_pins
[] = { GPIOA_3
};
375 static const unsigned int gen_clk_a4_pins
[] = { GPIOA_4
};
376 static const unsigned int clk12_24_a_pins
[] = { GPIOA_5
};
378 static const struct meson_pmx_group c3_periphs_groups
[] = {
394 GPIO_GROUP(GPIOB_10
),
395 GPIO_GROUP(GPIOB_11
),
396 GPIO_GROUP(GPIOB_12
),
397 GPIO_GROUP(GPIOB_13
),
398 GPIO_GROUP(GPIOB_14
),
416 GPIO_GROUP(GPIOX_10
),
417 GPIO_GROUP(GPIOX_11
),
418 GPIO_GROUP(GPIOX_12
),
419 GPIO_GROUP(GPIOX_13
),
433 GPIO_GROUP(GPIO_TEST_N
),
443 GROUP(i2c0_sda_e
, 2),
444 GROUP(i2c0_scl_e
, 2),
445 GROUP(clk_32k_in
, 2),
448 GROUP(i2c_slave_scl
, 3),
449 GROUP(i2c_slave_sda
, 3),
450 GROUP(clk12_24_e
, 3),
453 GROUP(emmc_nand_d0
, 1),
454 GROUP(emmc_nand_d1
, 1),
455 GROUP(emmc_nand_d2
, 1),
456 GROUP(emmc_nand_d3
, 1),
457 GROUP(emmc_nand_d4
, 1),
458 GROUP(emmc_nand_d5
, 1),
459 GROUP(emmc_nand_d6
, 1),
460 GROUP(emmc_nand_d7
, 1),
464 GROUP(emmc_nand_ds
, 1),
467 GROUP(nand_wen_clk
, 2),
469 GROUP(nand_ren_wr
, 2),
488 GROUP(spif_clk_loop
, 3),
501 GROUP(spi_a_mosi_b
, 5),
502 GROUP(spi_a_miso_b
, 5),
503 GROUP(spi_a_clk_b
, 5),
504 GROUP(spi_a_ss0_b
, 5),
505 GROUP(spi_a_ss1_b
, 5),
506 GROUP(spi_a_ss2_b
, 5),
507 GROUP(i2c1_sda_b
, 5),
508 GROUP(i2c1_scl_b
, 5),
511 GROUP(uart_a_tx_b
, 6),
512 GROUP(uart_a_rx_b
, 6),
513 GROUP(uart_a_cts_b
, 6),
514 GROUP(uart_a_rts_b
, 6),
515 GROUP(uart_d_tx_b
, 6),
516 GROUP(uart_d_rx_b
, 6),
517 GROUP(pdm_dclk_b
, 6),
518 GROUP(pdm_din0_b
, 6),
525 GROUP(sdcard_clk
, 1),
526 GROUP(sdcard_cmd
, 1),
530 GROUP(jtag_b_tdo
, 2),
531 GROUP(jtag_b_tdi
, 2),
532 GROUP(uart_b_rx_c
, 2),
533 GROUP(uart_b_tx_c
, 2),
534 GROUP(jtag_b_clk
, 2),
535 GROUP(jtag_b_tms
, 2),
544 GROUP(pdm_dclk_c
, 3),
545 GROUP(pdm_din0_c
, 3),
548 GROUP(spi_a_mosi_c
, 4),
549 GROUP(spi_a_miso_c
, 4),
550 GROUP(spi_a_clk_c
, 4),
551 GROUP(spi_a_ss0_c
, 4),
552 GROUP(spi_a_ss1_c
, 4),
564 GROUP(uart_a_rx_c
, 6),
565 GROUP(uart_a_tx_c
, 6),
566 GROUP(uart_c_rx_c
, 6),
567 GROUP(uart_c_tx_c
, 6),
568 GROUP(i2c3_sda_c
, 6),
569 GROUP(i2c3_scl_c
, 6),
570 GROUP(clk12_24_c
, 6),
579 GROUP(clk12_24_x
, 1),
580 GROUP(uart_e_tx_x
, 1),
581 GROUP(uart_e_rx_x
, 1),
582 GROUP(uart_e_cts
, 1),
583 GROUP(uart_e_rts
, 1),
589 GROUP(spi_a_mosi_x
, 2),
590 GROUP(spi_a_miso_x
, 2),
591 GROUP(spi_a_clk_x
, 2),
592 GROUP(spi_a_ss0_x
, 2),
593 GROUP(spi_a_ss1_x
, 2),
594 GROUP(spi_a_ss2_x
, 2),
595 GROUP(spi_b_ss2_x6
, 2),
596 GROUP(spi_b_miso_x
, 2),
597 GROUP(spi_b_clk_x
, 2),
598 GROUP(spi_b_mosi_x
, 2),
599 GROUP(spi_b_ss0_x
, 2),
600 GROUP(spi_b_ss1_x
, 2),
601 GROUP(spi_b_ss2_x12
, 2),
608 GROUP(tdm_sclk0_x
, 3),
610 GROUP(pdm_dclk_x5
, 3),
611 GROUP(pdm_din0_x6
, 3),
612 GROUP(pdm_din0_x9
, 3),
613 GROUP(pdm_dclk_x10
, 3),
614 GROUP(clk12_24_x13
, 3),
644 GROUP(clk12_24_x11
, 5),
647 GROUP(uart_a_rx_x
, 6),
648 GROUP(uart_a_tx_x
, 6),
649 GROUP(uart_c_rx_x
, 6),
650 GROUP(uart_c_tx_x
, 6),
651 GROUP(i2c3_sda_x
, 6),
652 GROUP(i2c3_scl_x
, 6),
653 GROUP(i2c1_sda_x
, 6),
654 GROUP(i2c1_scl_x
, 6),
655 GROUP(uart_d_tx_x
, 6),
656 GROUP(uart_d_rx_x
, 6),
661 GROUP(eth_led_act
, 1),
662 GROUP(eth_led_link
, 1),
668 GROUP(uart_a_tx_d
, 2),
669 GROUP(uart_a_rx_d
, 2),
670 GROUP(spi_b_miso_d
, 2),
671 GROUP(spi_b_clk_d
, 2),
672 GROUP(spi_b_mosi_d
, 2),
673 GROUP(spi_b_ss0_d
, 2),
674 GROUP(spi_b_ss1_d
, 2),
677 GROUP(i2c0_sda_d
, 3),
678 GROUP(i2c0_scl_d
, 3),
679 GROUP(i2c1_sda_d
, 3),
680 GROUP(i2c1_scl_d
, 3),
681 GROUP(pdm_dclk_d
, 3),
682 GROUP(pdm_din0_d
, 3),
690 GROUP(i2c3_sda_d
, 4),
691 GROUP(i2c3_scl_d
, 4),
695 GROUP(tdm_sclk0_d
, 5),
701 GROUP(uart_d_tx_d
, 6),
702 GROUP(uart_d_rx_d
, 6),
703 GROUP(uart_c_tx_d
, 6),
704 GROUP(uart_c_rx_d
, 6),
707 GROUP(uart_b_tx_a
, 1),
708 GROUP(uart_b_rx_a
, 1),
711 GROUP(i2c1_sda_a
, 1),
712 GROUP(i2c1_scl_a
, 1),
717 GROUP(pdm_dclk_z
, 2),
718 GROUP(pdm_din0_a
, 2),
721 GROUP(jtag_a_clk
, 3),
722 GROUP(jtag_a_tms
, 3),
723 GROUP(jtag_a_tdi
, 3),
724 GROUP(jtag_a_tdo
, 3),
728 GROUP(uart_f_tx_a
, 4),
729 GROUP(uart_f_rx_a
, 4),
732 GROUP(uart_e_tx_a
, 5),
733 GROUP(uart_e_rx_a
, 5),
738 GROUP(spi_a_mosi_a
, 6),
739 GROUP(gen_clk_a4
, 6),
740 GROUP(clk12_24_a
, 6),
743 static const char * const gpio_periphs_groups
[] = {
746 "GPIOE_0", "GPIOE_1", "GPIOE_2", "GPIOE_3", "GPIOE_4",
748 "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4",
749 "GPIOB_5", "GPIOB_6", "GPIOB_7", "GPIOB_8", "GPIOB_9",
750 "GPIOB_10", "GPIOB_11", "GPIOB_12", "GPIOB_13",
753 "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4",
754 "GPIOC_5", "GPIOC_6",
756 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
757 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
758 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13",
760 "GPIOD_0", "GPIOD_1", "GPIOD_2", "GPIOD_3", "GPIOD_4",
761 "GPIOD_5", "GPIOD_6",
763 "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
767 static const char * const uart_a_groups
[] = {
768 "uart_a_tx_b", "uart_a_rx_b", "uart_a_cts_b", "uart_a_rts_b",
769 "uart_a_rx_c", "uart_a_tx_c", "uart_a_rx_x", "uart_a_tx_x",
770 "uart_a_tx_d", "uart_a_rx_d",
773 static const char * const uart_b_groups
[] = {
774 "uart_b_rx_c", "uart_b_tx_c", "uart_b_tx_a", "uart_b_rx_a",
777 static const char * const uart_c_groups
[] = {
778 "uart_c_rx_c", "uart_c_tx_c",
779 "uart_c_rx_x", "uart_c_tx_x",
780 "uart_c_tx_d", "uart_c_rx_d",
783 static const char * const uart_d_groups
[] = {
784 "uart_d_tx_b", "uart_d_rx_b", "uart_d_tx_d", "uart_d_rx_d",
785 "uart_d_rx_x", "uart_d_tx_x",
788 static const char * const uart_e_groups
[] = {
789 "uart_e_cts", "uart_e_tx_x", "uart_e_rx_x", "uart_e_rts",
790 "uart_e_tx_a", "uart_e_rx_a",
793 static const char * const i2c0_groups
[] = {
794 "i2c0_sda_e", "i2c0_scl_e",
795 "i2c0_sda_d", "i2c0_scl_d",
798 static const char * const i2c1_groups
[] = {
799 "i2c1_sda_x", "i2c1_scl_x",
800 "i2c1_sda_d", "i2c1_scl_d",
801 "i2c1_sda_a", "i2c1_scl_a",
802 "i2c1_sda_b", "i2c1_scl_b",
805 static const char * const i2c2_groups
[] = {
806 "i2c2_sda", "i2c2_scl",
809 static const char * const i2c3_groups
[] = {
810 "i2c3_sda_c", "i2c3_scl_c",
811 "i2c3_sda_x", "i2c3_scl_x",
812 "i2c3_sda_d", "i2c3_scl_d",
815 static const char * const i2c_slave_groups
[] = {
816 "i2c_slave_scl", "i2c_slave_sda",
819 static const char * const pwm_a_groups
[] = {
823 static const char * const pwm_b_groups
[] = {
827 static const char * const pwm_c_groups
[] = {
831 static const char * const pwm_d_groups
[] = {
835 static const char * const pwm_e_groups
[] = {
839 static const char * const pwm_f_groups
[] = {
843 static const char * const pwm_g_groups
[] = {
844 "pwm_g_b", "pwm_g_c", "pwm_g_d", "pwm_g_x0", "pwm_g_x8",
847 static const char * const pwm_h_groups
[] = {
848 "pwm_h_b", "pwm_h_c", "pwm_h_d", "pwm_h_x1", "pwm_h_x9",
851 static const char * const pwm_i_groups
[] = {
852 "pwm_i_b", "pwm_i_c", "pwm_i_d", "pwm_i_x2", "pwm_i_x10",
855 static const char * const pwm_j_groups
[] = {
856 "pwm_j_c", "pwm_j_d", "pwm_j_b", "pwm_j_x3", "pwm_j_x12",
859 static const char * const pwm_k_groups
[] = {
860 "pwm_k_c", "pwm_k_d", "pwm_k_b", "pwm_k_x4", "pwm_k_x13",
863 static const char * const pwm_l_groups
[] = {
864 "pwm_l_c", "pwm_l_x", "pwm_l_b", "pwm_l_a",
867 static const char * const pwm_m_groups
[] = {
868 "pwm_m_c", "pwm_m_x", "pwm_m_a", "pwm_m_b",
871 static const char * const pwm_n_groups
[] = {
872 "pwm_n_x", "pwm_n_a", "pwm_n_b",
875 static const char * const pwm_c_hiz_groups
[] = {
879 static const char * const ir_out_groups
[] = {
883 static const char * const ir_in_groups
[] = {
884 "ir_in_d0", "ir_in_d6",
887 static const char * const jtag_a_groups
[] = {
888 "jtag_a_clk", "jtag_a_tms", "jtag_a_tdi", "jtag_a_tdo",
891 static const char * const jtag_b_groups
[] = {
892 "jtag_b_tdo", "jtag_b_tdi", "jtag_b_clk", "jtag_b_tms",
895 static const char * const gen_clk_groups
[] = {
896 "gen_clk_e", "gen_clk_c", "gen_clk_a", "gen_clk_x",
900 static const char * const clk12_24_groups
[] = {
901 "clk12_24_e", "clk12_24_c", "clk12_24_x", "clk12_24_a",
902 "clk12_24_x13", "clk12_24_x11",
905 static const char * const clk_32k_in_groups
[] = {
909 static const char * const emmc_groups
[] = {
910 "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
911 "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
912 "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
915 static const char * const nand_groups
[] = {
916 "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
917 "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
918 "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
919 "nand_wen_clk", "nand_ale", "nand_ren_wr", "nand_cle",
923 static const char * const spif_groups
[] = {
924 "spif_mo", "spif_mi", "spif_wp", "spif_cs",
925 "spif_clk", "spif_hold", "spif_clk_loop",
928 static const char * const spi_a_groups
[] = {
929 "spi_a_clk_b", "spi_a_ss0_b", "spi_a_ss1_b", "spi_a_ss2_b",
930 "spi_a_mosi_b", "spi_a_miso_b",
932 "spi_a_clk_c", "spi_a_ss0_c", "spi_a_ss1_c",
933 "spi_a_mosi_c", "spi_a_miso_c",
935 "spi_a_clk_x", "spi_a_ss0_x", "spi_a_ss1_x", "spi_a_ss2_x",
936 "spi_a_mosi_x", "spi_a_miso_x",
940 static const char * const spi_b_groups
[] = {
941 "spi_b_clk_x", "spi_b_ss0_x", "spi_b_ss1_x", "spi_b_ss2_x6",
942 "spi_b_miso_x", "spi_b_mosi_x", "spi_b_ss2_x12",
944 "spi_b_clk_d", "spi_b_ss0_d", "spi_b_ss1_d", "spi_b_miso_d",
948 static const char * const sdcard_groups
[] = {
949 "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3",
950 "sdcard_cd", "sdcard_clk", "sdcard_cmd",
953 static const char * const sdio_groups
[] = {
954 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
955 "sdio_clk", "sdio_cmd",
958 static const char * const pdm_groups
[] = {
959 "pdm_dclk_c", "pdm_din0_c", "pdm_dclk_d", "pdm_din0_d",
960 "pdm_dclk_z", "pdm_din0_a", "pdm_dclk_b", "pdm_din0_b",
961 "pdm_dclk_x5", "pdm_din0_x6", "pdm_din0_x9", "pdm_dclk_x10",
964 static const char * const eth_groups
[] = {
965 "eth_led_act", "eth_led_link",
968 static const char * const mclk_0_groups
[] = {
969 "mclk_0_x", "mclk_0_d",
972 static const char * const mclk_1_groups
[] = {
976 static const char * const tdm_groups
[] = {
977 "tdm_d3", "tdm_d2", "tdm_fs1", "tdm_d1_x", "tdm_d0_x",
978 "tdm_d1_d", "tdm_d0_d", "tdm_sclk1", "tdm_fs0_x", "tdm_fs0_d",
979 "tdm_sclk0_x", "tdm_sclk0_d",
982 static const char * const lcd_groups
[] = {
983 "lcd_d0", "lcd_d1", "lcd_d2", "lcd_d3", "lcd_d4",
984 "lcd_d5", "lcd_d6", "lcd_d7", "lcd_d8", "lcd_d9",
985 "lcd_d10", "lcd_d11", "lcd_d12", "lcd_d13", "lcd_d14",
986 "lcd_d15", "lcd_d16", "lcd_d17", "lcd_den",
987 "lcd_clk_a", "lcd_clk_x", "lcd_hs", "lcd_vs",
990 static const struct meson_pmx_func c3_periphs_functions
[] = {
991 FUNCTION(gpio_periphs
),
1001 FUNCTION(i2c_slave
),
1016 FUNCTION(pwm_c_hiz
),
1023 FUNCTION(clk_32k_in
),
1039 static const struct meson_bank c3_periphs_banks
[] = {
1040 /* name first last irq pullen pull dir out in ds */
1041 BANK_DS("X", GPIOX_0
, GPIOX_13
, 40, 53,
1042 0x03, 0, 0x04, 0, 0x02, 0, 0x01, 0, 0x00, 0, 0x07, 0),
1043 BANK_DS("D", GPIOD_0
, GPIOD_6
, 33, 39,
1044 0x23, 0, 0x24, 0, 0x22, 0, 0x21, 0, 0x20, 0, 0x27, 0),
1045 BANK_DS("E", GPIOE_0
, GPIOE_4
, 22, 26,
1046 0x33, 0, 0x34, 0, 0x32, 0, 0x31, 0, 0x30, 0, 0x37, 0),
1047 BANK_DS("C", GPIOC_0
, GPIOC_6
, 15, 21,
1048 0x43, 0, 0x44, 0, 0x42, 0, 0x41, 0, 0x40, 0, 0x47, 0),
1049 BANK_DS("B", GPIOB_0
, GPIOB_14
, 0, 14,
1050 0x53, 0, 0x54, 0, 0x52, 0, 0x51, 0, 0x50, 0, 0x57, 0),
1051 BANK_DS("A", GPIOA_0
, GPIOA_5
, 27, 32,
1052 0x63, 0, 0x64, 0, 0x62, 0, 0x61, 0, 0x60, 0, 0x67, 0),
1053 BANK_DS("TEST_N", GPIO_TEST_N
, GPIO_TEST_N
, 54, 54,
1054 0x73, 0, 0x74, 0, 0x72, 0, 0x71, 0, 0x70, 0, 0x77, 0),
1057 static const struct meson_pmx_bank c3_periphs_pmx_banks
[] = {
1058 /* name first last reg offset */
1059 BANK_PMX("B", GPIOB_0
, GPIOB_14
, 0x00, 0),
1060 BANK_PMX("X", GPIOX_0
, GPIOX_13
, 0x03, 0),
1061 BANK_PMX("C", GPIOC_0
, GPIOC_6
, 0x09, 0),
1062 BANK_PMX("A", GPIOA_0
, GPIOA_5
, 0x0b, 0),
1063 BANK_PMX("D", GPIOD_0
, GPIOD_6
, 0x10, 0),
1064 BANK_PMX("E", GPIOE_0
, GPIOE_4
, 0x12, 0),
1065 BANK_PMX("TEST_N", GPIO_TEST_N
, GPIO_TEST_N
, 0x02, 0),
1068 static const struct meson_axg_pmx_data c3_periphs_pmx_banks_data
= {
1069 .pmx_banks
= c3_periphs_pmx_banks
,
1070 .num_pmx_banks
= ARRAY_SIZE(c3_periphs_pmx_banks
),
1073 static const struct meson_pinctrl_data c3_periphs_pinctrl_data
= {
1074 .name
= "periphs-banks",
1075 .pins
= c3_periphs_pins
,
1076 .groups
= c3_periphs_groups
,
1077 .funcs
= c3_periphs_functions
,
1078 .banks
= c3_periphs_banks
,
1079 .num_pins
= ARRAY_SIZE(c3_periphs_pins
),
1080 .num_groups
= ARRAY_SIZE(c3_periphs_groups
),
1081 .num_funcs
= ARRAY_SIZE(c3_periphs_functions
),
1082 .num_banks
= ARRAY_SIZE(c3_periphs_banks
),
1083 .pmx_ops
= &meson_axg_pmx_ops
,
1084 .pmx_data
= &c3_periphs_pmx_banks_data
,
1085 .parse_dt
= &meson_a1_parse_dt_extra
,
1088 static const struct of_device_id c3_pinctrl_dt_match
[] = {
1090 .compatible
= "amlogic,c3-periphs-pinctrl",
1091 .data
= &c3_periphs_pinctrl_data
,
1095 MODULE_DEVICE_TABLE(of
, c3_pinctrl_dt_match
);
1097 static struct platform_driver c3_pinctrl_driver
= {
1098 .probe
= meson_pinctrl_probe
,
1100 .name
= "amlogic-c3-pinctrl",
1101 .of_match_table
= c3_pinctrl_dt_match
,
1104 module_platform_driver(c3_pinctrl_driver
);
1106 MODULE_AUTHOR("Huqiang Qin <huqiang.qin@amlogic.com>");
1107 MODULE_DESCRIPTION("Pin controller and GPIO driver for Amlogic C3 SoC");
1108 MODULE_LICENSE("Dual BSD/GPL");