1 /* 2 * Pin controller and GPIO driver for Amlogic Meson GXL. 3 * 4 * Copyright (C) 2016 Endless Mobile, Inc. 5 * Author: Carlo Caione <carlo@endlessm.com> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 * 11 * You should have received a copy of the GNU General Public License 12 * along with this program. If not, see <http://www.gnu.org/licenses/>. 13 */ 14 15 #include <dt-bindings/gpio/meson-gxl-gpio.h> 16 #include "pinctrl-meson.h" 17 #include "pinctrl-meson8-pmx.h" 18 19 static const struct pinctrl_pin_desc meson_gxl_periphs_pins[] = { 20 MESON_PIN(GPIOZ_0), 21 MESON_PIN(GPIOZ_1), 22 MESON_PIN(GPIOZ_2), 23 MESON_PIN(GPIOZ_3), 24 MESON_PIN(GPIOZ_4), 25 MESON_PIN(GPIOZ_5), 26 MESON_PIN(GPIOZ_6), 27 MESON_PIN(GPIOZ_7), 28 MESON_PIN(GPIOZ_8), 29 MESON_PIN(GPIOZ_9), 30 MESON_PIN(GPIOZ_10), 31 MESON_PIN(GPIOZ_11), 32 MESON_PIN(GPIOZ_12), 33 MESON_PIN(GPIOZ_13), 34 MESON_PIN(GPIOZ_14), 35 MESON_PIN(GPIOZ_15), 36 37 MESON_PIN(GPIOH_0), 38 MESON_PIN(GPIOH_1), 39 MESON_PIN(GPIOH_2), 40 MESON_PIN(GPIOH_3), 41 MESON_PIN(GPIOH_4), 42 MESON_PIN(GPIOH_5), 43 MESON_PIN(GPIOH_6), 44 MESON_PIN(GPIOH_7), 45 MESON_PIN(GPIOH_8), 46 MESON_PIN(GPIOH_9), 47 48 MESON_PIN(BOOT_0), 49 MESON_PIN(BOOT_1), 50 MESON_PIN(BOOT_2), 51 MESON_PIN(BOOT_3), 52 MESON_PIN(BOOT_4), 53 MESON_PIN(BOOT_5), 54 MESON_PIN(BOOT_6), 55 MESON_PIN(BOOT_7), 56 MESON_PIN(BOOT_8), 57 MESON_PIN(BOOT_9), 58 MESON_PIN(BOOT_10), 59 MESON_PIN(BOOT_11), 60 MESON_PIN(BOOT_12), 61 MESON_PIN(BOOT_13), 62 MESON_PIN(BOOT_14), 63 MESON_PIN(BOOT_15), 64 65 MESON_PIN(CARD_0), 66 MESON_PIN(CARD_1), 67 MESON_PIN(CARD_2), 68 MESON_PIN(CARD_3), 69 MESON_PIN(CARD_4), 70 MESON_PIN(CARD_5), 71 MESON_PIN(CARD_6), 72 73 MESON_PIN(GPIODV_0), 74 MESON_PIN(GPIODV_1), 75 MESON_PIN(GPIODV_2), 76 MESON_PIN(GPIODV_3), 77 MESON_PIN(GPIODV_4), 78 MESON_PIN(GPIODV_5), 79 MESON_PIN(GPIODV_6), 80 MESON_PIN(GPIODV_7), 81 MESON_PIN(GPIODV_8), 82 MESON_PIN(GPIODV_9), 83 MESON_PIN(GPIODV_10), 84 MESON_PIN(GPIODV_11), 85 MESON_PIN(GPIODV_12), 86 MESON_PIN(GPIODV_13), 87 MESON_PIN(GPIODV_14), 88 MESON_PIN(GPIODV_15), 89 MESON_PIN(GPIODV_16), 90 MESON_PIN(GPIODV_17), 91 MESON_PIN(GPIODV_18), 92 MESON_PIN(GPIODV_19), 93 MESON_PIN(GPIODV_20), 94 MESON_PIN(GPIODV_21), 95 MESON_PIN(GPIODV_22), 96 MESON_PIN(GPIODV_23), 97 MESON_PIN(GPIODV_24), 98 MESON_PIN(GPIODV_25), 99 MESON_PIN(GPIODV_26), 100 MESON_PIN(GPIODV_27), 101 MESON_PIN(GPIODV_28), 102 MESON_PIN(GPIODV_29), 103 104 MESON_PIN(GPIOX_0), 105 MESON_PIN(GPIOX_1), 106 MESON_PIN(GPIOX_2), 107 MESON_PIN(GPIOX_3), 108 MESON_PIN(GPIOX_4), 109 MESON_PIN(GPIOX_5), 110 MESON_PIN(GPIOX_6), 111 MESON_PIN(GPIOX_7), 112 MESON_PIN(GPIOX_8), 113 MESON_PIN(GPIOX_9), 114 MESON_PIN(GPIOX_10), 115 MESON_PIN(GPIOX_11), 116 MESON_PIN(GPIOX_12), 117 MESON_PIN(GPIOX_13), 118 MESON_PIN(GPIOX_14), 119 MESON_PIN(GPIOX_15), 120 MESON_PIN(GPIOX_16), 121 MESON_PIN(GPIOX_17), 122 MESON_PIN(GPIOX_18), 123 124 MESON_PIN(GPIOCLK_0), 125 MESON_PIN(GPIOCLK_1), 126 }; 127 128 static const unsigned int emmc_nand_d07_pins[] = { 129 BOOT_0, BOOT_1, BOOT_2, BOOT_3, BOOT_4, BOOT_5, BOOT_6, BOOT_7, 130 }; 131 static const unsigned int emmc_clk_pins[] = { BOOT_8 }; 132 static const unsigned int emmc_cmd_pins[] = { BOOT_10 }; 133 static const unsigned int emmc_ds_pins[] = { BOOT_15 }; 134 135 static const unsigned int nor_d_pins[] = { BOOT_11 }; 136 static const unsigned int nor_q_pins[] = { BOOT_12 }; 137 static const unsigned int nor_c_pins[] = { BOOT_13 }; 138 static const unsigned int nor_cs_pins[] = { BOOT_15 }; 139 140 static const unsigned int spi_mosi_pins[] = { GPIOX_8 }; 141 static const unsigned int spi_miso_pins[] = { GPIOX_9 }; 142 static const unsigned int spi_ss0_pins[] = { GPIOX_10 }; 143 static const unsigned int spi_sclk_pins[] = { GPIOX_11 }; 144 145 static const unsigned int sdcard_d0_pins[] = { CARD_1 }; 146 static const unsigned int sdcard_d1_pins[] = { CARD_0 }; 147 static const unsigned int sdcard_d2_pins[] = { CARD_5 }; 148 static const unsigned int sdcard_d3_pins[] = { CARD_4 }; 149 static const unsigned int sdcard_cmd_pins[] = { CARD_3 }; 150 static const unsigned int sdcard_clk_pins[] = { CARD_2 }; 151 152 static const unsigned int sdio_d0_pins[] = { GPIOX_0 }; 153 static const unsigned int sdio_d1_pins[] = { GPIOX_1 }; 154 static const unsigned int sdio_d2_pins[] = { GPIOX_2 }; 155 static const unsigned int sdio_d3_pins[] = { GPIOX_3 }; 156 static const unsigned int sdio_cmd_pins[] = { GPIOX_4 }; 157 static const unsigned int sdio_clk_pins[] = { GPIOX_5 }; 158 static const unsigned int sdio_irq_pins[] = { GPIOX_7 }; 159 160 static const unsigned int nand_ce0_pins[] = { BOOT_8 }; 161 static const unsigned int nand_ce1_pins[] = { BOOT_9 }; 162 static const unsigned int nand_rb0_pins[] = { BOOT_10 }; 163 static const unsigned int nand_ale_pins[] = { BOOT_11 }; 164 static const unsigned int nand_cle_pins[] = { BOOT_12 }; 165 static const unsigned int nand_wen_clk_pins[] = { BOOT_13 }; 166 static const unsigned int nand_ren_wr_pins[] = { BOOT_14 }; 167 static const unsigned int nand_dqs_pins[] = { BOOT_15 }; 168 169 static const unsigned int uart_tx_a_pins[] = { GPIOX_12 }; 170 static const unsigned int uart_rx_a_pins[] = { GPIOX_13 }; 171 static const unsigned int uart_cts_a_pins[] = { GPIOX_14 }; 172 static const unsigned int uart_rts_a_pins[] = { GPIOX_15 }; 173 174 static const unsigned int uart_tx_b_pins[] = { GPIODV_24 }; 175 static const unsigned int uart_rx_b_pins[] = { GPIODV_25 }; 176 static const unsigned int uart_cts_b_pins[] = { GPIODV_26 }; 177 static const unsigned int uart_rts_b_pins[] = { GPIODV_27 }; 178 179 static const unsigned int uart_tx_c_pins[] = { GPIOX_8 }; 180 static const unsigned int uart_rx_c_pins[] = { GPIOX_9 }; 181 static const unsigned int uart_cts_c_pins[] = { GPIOX_10 }; 182 static const unsigned int uart_rts_c_pins[] = { GPIOX_11 }; 183 184 static const unsigned int i2c_sck_a_pins[] = { GPIODV_25 }; 185 static const unsigned int i2c_sda_a_pins[] = { GPIODV_24 }; 186 187 static const unsigned int i2c_sck_b_pins[] = { GPIODV_27 }; 188 static const unsigned int i2c_sda_b_pins[] = { GPIODV_26 }; 189 190 static const unsigned int i2c_sck_c_pins[] = { GPIODV_29 }; 191 static const unsigned int i2c_sda_c_pins[] = { GPIODV_28 }; 192 193 static const unsigned int i2c_sck_c_dv19_pins[] = { GPIODV_19 }; 194 static const unsigned int i2c_sda_c_dv18_pins[] = { GPIODV_18 }; 195 196 static const unsigned int eth_mdio_pins[] = { GPIOZ_0 }; 197 static const unsigned int eth_mdc_pins[] = { GPIOZ_1 }; 198 static const unsigned int eth_clk_rx_clk_pins[] = { GPIOZ_2 }; 199 static const unsigned int eth_rx_dv_pins[] = { GPIOZ_3 }; 200 static const unsigned int eth_rxd0_pins[] = { GPIOZ_4 }; 201 static const unsigned int eth_rxd1_pins[] = { GPIOZ_5 }; 202 static const unsigned int eth_rxd2_pins[] = { GPIOZ_6 }; 203 static const unsigned int eth_rxd3_pins[] = { GPIOZ_7 }; 204 static const unsigned int eth_rgmii_tx_clk_pins[] = { GPIOZ_8 }; 205 static const unsigned int eth_tx_en_pins[] = { GPIOZ_9 }; 206 static const unsigned int eth_txd0_pins[] = { GPIOZ_10 }; 207 static const unsigned int eth_txd1_pins[] = { GPIOZ_11 }; 208 static const unsigned int eth_txd2_pins[] = { GPIOZ_12 }; 209 static const unsigned int eth_txd3_pins[] = { GPIOZ_13 }; 210 211 static const unsigned int pwm_a_pins[] = { GPIOX_6 }; 212 213 static const unsigned int pwm_b_pins[] = { GPIODV_29 }; 214 215 static const unsigned int pwm_c_pins[] = { GPIOZ_15 }; 216 217 static const unsigned int pwm_d_pins[] = { GPIODV_28 }; 218 219 static const unsigned int pwm_e_pins[] = { GPIOX_16 }; 220 221 static const unsigned int pwm_f_clk_pins[] = { GPIOCLK_1 }; 222 static const unsigned int pwm_f_x_pins[] = { GPIOX_7 }; 223 224 static const unsigned int hdmi_hpd_pins[] = { GPIOH_0 }; 225 static const unsigned int hdmi_sda_pins[] = { GPIOH_1 }; 226 static const unsigned int hdmi_scl_pins[] = { GPIOH_2 }; 227 228 static const unsigned int i2s_am_clk_pins[] = { GPIOH_6 }; 229 static const unsigned int i2s_out_ao_clk_pins[] = { GPIOH_7 }; 230 static const unsigned int i2s_out_lr_clk_pins[] = { GPIOH_8 }; 231 static const unsigned int i2s_out_ch01_pins[] = { GPIOH_9 }; 232 static const unsigned int i2s_out_ch23_z_pins[] = { GPIOZ_5 }; 233 static const unsigned int i2s_out_ch45_z_pins[] = { GPIOZ_6 }; 234 static const unsigned int i2s_out_ch67_z_pins[] = { GPIOZ_7 }; 235 236 static const unsigned int spdif_out_h_pins[] = { GPIOH_4 }; 237 238 static const unsigned int eth_link_led_pins[] = { GPIOZ_14 }; 239 static const unsigned int eth_act_led_pins[] = { GPIOZ_15 }; 240 241 static const unsigned int tsin_a_d0_pins[] = { GPIODV_0 }; 242 static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 }; 243 static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 }; 244 static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 }; 245 static const unsigned int tsin_a_fail_pins[] = { GPIODV_11 }; 246 static const unsigned int tsin_a_dp_pins[] = { 247 GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7, 248 }; 249 250 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = { 251 MESON_PIN(GPIOAO_0), 252 MESON_PIN(GPIOAO_1), 253 MESON_PIN(GPIOAO_2), 254 MESON_PIN(GPIOAO_3), 255 MESON_PIN(GPIOAO_4), 256 MESON_PIN(GPIOAO_5), 257 MESON_PIN(GPIOAO_6), 258 MESON_PIN(GPIOAO_7), 259 MESON_PIN(GPIOAO_8), 260 MESON_PIN(GPIOAO_9), 261 262 MESON_PIN(GPIO_TEST_N), 263 }; 264 265 static const unsigned int uart_tx_ao_a_pins[] = { GPIOAO_0 }; 266 static const unsigned int uart_rx_ao_a_pins[] = { GPIOAO_1 }; 267 static const unsigned int uart_tx_ao_b_0_pins[] = { GPIOAO_0 }; 268 static const unsigned int uart_rx_ao_b_1_pins[] = { GPIOAO_1 }; 269 static const unsigned int uart_cts_ao_a_pins[] = { GPIOAO_2 }; 270 static const unsigned int uart_rts_ao_a_pins[] = { GPIOAO_3 }; 271 static const unsigned int uart_tx_ao_b_pins[] = { GPIOAO_4 }; 272 static const unsigned int uart_rx_ao_b_pins[] = { GPIOAO_5 }; 273 static const unsigned int uart_cts_ao_b_pins[] = { GPIOAO_2 }; 274 static const unsigned int uart_rts_ao_b_pins[] = { GPIOAO_3 }; 275 276 static const unsigned int i2c_sck_ao_pins[] = {GPIOAO_4 }; 277 static const unsigned int i2c_sda_ao_pins[] = {GPIOAO_5 }; 278 static const unsigned int i2c_slave_sck_ao_pins[] = {GPIOAO_4 }; 279 static const unsigned int i2c_slave_sda_ao_pins[] = {GPIOAO_5 }; 280 281 static const unsigned int remote_input_ao_pins[] = {GPIOAO_7 }; 282 283 static const unsigned int pwm_ao_a_3_pins[] = { GPIOAO_3 }; 284 static const unsigned int pwm_ao_a_8_pins[] = { GPIOAO_8 }; 285 286 static const unsigned int pwm_ao_b_pins[] = { GPIOAO_9 }; 287 static const unsigned int pwm_ao_b_6_pins[] = { GPIOAO_6 }; 288 289 static const unsigned int i2s_out_ch23_ao_pins[] = { GPIOAO_8 }; 290 static const unsigned int i2s_out_ch45_ao_pins[] = { GPIOAO_9 }; 291 static const unsigned int i2s_out_ch67_ao_pins[] = { GPIO_TEST_N }; 292 293 static const unsigned int spdif_out_ao_6_pins[] = { GPIOAO_6 }; 294 static const unsigned int spdif_out_ao_9_pins[] = { GPIOAO_9 }; 295 296 static const unsigned int ao_cec_pins[] = { GPIOAO_8 }; 297 static const unsigned int ee_cec_pins[] = { GPIOAO_8 }; 298 299 static struct meson_pmx_group meson_gxl_periphs_groups[] = { 300 GPIO_GROUP(GPIOZ_0), 301 GPIO_GROUP(GPIOZ_1), 302 GPIO_GROUP(GPIOZ_2), 303 GPIO_GROUP(GPIOZ_3), 304 GPIO_GROUP(GPIOZ_4), 305 GPIO_GROUP(GPIOZ_5), 306 GPIO_GROUP(GPIOZ_6), 307 GPIO_GROUP(GPIOZ_7), 308 GPIO_GROUP(GPIOZ_8), 309 GPIO_GROUP(GPIOZ_9), 310 GPIO_GROUP(GPIOZ_10), 311 GPIO_GROUP(GPIOZ_11), 312 GPIO_GROUP(GPIOZ_12), 313 GPIO_GROUP(GPIOZ_13), 314 GPIO_GROUP(GPIOZ_14), 315 GPIO_GROUP(GPIOZ_15), 316 317 GPIO_GROUP(GPIOH_0), 318 GPIO_GROUP(GPIOH_1), 319 GPIO_GROUP(GPIOH_2), 320 GPIO_GROUP(GPIOH_3), 321 GPIO_GROUP(GPIOH_4), 322 GPIO_GROUP(GPIOH_5), 323 GPIO_GROUP(GPIOH_6), 324 GPIO_GROUP(GPIOH_7), 325 GPIO_GROUP(GPIOH_8), 326 GPIO_GROUP(GPIOH_9), 327 328 GPIO_GROUP(BOOT_0), 329 GPIO_GROUP(BOOT_1), 330 GPIO_GROUP(BOOT_2), 331 GPIO_GROUP(BOOT_3), 332 GPIO_GROUP(BOOT_4), 333 GPIO_GROUP(BOOT_5), 334 GPIO_GROUP(BOOT_6), 335 GPIO_GROUP(BOOT_7), 336 GPIO_GROUP(BOOT_8), 337 GPIO_GROUP(BOOT_9), 338 GPIO_GROUP(BOOT_10), 339 GPIO_GROUP(BOOT_11), 340 GPIO_GROUP(BOOT_12), 341 GPIO_GROUP(BOOT_13), 342 GPIO_GROUP(BOOT_14), 343 GPIO_GROUP(BOOT_15), 344 345 GPIO_GROUP(CARD_0), 346 GPIO_GROUP(CARD_1), 347 GPIO_GROUP(CARD_2), 348 GPIO_GROUP(CARD_3), 349 GPIO_GROUP(CARD_4), 350 GPIO_GROUP(CARD_5), 351 GPIO_GROUP(CARD_6), 352 353 GPIO_GROUP(GPIODV_0), 354 GPIO_GROUP(GPIODV_1), 355 GPIO_GROUP(GPIODV_2), 356 GPIO_GROUP(GPIODV_3), 357 GPIO_GROUP(GPIODV_4), 358 GPIO_GROUP(GPIODV_5), 359 GPIO_GROUP(GPIODV_6), 360 GPIO_GROUP(GPIODV_7), 361 GPIO_GROUP(GPIODV_8), 362 GPIO_GROUP(GPIODV_9), 363 GPIO_GROUP(GPIODV_10), 364 GPIO_GROUP(GPIODV_11), 365 GPIO_GROUP(GPIODV_12), 366 GPIO_GROUP(GPIODV_13), 367 GPIO_GROUP(GPIODV_14), 368 GPIO_GROUP(GPIODV_15), 369 GPIO_GROUP(GPIODV_16), 370 GPIO_GROUP(GPIODV_17), 371 GPIO_GROUP(GPIODV_19), 372 GPIO_GROUP(GPIODV_20), 373 GPIO_GROUP(GPIODV_21), 374 GPIO_GROUP(GPIODV_22), 375 GPIO_GROUP(GPIODV_23), 376 GPIO_GROUP(GPIODV_24), 377 GPIO_GROUP(GPIODV_25), 378 GPIO_GROUP(GPIODV_26), 379 GPIO_GROUP(GPIODV_27), 380 GPIO_GROUP(GPIODV_28), 381 GPIO_GROUP(GPIODV_29), 382 383 GPIO_GROUP(GPIOX_0), 384 GPIO_GROUP(GPIOX_1), 385 GPIO_GROUP(GPIOX_2), 386 GPIO_GROUP(GPIOX_3), 387 GPIO_GROUP(GPIOX_4), 388 GPIO_GROUP(GPIOX_5), 389 GPIO_GROUP(GPIOX_6), 390 GPIO_GROUP(GPIOX_7), 391 GPIO_GROUP(GPIOX_8), 392 GPIO_GROUP(GPIOX_9), 393 GPIO_GROUP(GPIOX_10), 394 GPIO_GROUP(GPIOX_11), 395 GPIO_GROUP(GPIOX_12), 396 GPIO_GROUP(GPIOX_13), 397 GPIO_GROUP(GPIOX_14), 398 GPIO_GROUP(GPIOX_15), 399 GPIO_GROUP(GPIOX_16), 400 GPIO_GROUP(GPIOX_17), 401 GPIO_GROUP(GPIOX_18), 402 403 GPIO_GROUP(GPIOCLK_0), 404 GPIO_GROUP(GPIOCLK_1), 405 406 GPIO_GROUP(GPIO_TEST_N), 407 408 /* Bank X */ 409 GROUP(sdio_d0, 5, 31), 410 GROUP(sdio_d1, 5, 30), 411 GROUP(sdio_d2, 5, 29), 412 GROUP(sdio_d3, 5, 28), 413 GROUP(sdio_clk, 5, 27), 414 GROUP(sdio_cmd, 5, 26), 415 GROUP(sdio_irq, 5, 24), 416 GROUP(uart_tx_a, 5, 19), 417 GROUP(uart_rx_a, 5, 18), 418 GROUP(uart_cts_a, 5, 17), 419 GROUP(uart_rts_a, 5, 16), 420 GROUP(uart_tx_c, 5, 13), 421 GROUP(uart_rx_c, 5, 12), 422 GROUP(uart_cts_c, 5, 11), 423 GROUP(uart_rts_c, 5, 10), 424 GROUP(pwm_a, 5, 25), 425 GROUP(pwm_e, 5, 15), 426 GROUP(pwm_f_x, 5, 14), 427 GROUP(spi_mosi, 5, 3), 428 GROUP(spi_miso, 5, 2), 429 GROUP(spi_ss0, 5, 1), 430 GROUP(spi_sclk, 5, 0), 431 432 /* Bank Z */ 433 GROUP(eth_mdio, 4, 23), 434 GROUP(eth_mdc, 4, 22), 435 GROUP(eth_clk_rx_clk, 4, 21), 436 GROUP(eth_rx_dv, 4, 20), 437 GROUP(eth_rxd0, 4, 19), 438 GROUP(eth_rxd1, 4, 18), 439 GROUP(eth_rxd2, 4, 17), 440 GROUP(eth_rxd3, 4, 16), 441 GROUP(eth_rgmii_tx_clk, 4, 15), 442 GROUP(eth_tx_en, 4, 14), 443 GROUP(eth_txd0, 4, 13), 444 GROUP(eth_txd1, 4, 12), 445 GROUP(eth_txd2, 4, 11), 446 GROUP(eth_txd3, 4, 10), 447 GROUP(pwm_c, 3, 20), 448 GROUP(i2s_out_ch23_z, 3, 26), 449 GROUP(i2s_out_ch45_z, 3, 25), 450 GROUP(i2s_out_ch67_z, 3, 24), 451 GROUP(eth_link_led, 4, 25), 452 GROUP(eth_act_led, 4, 24), 453 454 /* Bank H */ 455 GROUP(hdmi_hpd, 6, 31), 456 GROUP(hdmi_sda, 6, 30), 457 GROUP(hdmi_scl, 6, 29), 458 GROUP(i2s_am_clk, 6, 26), 459 GROUP(i2s_out_ao_clk, 6, 25), 460 GROUP(i2s_out_lr_clk, 6, 24), 461 GROUP(i2s_out_ch01, 6, 23), 462 GROUP(spdif_out_h, 6, 28), 463 464 /* Bank DV */ 465 GROUP(uart_tx_b, 2, 16), 466 GROUP(uart_rx_b, 2, 15), 467 GROUP(uart_cts_b, 2, 14), 468 GROUP(uart_rts_b, 2, 13), 469 GROUP(i2c_sda_c_dv18, 1, 17), 470 GROUP(i2c_sck_c_dv19, 1, 16), 471 GROUP(i2c_sda_a, 1, 15), 472 GROUP(i2c_sck_a, 1, 14), 473 GROUP(i2c_sda_b, 1, 13), 474 GROUP(i2c_sck_b, 1, 12), 475 GROUP(i2c_sda_c, 1, 11), 476 GROUP(i2c_sck_c, 1, 10), 477 GROUP(pwm_b, 2, 11), 478 GROUP(pwm_d, 2, 12), 479 GROUP(tsin_a_d0, 2, 4), 480 GROUP(tsin_a_dp, 2, 3), 481 GROUP(tsin_a_clk, 2, 2), 482 GROUP(tsin_a_sop, 2, 1), 483 GROUP(tsin_a_d_valid, 2, 0), 484 GROUP(tsin_a_fail, 1, 31), 485 486 /* Bank BOOT */ 487 GROUP(emmc_nand_d07, 7, 31), 488 GROUP(emmc_clk, 7, 30), 489 GROUP(emmc_cmd, 7, 29), 490 GROUP(emmc_ds, 7, 28), 491 GROUP(nor_d, 7, 13), 492 GROUP(nor_q, 7, 12), 493 GROUP(nor_c, 7, 11), 494 GROUP(nor_cs, 7, 10), 495 GROUP(nand_ce0, 7, 7), 496 GROUP(nand_ce1, 7, 6), 497 GROUP(nand_rb0, 7, 5), 498 GROUP(nand_ale, 7, 4), 499 GROUP(nand_cle, 7, 3), 500 GROUP(nand_wen_clk, 7, 2), 501 GROUP(nand_ren_wr, 7, 1), 502 GROUP(nand_dqs, 7, 0), 503 504 /* Bank CARD */ 505 GROUP(sdcard_d1, 6, 5), 506 GROUP(sdcard_d0, 6, 4), 507 GROUP(sdcard_d3, 6, 1), 508 GROUP(sdcard_d2, 6, 0), 509 GROUP(sdcard_cmd, 6, 2), 510 GROUP(sdcard_clk, 6, 3), 511 512 /* Bank CLK */ 513 GROUP(pwm_f_clk, 8, 30), 514 }; 515 516 static struct meson_pmx_group meson_gxl_aobus_groups[] = { 517 GPIO_GROUP(GPIOAO_0), 518 GPIO_GROUP(GPIOAO_1), 519 GPIO_GROUP(GPIOAO_2), 520 GPIO_GROUP(GPIOAO_3), 521 GPIO_GROUP(GPIOAO_4), 522 GPIO_GROUP(GPIOAO_5), 523 GPIO_GROUP(GPIOAO_6), 524 GPIO_GROUP(GPIOAO_7), 525 GPIO_GROUP(GPIOAO_8), 526 GPIO_GROUP(GPIOAO_9), 527 528 /* bank AO */ 529 GROUP(uart_tx_ao_b_0, 0, 26), 530 GROUP(uart_rx_ao_b_1, 0, 25), 531 GROUP(uart_tx_ao_b, 0, 24), 532 GROUP(uart_rx_ao_b, 0, 23), 533 GROUP(uart_tx_ao_a, 0, 12), 534 GROUP(uart_rx_ao_a, 0, 11), 535 GROUP(uart_cts_ao_a, 0, 10), 536 GROUP(uart_rts_ao_a, 0, 9), 537 GROUP(uart_cts_ao_b, 0, 8), 538 GROUP(uart_rts_ao_b, 0, 7), 539 GROUP(i2c_sck_ao, 0, 6), 540 GROUP(i2c_sda_ao, 0, 5), 541 GROUP(i2c_slave_sck_ao, 0, 2), 542 GROUP(i2c_slave_sda_ao, 0, 1), 543 GROUP(remote_input_ao, 0, 0), 544 GROUP(pwm_ao_a_3, 0, 22), 545 GROUP(pwm_ao_b_6, 0, 18), 546 GROUP(pwm_ao_a_8, 0, 17), 547 GROUP(pwm_ao_b, 0, 3), 548 GROUP(i2s_out_ch23_ao, 1, 0), 549 GROUP(i2s_out_ch45_ao, 1, 1), 550 GROUP(spdif_out_ao_6, 0, 16), 551 GROUP(spdif_out_ao_9, 0, 4), 552 GROUP(ao_cec, 0, 15), 553 GROUP(ee_cec, 0, 14), 554 555 /* test n pin */ 556 GROUP(i2s_out_ch67_ao, 1, 2), 557 }; 558 559 static const char * const gpio_periphs_groups[] = { 560 "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4", 561 "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9", 562 "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14", 563 "GPIOZ_15", 564 565 "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4", 566 "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9", 567 568 "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", 569 "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", 570 "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", 571 "BOOT_15", 572 573 "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", 574 "CARD_5", "CARD_6", 575 576 "GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4", 577 "GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9", 578 "GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14", 579 "GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19", 580 "GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24", 581 "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29", 582 583 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", 584 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", 585 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14", 586 "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", 587 }; 588 589 static const char * const emmc_groups[] = { 590 "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds", 591 }; 592 593 static const char * const nor_groups[] = { 594 "nor_d", "nor_q", "nor_c", "nor_cs", 595 }; 596 597 static const char * const spi_groups[] = { 598 "spi_mosi", "spi_miso", "spi_ss0", "spi_sclk", 599 }; 600 601 static const char * const sdcard_groups[] = { 602 "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3", 603 "sdcard_cmd", "sdcard_clk", 604 }; 605 606 static const char * const sdio_groups[] = { 607 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3", 608 "sdio_cmd", "sdio_clk", "sdio_irq", 609 }; 610 611 static const char * const nand_groups[] = { 612 "emmc_nand_d07", "nand_ce0", "nand_ce1", "nand_rb0", "nand_ale", 613 "nand_cle", "nand_wen_clk", "nand_ren_wr", "nand_dqs", 614 }; 615 616 static const char * const uart_a_groups[] = { 617 "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a", 618 }; 619 620 static const char * const uart_b_groups[] = { 621 "uart_tx_b", "uart_rx_b", "uart_cts_b", "uart_rts_b", 622 }; 623 624 static const char * const uart_c_groups[] = { 625 "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c", 626 }; 627 628 static const char * const i2c_a_groups[] = { 629 "i2c_sck_a", "i2c_sda_a", 630 }; 631 632 static const char * const i2c_b_groups[] = { 633 "i2c_sck_b", "i2c_sda_b", 634 }; 635 636 static const char * const i2c_c_groups[] = { 637 "i2c_sck_c", "i2c_sda_c", "i2c_sda_c_dv18", "i2c_sck_c_dv19", 638 }; 639 640 static const char * const eth_groups[] = { 641 "eth_mdio", "eth_mdc", "eth_clk_rx_clk", "eth_rx_dv", 642 "eth_rxd0", "eth_rxd1", "eth_rxd2", "eth_rxd3", 643 "eth_rgmii_tx_clk", "eth_tx_en", 644 "eth_txd0", "eth_txd1", "eth_txd2", "eth_txd3", 645 }; 646 647 static const char * const pwm_a_groups[] = { 648 "pwm_a", 649 }; 650 651 static const char * const pwm_b_groups[] = { 652 "pwm_b", 653 }; 654 655 static const char * const pwm_c_groups[] = { 656 "pwm_c", 657 }; 658 659 static const char * const pwm_d_groups[] = { 660 "pwm_d", 661 }; 662 663 static const char * const pwm_e_groups[] = { 664 "pwm_e", 665 }; 666 667 static const char * const pwm_f_groups[] = { 668 "pwm_f_clk", "pwm_f_x", 669 }; 670 671 static const char * const hdmi_hpd_groups[] = { 672 "hdmi_hpd", 673 }; 674 675 static const char * const hdmi_i2c_groups[] = { 676 "hdmi_sda", "hdmi_scl", 677 }; 678 679 static const char * const i2s_out_groups[] = { 680 "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk", 681 "i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z", 682 }; 683 684 static const char * const spdif_out_groups[] = { 685 "spdif_out_h", 686 }; 687 688 static const char * const eth_led_groups[] = { 689 "eth_link_led", "eth_act_led", 690 }; 691 692 static const char * const tsin_a_groups[] = { 693 "tsin_a_clk", "tsin_a_sop", 694 "tsin_a_d_valid", "tsin_a_d0", 695 "tsin_a_dp", "tsin_a_fail", 696 }; 697 698 static const char * const gpio_aobus_groups[] = { 699 "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", 700 "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", 701 702 "GPIO_TEST_N", 703 }; 704 705 static const char * const uart_ao_groups[] = { 706 "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a", 707 }; 708 709 static const char * const uart_ao_b_groups[] = { 710 "uart_tx_ao_b", "uart_rx_ao_b", "uart_cts_ao_b", "uart_rts_ao_b", 711 "uart_tx_ao_b_0", "uart_rx_ao_b_1", 712 }; 713 714 static const char * const i2c_ao_groups[] = { 715 "i2c_sck_ao", "i2c_sda_ao", 716 }; 717 718 static const char * const i2c_slave_ao_groups[] = { 719 "i2c_slave_sck_ao", "i2c_slave_sda_ao", 720 }; 721 722 static const char * const remote_input_ao_groups[] = { 723 "remote_input_ao", 724 }; 725 726 static const char * const pwm_ao_a_groups[] = { 727 "pwm_ao_a_3", "pwm_ao_a_8", 728 }; 729 730 static const char * const pwm_ao_b_groups[] = { 731 "pwm_ao_b", "pwm_ao_b_6", 732 }; 733 734 static const char * const i2s_out_ao_groups[] = { 735 "i2s_out_ch23_ao", "i2s_out_ch45_ao", "i2s_out_ch67_ao", 736 }; 737 738 static const char * const spdif_out_ao_groups[] = { 739 "spdif_out_ao_6", "spdif_out_ao_9", 740 }; 741 742 static const char * const cec_ao_groups[] = { 743 "ao_cec", "ee_cec", 744 }; 745 746 static struct meson_pmx_func meson_gxl_periphs_functions[] = { 747 FUNCTION(gpio_periphs), 748 FUNCTION(emmc), 749 FUNCTION(nor), 750 FUNCTION(spi), 751 FUNCTION(sdcard), 752 FUNCTION(sdio), 753 FUNCTION(nand), 754 FUNCTION(uart_a), 755 FUNCTION(uart_b), 756 FUNCTION(uart_c), 757 FUNCTION(i2c_a), 758 FUNCTION(i2c_b), 759 FUNCTION(i2c_c), 760 FUNCTION(eth), 761 FUNCTION(pwm_a), 762 FUNCTION(pwm_b), 763 FUNCTION(pwm_c), 764 FUNCTION(pwm_d), 765 FUNCTION(pwm_e), 766 FUNCTION(pwm_f), 767 FUNCTION(hdmi_hpd), 768 FUNCTION(hdmi_i2c), 769 FUNCTION(i2s_out), 770 FUNCTION(spdif_out), 771 FUNCTION(eth_led), 772 FUNCTION(tsin_a), 773 }; 774 775 static struct meson_pmx_func meson_gxl_aobus_functions[] = { 776 FUNCTION(gpio_aobus), 777 FUNCTION(uart_ao), 778 FUNCTION(uart_ao_b), 779 FUNCTION(i2c_ao), 780 FUNCTION(i2c_slave_ao), 781 FUNCTION(remote_input_ao), 782 FUNCTION(pwm_ao_a), 783 FUNCTION(pwm_ao_b), 784 FUNCTION(i2s_out_ao), 785 FUNCTION(spdif_out_ao), 786 FUNCTION(cec_ao), 787 }; 788 789 static struct meson_bank meson_gxl_periphs_banks[] = { 790 /* name first last irq pullen pull dir out in */ 791 BANK("X", GPIOX_0, GPIOX_18, 89, 107, 4, 0, 4, 0, 12, 0, 13, 0, 14, 0), 792 BANK("DV", GPIODV_0, GPIODV_29, 83, 88, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0), 793 BANK("H", GPIOH_0, GPIOH_9, 26, 35, 1, 20, 1, 20, 3, 20, 4, 20, 5, 20), 794 BANK("Z", GPIOZ_0, GPIOZ_15, 10, 25, 3, 0, 3, 0, 9, 0, 10, 0, 11, 0), 795 BANK("CARD", CARD_0, CARD_6, 52, 58, 2, 20, 2, 20, 6, 20, 7, 20, 8, 20), 796 BANK("BOOT", BOOT_0, BOOT_15, 36, 51, 2, 0, 2, 0, 6, 0, 7, 0, 8, 0), 797 BANK("CLK", GPIOCLK_0, GPIOCLK_1, 108, 109, 3, 28, 3, 28, 9, 28, 10, 28, 11, 28), 798 }; 799 800 static struct meson_bank meson_gxl_aobus_banks[] = { 801 /* name first last irq pullen pull dir out in */ 802 BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), 803 }; 804 805 static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = { 806 .name = "periphs-banks", 807 .pins = meson_gxl_periphs_pins, 808 .groups = meson_gxl_periphs_groups, 809 .funcs = meson_gxl_periphs_functions, 810 .banks = meson_gxl_periphs_banks, 811 .num_pins = ARRAY_SIZE(meson_gxl_periphs_pins), 812 .num_groups = ARRAY_SIZE(meson_gxl_periphs_groups), 813 .num_funcs = ARRAY_SIZE(meson_gxl_periphs_functions), 814 .num_banks = ARRAY_SIZE(meson_gxl_periphs_banks), 815 .pmx_ops = &meson8_pmx_ops, 816 }; 817 818 static struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = { 819 .name = "aobus-banks", 820 .pins = meson_gxl_aobus_pins, 821 .groups = meson_gxl_aobus_groups, 822 .funcs = meson_gxl_aobus_functions, 823 .banks = meson_gxl_aobus_banks, 824 .num_pins = ARRAY_SIZE(meson_gxl_aobus_pins), 825 .num_groups = ARRAY_SIZE(meson_gxl_aobus_groups), 826 .num_funcs = ARRAY_SIZE(meson_gxl_aobus_functions), 827 .num_banks = ARRAY_SIZE(meson_gxl_aobus_banks), 828 .pmx_ops = &meson8_pmx_ops, 829 }; 830 831 static const struct of_device_id meson_gxl_pinctrl_dt_match[] = { 832 { 833 .compatible = "amlogic,meson-gxl-periphs-pinctrl", 834 .data = &meson_gxl_periphs_pinctrl_data, 835 }, 836 { 837 .compatible = "amlogic,meson-gxl-aobus-pinctrl", 838 .data = &meson_gxl_aobus_pinctrl_data, 839 }, 840 { }, 841 }; 842 843 static struct platform_driver meson_gxl_pinctrl_driver = { 844 .probe = meson_pinctrl_probe, 845 .driver = { 846 .name = "meson-gxl-pinctrl", 847 .of_match_table = meson_gxl_pinctrl_dt_match, 848 }, 849 }; 850 builtin_platform_driver(meson_gxl_pinctrl_driver); 851