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