linux/drivers/pinctrl/meson/pinctrl-meson-s4.c
<<
>>
Prefs
   1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
   2/*
   3 * Pin controller and GPIO driver for Amlogic Meson S4 SoC.
   4 *
   5 * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
   6 * Author: Qianggui Song <qianggui.song@amlogic.com>
   7 */
   8
   9#include <dt-bindings/gpio/meson-s4-gpio.h>
  10#include "pinctrl-meson.h"
  11#include "pinctrl-meson-axg-pmx.h"
  12
  13static const struct pinctrl_pin_desc meson_s4_periphs_pins[] = {
  14        MESON_PIN(GPIOE_0),
  15        MESON_PIN(GPIOE_1),
  16
  17        MESON_PIN(GPIOB_0),
  18        MESON_PIN(GPIOB_1),
  19        MESON_PIN(GPIOB_2),
  20        MESON_PIN(GPIOB_3),
  21        MESON_PIN(GPIOB_4),
  22        MESON_PIN(GPIOB_5),
  23        MESON_PIN(GPIOB_6),
  24        MESON_PIN(GPIOB_7),
  25        MESON_PIN(GPIOB_8),
  26        MESON_PIN(GPIOB_9),
  27        MESON_PIN(GPIOB_10),
  28        MESON_PIN(GPIOB_11),
  29        MESON_PIN(GPIOB_12),
  30        MESON_PIN(GPIOB_13),
  31
  32        MESON_PIN(GPIOC_0),
  33        MESON_PIN(GPIOC_1),
  34        MESON_PIN(GPIOC_2),
  35        MESON_PIN(GPIOC_3),
  36        MESON_PIN(GPIOC_4),
  37        MESON_PIN(GPIOC_5),
  38        MESON_PIN(GPIOC_6),
  39        MESON_PIN(GPIOC_7),
  40
  41        MESON_PIN(GPIOD_0),
  42        MESON_PIN(GPIOD_1),
  43        MESON_PIN(GPIOD_2),
  44        MESON_PIN(GPIOD_3),
  45        MESON_PIN(GPIOD_4),
  46        MESON_PIN(GPIOD_5),
  47        MESON_PIN(GPIOD_6),
  48        MESON_PIN(GPIOD_7),
  49        MESON_PIN(GPIOD_8),
  50        MESON_PIN(GPIOD_9),
  51        MESON_PIN(GPIOD_10),
  52        MESON_PIN(GPIOD_11),
  53
  54        MESON_PIN(GPIOH_0),
  55        MESON_PIN(GPIOH_1),
  56        MESON_PIN(GPIOH_2),
  57        MESON_PIN(GPIOH_3),
  58        MESON_PIN(GPIOH_4),
  59        MESON_PIN(GPIOH_5),
  60        MESON_PIN(GPIOH_6),
  61        MESON_PIN(GPIOH_7),
  62        MESON_PIN(GPIOH_8),
  63        MESON_PIN(GPIOH_9),
  64        MESON_PIN(GPIOH_10),
  65        MESON_PIN(GPIOH_11),
  66
  67        MESON_PIN(GPIOX_0),
  68        MESON_PIN(GPIOX_1),
  69        MESON_PIN(GPIOX_2),
  70        MESON_PIN(GPIOX_3),
  71        MESON_PIN(GPIOX_4),
  72        MESON_PIN(GPIOX_5),
  73        MESON_PIN(GPIOX_6),
  74        MESON_PIN(GPIOX_7),
  75        MESON_PIN(GPIOX_8),
  76        MESON_PIN(GPIOX_9),
  77        MESON_PIN(GPIOX_10),
  78        MESON_PIN(GPIOX_11),
  79        MESON_PIN(GPIOX_12),
  80        MESON_PIN(GPIOX_13),
  81        MESON_PIN(GPIOX_14),
  82        MESON_PIN(GPIOX_15),
  83        MESON_PIN(GPIOX_16),
  84        MESON_PIN(GPIOX_17),
  85        MESON_PIN(GPIOX_18),
  86        MESON_PIN(GPIOX_19),
  87
  88        MESON_PIN(GPIOZ_0),
  89        MESON_PIN(GPIOZ_1),
  90        MESON_PIN(GPIOZ_2),
  91        MESON_PIN(GPIOZ_3),
  92        MESON_PIN(GPIOZ_4),
  93        MESON_PIN(GPIOZ_5),
  94        MESON_PIN(GPIOZ_6),
  95        MESON_PIN(GPIOZ_7),
  96        MESON_PIN(GPIOZ_8),
  97        MESON_PIN(GPIOZ_9),
  98        MESON_PIN(GPIOZ_10),
  99        MESON_PIN(GPIOZ_11),
 100        MESON_PIN(GPIOZ_12),
 101
 102        MESON_PIN(GPIO_TEST_N),
 103};
 104
 105/* BANK E func1 */
 106static const unsigned int i2c0_sda_pins[]               = { GPIOE_0 };
 107static const unsigned int i2c0_scl_pins[]               = { GPIOE_1 };
 108
 109/* BANK E func2 */
 110static const unsigned int uart_b_tx_e_pins[]            = { GPIOE_0 };
 111static const unsigned int uart_b_rx_e_pins[]            = { GPIOE_1 };
 112
 113/* BANK E func3 */
 114static const unsigned int pwm_h_pins[]                  = { GPIOE_0 };
 115static const unsigned int pwm_j_pins[]                  = { GPIOE_1 };
 116
 117/* BANK B func1 */
 118static const unsigned int emmc_nand_d0_pins[]           = { GPIOB_0 };
 119static const unsigned int emmc_nand_d1_pins[]           = { GPIOB_1 };
 120static const unsigned int emmc_nand_d2_pins[]           = { GPIOB_2 };
 121static const unsigned int emmc_nand_d3_pins[]           = { GPIOB_3 };
 122static const unsigned int emmc_nand_d4_pins[]           = { GPIOB_4 };
 123static const unsigned int emmc_nand_d5_pins[]           = { GPIOB_5 };
 124static const unsigned int emmc_nand_d6_pins[]           = { GPIOB_6 };
 125static const unsigned int emmc_nand_d7_pins[]           = { GPIOB_7 };
 126static const unsigned int emmc_clk_pins[]               = { GPIOB_8 };
 127static const unsigned int emmc_rst_pins[]               = { GPIOB_9 };
 128static const unsigned int emmc_cmd_pins[]               = { GPIOB_10 };
 129static const unsigned int emmc_nand_ds_pins[]           = { GPIOB_11 };
 130
 131/* Bank B func2 */
 132static const unsigned int nand_wen_clk_pins[]           = { GPIOB_8 };
 133static const unsigned int nand_ale_pins[]               = { GPIOB_9 };
 134static const unsigned int nand_ren_wr_pins[]            = { GPIOB_10 };
 135static const unsigned int nand_cle_pins[]               = { GPIOB_11 };
 136static const unsigned int nand_ce0_pins[]               = { GPIOB_12 };
 137
 138/* Bank B func3 */
 139static const unsigned int spif_hold_pins[]              = { GPIOB_3 };
 140static const unsigned int spif_mo_pins[]                = { GPIOB_4 };
 141static const unsigned int spif_mi_pins[]                = { GPIOB_5 };
 142static const unsigned int spif_clk_pins[]               = { GPIOB_6 };
 143static const unsigned int spif_wp_pins[]                = { GPIOB_7 };
 144static const unsigned int spif_cs_pins[]                = { GPIOB_13 };
 145
 146/* Bank C func1 */
 147static const unsigned int sdcard_d0_c_pins[]            = { GPIOC_0 };
 148static const unsigned int sdcard_d1_c_pins[]            = { GPIOC_1 };
 149static const unsigned int sdcard_d2_c_pins[]            = { GPIOC_2 };
 150static const unsigned int sdcard_d3_c_pins[]            = { GPIOC_3 };
 151static const unsigned int sdcard_clk_c_pins[]           = { GPIOC_4 };
 152static const unsigned int sdcard_cmd_c_pins[]           = { GPIOC_5 };
 153static const unsigned int sdcard_cd_pins[]              = { GPIOC_6 };
 154
 155/* Bank C func2 */
 156static const unsigned int jtag_2_tdo_pins[]             = { GPIOC_0 };
 157static const unsigned int jtag_2_tdi_pins[]             = { GPIOC_1 };
 158static const unsigned int uart_b_rx_c_pins[]            = { GPIOC_2 };
 159static const unsigned int uart_b_tx_c_pins[]            = { GPIOC_3 };
 160static const unsigned int jtag_2_clk_pins[]             = { GPIOC_4 };
 161static const unsigned int jtag_2_tms_pins[]             = { GPIOC_5 };
 162static const unsigned int i2c1_sda_c_pins[]             = { GPIOC_6 };
 163static const unsigned int i2c1_scl_c_pins[]             = { GPIOC_7 };
 164
 165/* Bank C func3 */
 166static const unsigned int pdm_din1_c_pins[]             = { GPIOC_0 };
 167static const unsigned int pdm_din0_c_pins[]             = { GPIOC_1 };
 168static const unsigned int i2c4_sda_c_pins[]             = { GPIOC_2 };
 169static const unsigned int i2c4_scl_c_pins[]             = { GPIOC_3 };
 170static const unsigned int pdm_dclk_c_pins[]             = { GPIOC_4 };
 171static const unsigned int iso7816_clk_c_pins[]          = { GPIOC_5 };
 172static const unsigned int iso7816_data_c_pins[]         = { GPIOC_6 };
 173
 174/* Bank C func4 */
 175static const unsigned int tdm_d2_c_pins[]               = { GPIOC_0 };
 176static const unsigned int tdm_d3_c_pins[]               = { GPIOC_1 };
 177static const unsigned int tdm_fs1_c_pins[]              = { GPIOC_2 };
 178static const unsigned int tdm_sclk1_c_pins[]            = { GPIOC_3 };
 179static const unsigned int mclk_1_c_pins[]               = { GPIOC_4 };
 180static const unsigned int tdm_d4_c_pins[]               = { GPIOC_5 };
 181static const unsigned int tdm_d5_c_pins[]               = { GPIOC_6 };
 182
 183/* Bank D func1 */
 184static const unsigned int uart_b_tx_d_pins[]            = { GPIOD_0 };
 185static const unsigned int uart_b_rx_d_pins[]            = { GPIOD_1 };
 186static const unsigned int uart_b_cts_d_pins[]           = { GPIOD_2 };
 187static const unsigned int uart_b_rts_d_pins[]           = { GPIOD_3 };
 188static const unsigned int remote_out_pins[]             = { GPIOD_4 };
 189static const unsigned int remote_in_pins[]              = { GPIOD_5 };
 190static const unsigned int jtag_1_clk_pins[]             = { GPIOD_6 };
 191static const unsigned int jtag_1_tms_pins[]             = { GPIOD_7 };
 192static const unsigned int jtag_1_tdi_pins[]             = { GPIOD_8 };
 193static const unsigned int jtag_1_tdo_pins[]             = { GPIOD_9 };
 194static const unsigned int clk12_24_pins[]               = { GPIOD_10 };
 195static const unsigned int pwm_g_hiz_pins[]              = { GPIOD_11 };
 196
 197/* Bank D func2 */
 198static const unsigned int i2c4_sda_d_pins[]             = { GPIOD_2 };
 199static const unsigned int i2c4_scl_d_pins[]             = { GPIOD_3 };
 200static const unsigned int mclk_1_d_pins[]               = { GPIOD_4 };
 201static const unsigned int tdm_sclk1_d_pins[]            = { GPIOD_6 };
 202static const unsigned int tdm_fs1_d_pins[]              = { GPIOD_7 };
 203static const unsigned int tdm_d4_d_pins[]               = { GPIOD_8 };
 204static const unsigned int tdm_d3_d_pins[]               = { GPIOD_9 };
 205static const unsigned int tdm_d2_d_pins[]               = { GPIOD_10 };
 206static const unsigned int pwm_g_d_pins[]                = { GPIOD_11 };
 207
 208/* Bank D func3 */
 209static const unsigned int uart_c_tx_pins[]              = { GPIOD_2 };
 210static const unsigned int uart_c_rx_pins[]              = { GPIOD_3 };
 211static const unsigned int pwm_b_d_pins[]                = { GPIOD_4 };
 212static const unsigned int pwm_a_d_pins[]                = { GPIOD_6 };
 213static const unsigned int pwm_c_d_pins[]                = { GPIOD_7 };
 214static const unsigned int pwm_d_d_pins[]                = { GPIOD_8 };
 215static const unsigned int pwm_i_d_pins[]                = { GPIOD_9 };
 216
 217/* Bank D func4 */
 218static const unsigned int clk_32k_in_pins[]             = { GPIOD_2 };
 219static const unsigned int pwm_b_hiz_pins[]              = { GPIOD_4 };
 220static const unsigned int pwm_a_hiz_pins[]              = { GPIOD_6 };
 221static const unsigned int pwm_c_hiz_pins[]              = { GPIOD_7 };
 222static const unsigned int pdm_dclk_d_pins[]             = { GPIOD_8 };
 223static const unsigned int pdm_din0_d_pins[]             = { GPIOD_9 };
 224static const unsigned int pdm_din1_d_pins[]             = { GPIOD_10 };
 225
 226/* Bank D func5 */
 227static const unsigned int mic_mute_en_pins[]            = { GPIOD_2 };
 228static const unsigned int mic_mute_key_pins[]           = { GPIOD_3 };
 229static const unsigned int i2c1_sda_d_pins[]             = { GPIOD_6 };
 230static const unsigned int i2c1_scl_d_pins[]             = { GPIOD_7 };
 231static const unsigned int i2c2_sda_d_pins[]             = { GPIOD_10 };
 232static const unsigned int i2c2_scl_d_pins[]             = { GPIOD_11 };
 233
 234/* Bank D func6 */
 235static const unsigned int gen_clk_d_pins[]              = { GPIOD_10 };
 236static const unsigned int tsin_b_clk_c_pins[]           = { GPIOD_6 };
 237static const unsigned int tsin_b_sop_c_pins[]           = { GPIOD_7 };
 238static const unsigned int tsin_b_valid_c_pins[]         = { GPIOD_8 };
 239static const unsigned int tsin_b_d0_c_pins[]            = { GPIOD_9 };
 240
 241/* Bank H func1 */
 242static const unsigned int hdmitx_sda_pins[]             = { GPIOH_0 };
 243static const unsigned int hdmitx_sck_pins[]             = { GPIOH_1 };
 244static const unsigned int hdmitx_hpd_in_pins[]          = { GPIOH_2 };
 245static const unsigned int ao_cec_a_pins[]               = { GPIOH_3 };
 246static const unsigned int spdif_out_h_pins[]            = { GPIOH_4 };
 247static const unsigned int spdif_in_pins[]               = { GPIOH_5 };
 248static const unsigned int i2c1_sda_h_pins[]             = { GPIOH_6 };
 249static const unsigned int i2c1_scl_h_pins[]             = { GPIOH_7 };
 250static const unsigned int i2c2_sda_h8_pins[]            = { GPIOH_8 };
 251static const unsigned int i2c2_scl_h9_pins[]            = { GPIOH_9 };
 252static const unsigned int eth_link_led_pins[]           = { GPIOH_10 };
 253static const unsigned int eth_act_led_pins[]            = { GPIOH_11 };
 254
 255/* Bank H func2 */
 256static const unsigned int i2c2_sda_h0_pins[]            = { GPIOH_0 };
 257static const unsigned int i2c2_scl_h1_pins[]            = { GPIOH_1 };
 258static const unsigned int ao_cec_b_pins[]               = { GPIOH_3 };
 259static const unsigned int uart_d_tx_h_pins[]            = { GPIOH_4 };
 260static const unsigned int uart_d_rx_h_pins[]            = { GPIOH_5 };
 261static const unsigned int uart_d_cts_h_pins[]           = { GPIOH_6 };
 262static const unsigned int uart_d_rts_h_pins[]           = { GPIOH_7 };
 263static const unsigned int iso7816_clk_h_pins[]          = { GPIOH_8 };
 264static const unsigned int iso7816_data_h_pins[]         = { GPIOH_9 };
 265static const unsigned int uart_e_tx_h_pins[]            = { GPIOH_10 };
 266static const unsigned int uart_e_rx_h_pins[]            = { GPIOH_11 };
 267
 268/* Bank H func3 */
 269static const unsigned int pwm_d_h_pins[]                = { GPIOH_6 };
 270static const unsigned int pwm_i_h_pins[]                = { GPIOH_7 };
 271static const unsigned int pdm_dclk_h_pins[]             = { GPIOH_8 };
 272static const unsigned int pdm_din0_h_pins[]             = { GPIOH_9 };
 273static const unsigned int pdm_din1_h_pins[]             = { GPIOH_10 };
 274
 275/* Bank H func4 */
 276static const unsigned int mclk_1_h_pins[]               = { GPIOH_4 };
 277static const unsigned int tdm_sclk1_h_pins[]            = { GPIOH_5 };
 278static const unsigned int tdm_fs1_h_pins[]              = { GPIOH_6 };
 279static const unsigned int tdm_d2_h_pins[]               = { GPIOH_7 };
 280static const unsigned int tdm_d3_h_pins[]               = { GPIOH_8 };
 281static const unsigned int tdm_d4_h_pins[]               = { GPIOH_9 };
 282
 283/* Bank H func5 */
 284static const unsigned int spi_a_miso_h_pins[]           = { GPIOH_4 };
 285static const unsigned int spi_a_mosi_h_pins[]           = { GPIOH_5 };
 286static const unsigned int spi_a_clk_h_pins[]            = { GPIOH_6 };
 287static const unsigned int spi_a_ss0_h_pins[]            = { GPIOH_7 };
 288
 289/* Bank H func6 */
 290static const unsigned int gen_clk_h_pins[]              = { GPIOH_11 };
 291static const unsigned int tsin_b1_clk_pins[]            = { GPIOH_4 };
 292static const unsigned int tsin_b1_sop_pins[]            = { GPIOH_5 };
 293static const unsigned int tsin_b1_valid_pins[]          = { GPIOH_6 };
 294static const unsigned int tsin_b1_d0_pins[]             = { GPIOH_7 };
 295
 296/* Bank X func1 */
 297static const unsigned int sdio_d0_pins[]                = { GPIOX_0 };
 298static const unsigned int sdio_d1_pins[]                = { GPIOX_1 };
 299static const unsigned int sdio_d2_pins[]                = { GPIOX_2 };
 300static const unsigned int sdio_d3_pins[]                = { GPIOX_3 };
 301static const unsigned int sdio_clk_pins[]               = { GPIOX_4 };
 302static const unsigned int sdio_cmd_pins[]               = { GPIOX_5 };
 303static const unsigned int pwm_a_x_pins[]                = { GPIOX_6 };
 304static const unsigned int pwm_f_x_pins[]                = { GPIOX_7 };
 305static const unsigned int tdm_d1_pins[]                 = { GPIOX_8 };
 306static const unsigned int tdm_d0_pins[]                 = { GPIOX_9 };
 307static const unsigned int tdm_fs0_pins[]                = { GPIOX_10 };
 308static const unsigned int tdm_sclk0_pins[]              = { GPIOX_11 };
 309static const unsigned int uart_a_tx_pins[]              = { GPIOX_12 };
 310static const unsigned int uart_a_rx_pins[]              = { GPIOX_13 };
 311static const unsigned int uart_a_cts_pins[]             = { GPIOX_14 };
 312static const unsigned int uart_a_rts_pins[]             = { GPIOX_15 };
 313static const unsigned int pwm_e_x_pins[]                = { GPIOX_16 };
 314static const unsigned int i2c1_sda_x_pins[]             = { GPIOX_17 };
 315static const unsigned int i2c1_scl_x_pins[]             = { GPIOX_18 };
 316static const unsigned int pwm_b_x_pins[]                = { GPIOX_19 };
 317
 318/* Bank X func2 */
 319static const unsigned int pdm_din0_x_pins[]             = { GPIOX_8 };
 320static const unsigned int pdm_din1_x_pins[]             = { GPIOX_9 };
 321static const unsigned int pdm_dclk_x_pins[]             = { GPIOX_11 };
 322
 323/* Bank X func3 */
 324static const unsigned int spi_a_mosi_x_pins[]           = { GPIOX_8 };
 325static const unsigned int spi_a_miso_x_pins[]           = { GPIOX_9 };
 326static const unsigned int spi_a_ss0_x_pins[]            = { GPIOX_10 };
 327static const unsigned int spi_a_clk_x_pins[]            = { GPIOX_11 };
 328
 329/* Bank X func4 */
 330static const unsigned int pwm_c_x_pins[]                = { GPIOX_8 };
 331static const unsigned int i2c_slave_scl_pins[]          = { GPIOX_10 };
 332static const unsigned int i2c_slave_sda_pins[]          = { GPIOX_11 };
 333
 334/* Bank X func5 */
 335static const unsigned int i2c3_sda_x_pins[]             = { GPIOX_10 };
 336static const unsigned int i2c3_scl_x_pins[]             = { GPIOX_11 };
 337
 338/* Bank Z func1 */
 339static const unsigned int tdm_fs2_pins[]                = { GPIOZ_0 };
 340static const unsigned int tdm_sclk2_pins[]              = { GPIOZ_1 };
 341static const unsigned int tdm_d4_z_pins[]               = { GPIOZ_2 };
 342static const unsigned int tdm_d5_z_pins[]               = { GPIOZ_3 };
 343static const unsigned int tdm_d6_pins[]                 = { GPIOZ_4 };
 344static const unsigned int tdm_d7_pins[]                 = { GPIOZ_5 };
 345static const unsigned int mclk_2_pins[]                 = { GPIOZ_6 };
 346static const unsigned int spdif_out_z_pins[]            = { GPIOZ_9 };
 347static const unsigned int dtv_a_if_agc_z10_pins[]       = { GPIOZ_10 };
 348static const unsigned int uart_e_tx_z11_pins[]          = { GPIOZ_11 };
 349static const unsigned int uart_e_rx_z12_pins[]          = { GPIOZ_12 };
 350
 351/* Bank Z func2 */
 352static const unsigned int tsin_a_clk_pins[]             = { GPIOZ_0 };
 353static const unsigned int tsin_a_sop_pins[]             = { GPIOZ_1 };
 354static const unsigned int tsin_a_valid_pins[]           = { GPIOZ_2 };
 355static const unsigned int tsin_a_din0_pins[]            = { GPIOZ_3 };
 356static const unsigned int dtv_a_if_agc_z6_pins[]        = { GPIOZ_6 };
 357static const unsigned int dtv_b_if_agc_pins[]           = { GPIOZ_7 };
 358static const unsigned int i2c3_sda_z_pins[]             = { GPIOZ_8 };
 359static const unsigned int i2c3_scl_z_pins[]             = { GPIOZ_9 };
 360static const unsigned int dtv_a_rf_agc_pins[]           = { GPIOZ_10 };
 361static const unsigned int dtv_b_rf_agc_pins[]           = { GPIOZ_11 };
 362
 363/* Bank Z func3 */
 364static const unsigned int sdcard_d0_z_pins[]            = { GPIOZ_0 };
 365static const unsigned int sdcard_d1_z_pins[]            = { GPIOZ_1 };
 366static const unsigned int sdcard_d2_z_pins[]            = { GPIOZ_2 };
 367static const unsigned int sdcard_d3_z_pins[]            = { GPIOZ_3 };
 368static const unsigned int sdcard_clk_z_pins[]           = { GPIOZ_4 };
 369static const unsigned int sdcard_cmd_z_pins[]           = { GPIOZ_5 };
 370static const unsigned int uart_e_tx_z8_pins[]           = { GPIOZ_8 };
 371static const unsigned int uart_e_rx_z9_pins[]           = { GPIOZ_9 };
 372static const unsigned int pdm_din1_z_pins[]             = { GPIOZ_10 };
 373static const unsigned int pdm_din0_z_pins[]             = { GPIOZ_11 };
 374static const unsigned int pdm_dclk_z_pins[]             = { GPIOZ_12 };
 375
 376/* Bank Z func4 */
 377static const unsigned int spi_a_miso_z_pins[]           = { GPIOZ_0 };
 378static const unsigned int spi_a_mosi_z_pins[]           = { GPIOZ_1 };
 379static const unsigned int spi_a_clk_z_pins[]            = { GPIOZ_2 };
 380static const unsigned int spi_a_ss0_z_pins[]            = { GPIOZ_3 };
 381static const unsigned int spi_a_ss1_z_pins[]            = { GPIOZ_4 };
 382static const unsigned int spi_a_ss2_z_pins[]            = { GPIOZ_5 };
 383static const unsigned int i2c4_scl_z_pins[]             = { GPIOZ_11 };
 384static const unsigned int i2c4_sda_z_pins[]             = { GPIOZ_12 };
 385
 386/* Bank Z func5 */
 387static const unsigned int uart_d_tx_z_pins[]            = { GPIOZ_0 };
 388static const unsigned int uart_d_rx_z_pins[]            = { GPIOZ_1 };
 389static const unsigned int uart_d_cts_z_pins[]           = { GPIOZ_2 };
 390static const unsigned int uart_d_rts_z_pins[]           = { GPIOZ_3 };
 391static const unsigned int pwm_g_z_pins[]                = { GPIOZ_4 };
 392static const unsigned int pwm_f_z_pins[]                = { GPIOZ_5 };
 393static const unsigned int pwm_e_z_pins[]                = { GPIOZ_6 };
 394static const unsigned int tsin_b_clk_z_pins[]           = { GPIOZ_7 };
 395static const unsigned int tsin_b_sop_z_pins[]           = { GPIOZ_10 };
 396static const unsigned int tsin_b_valid_z_pins[]         = { GPIOZ_11 };
 397static const unsigned int tsin_b_d0_z_pins[]            = { GPIOZ_12 };
 398
 399/* Bank Z func6 */
 400static const unsigned int s2_demod_gpio7_pins[]         = { GPIOZ_0 };
 401static const unsigned int s2_demod_gpio6_pins[]         = { GPIOZ_1 };
 402static const unsigned int s2_demod_gpio5_pins[]         = { GPIOZ_2 };
 403static const unsigned int s2_demod_gpio4_pins[]         = { GPIOZ_3 };
 404static const unsigned int s2_demod_gpio3_pins[]         = { GPIOZ_4 };
 405static const unsigned int s2_demod_gpio2_pins[]         = { GPIOZ_5 };
 406static const unsigned int diseqc_out_pins[]             = { GPIOZ_7 };
 407static const unsigned int s2_demod_gpio1_pins[]         = { GPIOZ_8 };
 408static const unsigned int s2_demod_gpio0_pins[]         = { GPIOZ_12 };
 409
 410/* Bank Z func7 */
 411static const unsigned int gen_clk_z9_pins[]             = { GPIOZ_9 };
 412static const unsigned int gen_clk_z12_pins[]            = { GPIOZ_12 };
 413
 414static struct meson_pmx_group meson_s4_periphs_groups[] = {
 415        GPIO_GROUP(GPIOE_0),
 416        GPIO_GROUP(GPIOE_1),
 417
 418        GPIO_GROUP(GPIOB_0),
 419        GPIO_GROUP(GPIOB_1),
 420        GPIO_GROUP(GPIOB_2),
 421        GPIO_GROUP(GPIOB_3),
 422        GPIO_GROUP(GPIOB_4),
 423        GPIO_GROUP(GPIOB_5),
 424        GPIO_GROUP(GPIOB_6),
 425        GPIO_GROUP(GPIOB_7),
 426        GPIO_GROUP(GPIOB_8),
 427        GPIO_GROUP(GPIOB_9),
 428        GPIO_GROUP(GPIOB_10),
 429        GPIO_GROUP(GPIOB_11),
 430        GPIO_GROUP(GPIOB_12),
 431        GPIO_GROUP(GPIOB_13),
 432
 433        GPIO_GROUP(GPIOC_0),
 434        GPIO_GROUP(GPIOC_1),
 435        GPIO_GROUP(GPIOC_2),
 436        GPIO_GROUP(GPIOC_3),
 437        GPIO_GROUP(GPIOC_4),
 438        GPIO_GROUP(GPIOC_5),
 439        GPIO_GROUP(GPIOC_6),
 440        GPIO_GROUP(GPIOC_7),
 441
 442        GPIO_GROUP(GPIOD_0),
 443        GPIO_GROUP(GPIOD_1),
 444        GPIO_GROUP(GPIOD_2),
 445        GPIO_GROUP(GPIOD_3),
 446        GPIO_GROUP(GPIOD_4),
 447        GPIO_GROUP(GPIOD_5),
 448        GPIO_GROUP(GPIOD_6),
 449        GPIO_GROUP(GPIOD_7),
 450        GPIO_GROUP(GPIOD_8),
 451        GPIO_GROUP(GPIOD_9),
 452        GPIO_GROUP(GPIOD_10),
 453        GPIO_GROUP(GPIOD_11),
 454
 455        GPIO_GROUP(GPIOH_0),
 456        GPIO_GROUP(GPIOH_1),
 457        GPIO_GROUP(GPIOH_2),
 458        GPIO_GROUP(GPIOH_3),
 459        GPIO_GROUP(GPIOH_4),
 460        GPIO_GROUP(GPIOH_5),
 461        GPIO_GROUP(GPIOH_6),
 462        GPIO_GROUP(GPIOH_7),
 463        GPIO_GROUP(GPIOH_8),
 464        GPIO_GROUP(GPIOH_9),
 465        GPIO_GROUP(GPIOH_10),
 466        GPIO_GROUP(GPIOH_11),
 467
 468        GPIO_GROUP(GPIOX_0),
 469        GPIO_GROUP(GPIOX_1),
 470        GPIO_GROUP(GPIOX_2),
 471        GPIO_GROUP(GPIOX_3),
 472        GPIO_GROUP(GPIOX_4),
 473        GPIO_GROUP(GPIOX_5),
 474        GPIO_GROUP(GPIOX_6),
 475        GPIO_GROUP(GPIOX_7),
 476        GPIO_GROUP(GPIOX_8),
 477        GPIO_GROUP(GPIOX_9),
 478        GPIO_GROUP(GPIOX_10),
 479        GPIO_GROUP(GPIOX_11),
 480        GPIO_GROUP(GPIOX_12),
 481        GPIO_GROUP(GPIOX_13),
 482        GPIO_GROUP(GPIOX_14),
 483        GPIO_GROUP(GPIOX_15),
 484        GPIO_GROUP(GPIOX_16),
 485        GPIO_GROUP(GPIOX_17),
 486        GPIO_GROUP(GPIOX_18),
 487        GPIO_GROUP(GPIOX_19),
 488
 489        GPIO_GROUP(GPIOZ_0),
 490        GPIO_GROUP(GPIOZ_1),
 491        GPIO_GROUP(GPIOZ_2),
 492        GPIO_GROUP(GPIOZ_3),
 493        GPIO_GROUP(GPIOZ_4),
 494        GPIO_GROUP(GPIOZ_5),
 495        GPIO_GROUP(GPIOZ_6),
 496        GPIO_GROUP(GPIOZ_7),
 497        GPIO_GROUP(GPIOZ_8),
 498        GPIO_GROUP(GPIOZ_9),
 499        GPIO_GROUP(GPIOZ_10),
 500        GPIO_GROUP(GPIOZ_11),
 501        GPIO_GROUP(GPIOZ_12),
 502
 503        GPIO_GROUP(GPIO_TEST_N),
 504
 505        /* BANK E func1 */
 506        GROUP(i2c0_sda,                 1),
 507        GROUP(i2c0_scl,                 1),
 508
 509        /* BANK E func2 */
 510        GROUP(uart_b_tx_e,              2),
 511        GROUP(uart_b_rx_e,              2),
 512
 513        /* BANK E func3 */
 514        GROUP(pwm_h,                    3),
 515        GROUP(pwm_j,                    3),
 516
 517        /* BANK B func1 */
 518        GROUP(emmc_nand_d0,             1),
 519        GROUP(emmc_nand_d1,             1),
 520        GROUP(emmc_nand_d2,             1),
 521        GROUP(emmc_nand_d3,             1),
 522        GROUP(emmc_nand_d4,             1),
 523        GROUP(emmc_nand_d5,             1),
 524        GROUP(emmc_nand_d6,             1),
 525        GROUP(emmc_nand_d7,             1),
 526        GROUP(emmc_clk,                 1),
 527        GROUP(emmc_rst,                 1),
 528        GROUP(emmc_cmd,                 1),
 529        GROUP(emmc_nand_ds,             1),
 530
 531        /* Bank B func2 */
 532        GROUP(nand_wen_clk,             2),
 533        GROUP(nand_ale,                 2),
 534        GROUP(nand_ren_wr,              2),
 535        GROUP(nand_cle,                 2),
 536        GROUP(nand_ce0,                 2),
 537
 538        /* Bank B func3 */
 539        GROUP(spif_hold,                3),
 540        GROUP(spif_mo,                  3),
 541        GROUP(spif_mi,                  3),
 542        GROUP(spif_clk,                 3),
 543        GROUP(spif_wp,                  3),
 544        GROUP(spif_cs,                  3),
 545
 546        /* Bank C func1 */
 547        GROUP(sdcard_d0_c,              1),
 548        GROUP(sdcard_d1_c,              1),
 549        GROUP(sdcard_d2_c,              1),
 550        GROUP(sdcard_d3_c,              1),
 551        GROUP(sdcard_clk_c,             1),
 552        GROUP(sdcard_cmd_c,             1),
 553        GROUP(sdcard_cd,                1),
 554
 555        /* Bank C func2 */
 556        GROUP(jtag_2_tdo,               2),
 557        GROUP(jtag_2_tdi,               2),
 558        GROUP(uart_b_rx_c,              2),
 559        GROUP(uart_b_tx_c,              2),
 560        GROUP(jtag_2_clk,               2),
 561        GROUP(jtag_2_tms,               2),
 562        GROUP(i2c1_sda_c,               2),
 563        GROUP(i2c1_scl_c,               2),
 564
 565        /* Bank C func3 */
 566        GROUP(pdm_din1_c,               3),
 567        GROUP(pdm_din0_c,               3),
 568        GROUP(i2c4_sda_c,               3),
 569        GROUP(i2c4_scl_c,               3),
 570        GROUP(pdm_dclk_c,               3),
 571        GROUP(iso7816_clk_c,            3),
 572        GROUP(iso7816_data_c,           3),
 573
 574        /* Bank C func4 */
 575        GROUP(tdm_d2_c,                 4),
 576        GROUP(tdm_d3_c,                 4),
 577        GROUP(tdm_fs1_c,                4),
 578        GROUP(mclk_1_c,                 4),
 579        GROUP(tdm_d4_c,                 4),
 580        GROUP(tdm_d5_c,                 4),
 581
 582        /* Bank D func1 */
 583        GROUP(uart_b_tx_d,              1),
 584        GROUP(uart_b_rx_d,              1),
 585        GROUP(uart_b_cts_d,             1),
 586        GROUP(uart_b_rts_d,             1),
 587        GROUP(remote_out,               1),
 588        GROUP(remote_in,                1),
 589        GROUP(jtag_1_clk,               1),
 590        GROUP(jtag_1_tms,               1),
 591        GROUP(jtag_1_tdi,               1),
 592        GROUP(jtag_1_tdo,               1),
 593        GROUP(clk12_24,                 1),
 594        GROUP(pwm_g_hiz,                1),
 595
 596        /* Bank D func2 */
 597        GROUP(i2c4_sda_d,               2),
 598        GROUP(i2c4_scl_d,               2),
 599        GROUP(mclk_1_d,                 2),
 600        GROUP(tdm_sclk1_d,              2),
 601        GROUP(tdm_fs1_d,                2),
 602        GROUP(tdm_d4_d,                 2),
 603        GROUP(tdm_d3_d,                 2),
 604        GROUP(tdm_d2_d,                 2),
 605        GROUP(pwm_g_d,                  2),
 606
 607        /* Bank D func3 */
 608        GROUP(uart_c_tx,                3),
 609        GROUP(uart_c_rx,                3),
 610        GROUP(pwm_b_d,                  3),
 611        GROUP(pwm_a_d,                  3),
 612        GROUP(pwm_c_d,                  3),
 613        GROUP(pwm_d_d,                  3),
 614        GROUP(pwm_i_d,                  3),
 615
 616        /* Bank D func4 */
 617        GROUP(clk_32k_in,               4),
 618        GROUP(pwm_b_hiz,                4),
 619        GROUP(pwm_a_hiz,                4),
 620        GROUP(pwm_c_hiz,                4),
 621        GROUP(pdm_dclk_d,               4),
 622        GROUP(pdm_din0_d,               4),
 623        GROUP(pdm_din1_d,               4),
 624
 625        /* Bank D func5 */
 626        GROUP(mic_mute_en,              5),
 627        GROUP(mic_mute_key,             5),
 628        GROUP(i2c1_sda_d,               5),
 629        GROUP(i2c1_scl_d,               5),
 630        GROUP(i2c2_sda_d,               5),
 631        GROUP(i2c2_scl_d,               5),
 632
 633        /* Bank D func6 */
 634        GROUP(gen_clk_d,                6),
 635        GROUP(tsin_b_clk_c,             6),
 636        GROUP(tsin_b_sop_c,             6),
 637        GROUP(tsin_b_valid_c,           6),
 638        GROUP(tsin_b_d0_c,              6),
 639
 640        /* Bank H func1 */
 641        GROUP(hdmitx_sda,               1),
 642        GROUP(hdmitx_sck,               1),
 643        GROUP(hdmitx_hpd_in,            1),
 644        GROUP(ao_cec_a,                 1),
 645        GROUP(spdif_out_h,              1),
 646        GROUP(spdif_in,                 1),
 647        GROUP(i2c1_sda_h,               1),
 648        GROUP(i2c1_scl_h,               1),
 649        GROUP(i2c2_sda_h8,              1),
 650        GROUP(i2c2_scl_h9,              1),
 651        GROUP(eth_link_led,             1),
 652        GROUP(eth_act_led,              1),
 653
 654        /* Bank H func2 */
 655        GROUP(i2c2_sda_h0,              2),
 656        GROUP(i2c2_scl_h1,              2),
 657        GROUP(ao_cec_b,                 2),
 658        GROUP(uart_d_tx_h,              2),
 659        GROUP(uart_d_rx_h,              2),
 660        GROUP(uart_d_cts_h,             2),
 661        GROUP(uart_d_rts_h,             2),
 662        GROUP(iso7816_clk_h,            2),
 663        GROUP(iso7816_data_h,           2),
 664        GROUP(uart_e_tx_h,              2),
 665        GROUP(uart_e_rx_h,              2),
 666
 667        /* Bank H func3 */
 668        GROUP(pwm_d_h,                  3),
 669        GROUP(pwm_i_h,                  3),
 670        GROUP(pdm_dclk_h,               3),
 671        GROUP(pdm_din0_h,               3),
 672        GROUP(pdm_din1_h,               3),
 673
 674        /* Bank H func4 */
 675        GROUP(mclk_1_h,                 4),
 676        GROUP(tdm_sclk1_h,              4),
 677        GROUP(tdm_fs1_h,                4),
 678        GROUP(tdm_d2_h,                 4),
 679        GROUP(tdm_d3_h,                 4),
 680        GROUP(tdm_d4_h,                 4),
 681
 682        /* Bank H func5 */
 683        GROUP(spi_a_miso_h,             5),
 684        GROUP(spi_a_mosi_h,             5),
 685        GROUP(spi_a_clk_h,              5),
 686        GROUP(spi_a_ss0_h,              5),
 687
 688        /* Bank H func6 */
 689        GROUP(gen_clk_h,                6),
 690        GROUP(tsin_b1_clk,              6),
 691        GROUP(tsin_b1_sop,              6),
 692        GROUP(tsin_b1_valid,            6),
 693        GROUP(tsin_b1_d0,               6),
 694
 695        /* Bank X func1 */
 696        GROUP(sdio_d0,                  1),
 697        GROUP(sdio_d1,                  1),
 698        GROUP(sdio_d2,                  1),
 699        GROUP(sdio_d3,                  1),
 700        GROUP(sdio_clk,                 1),
 701        GROUP(sdio_cmd,                 1),
 702        GROUP(pwm_a_x,                  1),
 703        GROUP(pwm_f_x,                  1),
 704        GROUP(tdm_d1,                   1),
 705        GROUP(tdm_d0,                   1),
 706        GROUP(tdm_fs0,                  1),
 707        GROUP(tdm_sclk0,                1),
 708        GROUP(uart_a_tx,                1),
 709        GROUP(uart_a_rx,                1),
 710        GROUP(uart_a_cts,               1),
 711        GROUP(uart_a_rts,               1),
 712        GROUP(pwm_e_x,                  1),
 713        GROUP(i2c1_sda_x,               1),
 714        GROUP(i2c1_scl_x,               1),
 715        GROUP(pwm_b_x,                  1),
 716
 717        /* Bank X func2 */
 718        GROUP(pdm_din0_x,               2),
 719        GROUP(pdm_din1_x,               2),
 720        GROUP(pdm_dclk_x,               2),
 721
 722        /* Bank X func3 */
 723        GROUP(spi_a_mosi_x,             3),
 724        GROUP(spi_a_miso_x,             3),
 725        GROUP(spi_a_ss0_x,              3),
 726        GROUP(spi_a_clk_x,              3),
 727
 728        /* Bank X func4 */
 729        GROUP(pwm_c_x,                  4),
 730        GROUP(i2c_slave_scl,            4),
 731        GROUP(i2c_slave_sda,            4),
 732
 733        /* Bank X func5 */
 734        GROUP(i2c3_sda_x,               5),
 735        GROUP(i2c3_scl_x,               5),
 736
 737        /* Bank Z func1 */
 738        GROUP(tdm_fs2,                  1),
 739        GROUP(tdm_sclk2,                1),
 740        GROUP(tdm_d4_z,                 1),
 741        GROUP(tdm_d5_z,                 1),
 742        GROUP(tdm_d6,                   1),
 743        GROUP(tdm_d7,                   1),
 744        GROUP(mclk_2,                   1),
 745        GROUP(spdif_out_z,              1),
 746        GROUP(dtv_a_if_agc_z10,         1),
 747        GROUP(uart_e_tx_z11,            1),
 748        GROUP(uart_e_rx_z12,            1),
 749
 750        /* Bank Z func2 */
 751        GROUP(tsin_a_clk,               2),
 752        GROUP(tsin_a_sop,               2),
 753        GROUP(tsin_a_valid,             2),
 754        GROUP(tsin_a_din0,              2),
 755        GROUP(dtv_a_if_agc_z6,          2),
 756        GROUP(dtv_b_if_agc,             2),
 757        GROUP(i2c3_sda_z,               2),
 758        GROUP(i2c3_scl_z,               2),
 759        GROUP(dtv_a_rf_agc,             2),
 760        GROUP(dtv_b_rf_agc,             2),
 761
 762        /* Bank Z func3 */
 763        GROUP(sdcard_d0_z,              3),
 764        GROUP(sdcard_d1_z,              3),
 765        GROUP(sdcard_d2_z,              3),
 766        GROUP(sdcard_d3_z,              3),
 767        GROUP(sdcard_clk_z,             3),
 768        GROUP(sdcard_cmd_z,             3),
 769        GROUP(uart_e_tx_z8,             3),
 770        GROUP(uart_e_rx_z9,             3),
 771        GROUP(pdm_din1_z,               3),
 772        GROUP(pdm_din0_z,               3),
 773        GROUP(pdm_dclk_z,               3),
 774
 775        /* Bank Z func4 */
 776        GROUP(spi_a_miso_z,             4),
 777        GROUP(spi_a_mosi_z,             4),
 778        GROUP(spi_a_clk_z,              4),
 779        GROUP(spi_a_ss0_z,              4),
 780        GROUP(spi_a_ss1_z,              4),
 781        GROUP(spi_a_ss2_z,              4),
 782        GROUP(i2c4_scl_z,               4),
 783        GROUP(i2c4_sda_z,               4),
 784
 785        /* Bank Z func5 */
 786        GROUP(uart_d_tx_z,              5),
 787        GROUP(uart_d_rx_z,              5),
 788        GROUP(uart_d_cts_z,             5),
 789        GROUP(uart_d_rts_z,             5),
 790        GROUP(pwm_g_z,                  5),
 791        GROUP(pwm_f_z,                  5),
 792        GROUP(pwm_e_z,                  5),
 793        GROUP(tsin_b_clk_z,             5),
 794        GROUP(tsin_b_sop_z,             5),
 795        GROUP(tsin_b_valid_z,           5),
 796        GROUP(tsin_b_d0_z,              5),
 797
 798        /* Bank Z func6 */
 799        GROUP(s2_demod_gpio7,           6),
 800        GROUP(s2_demod_gpio6,           6),
 801        GROUP(s2_demod_gpio5,           6),
 802        GROUP(s2_demod_gpio4,           6),
 803        GROUP(s2_demod_gpio3,           6),
 804        GROUP(s2_demod_gpio2,           6),
 805        GROUP(diseqc_out,               6),
 806        GROUP(s2_demod_gpio1,           6),
 807        GROUP(s2_demod_gpio0,           6),
 808
 809        /* Bank Z func7 */
 810        GROUP(gen_clk_z9,               7),
 811        GROUP(gen_clk_z12,              7),
 812};
 813
 814static const char * const gpio_periphs_groups[] = {
 815        "GPIOE_0", "GPIOE_1",
 816
 817        "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4", "GPIOB_5",
 818        "GPIOB_6", "GPIOB_7", "GPIOB_8", "GPIOB_9", "GPIOB_10", "GPIOB_11",
 819        "GPIOB_12", "GPIOB_13",
 820
 821        "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4", "GPIOC_5",
 822        "GPIOC_6", "GPIOC_7",
 823
 824        "GPIOD_0", "GPIOD_1", "GPIOD_2", "GPIOD_3", "GPIOD_4", "GPIOD_5",
 825        "GPIOD_6", "GPIOD_7", "GPIOD_8", "GPIOD_9", "GPIOD_10", "GPIOD_11",
 826
 827        "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4", "GPIOH_5",
 828        "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9", "GPIOH_10", "GPIOH_11",
 829
 830        "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", "GPIOX_5",
 831        "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", "GPIOX_10", "GPIOX_11",
 832        "GPIOX_12", "GPIOX_13", "GPIOX_14", "GPIOX_15", "GPIOX_16", "GPIOX_17",
 833        "GPIOX_18", "GPIOX_19",
 834
 835        "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4", "GPIOZ_5",
 836        "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9", "GPIOZ_10",
 837        "GPIOZ_11", "GPIOZ_12",
 838
 839        "GPIO_TEST_N",
 840};
 841
 842static const char * const i2c0_groups[] = {
 843        "i2c0_sda", "i2c0_scl",
 844};
 845
 846static const char * const i2c1_groups[] = {
 847        "i2c1_sda_c", "i2c1_scl_c",
 848        "i2c1_sda_d", "i2c1_scl_d",
 849        "i2c1_sda_h", "i2c1_scl_h",
 850        "i2c1_sda_x", "i2c1_scl_x",
 851};
 852
 853static const char * const i2c2_groups[] = {
 854        "i2c2_sda_d", "i2c2_scl_d",
 855        "i2c2_sda_h8", "i2c2_scl_h9",
 856        "i2c2_sda_h0", "i2c2_scl_h1l,"
 857};
 858
 859static const char * const i2c3_groups[] = {
 860        "i2c3_sda_x", "i2c3_scl_x",
 861        "i2c3_sda_z", "i2c3_scl_z",
 862};
 863
 864static const char * const i2c4_groups[] = {
 865        "i2c4_sda_c", "i2c4_scl_c",
 866        "i2c4_sda_d", "i2c4_scl_d",
 867        "i2c4_scl_z", "i2c4_sda_z",
 868};
 869
 870static const char * const uart_a_groups[] = {
 871        "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts",
 872};
 873
 874static const char * const uart_b_groups[] = {
 875        "uart_b_tx_e", "uart_b_rx_e", "uart_b_rx_c", "uart_b_tx_c",
 876        "uart_b_tx_d", "uart_b_rx_d", "uart_b_cts_d", "uart_b_rts_d",
 877};
 878
 879static const char * const uart_c_groups[] = {
 880        "uart_c_tx", "uart_c_rx",
 881};
 882
 883static const char * const uart_d_groups[] = {
 884        "uart_d_tx_h", "uart_d_rx_h", "uart_d_cts_h", "uart_d_rts_h",
 885        "uart_d_tx_z", "uart_d_rx_z", "uart_d_cts_z", "uart_d_rts_z",
 886};
 887
 888static const char * const uart_e_groups[] = {
 889        "uart_e_tx_h", "uart_e_rx_h", "uart_e_tx_z11", "uart_e_rx_z12",
 890        "uart_e_tx_z8", "uart_e_rx_z9",
 891};
 892
 893static const char * const emmc_groups[] = {
 894        "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
 895        "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
 896        "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
 897};
 898
 899static const char * const nand_groups[] = {
 900        "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
 901        "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
 902        "nand_wen_clk", "nand_ale", "nand_ren_wr", "nand_cle", "nand_ce0",
 903};
 904
 905static const char * const spif_groups[] = {
 906        "spif_hold", "spif_mo", "spif_mi", "spif_clk", "spif_wp",
 907        "spif_cs",
 908};
 909
 910static const char * const sdcard_groups[] = {
 911        "sdcard_d0_c", "sdcard_d1_c", "sdcard_d2_c", "sdcard_d3_c",
 912        "sdcard_clk_c", "sdcard_cmd_c", "sdcard_cd",
 913        "sdcard_d0_z", "sdcard_d1_z", "sdcard_d2_z", "sdcard_d3_z",
 914        "sdcard_clk_z", "sdcard_cmd_z",
 915};
 916
 917static const char * const jtag_1_groups[] = {
 918        "jtag_1_clk", "jtag_1_tms", "jtag_1_tdi", "jtag_1_tdo",
 919};
 920
 921static const char * const jtag_2_groups[] = {
 922        "jtag_2_tdo", "jtag_2_tdi", "jtag_2_clk", "jtag_2_tms",
 923};
 924
 925static const char * const pdm_groups[] = {
 926        "pdm_din1_c", "pdm_din0_c", "pdm_dclk_c",
 927        "pdm_dclk_d", "pdm_din0_d", "pdm_din1_d",
 928        "pdm_dclk_h", "pdm_din0_h", "pdm_din1_h",
 929        "pdm_din0_x", "pdm_din1_x", "pdm_dclk_x",
 930        "pdm_din1_z", "pdm_din0_z", "pdm_dclk_z",
 931};
 932
 933static const char * const iso7816_groups[] = {
 934        "iso7816_clk_c", "iso7816_data_c",
 935        "iso7816_clk_h", "iso7816_data_h",
 936};
 937
 938static const char * const tdm_groups[] = {
 939        "tdm_d2_c", "tdm_d3_c", "tdm_fs1_c", "tdm_d4_c", "tdm_d5_c",
 940        "tdm_fs1_d", "tdm_d4_d", "tdm_d3_d", "tdm_d2_d", "tdm_sclk1_d",
 941        "tdm_sclk1_h", "tdm_fs1_h", "tdm_d2_h", "tdm_d3_h", "tdm_d4_h",
 942        "tdm_d1", "tdm_d0", "tdm_fs0", "tdm_sclk0", "tdm_fs2", "tdm_sclk2",
 943        "tdm_d4_z", "tdm_d5_z", "tdm_d6", "tdm_d7",
 944};
 945
 946static const char * const mclk_1_groups[] = {
 947        "mclk_1_c", "mclk_1_d", "mclk_1_h", "mclk_2",
 948};
 949
 950static const char * const mclk_2_groups[] = {
 951        "mclk_2",
 952};
 953
 954static const char * const remote_out_groups[] = {
 955        "remote_out",
 956};
 957
 958static const char * const remote_in_groups[] = {
 959        "remote_in",
 960};
 961
 962static const char * const clk12_24_groups[] = {
 963        "clk12_24",
 964};
 965
 966static const char * const clk_32k_in_groups[] = {
 967        "clk_32k_in",
 968};
 969
 970static const char * const pwm_a_hiz_groups[] = {
 971        "pwm_a_hiz",
 972};
 973
 974static const char * const pwm_b_hiz_groups[] = {
 975        "pwm_b_hiz",
 976};
 977
 978static const char * const pwm_c_hiz_groups[] = {
 979        "pwm_c_hiz",
 980};
 981
 982static const char * const pwm_g_hiz_groups[] = {
 983        "pwm_g_hiz",
 984};
 985
 986static const char * const pwm_a_groups[] = {
 987        "pwm_a_d",
 988};
 989
 990static const char * const pwm_b_groups[] = {
 991        "pwm_b_d", "pwm_b_x",
 992};
 993
 994static const char * const pwm_c_groups[] = {
 995        "pwm_c_d", "pwm_c_x",
 996};
 997
 998static const char * const pwm_d_groups[] = {
 999        "pwm_d_d", "pwm_d_h",
1000};
1001
1002static const char * const pwm_e_groups[] = {
1003        "pwm_e_x", "pwm_e_z",
1004};
1005
1006static const char * const pwm_f_groups[] = {
1007        "pwm_f_x", "pwm_f_z",
1008};
1009
1010static const char * const pwm_g_groups[] = {
1011        "pwm_g_d", "pwm_g_z",
1012};
1013
1014static const char * const pwm_h_groups[] = {
1015        "pwm_h",
1016};
1017
1018static const char * const pwm_i_groups[] = {
1019        "pwm_i_d", "pwm_i_h"
1020};
1021
1022static const char * const pwm_j_groups[] = {
1023        "pwm_j",
1024};
1025
1026static const char * const mic_mute_groups[] = {
1027        "mic_mute_en", "mic_mute_key",
1028};
1029
1030static const char * const hdmitx_groups[] = {
1031        "hdmitx_sda", "hdmitx_sck", "hdmitx_hpd_in",
1032};
1033
1034static const char * const ao_cec_a_groups[] = {
1035        "ao_cec_a",
1036};
1037
1038static const char * const ao_cec_b_groups[] = {
1039        "ao_cec_b",
1040};
1041
1042static const char * const spdif_out_groups[] = {
1043        "spdif_out_h", "spdif_out_z",
1044};
1045
1046static const char * const spdif_in_groups[] = {
1047        "spdif_in",
1048};
1049
1050static const char * const eth_groups[] = {
1051        "eth_link_led", "eth_act_led",
1052};
1053
1054static const char * const spi_a_groups[] = {
1055        "spi_a_miso_h", "spi_a_mosi_h", "spi_a_clk_h", "spi_a_ss0_h",
1056
1057        "spi_a_mosi_x", "spi_a_miso_x", "spi_a_ss0_x", "spi_a_clk_x",
1058
1059        "spi_a_miso_z", "spi_a_mosi_z", "spi_a_clk_z", "spi_a_ss0_z",
1060        "spi_a_ss1_z", "spi_a_ss2_z",
1061};
1062
1063static const char * const gen_clk_groups[] = {
1064        "gen_clk_h", "gen_clk_z9", "gen_clk_z12",
1065};
1066
1067static const char * const sdio_groups[] = {
1068        "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3", "sdio_clk", "sdio_cmd",
1069};
1070
1071static const char * const i2c_slave_groups[] = {
1072        "i2c_slave_scl", "i2c_slave_sda",
1073};
1074
1075static const char * const dtv_groups[] = {
1076        "dtv_a_if_agc_z10", "dtv_a_if_agc_z6", "dtv_b_if_agc",
1077        "dtv_a_rf_agc", "dtv_b_rf_agc",
1078};
1079
1080static const char * const tsin_a_groups[] = {
1081        "tsin_a_clk", "tsin_a_sop", "tsin_a_valid", "tsin_a_din0",
1082};
1083
1084static const char * const tsin_b_groups[] = {
1085        "tsin_b_clk_c", "tsin_b_sop_c", "tsin_b_valid_c", "tsin_b_d0_c",
1086        "tsin_b_clk_z", "tsin_b_sop_z", "tsin_b_valid_z", "tsin_b_d0_z",
1087};
1088
1089static const char * const tsin_b1_groups[] = {
1090        "tsin_b1_clk", "tsin_b1_sop", "tsin_b1_valid", "tsin_b1_d0",
1091};
1092
1093static const char * const diseqc_out_groups[] = {
1094        "diseqc_out",
1095};
1096
1097static const char * const s2_demod_groups[] = {
1098        "s2_demod_gpio7", "s2_demod_gpio6", "s2_demod_gpio5", "s2_demod_gpio4",
1099        "s2_demod_gpio3", "s2_demod_gpio2", "s2_demod_gpio1", "s2_demod_gpio0",
1100};
1101
1102static struct meson_pmx_func meson_s4_periphs_functions[] = {
1103        FUNCTION(gpio_periphs),
1104        FUNCTION(i2c0),
1105        FUNCTION(i2c1),
1106        FUNCTION(i2c2),
1107        FUNCTION(i2c3),
1108        FUNCTION(i2c4),
1109        FUNCTION(uart_a),
1110        FUNCTION(uart_b),
1111        FUNCTION(uart_c),
1112        FUNCTION(uart_d),
1113        FUNCTION(uart_e),
1114        FUNCTION(emmc),
1115        FUNCTION(nand),
1116        FUNCTION(spif),
1117        FUNCTION(sdcard),
1118        FUNCTION(jtag_1),
1119        FUNCTION(jtag_2),
1120        FUNCTION(pdm),
1121        FUNCTION(iso7816),
1122        FUNCTION(tdm),
1123        FUNCTION(mclk_1),
1124        FUNCTION(mclk_2),
1125        FUNCTION(remote_out),
1126        FUNCTION(remote_in),
1127        FUNCTION(clk12_24),
1128        FUNCTION(clk_32k_in),
1129        FUNCTION(pwm_a_hiz),
1130        FUNCTION(pwm_b_hiz),
1131        FUNCTION(pwm_c_hiz),
1132        FUNCTION(pwm_g_hiz),
1133        FUNCTION(pwm_a),
1134        FUNCTION(pwm_b),
1135        FUNCTION(pwm_c),
1136        FUNCTION(pwm_d),
1137        FUNCTION(pwm_e),
1138        FUNCTION(pwm_f),
1139        FUNCTION(pwm_g),
1140        FUNCTION(pwm_h),
1141        FUNCTION(pwm_i),
1142        FUNCTION(pwm_j),
1143        FUNCTION(mic_mute),
1144        FUNCTION(hdmitx),
1145        FUNCTION(ao_cec_a),
1146        FUNCTION(ao_cec_b),
1147        FUNCTION(spdif_out),
1148        FUNCTION(spdif_in),
1149        FUNCTION(eth),
1150        FUNCTION(spi_a),
1151        FUNCTION(gen_clk),
1152        FUNCTION(sdio),
1153        FUNCTION(i2c_slave),
1154        FUNCTION(dtv),
1155        FUNCTION(tsin_a),
1156        FUNCTION(tsin_b),
1157        FUNCTION(tsin_b1),
1158        FUNCTION(diseqc_out),
1159        FUNCTION(s2_demod),
1160};
1161
1162static struct meson_bank meson_s4_periphs_banks[] = {
1163        /* name  first  last  irq  pullen  pull  dir  out  in */
1164        BANK_DS("B", GPIOB_0,    GPIOB_13,  0, 13,
1165                0x63,  0,  0x64,  0,  0x62, 0,  0x61, 0,  0x60, 0, 0x67, 0),
1166        BANK_DS("C", GPIOC_0,    GPIOC_7,   14, 21,
1167                0x53,  0,  0x54,  0,  0x52, 0,  0x51, 0,  0x50, 0, 0x57, 0),
1168        BANK_DS("E", GPIOE_0,    GPIOE_1,   22, 23,
1169                0x43,  0,  0x44,  0,  0x42, 0,  0x41, 0,  0x40, 0, 0x47, 0),
1170        BANK_DS("D", GPIOD_0,    GPIOD_11,  24, 35,
1171                0x33,  0,  0x34,  0,  0x32, 0,  0x31, 0,  0x30, 0, 0x37, 0),
1172        BANK_DS("H", GPIOH_0,    GPIOH_11,  36, 47,
1173                0x23,  0,  0x24,  0,  0x22, 0,  0x21, 0,  0x20, 0, 0x27, 0),
1174        BANK_DS("X", GPIOX_0,    GPIOX_19,   48, 67,
1175                0x13,  0,  0x14,  0,  0x12, 0,  0x11, 0,  0x10, 0, 0x17, 0),
1176        BANK_DS("Z", GPIOZ_0,    GPIOZ_12,  68, 80,
1177                0x03,  0,  0x04,  0,  0x02, 0,  0x01, 0,  0x00, 0, 0x07, 0),
1178        BANK_DS("TEST_N", GPIO_TEST_N,    GPIO_TEST_N,   -1, -1,
1179                0x83,  0,  0x84,  0,  0x82, 0,  0x81,  0, 0x80, 0, 0x87, 0),
1180};
1181
1182static struct meson_pmx_bank meson_s4_periphs_pmx_banks[] = {
1183        /*name              first        lask        reg offset*/
1184        BANK_PMX("B",      GPIOB_0,     GPIOB_13,    0x00, 0),
1185        BANK_PMX("C",      GPIOC_0,     GPIOC_7,     0x9,  0),
1186        BANK_PMX("E",      GPIOE_0,     GPIOE_1,     0x12, 0),
1187        BANK_PMX("D",      GPIOD_0,     GPIOD_11,    0x10, 0),
1188        BANK_PMX("H",      GPIOH_0,     GPIOH_11,    0xb,  0),
1189        BANK_PMX("X",      GPIOX_0,     GPIOX_19,    0x3,  0),
1190        BANK_PMX("Z",      GPIOZ_0,     GPIOZ_12,    0x6,  0),
1191        BANK_PMX("TEST_N", GPIO_TEST_N, GPIO_TEST_N, 0xf,  0)
1192};
1193
1194static struct meson_axg_pmx_data meson_s4_periphs_pmx_banks_data = {
1195        .pmx_banks      = meson_s4_periphs_pmx_banks,
1196        .num_pmx_banks  = ARRAY_SIZE(meson_s4_periphs_pmx_banks),
1197};
1198
1199static struct meson_pinctrl_data meson_s4_periphs_pinctrl_data = {
1200        .name           = "periphs-banks",
1201        .pins           = meson_s4_periphs_pins,
1202        .groups         = meson_s4_periphs_groups,
1203        .funcs          = meson_s4_periphs_functions,
1204        .banks          = meson_s4_periphs_banks,
1205        .num_pins       = ARRAY_SIZE(meson_s4_periphs_pins),
1206        .num_groups     = ARRAY_SIZE(meson_s4_periphs_groups),
1207        .num_funcs      = ARRAY_SIZE(meson_s4_periphs_functions),
1208        .num_banks      = ARRAY_SIZE(meson_s4_periphs_banks),
1209        .pmx_ops        = &meson_axg_pmx_ops,
1210        .pmx_data       = &meson_s4_periphs_pmx_banks_data,
1211        .parse_dt       = &meson_a1_parse_dt_extra,
1212};
1213
1214static const struct of_device_id meson_s4_pinctrl_dt_match[] = {
1215        {
1216                .compatible = "amlogic,meson-s4-periphs-pinctrl",
1217                .data = &meson_s4_periphs_pinctrl_data,
1218        },
1219        { }
1220};
1221MODULE_DEVICE_TABLE(of, meson_s4_pinctrl_dt_match);
1222
1223static struct platform_driver meson_s4_pinctrl_driver = {
1224        .probe  = meson_pinctrl_probe,
1225        .driver = {
1226                .name   = "meson-s4-pinctrl",
1227                .of_match_table = meson_s4_pinctrl_dt_match,
1228        },
1229};
1230module_platform_driver(meson_s4_pinctrl_driver);
1231
1232MODULE_LICENSE("Dual BSD/GPL");
1233