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_d0_x_pins[] = { GPIOX_10 }; 243 static const unsigned int tsin_a_clk_pins[] = { GPIODV_8 }; 244 static const unsigned int tsin_a_clk_x_pins[] = { GPIOX_11 }; 245 static const unsigned int tsin_a_sop_pins[] = { GPIODV_9 }; 246 static const unsigned int tsin_a_sop_x_pins[] = { GPIOX_8 }; 247 static const unsigned int tsin_a_d_valid_pins[] = { GPIODV_10 }; 248 static const unsigned int tsin_a_d_valid_x_pins[] = { GPIOX_9 }; 249 static const unsigned int tsin_a_fail_pins[] = { GPIODV_11 }; 250 static const unsigned int tsin_a_dp_pins[] = { 251 GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7, 252 }; 253 254 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = { 255 MESON_PIN(GPIOAO_0), 256 MESON_PIN(GPIOAO_1), 257 MESON_PIN(GPIOAO_2), 258 MESON_PIN(GPIOAO_3), 259 MESON_PIN(GPIOAO_4), 260 MESON_PIN(GPIOAO_5), 261 MESON_PIN(GPIOAO_6), 262 MESON_PIN(GPIOAO_7), 263 MESON_PIN(GPIOAO_8), 264 MESON_PIN(GPIOAO_9), 265 266 MESON_PIN(GPIO_TEST_N), 267 }; 268 269 static const unsigned int uart_tx_ao_a_pins[] = { GPIOAO_0 }; 270 static const unsigned int uart_rx_ao_a_pins[] = { GPIOAO_1 }; 271 static const unsigned int uart_tx_ao_b_0_pins[] = { GPIOAO_0 }; 272 static const unsigned int uart_rx_ao_b_1_pins[] = { GPIOAO_1 }; 273 static const unsigned int uart_cts_ao_a_pins[] = { GPIOAO_2 }; 274 static const unsigned int uart_rts_ao_a_pins[] = { GPIOAO_3 }; 275 static const unsigned int uart_tx_ao_b_pins[] = { GPIOAO_4 }; 276 static const unsigned int uart_rx_ao_b_pins[] = { GPIOAO_5 }; 277 static const unsigned int uart_cts_ao_b_pins[] = { GPIOAO_2 }; 278 static const unsigned int uart_rts_ao_b_pins[] = { GPIOAO_3 }; 279 280 static const unsigned int i2c_sck_ao_pins[] = {GPIOAO_4 }; 281 static const unsigned int i2c_sda_ao_pins[] = {GPIOAO_5 }; 282 static const unsigned int i2c_slave_sck_ao_pins[] = {GPIOAO_4 }; 283 static const unsigned int i2c_slave_sda_ao_pins[] = {GPIOAO_5 }; 284 285 static const unsigned int remote_input_ao_pins[] = {GPIOAO_7 }; 286 287 static const unsigned int pwm_ao_a_3_pins[] = { GPIOAO_3 }; 288 static const unsigned int pwm_ao_a_8_pins[] = { GPIOAO_8 }; 289 290 static const unsigned int pwm_ao_b_pins[] = { GPIOAO_9 }; 291 static const unsigned int pwm_ao_b_6_pins[] = { GPIOAO_6 }; 292 293 static const unsigned int i2s_out_ch23_ao_pins[] = { GPIOAO_8 }; 294 static const unsigned int i2s_out_ch45_ao_pins[] = { GPIOAO_9 }; 295 static const unsigned int i2s_out_ch67_ao_pins[] = { GPIO_TEST_N }; 296 297 static const unsigned int spdif_out_ao_6_pins[] = { GPIOAO_6 }; 298 static const unsigned int spdif_out_ao_9_pins[] = { GPIOAO_9 }; 299 300 static const unsigned int ao_cec_pins[] = { GPIOAO_8 }; 301 static const unsigned int ee_cec_pins[] = { GPIOAO_8 }; 302 303 static struct meson_pmx_group meson_gxl_periphs_groups[] = { 304 GPIO_GROUP(GPIOZ_0), 305 GPIO_GROUP(GPIOZ_1), 306 GPIO_GROUP(GPIOZ_2), 307 GPIO_GROUP(GPIOZ_3), 308 GPIO_GROUP(GPIOZ_4), 309 GPIO_GROUP(GPIOZ_5), 310 GPIO_GROUP(GPIOZ_6), 311 GPIO_GROUP(GPIOZ_7), 312 GPIO_GROUP(GPIOZ_8), 313 GPIO_GROUP(GPIOZ_9), 314 GPIO_GROUP(GPIOZ_10), 315 GPIO_GROUP(GPIOZ_11), 316 GPIO_GROUP(GPIOZ_12), 317 GPIO_GROUP(GPIOZ_13), 318 GPIO_GROUP(GPIOZ_14), 319 GPIO_GROUP(GPIOZ_15), 320 321 GPIO_GROUP(GPIOH_0), 322 GPIO_GROUP(GPIOH_1), 323 GPIO_GROUP(GPIOH_2), 324 GPIO_GROUP(GPIOH_3), 325 GPIO_GROUP(GPIOH_4), 326 GPIO_GROUP(GPIOH_5), 327 GPIO_GROUP(GPIOH_6), 328 GPIO_GROUP(GPIOH_7), 329 GPIO_GROUP(GPIOH_8), 330 GPIO_GROUP(GPIOH_9), 331 332 GPIO_GROUP(BOOT_0), 333 GPIO_GROUP(BOOT_1), 334 GPIO_GROUP(BOOT_2), 335 GPIO_GROUP(BOOT_3), 336 GPIO_GROUP(BOOT_4), 337 GPIO_GROUP(BOOT_5), 338 GPIO_GROUP(BOOT_6), 339 GPIO_GROUP(BOOT_7), 340 GPIO_GROUP(BOOT_8), 341 GPIO_GROUP(BOOT_9), 342 GPIO_GROUP(BOOT_10), 343 GPIO_GROUP(BOOT_11), 344 GPIO_GROUP(BOOT_12), 345 GPIO_GROUP(BOOT_13), 346 GPIO_GROUP(BOOT_14), 347 GPIO_GROUP(BOOT_15), 348 349 GPIO_GROUP(CARD_0), 350 GPIO_GROUP(CARD_1), 351 GPIO_GROUP(CARD_2), 352 GPIO_GROUP(CARD_3), 353 GPIO_GROUP(CARD_4), 354 GPIO_GROUP(CARD_5), 355 GPIO_GROUP(CARD_6), 356 357 GPIO_GROUP(GPIODV_0), 358 GPIO_GROUP(GPIODV_1), 359 GPIO_GROUP(GPIODV_2), 360 GPIO_GROUP(GPIODV_3), 361 GPIO_GROUP(GPIODV_4), 362 GPIO_GROUP(GPIODV_5), 363 GPIO_GROUP(GPIODV_6), 364 GPIO_GROUP(GPIODV_7), 365 GPIO_GROUP(GPIODV_8), 366 GPIO_GROUP(GPIODV_9), 367 GPIO_GROUP(GPIODV_10), 368 GPIO_GROUP(GPIODV_11), 369 GPIO_GROUP(GPIODV_12), 370 GPIO_GROUP(GPIODV_13), 371 GPIO_GROUP(GPIODV_14), 372 GPIO_GROUP(GPIODV_15), 373 GPIO_GROUP(GPIODV_16), 374 GPIO_GROUP(GPIODV_17), 375 GPIO_GROUP(GPIODV_19), 376 GPIO_GROUP(GPIODV_20), 377 GPIO_GROUP(GPIODV_21), 378 GPIO_GROUP(GPIODV_22), 379 GPIO_GROUP(GPIODV_23), 380 GPIO_GROUP(GPIODV_24), 381 GPIO_GROUP(GPIODV_25), 382 GPIO_GROUP(GPIODV_26), 383 GPIO_GROUP(GPIODV_27), 384 GPIO_GROUP(GPIODV_28), 385 GPIO_GROUP(GPIODV_29), 386 387 GPIO_GROUP(GPIOX_0), 388 GPIO_GROUP(GPIOX_1), 389 GPIO_GROUP(GPIOX_2), 390 GPIO_GROUP(GPIOX_3), 391 GPIO_GROUP(GPIOX_4), 392 GPIO_GROUP(GPIOX_5), 393 GPIO_GROUP(GPIOX_6), 394 GPIO_GROUP(GPIOX_7), 395 GPIO_GROUP(GPIOX_8), 396 GPIO_GROUP(GPIOX_9), 397 GPIO_GROUP(GPIOX_10), 398 GPIO_GROUP(GPIOX_11), 399 GPIO_GROUP(GPIOX_12), 400 GPIO_GROUP(GPIOX_13), 401 GPIO_GROUP(GPIOX_14), 402 GPIO_GROUP(GPIOX_15), 403 GPIO_GROUP(GPIOX_16), 404 GPIO_GROUP(GPIOX_17), 405 GPIO_GROUP(GPIOX_18), 406 407 GPIO_GROUP(GPIOCLK_0), 408 GPIO_GROUP(GPIOCLK_1), 409 410 GPIO_GROUP(GPIO_TEST_N), 411 412 /* Bank X */ 413 GROUP(sdio_d0, 5, 31), 414 GROUP(sdio_d1, 5, 30), 415 GROUP(sdio_d2, 5, 29), 416 GROUP(sdio_d3, 5, 28), 417 GROUP(sdio_clk, 5, 27), 418 GROUP(sdio_cmd, 5, 26), 419 GROUP(sdio_irq, 5, 24), 420 GROUP(uart_tx_a, 5, 19), 421 GROUP(uart_rx_a, 5, 18), 422 GROUP(uart_cts_a, 5, 17), 423 GROUP(uart_rts_a, 5, 16), 424 GROUP(uart_tx_c, 5, 13), 425 GROUP(uart_rx_c, 5, 12), 426 GROUP(uart_cts_c, 5, 11), 427 GROUP(uart_rts_c, 5, 10), 428 GROUP(pwm_a, 5, 25), 429 GROUP(pwm_e, 5, 15), 430 GROUP(pwm_f_x, 5, 14), 431 GROUP(spi_mosi, 5, 3), 432 GROUP(spi_miso, 5, 2), 433 GROUP(spi_ss0, 5, 1), 434 GROUP(spi_sclk, 5, 0), 435 GROUP(tsin_a_sop_x, 6, 3), 436 GROUP(tsin_a_d_valid_x, 6, 2), 437 GROUP(tsin_a_d0_x, 6, 1), 438 GROUP(tsin_a_clk_x, 6, 0), 439 440 /* Bank Z */ 441 GROUP(eth_mdio, 4, 23), 442 GROUP(eth_mdc, 4, 22), 443 GROUP(eth_clk_rx_clk, 4, 21), 444 GROUP(eth_rx_dv, 4, 20), 445 GROUP(eth_rxd0, 4, 19), 446 GROUP(eth_rxd1, 4, 18), 447 GROUP(eth_rxd2, 4, 17), 448 GROUP(eth_rxd3, 4, 16), 449 GROUP(eth_rgmii_tx_clk, 4, 15), 450 GROUP(eth_tx_en, 4, 14), 451 GROUP(eth_txd0, 4, 13), 452 GROUP(eth_txd1, 4, 12), 453 GROUP(eth_txd2, 4, 11), 454 GROUP(eth_txd3, 4, 10), 455 GROUP(pwm_c, 3, 20), 456 GROUP(i2s_out_ch23_z, 3, 26), 457 GROUP(i2s_out_ch45_z, 3, 25), 458 GROUP(i2s_out_ch67_z, 3, 24), 459 GROUP(eth_link_led, 4, 25), 460 GROUP(eth_act_led, 4, 24), 461 462 /* Bank H */ 463 GROUP(hdmi_hpd, 6, 31), 464 GROUP(hdmi_sda, 6, 30), 465 GROUP(hdmi_scl, 6, 29), 466 GROUP(i2s_am_clk, 6, 26), 467 GROUP(i2s_out_ao_clk, 6, 25), 468 GROUP(i2s_out_lr_clk, 6, 24), 469 GROUP(i2s_out_ch01, 6, 23), 470 GROUP(spdif_out_h, 6, 28), 471 472 /* Bank DV */ 473 GROUP(uart_tx_b, 2, 16), 474 GROUP(uart_rx_b, 2, 15), 475 GROUP(uart_cts_b, 2, 14), 476 GROUP(uart_rts_b, 2, 13), 477 GROUP(i2c_sda_c_dv18, 1, 17), 478 GROUP(i2c_sck_c_dv19, 1, 16), 479 GROUP(i2c_sda_a, 1, 15), 480 GROUP(i2c_sck_a, 1, 14), 481 GROUP(i2c_sda_b, 1, 13), 482 GROUP(i2c_sck_b, 1, 12), 483 GROUP(i2c_sda_c, 1, 11), 484 GROUP(i2c_sck_c, 1, 10), 485 GROUP(pwm_b, 2, 11), 486 GROUP(pwm_d, 2, 12), 487 GROUP(tsin_a_d0, 2, 4), 488 GROUP(tsin_a_dp, 2, 3), 489 GROUP(tsin_a_clk, 2, 2), 490 GROUP(tsin_a_sop, 2, 1), 491 GROUP(tsin_a_d_valid, 2, 0), 492 GROUP(tsin_a_fail, 1, 31), 493 494 /* Bank BOOT */ 495 GROUP(emmc_nand_d07, 7, 31), 496 GROUP(emmc_clk, 7, 30), 497 GROUP(emmc_cmd, 7, 29), 498 GROUP(emmc_ds, 7, 28), 499 GROUP(nor_d, 7, 13), 500 GROUP(nor_q, 7, 12), 501 GROUP(nor_c, 7, 11), 502 GROUP(nor_cs, 7, 10), 503 GROUP(nand_ce0, 7, 7), 504 GROUP(nand_ce1, 7, 6), 505 GROUP(nand_rb0, 7, 5), 506 GROUP(nand_ale, 7, 4), 507 GROUP(nand_cle, 7, 3), 508 GROUP(nand_wen_clk, 7, 2), 509 GROUP(nand_ren_wr, 7, 1), 510 GROUP(nand_dqs, 7, 0), 511 512 /* Bank CARD */ 513 GROUP(sdcard_d1, 6, 5), 514 GROUP(sdcard_d0, 6, 4), 515 GROUP(sdcard_d3, 6, 1), 516 GROUP(sdcard_d2, 6, 0), 517 GROUP(sdcard_cmd, 6, 2), 518 GROUP(sdcard_clk, 6, 3), 519 520 /* Bank CLK */ 521 GROUP(pwm_f_clk, 8, 30), 522 }; 523 524 static struct meson_pmx_group meson_gxl_aobus_groups[] = { 525 GPIO_GROUP(GPIOAO_0), 526 GPIO_GROUP(GPIOAO_1), 527 GPIO_GROUP(GPIOAO_2), 528 GPIO_GROUP(GPIOAO_3), 529 GPIO_GROUP(GPIOAO_4), 530 GPIO_GROUP(GPIOAO_5), 531 GPIO_GROUP(GPIOAO_6), 532 GPIO_GROUP(GPIOAO_7), 533 GPIO_GROUP(GPIOAO_8), 534 GPIO_GROUP(GPIOAO_9), 535 536 /* bank AO */ 537 GROUP(uart_tx_ao_b_0, 0, 26), 538 GROUP(uart_rx_ao_b_1, 0, 25), 539 GROUP(uart_tx_ao_b, 0, 24), 540 GROUP(uart_rx_ao_b, 0, 23), 541 GROUP(uart_tx_ao_a, 0, 12), 542 GROUP(uart_rx_ao_a, 0, 11), 543 GROUP(uart_cts_ao_a, 0, 10), 544 GROUP(uart_rts_ao_a, 0, 9), 545 GROUP(uart_cts_ao_b, 0, 8), 546 GROUP(uart_rts_ao_b, 0, 7), 547 GROUP(i2c_sck_ao, 0, 6), 548 GROUP(i2c_sda_ao, 0, 5), 549 GROUP(i2c_slave_sck_ao, 0, 2), 550 GROUP(i2c_slave_sda_ao, 0, 1), 551 GROUP(remote_input_ao, 0, 0), 552 GROUP(pwm_ao_a_3, 0, 22), 553 GROUP(pwm_ao_b_6, 0, 18), 554 GROUP(pwm_ao_a_8, 0, 17), 555 GROUP(pwm_ao_b, 0, 3), 556 GROUP(i2s_out_ch23_ao, 1, 0), 557 GROUP(i2s_out_ch45_ao, 1, 1), 558 GROUP(spdif_out_ao_6, 0, 16), 559 GROUP(spdif_out_ao_9, 0, 4), 560 GROUP(ao_cec, 0, 15), 561 GROUP(ee_cec, 0, 14), 562 563 /* test n pin */ 564 GROUP(i2s_out_ch67_ao, 1, 2), 565 }; 566 567 static const char * const gpio_periphs_groups[] = { 568 "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4", 569 "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9", 570 "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14", 571 "GPIOZ_15", 572 573 "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4", 574 "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9", 575 576 "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", 577 "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", 578 "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", 579 "BOOT_15", 580 581 "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", 582 "CARD_5", "CARD_6", 583 584 "GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4", 585 "GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9", 586 "GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14", 587 "GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19", 588 "GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24", 589 "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29", 590 591 "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", 592 "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", 593 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14", 594 "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", 595 }; 596 597 static const char * const emmc_groups[] = { 598 "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds", 599 }; 600 601 static const char * const nor_groups[] = { 602 "nor_d", "nor_q", "nor_c", "nor_cs", 603 }; 604 605 static const char * const spi_groups[] = { 606 "spi_mosi", "spi_miso", "spi_ss0", "spi_sclk", 607 }; 608 609 static const char * const sdcard_groups[] = { 610 "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3", 611 "sdcard_cmd", "sdcard_clk", 612 }; 613 614 static const char * const sdio_groups[] = { 615 "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3", 616 "sdio_cmd", "sdio_clk", "sdio_irq", 617 }; 618 619 static const char * const nand_groups[] = { 620 "nand_ce0", "nand_ce1", "nand_rb0", "nand_ale", "nand_cle", 621 "nand_wen_clk", "nand_ren_wr", "nand_dqs", 622 }; 623 624 static const char * const uart_a_groups[] = { 625 "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a", 626 }; 627 628 static const char * const uart_b_groups[] = { 629 "uart_tx_b", "uart_rx_b", "uart_cts_b", "uart_rts_b", 630 }; 631 632 static const char * const uart_c_groups[] = { 633 "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c", 634 }; 635 636 static const char * const i2c_a_groups[] = { 637 "i2c_sck_a", "i2c_sda_a", 638 }; 639 640 static const char * const i2c_b_groups[] = { 641 "i2c_sck_b", "i2c_sda_b", 642 }; 643 644 static const char * const i2c_c_groups[] = { 645 "i2c_sck_c", "i2c_sda_c", "i2c_sda_c_dv18", "i2c_sck_c_dv19", 646 }; 647 648 static const char * const eth_groups[] = { 649 "eth_mdio", "eth_mdc", "eth_clk_rx_clk", "eth_rx_dv", 650 "eth_rxd0", "eth_rxd1", "eth_rxd2", "eth_rxd3", 651 "eth_rgmii_tx_clk", "eth_tx_en", 652 "eth_txd0", "eth_txd1", "eth_txd2", "eth_txd3", 653 }; 654 655 static const char * const pwm_a_groups[] = { 656 "pwm_a", 657 }; 658 659 static const char * const pwm_b_groups[] = { 660 "pwm_b", 661 }; 662 663 static const char * const pwm_c_groups[] = { 664 "pwm_c", 665 }; 666 667 static const char * const pwm_d_groups[] = { 668 "pwm_d", 669 }; 670 671 static const char * const pwm_e_groups[] = { 672 "pwm_e", 673 }; 674 675 static const char * const pwm_f_groups[] = { 676 "pwm_f_clk", "pwm_f_x", 677 }; 678 679 static const char * const hdmi_hpd_groups[] = { 680 "hdmi_hpd", 681 }; 682 683 static const char * const hdmi_i2c_groups[] = { 684 "hdmi_sda", "hdmi_scl", 685 }; 686 687 static const char * const i2s_out_groups[] = { 688 "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk", 689 "i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z", 690 }; 691 692 static const char * const spdif_out_groups[] = { 693 "spdif_out_h", 694 }; 695 696 static const char * const eth_led_groups[] = { 697 "eth_link_led", "eth_act_led", 698 }; 699 700 static const char * const tsin_a_groups[] = { 701 "tsin_a_clk", "tsin_a_clk_x", "tsin_a_sop", "tsin_a_sop_x", 702 "tsin_a_d_valid", "tsin_a_d_valid_x", "tsin_a_d0", "tsin_a_d0_x", 703 "tsin_a_dp", "tsin_a_fail", 704 }; 705 706 static const char * const gpio_aobus_groups[] = { 707 "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", 708 "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", 709 710 "GPIO_TEST_N", 711 }; 712 713 static const char * const uart_ao_groups[] = { 714 "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a", 715 }; 716 717 static const char * const uart_ao_b_groups[] = { 718 "uart_tx_ao_b", "uart_rx_ao_b", "uart_cts_ao_b", "uart_rts_ao_b", 719 "uart_tx_ao_b_0", "uart_rx_ao_b_1", 720 }; 721 722 static const char * const i2c_ao_groups[] = { 723 "i2c_sck_ao", "i2c_sda_ao", 724 }; 725 726 static const char * const i2c_slave_ao_groups[] = { 727 "i2c_slave_sck_ao", "i2c_slave_sda_ao", 728 }; 729 730 static const char * const remote_input_ao_groups[] = { 731 "remote_input_ao", 732 }; 733 734 static const char * const pwm_ao_a_groups[] = { 735 "pwm_ao_a_3", "pwm_ao_a_8", 736 }; 737 738 static const char * const pwm_ao_b_groups[] = { 739 "pwm_ao_b", "pwm_ao_b_6", 740 }; 741 742 static const char * const i2s_out_ao_groups[] = { 743 "i2s_out_ch23_ao", "i2s_out_ch45_ao", "i2s_out_ch67_ao", 744 }; 745 746 static const char * const spdif_out_ao_groups[] = { 747 "spdif_out_ao_6", "spdif_out_ao_9", 748 }; 749 750 static const char * const cec_ao_groups[] = { 751 "ao_cec", "ee_cec", 752 }; 753 754 static struct meson_pmx_func meson_gxl_periphs_functions[] = { 755 FUNCTION(gpio_periphs), 756 FUNCTION(emmc), 757 FUNCTION(nor), 758 FUNCTION(spi), 759 FUNCTION(sdcard), 760 FUNCTION(sdio), 761 FUNCTION(nand), 762 FUNCTION(uart_a), 763 FUNCTION(uart_b), 764 FUNCTION(uart_c), 765 FUNCTION(i2c_a), 766 FUNCTION(i2c_b), 767 FUNCTION(i2c_c), 768 FUNCTION(eth), 769 FUNCTION(pwm_a), 770 FUNCTION(pwm_b), 771 FUNCTION(pwm_c), 772 FUNCTION(pwm_d), 773 FUNCTION(pwm_e), 774 FUNCTION(pwm_f), 775 FUNCTION(hdmi_hpd), 776 FUNCTION(hdmi_i2c), 777 FUNCTION(i2s_out), 778 FUNCTION(spdif_out), 779 FUNCTION(eth_led), 780 FUNCTION(tsin_a), 781 }; 782 783 static struct meson_pmx_func meson_gxl_aobus_functions[] = { 784 FUNCTION(gpio_aobus), 785 FUNCTION(uart_ao), 786 FUNCTION(uart_ao_b), 787 FUNCTION(i2c_ao), 788 FUNCTION(i2c_slave_ao), 789 FUNCTION(remote_input_ao), 790 FUNCTION(pwm_ao_a), 791 FUNCTION(pwm_ao_b), 792 FUNCTION(i2s_out_ao), 793 FUNCTION(spdif_out_ao), 794 FUNCTION(cec_ao), 795 }; 796 797 static struct meson_bank meson_gxl_periphs_banks[] = { 798 /* name first last irq pullen pull dir out in */ 799 BANK("X", GPIOX_0, GPIOX_18, 89, 107, 4, 0, 4, 0, 12, 0, 13, 0, 14, 0), 800 BANK("DV", GPIODV_0, GPIODV_29, 83, 88, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0), 801 BANK("H", GPIOH_0, GPIOH_9, 26, 35, 1, 20, 1, 20, 3, 20, 4, 20, 5, 20), 802 BANK("Z", GPIOZ_0, GPIOZ_15, 10, 25, 3, 0, 3, 0, 9, 0, 10, 0, 11, 0), 803 BANK("CARD", CARD_0, CARD_6, 52, 58, 2, 20, 2, 20, 6, 20, 7, 20, 8, 20), 804 BANK("BOOT", BOOT_0, BOOT_15, 36, 51, 2, 0, 2, 0, 6, 0, 7, 0, 8, 0), 805 BANK("CLK", GPIOCLK_0, GPIOCLK_1, 108, 109, 3, 28, 3, 28, 9, 28, 10, 28, 11, 28), 806 }; 807 808 static struct meson_bank meson_gxl_aobus_banks[] = { 809 /* name first last irq pullen pull dir out in */ 810 BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), 811 }; 812 813 static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = { 814 .name = "periphs-banks", 815 .pins = meson_gxl_periphs_pins, 816 .groups = meson_gxl_periphs_groups, 817 .funcs = meson_gxl_periphs_functions, 818 .banks = meson_gxl_periphs_banks, 819 .num_pins = ARRAY_SIZE(meson_gxl_periphs_pins), 820 .num_groups = ARRAY_SIZE(meson_gxl_periphs_groups), 821 .num_funcs = ARRAY_SIZE(meson_gxl_periphs_functions), 822 .num_banks = ARRAY_SIZE(meson_gxl_periphs_banks), 823 .pmx_ops = &meson8_pmx_ops, 824 }; 825 826 static struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = { 827 .name = "aobus-banks", 828 .pins = meson_gxl_aobus_pins, 829 .groups = meson_gxl_aobus_groups, 830 .funcs = meson_gxl_aobus_functions, 831 .banks = meson_gxl_aobus_banks, 832 .num_pins = ARRAY_SIZE(meson_gxl_aobus_pins), 833 .num_groups = ARRAY_SIZE(meson_gxl_aobus_groups), 834 .num_funcs = ARRAY_SIZE(meson_gxl_aobus_functions), 835 .num_banks = ARRAY_SIZE(meson_gxl_aobus_banks), 836 .pmx_ops = &meson8_pmx_ops, 837 }; 838 839 static const struct of_device_id meson_gxl_pinctrl_dt_match[] = { 840 { 841 .compatible = "amlogic,meson-gxl-periphs-pinctrl", 842 .data = &meson_gxl_periphs_pinctrl_data, 843 }, 844 { 845 .compatible = "amlogic,meson-gxl-aobus-pinctrl", 846 .data = &meson_gxl_aobus_pinctrl_data, 847 }, 848 { }, 849 }; 850 851 static struct platform_driver meson_gxl_pinctrl_driver = { 852 .probe = meson_pinctrl_probe, 853 .driver = { 854 .name = "meson-gxl-pinctrl", 855 .of_match_table = meson_gxl_pinctrl_dt_match, 856 }, 857 }; 858 builtin_platform_driver(meson_gxl_pinctrl_driver); 859