Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Pin controller and GPIO driver for Amlogic Meson GXL.
0004  *
0005  * Copyright (C) 2016 Endless Mobile, Inc.
0006  * Author: Carlo Caione <carlo@endlessm.com>
0007  */
0008 
0009 #include <dt-bindings/gpio/meson-gxl-gpio.h>
0010 #include "pinctrl-meson.h"
0011 #include "pinctrl-meson8-pmx.h"
0012 
0013 static const struct pinctrl_pin_desc meson_gxl_periphs_pins[] = {
0014     MESON_PIN(GPIOZ_0),
0015     MESON_PIN(GPIOZ_1),
0016     MESON_PIN(GPIOZ_2),
0017     MESON_PIN(GPIOZ_3),
0018     MESON_PIN(GPIOZ_4),
0019     MESON_PIN(GPIOZ_5),
0020     MESON_PIN(GPIOZ_6),
0021     MESON_PIN(GPIOZ_7),
0022     MESON_PIN(GPIOZ_8),
0023     MESON_PIN(GPIOZ_9),
0024     MESON_PIN(GPIOZ_10),
0025     MESON_PIN(GPIOZ_11),
0026     MESON_PIN(GPIOZ_12),
0027     MESON_PIN(GPIOZ_13),
0028     MESON_PIN(GPIOZ_14),
0029     MESON_PIN(GPIOZ_15),
0030 
0031     MESON_PIN(GPIOH_0),
0032     MESON_PIN(GPIOH_1),
0033     MESON_PIN(GPIOH_2),
0034     MESON_PIN(GPIOH_3),
0035     MESON_PIN(GPIOH_4),
0036     MESON_PIN(GPIOH_5),
0037     MESON_PIN(GPIOH_6),
0038     MESON_PIN(GPIOH_7),
0039     MESON_PIN(GPIOH_8),
0040     MESON_PIN(GPIOH_9),
0041 
0042     MESON_PIN(BOOT_0),
0043     MESON_PIN(BOOT_1),
0044     MESON_PIN(BOOT_2),
0045     MESON_PIN(BOOT_3),
0046     MESON_PIN(BOOT_4),
0047     MESON_PIN(BOOT_5),
0048     MESON_PIN(BOOT_6),
0049     MESON_PIN(BOOT_7),
0050     MESON_PIN(BOOT_8),
0051     MESON_PIN(BOOT_9),
0052     MESON_PIN(BOOT_10),
0053     MESON_PIN(BOOT_11),
0054     MESON_PIN(BOOT_12),
0055     MESON_PIN(BOOT_13),
0056     MESON_PIN(BOOT_14),
0057     MESON_PIN(BOOT_15),
0058 
0059     MESON_PIN(CARD_0),
0060     MESON_PIN(CARD_1),
0061     MESON_PIN(CARD_2),
0062     MESON_PIN(CARD_3),
0063     MESON_PIN(CARD_4),
0064     MESON_PIN(CARD_5),
0065     MESON_PIN(CARD_6),
0066 
0067     MESON_PIN(GPIODV_0),
0068     MESON_PIN(GPIODV_1),
0069     MESON_PIN(GPIODV_2),
0070     MESON_PIN(GPIODV_3),
0071     MESON_PIN(GPIODV_4),
0072     MESON_PIN(GPIODV_5),
0073     MESON_PIN(GPIODV_6),
0074     MESON_PIN(GPIODV_7),
0075     MESON_PIN(GPIODV_8),
0076     MESON_PIN(GPIODV_9),
0077     MESON_PIN(GPIODV_10),
0078     MESON_PIN(GPIODV_11),
0079     MESON_PIN(GPIODV_12),
0080     MESON_PIN(GPIODV_13),
0081     MESON_PIN(GPIODV_14),
0082     MESON_PIN(GPIODV_15),
0083     MESON_PIN(GPIODV_16),
0084     MESON_PIN(GPIODV_17),
0085     MESON_PIN(GPIODV_18),
0086     MESON_PIN(GPIODV_19),
0087     MESON_PIN(GPIODV_20),
0088     MESON_PIN(GPIODV_21),
0089     MESON_PIN(GPIODV_22),
0090     MESON_PIN(GPIODV_23),
0091     MESON_PIN(GPIODV_24),
0092     MESON_PIN(GPIODV_25),
0093     MESON_PIN(GPIODV_26),
0094     MESON_PIN(GPIODV_27),
0095     MESON_PIN(GPIODV_28),
0096     MESON_PIN(GPIODV_29),
0097 
0098     MESON_PIN(GPIOX_0),
0099     MESON_PIN(GPIOX_1),
0100     MESON_PIN(GPIOX_2),
0101     MESON_PIN(GPIOX_3),
0102     MESON_PIN(GPIOX_4),
0103     MESON_PIN(GPIOX_5),
0104     MESON_PIN(GPIOX_6),
0105     MESON_PIN(GPIOX_7),
0106     MESON_PIN(GPIOX_8),
0107     MESON_PIN(GPIOX_9),
0108     MESON_PIN(GPIOX_10),
0109     MESON_PIN(GPIOX_11),
0110     MESON_PIN(GPIOX_12),
0111     MESON_PIN(GPIOX_13),
0112     MESON_PIN(GPIOX_14),
0113     MESON_PIN(GPIOX_15),
0114     MESON_PIN(GPIOX_16),
0115     MESON_PIN(GPIOX_17),
0116     MESON_PIN(GPIOX_18),
0117 
0118     MESON_PIN(GPIOCLK_0),
0119     MESON_PIN(GPIOCLK_1),
0120 };
0121 
0122 static const unsigned int emmc_nand_d07_pins[] = {
0123     BOOT_0, BOOT_1, BOOT_2, BOOT_3, BOOT_4, BOOT_5, BOOT_6, BOOT_7,
0124 };
0125 static const unsigned int emmc_clk_pins[]   = { BOOT_8 };
0126 static const unsigned int emmc_cmd_pins[]   = { BOOT_10 };
0127 static const unsigned int emmc_ds_pins[]    = { BOOT_15 };
0128 
0129 static const unsigned int nor_d_pins[]      = { BOOT_11 };
0130 static const unsigned int nor_q_pins[]      = { BOOT_12 };
0131 static const unsigned int nor_c_pins[]      = { BOOT_13 };
0132 static const unsigned int nor_cs_pins[]     = { BOOT_15 };
0133 
0134 static const unsigned int spi_mosi_pins[]   = { GPIOX_8 };
0135 static const unsigned int spi_miso_pins[]   = { GPIOX_9 };
0136 static const unsigned int spi_ss0_pins[]    = { GPIOX_10 };
0137 static const unsigned int spi_sclk_pins[]   = { GPIOX_11 };
0138 
0139 static const unsigned int sdcard_d0_pins[]  = { CARD_1 };
0140 static const unsigned int sdcard_d1_pins[]  = { CARD_0 };
0141 static const unsigned int sdcard_d2_pins[]  = { CARD_5 };
0142 static const unsigned int sdcard_d3_pins[]  = { CARD_4 };
0143 static const unsigned int sdcard_cmd_pins[] = { CARD_3 };
0144 static const unsigned int sdcard_clk_pins[] = { CARD_2 };
0145 
0146 static const unsigned int sdio_d0_pins[]    = { GPIOX_0 };
0147 static const unsigned int sdio_d1_pins[]    = { GPIOX_1 };
0148 static const unsigned int sdio_d2_pins[]    = { GPIOX_2 };
0149 static const unsigned int sdio_d3_pins[]    = { GPIOX_3 };
0150 static const unsigned int sdio_clk_pins[]   = { GPIOX_4 };
0151 static const unsigned int sdio_cmd_pins[]   = { GPIOX_5 };
0152 static const unsigned int sdio_irq_pins[]   = { GPIOX_7 };
0153 
0154 static const unsigned int nand_ce0_pins[]   = { BOOT_8 };
0155 static const unsigned int nand_ce1_pins[]   = { BOOT_9 };
0156 static const unsigned int nand_rb0_pins[]   = { BOOT_10 };
0157 static const unsigned int nand_ale_pins[]   = { BOOT_11 };
0158 static const unsigned int nand_cle_pins[]   = { BOOT_12 };
0159 static const unsigned int nand_wen_clk_pins[]   = { BOOT_13 };
0160 static const unsigned int nand_ren_wr_pins[]    = { BOOT_14 };
0161 static const unsigned int nand_dqs_pins[]   = { BOOT_15 };
0162 
0163 static const unsigned int uart_tx_a_pins[]  = { GPIOX_12 };
0164 static const unsigned int uart_rx_a_pins[]  = { GPIOX_13 };
0165 static const unsigned int uart_cts_a_pins[] = { GPIOX_14 };
0166 static const unsigned int uart_rts_a_pins[] = { GPIOX_15 };
0167 
0168 static const unsigned int uart_tx_b_pins[]  = { GPIODV_24 };
0169 static const unsigned int uart_rx_b_pins[]  = { GPIODV_25 };
0170 static const unsigned int uart_cts_b_pins[] = { GPIODV_26 };
0171 static const unsigned int uart_rts_b_pins[] = { GPIODV_27 };
0172 
0173 static const unsigned int uart_tx_c_pins[]  = { GPIOX_8 };
0174 static const unsigned int uart_rx_c_pins[]  = { GPIOX_9 };
0175 static const unsigned int uart_cts_c_pins[] = { GPIOX_10 };
0176 static const unsigned int uart_rts_c_pins[] = { GPIOX_11 };
0177 
0178 static const unsigned int i2c_sck_a_pins[]  = { GPIODV_25 };
0179 static const unsigned int i2c_sda_a_pins[]  = { GPIODV_24 };
0180 
0181 static const unsigned int i2c_sck_b_pins[]  = { GPIODV_27 };
0182 static const unsigned int i2c_sda_b_pins[]  = { GPIODV_26 };
0183 
0184 static const unsigned int i2c_sck_c_pins[]  = { GPIODV_29 };
0185 static const unsigned int i2c_sda_c_pins[]  = { GPIODV_28 };
0186 
0187 static const unsigned int i2c_sck_c_dv19_pins[] = { GPIODV_19 };
0188 static const unsigned int i2c_sda_c_dv18_pins[] = { GPIODV_18 };
0189 
0190 static const unsigned int eth_mdio_pins[]   = { GPIOZ_0 };
0191 static const unsigned int eth_mdc_pins[]    = { GPIOZ_1 };
0192 static const unsigned int eth_clk_rx_clk_pins[] = { GPIOZ_2 };
0193 static const unsigned int eth_rx_dv_pins[]  = { GPIOZ_3 };
0194 static const unsigned int eth_rxd0_pins[]   = { GPIOZ_4 };
0195 static const unsigned int eth_rxd1_pins[]   = { GPIOZ_5 };
0196 static const unsigned int eth_rxd2_pins[]   = { GPIOZ_6 };
0197 static const unsigned int eth_rxd3_pins[]   = { GPIOZ_7 };
0198 static const unsigned int eth_rgmii_tx_clk_pins[] = { GPIOZ_8 };
0199 static const unsigned int eth_tx_en_pins[]  = { GPIOZ_9 };
0200 static const unsigned int eth_txd0_pins[]   = { GPIOZ_10 };
0201 static const unsigned int eth_txd1_pins[]   = { GPIOZ_11 };
0202 static const unsigned int eth_txd2_pins[]   = { GPIOZ_12 };
0203 static const unsigned int eth_txd3_pins[]   = { GPIOZ_13 };
0204 
0205 static const unsigned int pwm_a_pins[]      = { GPIOX_6 };
0206 
0207 static const unsigned int pwm_b_pins[]      = { GPIODV_29 };
0208 
0209 static const unsigned int pwm_c_pins[]      = { GPIOZ_15 };
0210 
0211 static const unsigned int pwm_d_pins[]      = { GPIODV_28 };
0212 
0213 static const unsigned int pwm_e_pins[]      = { GPIOX_16 };
0214 
0215 static const unsigned int pwm_f_clk_pins[]  = { GPIOCLK_1 };
0216 static const unsigned int pwm_f_x_pins[]    = { GPIOX_7 };
0217 
0218 static const unsigned int hdmi_hpd_pins[]   = { GPIOH_0 };
0219 static const unsigned int hdmi_sda_pins[]   = { GPIOH_1 };
0220 static const unsigned int hdmi_scl_pins[]   = { GPIOH_2 };
0221 
0222 static const unsigned int i2s_am_clk_pins[] = { GPIOH_6 };
0223 static const unsigned int i2s_out_ao_clk_pins[] = { GPIOH_7 };
0224 static const unsigned int i2s_out_lr_clk_pins[] = { GPIOH_8 };
0225 static const unsigned int i2s_out_ch01_pins[]   = { GPIOH_9 };
0226 static const unsigned int i2s_out_ch23_z_pins[] = { GPIOZ_5 };
0227 static const unsigned int i2s_out_ch45_z_pins[] = { GPIOZ_6 };
0228 static const unsigned int i2s_out_ch67_z_pins[] = { GPIOZ_7 };
0229 
0230 static const unsigned int spdif_out_h_pins[]    = { GPIOH_4 };
0231 
0232 static const unsigned int eth_link_led_pins[]   = { GPIOZ_14 };
0233 static const unsigned int eth_act_led_pins[]    = { GPIOZ_15 };
0234 
0235 static const unsigned int tsin_a_d0_pins[]  = { GPIODV_0 };
0236 static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 };
0237 static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 };
0238 static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 };
0239 static const unsigned int tsin_a_fail_pins[]    = { GPIODV_11 };
0240 static const unsigned int tsin_a_dp_pins[] = {
0241     GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7,
0242 };
0243 
0244 static const unsigned int tsin_b_clk_pins[] = { GPIOH_6 };
0245 static const unsigned int tsin_b_d0_pins[]  = { GPIOH_7 };
0246 static const unsigned int tsin_b_sop_pins[] = { GPIOH_8 };
0247 static const unsigned int tsin_b_d_valid_pins[] = { GPIOH_9 };
0248 
0249 static const unsigned int tsin_b_fail_z4_pins[] = { GPIOZ_4 };
0250 static const unsigned int tsin_b_clk_z3_pins[]  = { GPIOZ_3 };
0251 static const unsigned int tsin_b_d0_z2_pins[]   = { GPIOZ_2 };
0252 static const unsigned int tsin_b_sop_z1_pins[]  = { GPIOZ_1 };
0253 static const unsigned int tsin_b_d_valid_z0_pins[] = { GPIOZ_0 };
0254 
0255 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = {
0256     MESON_PIN(GPIOAO_0),
0257     MESON_PIN(GPIOAO_1),
0258     MESON_PIN(GPIOAO_2),
0259     MESON_PIN(GPIOAO_3),
0260     MESON_PIN(GPIOAO_4),
0261     MESON_PIN(GPIOAO_5),
0262     MESON_PIN(GPIOAO_6),
0263     MESON_PIN(GPIOAO_7),
0264     MESON_PIN(GPIOAO_8),
0265     MESON_PIN(GPIOAO_9),
0266 
0267     MESON_PIN(GPIO_TEST_N),
0268 };
0269 
0270 static const unsigned int uart_tx_ao_a_pins[]   = { GPIOAO_0 };
0271 static const unsigned int uart_rx_ao_a_pins[]   = { GPIOAO_1 };
0272 static const unsigned int uart_tx_ao_b_0_pins[] = { GPIOAO_0 };
0273 static const unsigned int uart_rx_ao_b_1_pins[] = { GPIOAO_1 };
0274 static const unsigned int uart_cts_ao_a_pins[]  = { GPIOAO_2 };
0275 static const unsigned int uart_rts_ao_a_pins[]  = { GPIOAO_3 };
0276 static const unsigned int uart_tx_ao_b_pins[]   = { GPIOAO_4 };
0277 static const unsigned int uart_rx_ao_b_pins[]   = { GPIOAO_5 };
0278 static const unsigned int uart_cts_ao_b_pins[]  = { GPIOAO_2 };
0279 static const unsigned int uart_rts_ao_b_pins[]  = { GPIOAO_3 };
0280 
0281 static const unsigned int i2c_sck_ao_pins[] = {GPIOAO_4 };
0282 static const unsigned int i2c_sda_ao_pins[] = {GPIOAO_5 };
0283 static const unsigned int i2c_slave_sck_ao_pins[] = {GPIOAO_4 };
0284 static const unsigned int i2c_slave_sda_ao_pins[] = {GPIOAO_5 };
0285 
0286 static const unsigned int remote_input_ao_pins[] = {GPIOAO_7 };
0287 
0288 static const unsigned int pwm_ao_a_3_pins[] = { GPIOAO_3 };
0289 static const unsigned int pwm_ao_a_8_pins[] = { GPIOAO_8 };
0290 
0291 static const unsigned int pwm_ao_b_pins[]   = { GPIOAO_9 };
0292 static const unsigned int pwm_ao_b_6_pins[] = { GPIOAO_6 };
0293 
0294 static const unsigned int i2s_out_ch23_ao_pins[] = { GPIOAO_8 };
0295 static const unsigned int i2s_out_ch45_ao_pins[] = { GPIOAO_9 };
0296 static const unsigned int i2s_out_ch67_ao_pins[] = { GPIO_TEST_N };
0297 
0298 static const unsigned int spdif_out_ao_6_pins[] = { GPIOAO_6 };
0299 static const unsigned int spdif_out_ao_9_pins[] = { GPIOAO_9 };
0300 
0301 static const unsigned int ao_cec_pins[]     = { GPIOAO_8 };
0302 static const unsigned int ee_cec_pins[]     = { GPIOAO_8 };
0303 
0304 static struct meson_pmx_group meson_gxl_periphs_groups[] = {
0305     GPIO_GROUP(GPIOZ_0),
0306     GPIO_GROUP(GPIOZ_1),
0307     GPIO_GROUP(GPIOZ_2),
0308     GPIO_GROUP(GPIOZ_3),
0309     GPIO_GROUP(GPIOZ_4),
0310     GPIO_GROUP(GPIOZ_5),
0311     GPIO_GROUP(GPIOZ_6),
0312     GPIO_GROUP(GPIOZ_7),
0313     GPIO_GROUP(GPIOZ_8),
0314     GPIO_GROUP(GPIOZ_9),
0315     GPIO_GROUP(GPIOZ_10),
0316     GPIO_GROUP(GPIOZ_11),
0317     GPIO_GROUP(GPIOZ_12),
0318     GPIO_GROUP(GPIOZ_13),
0319     GPIO_GROUP(GPIOZ_14),
0320     GPIO_GROUP(GPIOZ_15),
0321 
0322     GPIO_GROUP(GPIOH_0),
0323     GPIO_GROUP(GPIOH_1),
0324     GPIO_GROUP(GPIOH_2),
0325     GPIO_GROUP(GPIOH_3),
0326     GPIO_GROUP(GPIOH_4),
0327     GPIO_GROUP(GPIOH_5),
0328     GPIO_GROUP(GPIOH_6),
0329     GPIO_GROUP(GPIOH_7),
0330     GPIO_GROUP(GPIOH_8),
0331     GPIO_GROUP(GPIOH_9),
0332 
0333     GPIO_GROUP(BOOT_0),
0334     GPIO_GROUP(BOOT_1),
0335     GPIO_GROUP(BOOT_2),
0336     GPIO_GROUP(BOOT_3),
0337     GPIO_GROUP(BOOT_4),
0338     GPIO_GROUP(BOOT_5),
0339     GPIO_GROUP(BOOT_6),
0340     GPIO_GROUP(BOOT_7),
0341     GPIO_GROUP(BOOT_8),
0342     GPIO_GROUP(BOOT_9),
0343     GPIO_GROUP(BOOT_10),
0344     GPIO_GROUP(BOOT_11),
0345     GPIO_GROUP(BOOT_12),
0346     GPIO_GROUP(BOOT_13),
0347     GPIO_GROUP(BOOT_14),
0348     GPIO_GROUP(BOOT_15),
0349 
0350     GPIO_GROUP(CARD_0),
0351     GPIO_GROUP(CARD_1),
0352     GPIO_GROUP(CARD_2),
0353     GPIO_GROUP(CARD_3),
0354     GPIO_GROUP(CARD_4),
0355     GPIO_GROUP(CARD_5),
0356     GPIO_GROUP(CARD_6),
0357 
0358     GPIO_GROUP(GPIODV_0),
0359     GPIO_GROUP(GPIODV_1),
0360     GPIO_GROUP(GPIODV_2),
0361     GPIO_GROUP(GPIODV_3),
0362     GPIO_GROUP(GPIODV_4),
0363     GPIO_GROUP(GPIODV_5),
0364     GPIO_GROUP(GPIODV_6),
0365     GPIO_GROUP(GPIODV_7),
0366     GPIO_GROUP(GPIODV_8),
0367     GPIO_GROUP(GPIODV_9),
0368     GPIO_GROUP(GPIODV_10),
0369     GPIO_GROUP(GPIODV_11),
0370     GPIO_GROUP(GPIODV_12),
0371     GPIO_GROUP(GPIODV_13),
0372     GPIO_GROUP(GPIODV_14),
0373     GPIO_GROUP(GPIODV_15),
0374     GPIO_GROUP(GPIODV_16),
0375     GPIO_GROUP(GPIODV_17),
0376     GPIO_GROUP(GPIODV_19),
0377     GPIO_GROUP(GPIODV_20),
0378     GPIO_GROUP(GPIODV_21),
0379     GPIO_GROUP(GPIODV_22),
0380     GPIO_GROUP(GPIODV_23),
0381     GPIO_GROUP(GPIODV_24),
0382     GPIO_GROUP(GPIODV_25),
0383     GPIO_GROUP(GPIODV_26),
0384     GPIO_GROUP(GPIODV_27),
0385     GPIO_GROUP(GPIODV_28),
0386     GPIO_GROUP(GPIODV_29),
0387 
0388     GPIO_GROUP(GPIOX_0),
0389     GPIO_GROUP(GPIOX_1),
0390     GPIO_GROUP(GPIOX_2),
0391     GPIO_GROUP(GPIOX_3),
0392     GPIO_GROUP(GPIOX_4),
0393     GPIO_GROUP(GPIOX_5),
0394     GPIO_GROUP(GPIOX_6),
0395     GPIO_GROUP(GPIOX_7),
0396     GPIO_GROUP(GPIOX_8),
0397     GPIO_GROUP(GPIOX_9),
0398     GPIO_GROUP(GPIOX_10),
0399     GPIO_GROUP(GPIOX_11),
0400     GPIO_GROUP(GPIOX_12),
0401     GPIO_GROUP(GPIOX_13),
0402     GPIO_GROUP(GPIOX_14),
0403     GPIO_GROUP(GPIOX_15),
0404     GPIO_GROUP(GPIOX_16),
0405     GPIO_GROUP(GPIOX_17),
0406     GPIO_GROUP(GPIOX_18),
0407 
0408     GPIO_GROUP(GPIOCLK_0),
0409     GPIO_GROUP(GPIOCLK_1),
0410 
0411     GPIO_GROUP(GPIO_TEST_N),
0412 
0413     /* Bank X */
0414     GROUP(sdio_d0,      5,  31),
0415     GROUP(sdio_d1,      5,  30),
0416     GROUP(sdio_d2,      5,  29),
0417     GROUP(sdio_d3,      5,  28),
0418     GROUP(sdio_clk,     5,  27),
0419     GROUP(sdio_cmd,     5,  26),
0420     GROUP(sdio_irq,     5,  24),
0421     GROUP(uart_tx_a,    5,  19),
0422     GROUP(uart_rx_a,    5,  18),
0423     GROUP(uart_cts_a,   5,  17),
0424     GROUP(uart_rts_a,   5,  16),
0425     GROUP(uart_tx_c,    5,  13),
0426     GROUP(uart_rx_c,    5,  12),
0427     GROUP(uart_cts_c,   5,  11),
0428     GROUP(uart_rts_c,   5,  10),
0429     GROUP(pwm_a,        5,  25),
0430     GROUP(pwm_e,        5,  15),
0431     GROUP(pwm_f_x,      5,  14),
0432     GROUP(spi_mosi,     5,  3),
0433     GROUP(spi_miso,     5,  2),
0434     GROUP(spi_ss0,      5,  1),
0435     GROUP(spi_sclk,     5,  0),
0436 
0437     /* Bank Z */
0438     GROUP(eth_mdio,     4,  23),
0439     GROUP(eth_mdc,      4,  22),
0440     GROUP(eth_clk_rx_clk,   4,  21),
0441     GROUP(eth_rx_dv,    4,  20),
0442     GROUP(eth_rxd0,     4,  19),
0443     GROUP(eth_rxd1,     4,  18),
0444     GROUP(eth_rxd2,     4,  17),
0445     GROUP(eth_rxd3,     4,  16),
0446     GROUP(eth_rgmii_tx_clk, 4,  15),
0447     GROUP(eth_tx_en,    4,  14),
0448     GROUP(eth_txd0,     4,  13),
0449     GROUP(eth_txd1,     4,  12),
0450     GROUP(eth_txd2,     4,  11),
0451     GROUP(eth_txd3,     4,  10),
0452     GROUP(tsin_b_fail_z4,   3,  15),
0453     GROUP(tsin_b_clk_z3,    3,  16),
0454     GROUP(tsin_b_d0_z2, 3,  17),
0455     GROUP(tsin_b_sop_z1,    3,  18),
0456     GROUP(tsin_b_d_valid_z0, 3, 19),
0457     GROUP(pwm_c,        3,  20),
0458     GROUP(i2s_out_ch23_z,   3,  26),
0459     GROUP(i2s_out_ch45_z,   3,  25),
0460     GROUP(i2s_out_ch67_z,   3,  24),
0461     GROUP(eth_link_led, 4,  25),
0462     GROUP(eth_act_led,  4,  24),
0463 
0464     /* Bank H */
0465     GROUP(hdmi_hpd,     6,  31),
0466     GROUP(hdmi_sda,     6,  30),
0467     GROUP(hdmi_scl,     6,  29),
0468     GROUP(i2s_am_clk,   6,  26),
0469     GROUP(i2s_out_ao_clk,   6,  25),
0470     GROUP(i2s_out_lr_clk,   6,  24),
0471     GROUP(i2s_out_ch01, 6,  23),
0472     GROUP(spdif_out_h,  6,  28),
0473     GROUP(tsin_b_d0,    6,  17),
0474     GROUP(tsin_b_sop,   6,  18),
0475     GROUP(tsin_b_d_valid,   6,  19),
0476     GROUP(tsin_b_clk,   6,  20),
0477 
0478     /* Bank DV */
0479     GROUP(uart_tx_b,    2,  16),
0480     GROUP(uart_rx_b,    2,  15),
0481     GROUP(uart_cts_b,   2,  14),
0482     GROUP(uart_rts_b,   2,  13),
0483     GROUP(i2c_sda_c_dv18,   1,  17),
0484     GROUP(i2c_sck_c_dv19,   1,  16),
0485     GROUP(i2c_sda_a,    1,  15),
0486     GROUP(i2c_sck_a,    1,  14),
0487     GROUP(i2c_sda_b,    1,  13),
0488     GROUP(i2c_sck_b,    1,  12),
0489     GROUP(i2c_sda_c,    1,  11),
0490     GROUP(i2c_sck_c,    1,  10),
0491     GROUP(pwm_b,        2,  11),
0492     GROUP(pwm_d,        2,  12),
0493     GROUP(tsin_a_d0,    2,  4),
0494     GROUP(tsin_a_dp,    2,  3),
0495     GROUP(tsin_a_clk,   2,  2),
0496     GROUP(tsin_a_sop,   2,  1),
0497     GROUP(tsin_a_d_valid,   2,  0),
0498     GROUP(tsin_a_fail,  1,  31),
0499 
0500     /* Bank BOOT */
0501     GROUP(emmc_nand_d07,    7,  31),
0502     GROUP(emmc_clk,     7,  30),
0503     GROUP(emmc_cmd,     7,  29),
0504     GROUP(emmc_ds,      7,  28),
0505     GROUP(nor_d,        7,  13),
0506     GROUP(nor_q,        7,  12),
0507     GROUP(nor_c,        7,  11),
0508     GROUP(nor_cs,       7,  10),
0509     GROUP(nand_ce0,     7,  7),
0510     GROUP(nand_ce1,     7,  6),
0511     GROUP(nand_rb0,     7,  5),
0512     GROUP(nand_ale,     7,  4),
0513     GROUP(nand_cle,     7,  3),
0514     GROUP(nand_wen_clk, 7,  2),
0515     GROUP(nand_ren_wr,  7,  1),
0516     GROUP(nand_dqs,     7,  0),
0517 
0518     /* Bank CARD */
0519     GROUP(sdcard_d1,    6,  5),
0520     GROUP(sdcard_d0,    6,  4),
0521     GROUP(sdcard_d3,    6,  1),
0522     GROUP(sdcard_d2,    6,  0),
0523     GROUP(sdcard_cmd,   6,  2),
0524     GROUP(sdcard_clk,   6,  3),
0525 
0526     /* Bank CLK */
0527     GROUP(pwm_f_clk,    8,  30),
0528 };
0529 
0530 static struct meson_pmx_group meson_gxl_aobus_groups[] = {
0531     GPIO_GROUP(GPIOAO_0),
0532     GPIO_GROUP(GPIOAO_1),
0533     GPIO_GROUP(GPIOAO_2),
0534     GPIO_GROUP(GPIOAO_3),
0535     GPIO_GROUP(GPIOAO_4),
0536     GPIO_GROUP(GPIOAO_5),
0537     GPIO_GROUP(GPIOAO_6),
0538     GPIO_GROUP(GPIOAO_7),
0539     GPIO_GROUP(GPIOAO_8),
0540     GPIO_GROUP(GPIOAO_9),
0541 
0542     /* bank AO */
0543     GROUP(uart_tx_ao_b_0,   0,  26),
0544     GROUP(uart_rx_ao_b_1,   0,  25),
0545     GROUP(uart_tx_ao_b, 0,  24),
0546     GROUP(uart_rx_ao_b, 0,  23),
0547     GROUP(uart_tx_ao_a, 0,  12),
0548     GROUP(uart_rx_ao_a, 0,  11),
0549     GROUP(uart_cts_ao_a,    0,  10),
0550     GROUP(uart_rts_ao_a,    0,  9),
0551     GROUP(uart_cts_ao_b,    0,  8),
0552     GROUP(uart_rts_ao_b,    0,  7),
0553     GROUP(i2c_sck_ao,   0,  6),
0554     GROUP(i2c_sda_ao,   0,  5),
0555     GROUP(i2c_slave_sck_ao, 0,  2),
0556     GROUP(i2c_slave_sda_ao, 0,  1),
0557     GROUP(remote_input_ao,  0,  0),
0558     GROUP(pwm_ao_a_3,   0,  22),
0559     GROUP(pwm_ao_b_6,   0,  18),
0560     GROUP(pwm_ao_a_8,   0,  17),
0561     GROUP(pwm_ao_b,     0,  3),
0562     GROUP(i2s_out_ch23_ao,  1,  0),
0563     GROUP(i2s_out_ch45_ao,  1,  1),
0564     GROUP(spdif_out_ao_6,   0,  16),
0565     GROUP(spdif_out_ao_9,   0,  4),
0566     GROUP(ao_cec,       0,  15),
0567     GROUP(ee_cec,       0,  14),
0568 
0569     /* test n pin */
0570     GROUP(i2s_out_ch67_ao,  1,  2),
0571 };
0572 
0573 static const char * const gpio_periphs_groups[] = {
0574     "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
0575     "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
0576     "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14",
0577     "GPIOZ_15",
0578 
0579     "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4",
0580     "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9",
0581 
0582     "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
0583     "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
0584     "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
0585     "BOOT_15",
0586 
0587     "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4",
0588     "CARD_5", "CARD_6",
0589 
0590     "GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4",
0591     "GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9",
0592     "GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14",
0593     "GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19",
0594     "GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24",
0595     "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29",
0596 
0597     "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
0598     "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
0599     "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
0600     "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18",
0601 };
0602 
0603 static const char * const emmc_groups[] = {
0604     "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds",
0605 };
0606 
0607 static const char * const nor_groups[] = {
0608     "nor_d", "nor_q", "nor_c", "nor_cs",
0609 };
0610 
0611 static const char * const spi_groups[] = {
0612     "spi_mosi", "spi_miso", "spi_ss0", "spi_sclk",
0613 };
0614 
0615 static const char * const sdcard_groups[] = {
0616     "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3",
0617     "sdcard_cmd", "sdcard_clk",
0618 };
0619 
0620 static const char * const sdio_groups[] = {
0621     "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
0622     "sdio_cmd", "sdio_clk", "sdio_irq",
0623 };
0624 
0625 static const char * const nand_groups[] = {
0626     "emmc_nand_d07", "nand_ce0", "nand_ce1", "nand_rb0", "nand_ale",
0627     "nand_cle", "nand_wen_clk", "nand_ren_wr", "nand_dqs",
0628 };
0629 
0630 static const char * const uart_a_groups[] = {
0631     "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a",
0632 };
0633 
0634 static const char * const uart_b_groups[] = {
0635     "uart_tx_b", "uart_rx_b", "uart_cts_b", "uart_rts_b",
0636 };
0637 
0638 static const char * const uart_c_groups[] = {
0639     "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c",
0640 };
0641 
0642 static const char * const i2c_a_groups[] = {
0643     "i2c_sck_a", "i2c_sda_a",
0644 };
0645 
0646 static const char * const i2c_b_groups[] = {
0647     "i2c_sck_b", "i2c_sda_b",
0648 };
0649 
0650 static const char * const i2c_c_groups[] = {
0651     "i2c_sck_c", "i2c_sda_c", "i2c_sda_c_dv18", "i2c_sck_c_dv19",
0652 };
0653 
0654 static const char * const eth_groups[] = {
0655     "eth_mdio", "eth_mdc", "eth_clk_rx_clk", "eth_rx_dv",
0656     "eth_rxd0", "eth_rxd1", "eth_rxd2", "eth_rxd3",
0657     "eth_rgmii_tx_clk", "eth_tx_en",
0658     "eth_txd0", "eth_txd1", "eth_txd2", "eth_txd3",
0659 };
0660 
0661 static const char * const pwm_a_groups[] = {
0662     "pwm_a",
0663 };
0664 
0665 static const char * const pwm_b_groups[] = {
0666     "pwm_b",
0667 };
0668 
0669 static const char * const pwm_c_groups[] = {
0670     "pwm_c",
0671 };
0672 
0673 static const char * const pwm_d_groups[] = {
0674     "pwm_d",
0675 };
0676 
0677 static const char * const pwm_e_groups[] = {
0678     "pwm_e",
0679 };
0680 
0681 static const char * const pwm_f_groups[] = {
0682     "pwm_f_clk", "pwm_f_x",
0683 };
0684 
0685 static const char * const hdmi_hpd_groups[] = {
0686     "hdmi_hpd",
0687 };
0688 
0689 static const char * const hdmi_i2c_groups[] = {
0690     "hdmi_sda", "hdmi_scl",
0691 };
0692 
0693 static const char * const i2s_out_groups[] = {
0694     "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk",
0695     "i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z",
0696 };
0697 
0698 static const char * const spdif_out_groups[] = {
0699     "spdif_out_h",
0700 };
0701 
0702 static const char * const eth_led_groups[] = {
0703     "eth_link_led", "eth_act_led",
0704 };
0705 
0706 static const char * const tsin_a_groups[] = {
0707     "tsin_a_clk", "tsin_a_sop",
0708     "tsin_a_d_valid", "tsin_a_d0",
0709     "tsin_a_dp", "tsin_a_fail",
0710 };
0711 
0712 static const char * const tsin_b_groups[] = {
0713     "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0",
0714     "tsin_b_clk_z3", "tsin_b_sop_z1", "tsin_b_d_valid_z0", "tsin_b_d0_z2",
0715     "tsin_b_fail_z4",
0716 };
0717 
0718 static const char * const gpio_aobus_groups[] = {
0719     "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
0720     "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
0721 
0722     "GPIO_TEST_N",
0723 };
0724 
0725 static const char * const uart_ao_groups[] = {
0726     "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a",
0727 };
0728 
0729 static const char * const uart_ao_b_groups[] = {
0730     "uart_tx_ao_b", "uart_rx_ao_b", "uart_cts_ao_b", "uart_rts_ao_b",
0731     "uart_tx_ao_b_0", "uart_rx_ao_b_1",
0732 };
0733 
0734 static const char * const i2c_ao_groups[] = {
0735     "i2c_sck_ao", "i2c_sda_ao",
0736 };
0737 
0738 static const char * const i2c_slave_ao_groups[] = {
0739     "i2c_slave_sck_ao", "i2c_slave_sda_ao",
0740 };
0741 
0742 static const char * const remote_input_ao_groups[] = {
0743     "remote_input_ao",
0744 };
0745 
0746 static const char * const pwm_ao_a_groups[] = {
0747     "pwm_ao_a_3", "pwm_ao_a_8",
0748 };
0749 
0750 static const char * const pwm_ao_b_groups[] = {
0751     "pwm_ao_b", "pwm_ao_b_6",
0752 };
0753 
0754 static const char * const i2s_out_ao_groups[] = {
0755     "i2s_out_ch23_ao", "i2s_out_ch45_ao", "i2s_out_ch67_ao",
0756 };
0757 
0758 static const char * const spdif_out_ao_groups[] = {
0759     "spdif_out_ao_6", "spdif_out_ao_9",
0760 };
0761 
0762 static const char * const cec_ao_groups[] = {
0763     "ao_cec", "ee_cec",
0764 };
0765 
0766 static struct meson_pmx_func meson_gxl_periphs_functions[] = {
0767     FUNCTION(gpio_periphs),
0768     FUNCTION(emmc),
0769     FUNCTION(nor),
0770     FUNCTION(spi),
0771     FUNCTION(sdcard),
0772     FUNCTION(sdio),
0773     FUNCTION(nand),
0774     FUNCTION(uart_a),
0775     FUNCTION(uart_b),
0776     FUNCTION(uart_c),
0777     FUNCTION(i2c_a),
0778     FUNCTION(i2c_b),
0779     FUNCTION(i2c_c),
0780     FUNCTION(eth),
0781     FUNCTION(pwm_a),
0782     FUNCTION(pwm_b),
0783     FUNCTION(pwm_c),
0784     FUNCTION(pwm_d),
0785     FUNCTION(pwm_e),
0786     FUNCTION(pwm_f),
0787     FUNCTION(hdmi_hpd),
0788     FUNCTION(hdmi_i2c),
0789     FUNCTION(i2s_out),
0790     FUNCTION(spdif_out),
0791     FUNCTION(eth_led),
0792     FUNCTION(tsin_a),
0793     FUNCTION(tsin_b),
0794 };
0795 
0796 static struct meson_pmx_func meson_gxl_aobus_functions[] = {
0797     FUNCTION(gpio_aobus),
0798     FUNCTION(uart_ao),
0799     FUNCTION(uart_ao_b),
0800     FUNCTION(i2c_ao),
0801     FUNCTION(i2c_slave_ao),
0802     FUNCTION(remote_input_ao),
0803     FUNCTION(pwm_ao_a),
0804     FUNCTION(pwm_ao_b),
0805     FUNCTION(i2s_out_ao),
0806     FUNCTION(spdif_out_ao),
0807     FUNCTION(cec_ao),
0808 };
0809 
0810 static struct meson_bank meson_gxl_periphs_banks[] = {
0811     /*   name    first      last       irq       pullen  pull    dir     out     in  */
0812     BANK("X",    GPIOX_0,   GPIOX_18,   89, 107, 4,  0,  4,  0,  12, 0,  13, 0,  14, 0),
0813     BANK("DV",   GPIODV_0,  GPIODV_29,  83,  88, 0,  0,  0,  0,  0,  0,  1,  0,  2,  0),
0814     BANK("H",    GPIOH_0,   GPIOH_9,    26,  35, 1, 20,  1, 20,  3, 20,  4, 20,  5, 20),
0815     BANK("Z",    GPIOZ_0,   GPIOZ_15,   10,  25, 3,  0,  3,  0,  9,  0,  10, 0, 11,  0),
0816     BANK("CARD", CARD_0,    CARD_6,     52,  58, 2, 20,  2, 20,  6, 20,  7, 20,  8, 20),
0817     BANK("BOOT", BOOT_0,    BOOT_15,    36,  51, 2,  0,  2,  0,  6,  0,  7,  0,  8,  0),
0818     BANK("CLK",  GPIOCLK_0, GPIOCLK_1, 108, 109, 3, 28,  3, 28,  9, 28, 10, 28, 11, 28),
0819 };
0820 
0821 static struct meson_bank meson_gxl_aobus_banks[] = {
0822     /*   name    first      last      irq   pullen  pull    dir     out     in  */
0823     BANK("AO",   GPIOAO_0,  GPIOAO_9, 0, 9, 0,  16, 0, 0,   0,  0,  0, 16,  1,  0),
0824 };
0825 
0826 static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
0827     .name       = "periphs-banks",
0828     .pins       = meson_gxl_periphs_pins,
0829     .groups     = meson_gxl_periphs_groups,
0830     .funcs      = meson_gxl_periphs_functions,
0831     .banks      = meson_gxl_periphs_banks,
0832     .num_pins   = ARRAY_SIZE(meson_gxl_periphs_pins),
0833     .num_groups = ARRAY_SIZE(meson_gxl_periphs_groups),
0834     .num_funcs  = ARRAY_SIZE(meson_gxl_periphs_functions),
0835     .num_banks  = ARRAY_SIZE(meson_gxl_periphs_banks),
0836     .pmx_ops    = &meson8_pmx_ops,
0837 };
0838 
0839 static struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = {
0840     .name       = "aobus-banks",
0841     .pins       = meson_gxl_aobus_pins,
0842     .groups     = meson_gxl_aobus_groups,
0843     .funcs      = meson_gxl_aobus_functions,
0844     .banks      = meson_gxl_aobus_banks,
0845     .num_pins   = ARRAY_SIZE(meson_gxl_aobus_pins),
0846     .num_groups = ARRAY_SIZE(meson_gxl_aobus_groups),
0847     .num_funcs  = ARRAY_SIZE(meson_gxl_aobus_functions),
0848     .num_banks  = ARRAY_SIZE(meson_gxl_aobus_banks),
0849     .pmx_ops    = &meson8_pmx_ops,
0850     .parse_dt   = meson8_aobus_parse_dt_extra,
0851 };
0852 
0853 static const struct of_device_id meson_gxl_pinctrl_dt_match[] = {
0854     {
0855         .compatible = "amlogic,meson-gxl-periphs-pinctrl",
0856         .data = &meson_gxl_periphs_pinctrl_data,
0857     },
0858     {
0859         .compatible = "amlogic,meson-gxl-aobus-pinctrl",
0860         .data = &meson_gxl_aobus_pinctrl_data,
0861     },
0862     { },
0863 };
0864 MODULE_DEVICE_TABLE(of, meson_gxl_pinctrl_dt_match);
0865 
0866 static struct platform_driver meson_gxl_pinctrl_driver = {
0867     .probe      = meson_pinctrl_probe,
0868     .driver = {
0869         .name   = "meson-gxl-pinctrl",
0870         .of_match_table = meson_gxl_pinctrl_dt_match,
0871     },
0872 };
0873 module_platform_driver(meson_gxl_pinctrl_driver);
0874 MODULE_LICENSE("GPL v2");