blob: 30cf3bc0be4ebfc021371576efbb98d6bb19038f [file] [log] [blame]
Igor Prusov9402d2a2023-05-05 15:56:38 +03001// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 * Author: Qianggui Song <qianggui.song@amlogic.com>
5 * Copyright (C) 2023 SberDevices, Inc.
6 * Author: Igor Prusov <ivprusov@sberdevices.ru>
7 */
8
9#include <common.h>
10#include <dm.h>
11#include <dm/pinctrl.h>
12#include <dt-bindings/gpio/meson-a1-gpio.h>
13
14#include "pinctrl-meson.h"
15#include "pinctrl-meson-axg.h"
16
17/* psram */
18static const unsigned int psram_clkn_pins[] = { GPIOP_0 };
19static const unsigned int psram_clkp_pins[] = { GPIOP_1 };
20static const unsigned int psram_ce_n_pins[] = { GPIOP_2 };
21static const unsigned int psram_rst_n_pins[] = { GPIOP_3 };
22static const unsigned int psram_adq0_pins[] = { GPIOP_4 };
23static const unsigned int psram_adq1_pins[] = { GPIOP_5 };
24static const unsigned int psram_adq2_pins[] = { GPIOP_6 };
25static const unsigned int psram_adq3_pins[] = { GPIOP_7 };
26static const unsigned int psram_adq4_pins[] = { GPIOP_8 };
27static const unsigned int psram_adq5_pins[] = { GPIOP_9 };
28static const unsigned int psram_adq6_pins[] = { GPIOP_10 };
29static const unsigned int psram_adq7_pins[] = { GPIOP_11 };
30static const unsigned int psram_dqs_dm_pins[] = { GPIOP_12 };
31
32/* sdcard */
33static const unsigned int sdcard_d0_b_pins[] = { GPIOB_0 };
34static const unsigned int sdcard_d1_b_pins[] = { GPIOB_1 };
35static const unsigned int sdcard_d2_b_pins[] = { GPIOB_2 };
36static const unsigned int sdcard_d3_b_pins[] = { GPIOB_3 };
37static const unsigned int sdcard_clk_b_pins[] = { GPIOB_4 };
38static const unsigned int sdcard_cmd_b_pins[] = { GPIOB_5 };
39
40static const unsigned int sdcard_d0_x_pins[] = { GPIOX_0 };
41static const unsigned int sdcard_d1_x_pins[] = { GPIOX_1 };
42static const unsigned int sdcard_d2_x_pins[] = { GPIOX_2 };
43static const unsigned int sdcard_d3_x_pins[] = { GPIOX_3 };
44static const unsigned int sdcard_clk_x_pins[] = { GPIOX_4 };
45static const unsigned int sdcard_cmd_x_pins[] = { GPIOX_5 };
46
47/* spif */
48static const unsigned int spif_mo_pins[] = { GPIOB_0 };
49static const unsigned int spif_mi_pins[] = { GPIOB_1 };
50static const unsigned int spif_wp_n_pins[] = { GPIOB_2 };
51static const unsigned int spif_hold_n_pins[] = { GPIOB_3 };
52static const unsigned int spif_clk_pins[] = { GPIOB_4 };
53static const unsigned int spif_cs_pins[] = { GPIOB_5 };
54
55/* i2c0 */
56static const unsigned int i2c0_sck_f9_pins[] = { GPIOF_9 };
57static const unsigned int i2c0_sda_f10_pins[] = { GPIOF_10 };
58static const unsigned int i2c0_sck_f11_pins[] = { GPIOF_11 };
59static const unsigned int i2c0_sda_f12_pins[] = { GPIOF_12 };
60
61/* i2c1 */
62static const unsigned int i2c1_sda_x_pins[] = { GPIOX_9 };
63static const unsigned int i2c1_sck_x_pins[] = { GPIOX_10 };
64static const unsigned int i2c1_sda_a_pins[] = { GPIOA_10 };
65static const unsigned int i2c1_sck_a_pins[] = { GPIOA_11 };
66
67/* i2c2 */
68static const unsigned int i2c2_sck_x0_pins[] = { GPIOX_0 };
69static const unsigned int i2c2_sda_x1_pins[] = { GPIOX_1 };
70static const unsigned int i2c2_sck_x15_pins[] = { GPIOX_15 };
71static const unsigned int i2c2_sda_x16_pins[] = { GPIOX_16 };
72static const unsigned int i2c2_sck_a4_pins[] = { GPIOA_4 };
73static const unsigned int i2c2_sda_a5_pins[] = { GPIOA_5 };
74static const unsigned int i2c2_sck_a8_pins[] = { GPIOA_8 };
75static const unsigned int i2c2_sda_a9_pins[] = { GPIOA_9 };
76
77/* i2c3 */
78static const unsigned int i2c3_sck_f_pins[] = { GPIOF_4 };
79static const unsigned int i2c3_sda_f_pins[] = { GPIOF_5 };
80static const unsigned int i2c3_sck_x_pins[] = { GPIOX_11 };
81static const unsigned int i2c3_sda_x_pins[] = { GPIOX_12 };
82
83/* i2c slave */
84static const unsigned int i2c_slave_sck_a_pins[] = { GPIOA_10 };
85static const unsigned int i2c_slave_sda_a_pins[] = { GPIOA_11 };
86static const unsigned int i2c_slave_sck_f_pins[] = { GPIOF_11 };
87static const unsigned int i2c_slave_sda_f_pins[] = { GPIOF_12 };
88
89/* uart_a */
90static const unsigned int uart_a_tx_pins[] = { GPIOX_11 };
91static const unsigned int uart_a_rx_pins[] = { GPIOX_12 };
92static const unsigned int uart_a_cts_pins[] = { GPIOX_13 };
93static const unsigned int uart_a_rts_pins[] = { GPIOX_14 };
94
95/* uart_b */
96static const unsigned int uart_b_tx_x_pins[] = { GPIOX_7 };
97static const unsigned int uart_b_rx_x_pins[] = { GPIOX_8 };
98static const unsigned int uart_b_tx_f_pins[] = { GPIOF_0 };
99static const unsigned int uart_b_rx_f_pins[] = { GPIOF_1 };
100
101/* uart_c */
102static const unsigned int uart_c_tx_x0_pins[] = { GPIOX_0 };
103static const unsigned int uart_c_rx_x1_pins[] = { GPIOX_1 };
104static const unsigned int uart_c_cts_pins[] = { GPIOX_2 };
105static const unsigned int uart_c_rts_pins[] = { GPIOX_3 };
106static const unsigned int uart_c_tx_x15_pins[] = { GPIOX_15 };
107static const unsigned int uart_c_rx_x16_pins[] = { GPIOX_16 };
108
109/* pmw_a */
110static const unsigned int pwm_a_x6_pins[] = { GPIOX_6 };
111static const unsigned int pwm_a_x7_pins[] = { GPIOX_7 };
112static const unsigned int pwm_a_f6_pins[] = { GPIOF_6 };
113static const unsigned int pwm_a_f10_pins[] = { GPIOF_10 };
114static const unsigned int pwm_a_a_pins[] = { GPIOA_5 };
115
116/* pmw_b */
117static const unsigned int pwm_b_x_pins[] = { GPIOX_8 };
118static const unsigned int pwm_b_f_pins[] = { GPIOF_7 };
119static const unsigned int pwm_b_a_pins[] = { GPIOA_11 };
120
121/* pmw_c */
122static const unsigned int pwm_c_x_pins[] = { GPIOX_9 };
123static const unsigned int pwm_c_f3_pins[] = { GPIOF_3 };
124static const unsigned int pwm_c_f8_pins[] = { GPIOF_8 };
125static const unsigned int pwm_c_a_pins[] = { GPIOA_10 };
126
127/* pwm_d */
128static const unsigned int pwm_d_x10_pins[] = { GPIOX_10 };
129static const unsigned int pwm_d_x13_pins[] = { GPIOX_13 };
130static const unsigned int pwm_d_x15_pins[] = { GPIOX_15 };
131static const unsigned int pwm_d_f_pins[] = { GPIOF_11 };
132
133/* pwm_e */
134static const unsigned int pwm_e_p_pins[] = { GPIOP_3 };
135static const unsigned int pwm_e_x2_pins[] = { GPIOX_2 };
136static const unsigned int pwm_e_x14_pins[] = { GPIOX_14 };
137static const unsigned int pwm_e_x16_pins[] = { GPIOX_16 };
138static const unsigned int pwm_e_f_pins[] = { GPIOF_3 };
139static const unsigned int pwm_e_a_pins[] = { GPIOA_0 };
140
141/* pwm_f */
142static const unsigned int pwm_f_b_pins[] = { GPIOB_6 };
143static const unsigned int pwm_f_x_pins[] = { GPIOX_3 };
144static const unsigned int pwm_f_f4_pins[] = { GPIOF_4 };
145static const unsigned int pwm_f_f12_pins[] = { GPIOF_12 };
146
147/* pwm_a_hiz */
148static const unsigned int pwm_a_hiz_f8_pins[] = { GPIOF_8 };
149static const unsigned int pwm_a_hiz_f10_pins[] = { GPIOF_10 };
150static const unsigned int pmw_a_hiz_f6_pins[] = { GPIOF_6 };
151
152/* pwm_b_hiz */
153static const unsigned int pwm_b_hiz_pins[] = { GPIOF_7 };
154
155/* pmw_c_hiz */
156static const unsigned int pwm_c_hiz_pins[] = { GPIOF_8 };
157
158/* tdm_a */
159static const unsigned int tdm_a_dout1_pins[] = { GPIOX_7 };
160static const unsigned int tdm_a_dout0_pins[] = { GPIOX_8 };
161static const unsigned int tdm_a_fs_pins[] = { GPIOX_9 };
162static const unsigned int tdm_a_sclk_pins[] = { GPIOX_10 };
163static const unsigned int tdm_a_din1_pins[] = { GPIOX_7 };
164static const unsigned int tdm_a_din0_pins[] = { GPIOX_8 };
165static const unsigned int tdm_a_slv_fs_pins[] = { GPIOX_9 };
166static const unsigned int tdm_a_slv_sclk_pins[] = { GPIOX_10 };
167
168/* spi_a */
169static const unsigned int spi_a_mosi_x2_pins[] = { GPIOX_2 };
170static const unsigned int spi_a_ss0_x3_pins[] = { GPIOX_3 };
171static const unsigned int spi_a_sclk_x4_pins[] = { GPIOX_4 };
172static const unsigned int spi_a_miso_x5_pins[] = { GPIOX_5 };
173static const unsigned int spi_a_mosi_x7_pins[] = { GPIOX_7 };
174static const unsigned int spi_a_miso_x8_pins[] = { GPIOX_8 };
175static const unsigned int spi_a_ss0_x9_pins[] = { GPIOX_9 };
176static const unsigned int spi_a_sclk_x10_pins[] = { GPIOX_10 };
177
178static const unsigned int spi_a_mosi_a_pins[] = { GPIOA_6 };
179static const unsigned int spi_a_miso_a_pins[] = { GPIOA_7 };
180static const unsigned int spi_a_ss0_a_pins[] = { GPIOA_8 };
181static const unsigned int spi_a_sclk_a_pins[] = { GPIOA_9 };
182
183/* pdm */
184static const unsigned int pdm_din0_x_pins[] = { GPIOX_7 };
185static const unsigned int pdm_din1_x_pins[] = { GPIOX_8 };
186static const unsigned int pdm_din2_x_pins[] = { GPIOX_9 };
187static const unsigned int pdm_dclk_x_pins[] = { GPIOX_10 };
188
189static const unsigned int pdm_din2_a_pins[] = { GPIOA_6 };
190static const unsigned int pdm_din1_a_pins[] = { GPIOA_7 };
191static const unsigned int pdm_din0_a_pins[] = { GPIOA_8 };
192static const unsigned int pdm_dclk_pins[] = { GPIOA_9 };
193
194/* gen_clk */
195static const unsigned int gen_clk_x_pins[] = { GPIOX_7 };
196static const unsigned int gen_clk_f8_pins[] = { GPIOF_8 };
197static const unsigned int gen_clk_f10_pins[] = { GPIOF_10 };
198static const unsigned int gen_clk_a_pins[] = { GPIOA_11 };
199
200/* jtag_a */
201static const unsigned int jtag_a_clk_pins[] = { GPIOF_4 };
202static const unsigned int jtag_a_tms_pins[] = { GPIOF_5 };
203static const unsigned int jtag_a_tdi_pins[] = { GPIOF_6 };
204static const unsigned int jtag_a_tdo_pins[] = { GPIOF_7 };
205
206/* clk_32_in */
207static const unsigned int clk_32k_in_pins[] = { GPIOF_2 };
208
209/* ir in */
210static const unsigned int remote_input_f_pins[] = { GPIOF_3 };
211static const unsigned int remote_input_a_pins[] = { GPIOA_11 };
212
213/* ir out */
214static const unsigned int remote_out_pins[] = { GPIOF_5 };
215
216/* spdif */
217static const unsigned int spdif_in_f6_pins[] = { GPIOF_6 };
218static const unsigned int spdif_in_f7_pins[] = { GPIOF_7 };
219
220/* sw */
221static const unsigned int swclk_pins[] = { GPIOF_4 };
222static const unsigned int swdio_pins[] = { GPIOF_5 };
223
224/* clk_25 */
225static const unsigned int clk25_pins[] = { GPIOF_10 };
226
227/* cec_a */
228static const unsigned int cec_a_pins[] = { GPIOF_2 };
229
230/* cec_b */
231static const unsigned int cec_b_pins[] = { GPIOF_2 };
232
233/* clk12_24 */
234static const unsigned int clk12_24_pins[] = { GPIOF_10 };
235
236/* mclk_0 */
237static const unsigned int mclk_0_pins[] = { GPIOA_0 };
238
239/* tdm_b */
240static const unsigned int tdm_b_sclk_pins[] = { GPIOA_1 };
241static const unsigned int tdm_b_fs_pins[] = { GPIOA_2 };
242static const unsigned int tdm_b_dout0_pins[] = { GPIOA_3 };
243static const unsigned int tdm_b_dout1_pins[] = { GPIOA_4 };
244static const unsigned int tdm_b_dout2_pins[] = { GPIOA_5 };
245static const unsigned int tdm_b_dout3_pins[] = { GPIOA_6 };
246static const unsigned int tdm_b_dout4_pins[] = { GPIOA_7 };
247static const unsigned int tdm_b_dout5_pins[] = { GPIOA_8 };
248static const unsigned int tdm_b_slv_sclk_pins[] = { GPIOA_5 };
249static const unsigned int tdm_b_slv_fs_pins[] = { GPIOA_6 };
250static const unsigned int tdm_b_din0_pins[] = { GPIOA_7 };
251static const unsigned int tdm_b_din1_pins[] = { GPIOA_8 };
252static const unsigned int tdm_b_din2_pins[] = { GPIOA_9 };
253
254/* mclk_vad */
255static const unsigned int mclk_vad_pins[] = { GPIOA_0 };
256
257/* tdm_vad */
258static const unsigned int tdm_vad_sclk_a1_pins[] = { GPIOA_1 };
259static const unsigned int tdm_vad_fs_a2_pins[] = { GPIOA_2 };
260static const unsigned int tdm_vad_sclk_a5_pins[] = { GPIOA_5 };
261static const unsigned int tdm_vad_fs_a6_pins[] = { GPIOA_6 };
262
263/* tst_out */
264static const unsigned int tst_out0_pins[] = { GPIOA_0 };
265static const unsigned int tst_out1_pins[] = { GPIOA_1 };
266static const unsigned int tst_out2_pins[] = { GPIOA_2 };
267static const unsigned int tst_out3_pins[] = { GPIOA_3 };
268static const unsigned int tst_out4_pins[] = { GPIOA_4 };
269static const unsigned int tst_out5_pins[] = { GPIOA_5 };
270static const unsigned int tst_out6_pins[] = { GPIOA_6 };
271static const unsigned int tst_out7_pins[] = { GPIOA_7 };
272static const unsigned int tst_out8_pins[] = { GPIOA_8 };
273static const unsigned int tst_out9_pins[] = { GPIOA_9 };
274static const unsigned int tst_out10_pins[] = { GPIOA_10 };
275static const unsigned int tst_out11_pins[] = { GPIOA_11 };
276
277/* mute */
278static const unsigned int mute_key_pins[] = { GPIOA_4 };
279static const unsigned int mute_en_pins[] = { GPIOA_5 };
280
281static struct meson_pmx_group meson_a1_periphs_groups[] = {
282 GPIO_GROUP(GPIOP_0, 0),
283 GPIO_GROUP(GPIOP_1, 0),
284 GPIO_GROUP(GPIOP_2, 0),
285 GPIO_GROUP(GPIOP_3, 0),
286 GPIO_GROUP(GPIOP_4, 0),
287 GPIO_GROUP(GPIOP_5, 0),
288 GPIO_GROUP(GPIOP_6, 0),
289 GPIO_GROUP(GPIOP_7, 0),
290 GPIO_GROUP(GPIOP_8, 0),
291 GPIO_GROUP(GPIOP_9, 0),
292 GPIO_GROUP(GPIOP_10, 0),
293 GPIO_GROUP(GPIOP_11, 0),
294 GPIO_GROUP(GPIOP_12, 0),
295 GPIO_GROUP(GPIOB_0, 0),
296 GPIO_GROUP(GPIOB_1, 0),
297 GPIO_GROUP(GPIOB_2, 0),
298 GPIO_GROUP(GPIOB_3, 0),
299 GPIO_GROUP(GPIOB_4, 0),
300 GPIO_GROUP(GPIOB_5, 0),
301 GPIO_GROUP(GPIOB_6, 0),
302 GPIO_GROUP(GPIOX_0, 0),
303 GPIO_GROUP(GPIOX_1, 0),
304 GPIO_GROUP(GPIOX_2, 0),
305 GPIO_GROUP(GPIOX_3, 0),
306 GPIO_GROUP(GPIOX_4, 0),
307 GPIO_GROUP(GPIOX_5, 0),
308 GPIO_GROUP(GPIOX_6, 0),
309 GPIO_GROUP(GPIOX_7, 0),
310 GPIO_GROUP(GPIOX_8, 0),
311 GPIO_GROUP(GPIOX_9, 0),
312 GPIO_GROUP(GPIOX_10, 0),
313 GPIO_GROUP(GPIOX_11, 0),
314 GPIO_GROUP(GPIOX_12, 0),
315 GPIO_GROUP(GPIOX_13, 0),
316 GPIO_GROUP(GPIOX_14, 0),
317 GPIO_GROUP(GPIOX_15, 0),
318 GPIO_GROUP(GPIOX_16, 0),
319 GPIO_GROUP(GPIOF_0, 0),
320 GPIO_GROUP(GPIOF_1, 0),
321 GPIO_GROUP(GPIOF_2, 0),
322 GPIO_GROUP(GPIOF_3, 0),
323 GPIO_GROUP(GPIOF_4, 0),
324 GPIO_GROUP(GPIOF_5, 0),
325 GPIO_GROUP(GPIOF_6, 0),
326 GPIO_GROUP(GPIOF_7, 0),
327 GPIO_GROUP(GPIOF_8, 0),
328 GPIO_GROUP(GPIOF_9, 0),
329 GPIO_GROUP(GPIOF_10, 0),
330 GPIO_GROUP(GPIOF_11, 0),
331 GPIO_GROUP(GPIOF_12, 0),
332 GPIO_GROUP(GPIOA_0, 0),
333 GPIO_GROUP(GPIOA_1, 0),
334 GPIO_GROUP(GPIOA_2, 0),
335 GPIO_GROUP(GPIOA_3, 0),
336 GPIO_GROUP(GPIOA_4, 0),
337 GPIO_GROUP(GPIOA_5, 0),
338 GPIO_GROUP(GPIOA_6, 0),
339 GPIO_GROUP(GPIOA_7, 0),
340 GPIO_GROUP(GPIOA_8, 0),
341 GPIO_GROUP(GPIOA_9, 0),
342 GPIO_GROUP(GPIOA_10, 0),
343 GPIO_GROUP(GPIOA_11, 0),
344
345 /* bank P func1 */
346 GROUP(psram_clkn, 1),
347 GROUP(psram_clkp, 1),
348 GROUP(psram_ce_n, 1),
349 GROUP(psram_rst_n, 1),
350 GROUP(psram_adq0, 1),
351 GROUP(psram_adq1, 1),
352 GROUP(psram_adq2, 1),
353 GROUP(psram_adq3, 1),
354 GROUP(psram_adq4, 1),
355 GROUP(psram_adq5, 1),
356 GROUP(psram_adq6, 1),
357 GROUP(psram_adq7, 1),
358 GROUP(psram_dqs_dm, 1),
359
360 /* bank P func2 */
361 GROUP(pwm_e_p, 2),
362
363 /* bank B func1 */
364 GROUP(spif_mo, 1),
365 GROUP(spif_mi, 1),
366 GROUP(spif_wp_n, 1),
367 GROUP(spif_hold_n, 1),
368 GROUP(spif_clk, 1),
369 GROUP(spif_cs, 1),
370 GROUP(pwm_f_b, 1),
371
372 /* bank B func2 */
373 GROUP(sdcard_d0_b, 2),
374 GROUP(sdcard_d1_b, 2),
375 GROUP(sdcard_d2_b, 2),
376 GROUP(sdcard_d3_b, 2),
377 GROUP(sdcard_clk_b, 2),
378 GROUP(sdcard_cmd_b, 2),
379
380 /* bank X func1 */
381 GROUP(sdcard_d0_x, 1),
382 GROUP(sdcard_d1_x, 1),
383 GROUP(sdcard_d2_x, 1),
384 GROUP(sdcard_d3_x, 1),
385 GROUP(sdcard_clk_x, 1),
386 GROUP(sdcard_cmd_x, 1),
387 GROUP(pwm_a_x6, 1),
388 GROUP(tdm_a_dout1, 1),
389 GROUP(tdm_a_dout0, 1),
390 GROUP(tdm_a_fs, 1),
391 GROUP(tdm_a_sclk, 1),
392 GROUP(uart_a_tx, 1),
393 GROUP(uart_a_rx, 1),
394 GROUP(uart_a_cts, 1),
395 GROUP(uart_a_rts, 1),
396 GROUP(pwm_d_x15, 1),
397 GROUP(pwm_e_x16, 1),
398
399 /* bank X func2 */
400 GROUP(i2c2_sck_x0, 2),
401 GROUP(i2c2_sda_x1, 2),
402 GROUP(spi_a_mosi_x2, 2),
403 GROUP(spi_a_ss0_x3, 2),
404 GROUP(spi_a_sclk_x4, 2),
405 GROUP(spi_a_miso_x5, 2),
406 GROUP(tdm_a_din1, 2),
407 GROUP(tdm_a_din0, 2),
408 GROUP(tdm_a_slv_fs, 2),
409 GROUP(tdm_a_slv_sclk, 2),
410 GROUP(i2c3_sck_x, 2),
411 GROUP(i2c3_sda_x, 2),
412 GROUP(pwm_d_x13, 2),
413 GROUP(pwm_e_x14, 2),
414 GROUP(i2c2_sck_x15, 2),
415 GROUP(i2c2_sda_x16, 2),
416
417 /* bank X func3 */
418 GROUP(uart_c_tx_x0, 3),
419 GROUP(uart_c_rx_x1, 3),
420 GROUP(uart_c_cts, 3),
421 GROUP(uart_c_rts, 3),
422 GROUP(pdm_din0_x, 3),
423 GROUP(pdm_din1_x, 3),
424 GROUP(pdm_din2_x, 3),
425 GROUP(pdm_dclk_x, 3),
426 GROUP(uart_c_tx_x15, 3),
427 GROUP(uart_c_rx_x16, 3),
428
429 /* bank X func4 */
430 GROUP(pwm_e_x2, 4),
431 GROUP(pwm_f_x, 4),
432 GROUP(spi_a_mosi_x7, 4),
433 GROUP(spi_a_miso_x8, 4),
434 GROUP(spi_a_ss0_x9, 4),
435 GROUP(spi_a_sclk_x10, 4),
436
437 /* bank X func5 */
438 GROUP(uart_b_tx_x, 5),
439 GROUP(uart_b_rx_x, 5),
440 GROUP(i2c1_sda_x, 5),
441 GROUP(i2c1_sck_x, 5),
442
443 /* bank X func6 */
444 GROUP(pwm_a_x7, 6),
445 GROUP(pwm_b_x, 6),
446 GROUP(pwm_c_x, 6),
447 GROUP(pwm_d_x10, 6),
448
449 /* bank X func7 */
450 GROUP(gen_clk_x, 7),
451
452 /* bank F func1 */
453 GROUP(uart_b_tx_f, 1),
454 GROUP(uart_b_rx_f, 1),
455 GROUP(remote_input_f, 1),
456 GROUP(jtag_a_clk, 1),
457 GROUP(jtag_a_tms, 1),
458 GROUP(jtag_a_tdi, 1),
459 GROUP(jtag_a_tdo, 1),
460 GROUP(gen_clk_f8, 1),
461 GROUP(pwm_a_f10, 1),
462 GROUP(i2c0_sck_f11, 1),
463 GROUP(i2c0_sda_f12, 1),
464
465 /* bank F func2 */
466 GROUP(clk_32k_in, 2),
467 GROUP(pwm_e_f, 2),
468 GROUP(pwm_f_f4, 2),
469 GROUP(remote_out, 2),
470 GROUP(spdif_in_f6, 2),
471 GROUP(spdif_in_f7, 2),
472 GROUP(pwm_a_hiz_f8, 2),
473 GROUP(pwm_a_hiz_f10, 2),
474 GROUP(pwm_d_f, 2),
475 GROUP(pwm_f_f12, 2),
476
477 /* bank F func3 */
478 GROUP(pwm_c_f3, 3),
479 GROUP(swclk, 3),
480 GROUP(swdio, 3),
481 GROUP(pwm_a_f6, 3),
482 GROUP(pwm_b_f, 3),
483 GROUP(pwm_c_f8, 3),
484 GROUP(clk25, 3),
485 GROUP(i2c_slave_sck_f, 3),
486 GROUP(i2c_slave_sda_f, 3),
487
488 /* bank F func4 */
489 GROUP(cec_a, 4),
490 GROUP(i2c3_sck_f, 4),
491 GROUP(i2c3_sda_f, 4),
492 GROUP(pmw_a_hiz_f6, 4),
493 GROUP(pwm_b_hiz, 4),
494 GROUP(pwm_c_hiz, 4),
495 GROUP(i2c0_sck_f9, 4),
496 GROUP(i2c0_sda_f10, 4),
497
498 /* bank F func5 */
499 GROUP(cec_b, 5),
500 GROUP(clk12_24, 5),
501
502 /* bank F func7 */
503 GROUP(gen_clk_f10, 7),
504
505 /* bank A func1 */
506 GROUP(mclk_0, 1),
507 GROUP(tdm_b_sclk, 1),
508 GROUP(tdm_b_fs, 1),
509 GROUP(tdm_b_dout0, 1),
510 GROUP(tdm_b_dout1, 1),
511 GROUP(tdm_b_dout2, 1),
512 GROUP(tdm_b_dout3, 1),
513 GROUP(tdm_b_dout4, 1),
514 GROUP(tdm_b_dout5, 1),
515 GROUP(remote_input_a, 1),
516
517 /* bank A func2 */
518 GROUP(pwm_e_a, 2),
519 GROUP(tdm_b_slv_sclk, 2),
520 GROUP(tdm_b_slv_fs, 2),
521 GROUP(tdm_b_din0, 2),
522 GROUP(tdm_b_din1, 2),
523 GROUP(tdm_b_din2, 2),
524 GROUP(i2c1_sda_a, 2),
525 GROUP(i2c1_sck_a, 2),
526
527 /* bank A func3 */
528 GROUP(i2c2_sck_a4, 3),
529 GROUP(i2c2_sda_a5, 3),
530 GROUP(pdm_din2_a, 3),
531 GROUP(pdm_din1_a, 3),
532 GROUP(pdm_din0_a, 3),
533 GROUP(pdm_dclk, 3),
534 GROUP(pwm_c_a, 3),
535 GROUP(pwm_b_a, 3),
536
537 /* bank A func4 */
538 GROUP(pwm_a_a, 4),
539 GROUP(spi_a_mosi_a, 4),
540 GROUP(spi_a_miso_a, 4),
541 GROUP(spi_a_ss0_a, 4),
542 GROUP(spi_a_sclk_a, 4),
543 GROUP(i2c_slave_sck_a, 4),
544 GROUP(i2c_slave_sda_a, 4),
545
546 /* bank A func5 */
547 GROUP(mclk_vad, 5),
548 GROUP(tdm_vad_sclk_a1, 5),
549 GROUP(tdm_vad_fs_a2, 5),
550 GROUP(tdm_vad_sclk_a5, 5),
551 GROUP(tdm_vad_fs_a6, 5),
552 GROUP(i2c2_sck_a8, 5),
553 GROUP(i2c2_sda_a9, 5),
554
555 /* bank A func6 */
556 GROUP(tst_out0, 6),
557 GROUP(tst_out1, 6),
558 GROUP(tst_out2, 6),
559 GROUP(tst_out3, 6),
560 GROUP(tst_out4, 6),
561 GROUP(tst_out5, 6),
562 GROUP(tst_out6, 6),
563 GROUP(tst_out7, 6),
564 GROUP(tst_out8, 6),
565 GROUP(tst_out9, 6),
566 GROUP(tst_out10, 6),
567 GROUP(tst_out11, 6),
568
569 /* bank A func7 */
570 GROUP(mute_key, 7),
571 GROUP(mute_en, 7),
572 GROUP(gen_clk_a, 7),
573};
574
575static const char * const gpio_periphs_groups[] = {
576 "GPIOP_0", "GPIOP_1", "GPIOP_2", "GPIOP_3", "GPIOP_4",
577 "GPIOP_5", "GPIOP_6", "GPIOP_7", "GPIOP_8", "GPIOP_9",
578 "GPIOP_10", "GPIOP_11", "GPIOP_12",
579
580 "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4",
581 "GPIOB_5", "GPIOB_6",
582
583 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
584 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
585 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
586 "GPIOX_15", "GPIOX_16",
587
588 "GPIOF_0", "GPIOF_1", "GPIOF_2", "GPIOF_3", "GPIOF_4",
589 "GPIOF_5", "GPIOF_6", "GPIOF_7", "GPIOF_8", "GPIOF_9",
590 "GPIOF_10", "GPIOF_11", "GPIOF_12",
591
592 "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
593 "GPIOA_5", "GPIOA_6", "GPIOA_7", "GPIOA_8", "GPIOA_9",
594 "GPIOA_10", "GPIOA_11",
595};
596
597static const char * const psram_groups[] = {
598 "psram_clkn", "psram_clkp", "psram_ce_n", "psram_rst_n", "psram_adq0",
599 "psram_adq1", "psram_adq2", "psram_adq3", "psram_adq4", "psram_adq5",
600 "psram_adq6", "psram_adq7", "psram_dqs_dm",
601};
602
603static const char * const pwm_a_groups[] = {
604 "pwm_a_x6", "pwm_a_x7", "pwm_a_f10", "pwm_a_f6", "pwm_a_a",
605};
606
607static const char * const pwm_b_groups[] = {
608 "pwm_b_x", "pwm_b_f", "pwm_b_a",
609};
610
611static const char * const pwm_c_groups[] = {
612 "pwm_c_x", "pwm_c_f3", "pwm_c_f8", "pwm_c_a",
613};
614
615static const char * const pwm_d_groups[] = {
616 "pwm_d_x15", "pwm_d_x13", "pwm_d_x10", "pwm_d_f",
617};
618
619static const char * const pwm_e_groups[] = {
620 "pwm_e_p", "pwm_e_x16", "pwm_e_x14", "pwm_e_x2", "pwm_e_f",
621 "pwm_e_a",
622};
623
624static const char * const pwm_f_groups[] = {
625 "pwm_f_b", "pwm_f_x", "pwm_f_f4", "pwm_f_f12",
626};
627
628static const char * const pwm_a_hiz_groups[] = {
629 "pwm_a_hiz_f8", "pwm_a_hiz_f10", "pwm_a_hiz_f6",
630};
631
632static const char * const pwm_b_hiz_groups[] = {
633 "pwm_b_hiz",
634};
635
636static const char * const pwm_c_hiz_groups[] = {
637 "pwm_c_hiz",
638};
639
640static const char * const spif_groups[] = {
641 "spif_mo", "spif_mi", "spif_wp_n", "spif_hold_n", "spif_clk",
642 "spif_cs",
643};
644
645static const char * const sdcard_groups[] = {
646 "sdcard_d0_b", "sdcard_d1_b", "sdcard_d2_b", "sdcard_d3_b",
647 "sdcard_clk_b", "sdcard_cmd_b",
648
649 "sdcard_d0_x", "sdcard_d1_x", "sdcard_d2_x", "sdcard_d3_x",
650 "sdcard_clk_x", "sdcard_cmd_x",
651};
652
653static const char * const tdm_a_groups[] = {
654 "tdm_a_din0", "tdm_a_din1", "tdm_a_fs", "tdm_a_sclk",
655 "tdm_a_slv_fs", "tdm_a_slv_sclk", "tdm_a_dout0", "tdm_a_dout1",
656};
657
658static const char * const uart_a_groups[] = {
659 "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts",
660};
661
662static const char * const uart_b_groups[] = {
663 "uart_b_tx_x", "uart_b_rx_x", "uart_b_tx_f", "uart_b_rx_f",
664};
665
666static const char * const uart_c_groups[] = {
667 "uart_c_tx_x0", "uart_c_rx_x1", "uart_c_cts", "uart_c_rts",
668 "uart_c_tx_x15", "uart_c_rx_x16",
669};
670
671static const char * const i2c0_groups[] = {
672 "i2c0_sck_f11", "i2c0_sda_f12", "i2c0_sck_f9", "i2c0_sda_f10",
673};
674
675static const char * const i2c1_groups[] = {
676 "i2c1_sda_x", "i2c1_sck_x", "i2c1_sda_a", "i2c1_sck_a",
677};
678
679static const char * const i2c2_groups[] = {
680 "i2c2_sck_x0", "i2c2_sda_x1", "i2c2_sck_x15", "i2c2_sda_x16",
681 "i2c2_sck_a4", "i2c2_sda_a5", "i2c2_sck_a8", "i2c2_sda_a9",
682};
683
684static const char * const i2c3_groups[] = {
685 "i2c3_sck_x", "i2c3_sda_x", "i2c3_sck_f", "i2c3_sda_f",
686};
687
688static const char * const spi_a_groups[] = {
689 "spi_a_mosi_x2", "spi_a_ss0_x3", "spi_a_sclk_x4", "spi_a_miso_x5",
690 "spi_a_mosi_x7", "spi_a_miso_x8", "spi_a_ss0_x9", "spi_a_sclk_x10",
691
692 "spi_a_mosi_a", "spi_a_miso_a", "spi_a_ss0_a", "spi_a_sclk_a",
693};
694
695static const char * const pdm_groups[] = {
696 "pdm_din0_x", "pdm_din1_x", "pdm_din2_x", "pdm_dclk_x", "pdm_din2_a",
697 "pdm_din1_a", "pdm_din0_a", "pdm_dclk",
698};
699
700static const char * const gen_clk_groups[] = {
701 "gen_clk_x", "gen_clk_f8", "gen_clk_f10", "gen_clk_a",
702};
703
704static const char * const remote_input_groups[] = {
705 "remote_input_f",
706 "remote_input_a",
707};
708
709static const char * const jtag_a_groups[] = {
710 "jtag_a_clk", "jtag_a_tms", "jtag_a_tdi", "jtag_a_tdo",
711};
712
713static const char * const clk_32k_in_groups[] = {
714 "clk_32k_in",
715};
716
717static const char * const remote_out_groups[] = {
718 "remote_out",
719};
720
721static const char * const spdif_in_groups[] = {
722 "spdif_in_f6", "spdif_in_f7",
723};
724
725static const char * const sw_groups[] = {
726 "swclk", "swdio",
727};
728
729static const char * const clk25_groups[] = {
730 "clk_25",
731};
732
733static const char * const cec_a_groups[] = {
734 "cec_a",
735};
736
737static const char * const cec_b_groups[] = {
738 "cec_b",
739};
740
741static const char * const clk12_24_groups[] = {
742 "clk12_24",
743};
744
745static const char * const mclk_0_groups[] = {
746 "mclk_0",
747};
748
749static const char * const tdm_b_groups[] = {
750 "tdm_b_din0", "tdm_b_din1", "tdm_b_din2",
751 "tdm_b_sclk", "tdm_b_fs", "tdm_b_dout0", "tdm_b_dout1",
752 "tdm_b_dout2", "tdm_b_dout3", "tdm_b_dout4", "tdm_b_dout5",
753 "tdm_b_slv_sclk", "tdm_b_slv_fs",
754};
755
756static const char * const mclk_vad_groups[] = {
757 "mclk_vad",
758};
759
760static const char * const tdm_vad_groups[] = {
761 "tdm_vad_sclk_a1", "tdm_vad_fs_a2", "tdm_vad_sclk_a5", "tdm_vad_fs_a6",
762};
763
764static const char * const tst_out_groups[] = {
765 "tst_out0", "tst_out1", "tst_out2", "tst_out3",
766 "tst_out4", "tst_out5", "tst_out6", "tst_out7",
767 "tst_out8", "tst_out9", "tst_out10", "tst_out11",
768};
769
770static const char * const mute_groups[] = {
771 "mute_key", "mute_en",
772};
773
774static struct meson_pmx_func meson_a1_periphs_functions[] = {
775 FUNCTION(gpio_periphs),
776 FUNCTION(psram),
777 FUNCTION(pwm_a),
778 FUNCTION(pwm_b),
779 FUNCTION(pwm_c),
780 FUNCTION(pwm_d),
781 FUNCTION(pwm_e),
782 FUNCTION(pwm_f),
783 FUNCTION(pwm_a_hiz),
784 FUNCTION(pwm_b_hiz),
785 FUNCTION(pwm_c_hiz),
786 FUNCTION(spif),
787 FUNCTION(sdcard),
788 FUNCTION(tdm_a),
789 FUNCTION(uart_a),
790 FUNCTION(uart_b),
791 FUNCTION(uart_c),
792 FUNCTION(i2c0),
793 FUNCTION(i2c1),
794 FUNCTION(i2c2),
795 FUNCTION(i2c3),
796 FUNCTION(spi_a),
797 FUNCTION(pdm),
798 FUNCTION(gen_clk),
799 FUNCTION(remote_input),
800 FUNCTION(jtag_a),
801 FUNCTION(clk_32k_in),
802 FUNCTION(remote_out),
803 FUNCTION(spdif_in),
804 FUNCTION(sw),
805 FUNCTION(clk25),
806 FUNCTION(cec_a),
807 FUNCTION(cec_b),
808 FUNCTION(clk12_24),
809 FUNCTION(mclk_0),
810 FUNCTION(tdm_b),
811 FUNCTION(mclk_vad),
812 FUNCTION(tdm_vad),
813 FUNCTION(tst_out),
814 FUNCTION(mute),
815};
816
817static struct meson_bank meson_a1_periphs_banks[] = {
818 /* name first last pullen pull dir out in ds */
819 BANK_DS("P", GPIOP_0, GPIOP_12, 0x3, 0, 0x4, 0, 0x2, 0, 0x1, 0, 0x0, 0, 0x5, 0),
820 BANK_DS("B", GPIOB_0, GPIOB_6, 0x13, 0, 0x14, 0, 0x12, 0, 0x11, 0, 0x10, 0, 0x15, 0),
821 BANK_DS("X", GPIOX_0, GPIOX_16, 0x23, 0, 0x24, 0, 0x22, 0, 0x21, 0, 0x20, 0, 0x25, 0),
822 BANK_DS("F", GPIOF_0, GPIOF_12, 0x33, 0, 0x34, 0, 0x32, 0, 0x31, 0, 0x30, 0, 0x35, 0),
823 BANK_DS("A", GPIOA_0, GPIOA_11, 0x43, 0, 0x44, 0, 0x42, 0, 0x41, 0, 0x40, 0, 0x45, 0),
824};
825
826static struct meson_pmx_bank meson_a1_periphs_pmx_banks[] = {
827 /* name first last reg offset */
828 BANK_PMX("P", GPIOP_0, GPIOP_12, 0x0, 0),
829 BANK_PMX("B", GPIOB_0, GPIOB_6, 0x2, 0),
830 BANK_PMX("X", GPIOX_0, GPIOX_16, 0x3, 0),
831 BANK_PMX("F", GPIOF_0, GPIOF_12, 0x6, 0),
832 BANK_PMX("A", GPIOA_0, GPIOA_11, 0x8, 0),
833};
834
835static struct meson_axg_pmx_data meson_a1_periphs_pmx_banks_data = {
836 .pmx_banks = meson_a1_periphs_pmx_banks,
837 .num_pmx_banks = ARRAY_SIZE(meson_a1_periphs_pmx_banks),
838};
839
840static struct meson_pinctrl_data meson_a1_periphs_pinctrl_data = {
841 .name = "periphs-banks",
842 .groups = meson_a1_periphs_groups,
843 .funcs = meson_a1_periphs_functions,
844 .banks = meson_a1_periphs_banks,
845 .num_pins = 62,
846 .num_groups = ARRAY_SIZE(meson_a1_periphs_groups),
847 .num_funcs = ARRAY_SIZE(meson_a1_periphs_functions),
848 .num_banks = ARRAY_SIZE(meson_a1_periphs_banks),
849 .pmx_data = &meson_a1_periphs_pmx_banks_data,
850};
851
852static const struct udevice_id meson_a1_pinctrl_match[] = {
853 {
854 .compatible = "amlogic,meson-a1-periphs-pinctrl",
855 .data = (ulong)&meson_a1_periphs_pinctrl_data,
856 },
857 { },
858};
859
860U_BOOT_DRIVER(meson_a1_pinctrl) = {
861 .name = "meson-a1-pinctrl",
862 .id = UCLASS_PINCTRL,
863 .of_match = of_match_ptr(meson_a1_pinctrl_match),
864 .probe = meson_pinctrl_probe,
865 .priv_auto = sizeof(struct meson_pinctrl),
866 .ops = &meson_axg_pinctrl_ops,
867};