Back to home page

OSCL-LXR

 
 

    


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