Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com> |
| 4 | * |
| 5 | * Based on code from Linux kernel: |
| 6 | * Copyright (C) 2016 Endless Mobile, Inc. |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
Simon Glass | 51a3ec3 | 2017-05-17 17:18:07 -0600 | [diff] [blame] | 9 | #include <common.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 10 | #include <dm.h> |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 11 | #include <dm/pinctrl.h> |
| 12 | #include <dt-bindings/gpio/meson-gxbb-gpio.h> |
| 13 | |
| 14 | #include "pinctrl-meson.h" |
| 15 | |
Neil Armstrong | 9b93a3b | 2018-04-11 17:40:41 +0200 | [diff] [blame] | 16 | #define EE_OFF 15 |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 17 | |
| 18 | static const unsigned int emmc_nand_d07_pins[] = { |
| 19 | PIN(BOOT_0, EE_OFF), PIN(BOOT_1, EE_OFF), PIN(BOOT_2, EE_OFF), |
| 20 | PIN(BOOT_3, EE_OFF), PIN(BOOT_4, EE_OFF), PIN(BOOT_5, EE_OFF), |
| 21 | PIN(BOOT_6, EE_OFF), PIN(BOOT_7, EE_OFF), |
| 22 | }; |
| 23 | static const unsigned int emmc_clk_pins[] = { PIN(BOOT_8, EE_OFF) }; |
| 24 | static const unsigned int emmc_cmd_pins[] = { PIN(BOOT_10, EE_OFF) }; |
| 25 | static const unsigned int emmc_ds_pins[] = { PIN(BOOT_15, EE_OFF) }; |
| 26 | |
| 27 | static const unsigned int sdcard_d0_pins[] = { PIN(CARD_1, EE_OFF) }; |
| 28 | static const unsigned int sdcard_d1_pins[] = { PIN(CARD_0, EE_OFF) }; |
| 29 | static const unsigned int sdcard_d2_pins[] = { PIN(CARD_5, EE_OFF) }; |
| 30 | static const unsigned int sdcard_d3_pins[] = { PIN(CARD_4, EE_OFF) }; |
| 31 | static const unsigned int sdcard_cmd_pins[] = { PIN(CARD_3, EE_OFF) }; |
| 32 | static const unsigned int sdcard_clk_pins[] = { PIN(CARD_2, EE_OFF) }; |
| 33 | |
| 34 | static const unsigned int uart_tx_a_pins[] = { PIN(GPIOX_12, EE_OFF) }; |
| 35 | static const unsigned int uart_rx_a_pins[] = { PIN(GPIOX_13, EE_OFF) }; |
| 36 | static const unsigned int uart_cts_a_pins[] = { PIN(GPIOX_14, EE_OFF) }; |
| 37 | static const unsigned int uart_rts_a_pins[] = { PIN(GPIOX_15, EE_OFF) }; |
| 38 | |
| 39 | static const unsigned int uart_tx_b_pins[] = { PIN(GPIODV_24, EE_OFF) }; |
| 40 | static const unsigned int uart_rx_b_pins[] = { PIN(GPIODV_25, EE_OFF) }; |
| 41 | static const unsigned int uart_cts_b_pins[] = { PIN(GPIODV_26, EE_OFF) }; |
| 42 | static const unsigned int uart_rts_b_pins[] = { PIN(GPIODV_27, EE_OFF) }; |
| 43 | |
| 44 | static const unsigned int uart_tx_c_pins[] = { PIN(GPIOY_13, EE_OFF) }; |
| 45 | static const unsigned int uart_rx_c_pins[] = { PIN(GPIOY_14, EE_OFF) }; |
| 46 | static const unsigned int uart_cts_c_pins[] = { PIN(GPIOX_11, EE_OFF) }; |
| 47 | static const unsigned int uart_rts_c_pins[] = { PIN(GPIOX_12, EE_OFF) }; |
| 48 | |
| 49 | static const unsigned int eth_mdio_pins[] = { PIN(GPIOZ_0, EE_OFF) }; |
| 50 | static const unsigned int eth_mdc_pins[] = { PIN(GPIOZ_1, EE_OFF) }; |
| 51 | static const unsigned int eth_clk_rx_clk_pins[] = { PIN(GPIOZ_2, EE_OFF) }; |
| 52 | static const unsigned int eth_rx_dv_pins[] = { PIN(GPIOZ_3, EE_OFF) }; |
| 53 | static const unsigned int eth_rxd0_pins[] = { PIN(GPIOZ_4, EE_OFF) }; |
| 54 | static const unsigned int eth_rxd1_pins[] = { PIN(GPIOZ_5, EE_OFF) }; |
| 55 | static const unsigned int eth_rxd2_pins[] = { PIN(GPIOZ_6, EE_OFF) }; |
| 56 | static const unsigned int eth_rxd3_pins[] = { PIN(GPIOZ_7, EE_OFF) }; |
| 57 | static const unsigned int eth_rgmii_tx_clk_pins[] = { PIN(GPIOZ_8, EE_OFF) }; |
| 58 | static const unsigned int eth_tx_en_pins[] = { PIN(GPIOZ_9, EE_OFF) }; |
| 59 | static const unsigned int eth_txd0_pins[] = { PIN(GPIOZ_10, EE_OFF) }; |
| 60 | static const unsigned int eth_txd1_pins[] = { PIN(GPIOZ_11, EE_OFF) }; |
| 61 | static const unsigned int eth_txd2_pins[] = { PIN(GPIOZ_12, EE_OFF) }; |
| 62 | static const unsigned int eth_txd3_pins[] = { PIN(GPIOZ_13, EE_OFF) }; |
| 63 | |
| 64 | static const unsigned int uart_tx_ao_a_pins[] = { PIN(GPIOAO_0, 0) }; |
| 65 | static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, 0) }; |
| 66 | static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, 0) }; |
| 67 | static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, 0) }; |
| 68 | static const unsigned int uart_tx_ao_b_pins[] = { PIN(GPIOAO_0, 0) }; |
| 69 | static const unsigned int uart_rx_ao_b_pins[] = { PIN(GPIOAO_1, 0), |
| 70 | PIN(GPIOAO_5, 0) }; |
| 71 | static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, 0) }; |
| 72 | static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) }; |
| 73 | |
| 74 | static const unsigned int i2c_sck_ao_pins[] = {PIN(GPIOAO_4, 0) }; |
| 75 | static const unsigned int i2c_sda_ao_pins[] = {PIN(GPIOAO_5, 0) }; |
| 76 | static const unsigned int i2c_slave_sck_ao_pins[] = {PIN(GPIOAO_4, 0) }; |
| 77 | static const unsigned int i2c_slave_sda_ao_pins[] = {PIN(GPIOAO_5, 0) }; |
| 78 | |
| 79 | static struct meson_pmx_group meson_gxbb_periphs_groups[] = { |
| 80 | GPIO_GROUP(GPIOZ_0, EE_OFF), |
| 81 | GPIO_GROUP(GPIOZ_1, EE_OFF), |
| 82 | GPIO_GROUP(GPIOZ_2, EE_OFF), |
| 83 | GPIO_GROUP(GPIOZ_3, EE_OFF), |
| 84 | GPIO_GROUP(GPIOZ_4, EE_OFF), |
| 85 | GPIO_GROUP(GPIOZ_5, EE_OFF), |
| 86 | GPIO_GROUP(GPIOZ_6, EE_OFF), |
| 87 | GPIO_GROUP(GPIOZ_7, EE_OFF), |
| 88 | GPIO_GROUP(GPIOZ_8, EE_OFF), |
| 89 | GPIO_GROUP(GPIOZ_9, EE_OFF), |
| 90 | GPIO_GROUP(GPIOZ_10, EE_OFF), |
| 91 | GPIO_GROUP(GPIOZ_11, EE_OFF), |
| 92 | GPIO_GROUP(GPIOZ_12, EE_OFF), |
| 93 | GPIO_GROUP(GPIOZ_13, EE_OFF), |
| 94 | GPIO_GROUP(GPIOZ_14, EE_OFF), |
| 95 | GPIO_GROUP(GPIOZ_15, EE_OFF), |
| 96 | |
| 97 | GPIO_GROUP(GPIOH_0, EE_OFF), |
| 98 | GPIO_GROUP(GPIOH_1, EE_OFF), |
| 99 | GPIO_GROUP(GPIOH_2, EE_OFF), |
| 100 | GPIO_GROUP(GPIOH_3, EE_OFF), |
| 101 | |
| 102 | GPIO_GROUP(BOOT_0, EE_OFF), |
| 103 | GPIO_GROUP(BOOT_1, EE_OFF), |
| 104 | GPIO_GROUP(BOOT_2, EE_OFF), |
| 105 | GPIO_GROUP(BOOT_3, EE_OFF), |
| 106 | GPIO_GROUP(BOOT_4, EE_OFF), |
| 107 | GPIO_GROUP(BOOT_5, EE_OFF), |
| 108 | GPIO_GROUP(BOOT_6, EE_OFF), |
| 109 | GPIO_GROUP(BOOT_7, EE_OFF), |
| 110 | GPIO_GROUP(BOOT_8, EE_OFF), |
| 111 | GPIO_GROUP(BOOT_9, EE_OFF), |
| 112 | GPIO_GROUP(BOOT_10, EE_OFF), |
| 113 | GPIO_GROUP(BOOT_11, EE_OFF), |
| 114 | GPIO_GROUP(BOOT_12, EE_OFF), |
| 115 | GPIO_GROUP(BOOT_13, EE_OFF), |
| 116 | GPIO_GROUP(BOOT_14, EE_OFF), |
| 117 | GPIO_GROUP(BOOT_15, EE_OFF), |
| 118 | GPIO_GROUP(BOOT_16, EE_OFF), |
| 119 | GPIO_GROUP(BOOT_17, EE_OFF), |
| 120 | |
| 121 | GPIO_GROUP(CARD_0, EE_OFF), |
| 122 | GPIO_GROUP(CARD_1, EE_OFF), |
| 123 | GPIO_GROUP(CARD_2, EE_OFF), |
| 124 | GPIO_GROUP(CARD_3, EE_OFF), |
| 125 | GPIO_GROUP(CARD_4, EE_OFF), |
| 126 | GPIO_GROUP(CARD_5, EE_OFF), |
| 127 | GPIO_GROUP(CARD_6, EE_OFF), |
| 128 | |
| 129 | GPIO_GROUP(GPIODV_0, EE_OFF), |
| 130 | GPIO_GROUP(GPIODV_1, EE_OFF), |
| 131 | GPIO_GROUP(GPIODV_2, EE_OFF), |
| 132 | GPIO_GROUP(GPIODV_3, EE_OFF), |
| 133 | GPIO_GROUP(GPIODV_4, EE_OFF), |
| 134 | GPIO_GROUP(GPIODV_5, EE_OFF), |
| 135 | GPIO_GROUP(GPIODV_6, EE_OFF), |
| 136 | GPIO_GROUP(GPIODV_7, EE_OFF), |
| 137 | GPIO_GROUP(GPIODV_8, EE_OFF), |
| 138 | GPIO_GROUP(GPIODV_9, EE_OFF), |
| 139 | GPIO_GROUP(GPIODV_10, EE_OFF), |
| 140 | GPIO_GROUP(GPIODV_11, EE_OFF), |
| 141 | GPIO_GROUP(GPIODV_12, EE_OFF), |
| 142 | GPIO_GROUP(GPIODV_13, EE_OFF), |
| 143 | GPIO_GROUP(GPIODV_14, EE_OFF), |
| 144 | GPIO_GROUP(GPIODV_15, EE_OFF), |
| 145 | GPIO_GROUP(GPIODV_16, EE_OFF), |
| 146 | GPIO_GROUP(GPIODV_17, EE_OFF), |
| 147 | GPIO_GROUP(GPIODV_19, EE_OFF), |
| 148 | GPIO_GROUP(GPIODV_20, EE_OFF), |
| 149 | GPIO_GROUP(GPIODV_21, EE_OFF), |
| 150 | GPIO_GROUP(GPIODV_22, EE_OFF), |
| 151 | GPIO_GROUP(GPIODV_23, EE_OFF), |
| 152 | GPIO_GROUP(GPIODV_24, EE_OFF), |
| 153 | GPIO_GROUP(GPIODV_25, EE_OFF), |
| 154 | GPIO_GROUP(GPIODV_26, EE_OFF), |
| 155 | GPIO_GROUP(GPIODV_27, EE_OFF), |
| 156 | GPIO_GROUP(GPIODV_28, EE_OFF), |
| 157 | GPIO_GROUP(GPIODV_29, EE_OFF), |
| 158 | |
| 159 | GPIO_GROUP(GPIOY_0, EE_OFF), |
| 160 | GPIO_GROUP(GPIOY_1, EE_OFF), |
| 161 | GPIO_GROUP(GPIOY_2, EE_OFF), |
| 162 | GPIO_GROUP(GPIOY_3, EE_OFF), |
| 163 | GPIO_GROUP(GPIOY_4, EE_OFF), |
| 164 | GPIO_GROUP(GPIOY_5, EE_OFF), |
| 165 | GPIO_GROUP(GPIOY_6, EE_OFF), |
| 166 | GPIO_GROUP(GPIOY_7, EE_OFF), |
| 167 | GPIO_GROUP(GPIOY_8, EE_OFF), |
| 168 | GPIO_GROUP(GPIOY_9, EE_OFF), |
| 169 | GPIO_GROUP(GPIOY_10, EE_OFF), |
| 170 | GPIO_GROUP(GPIOY_11, EE_OFF), |
| 171 | GPIO_GROUP(GPIOY_12, EE_OFF), |
| 172 | GPIO_GROUP(GPIOY_13, EE_OFF), |
| 173 | GPIO_GROUP(GPIOY_14, EE_OFF), |
| 174 | GPIO_GROUP(GPIOY_15, EE_OFF), |
| 175 | GPIO_GROUP(GPIOY_16, EE_OFF), |
| 176 | |
| 177 | GPIO_GROUP(GPIOX_0, EE_OFF), |
| 178 | GPIO_GROUP(GPIOX_1, EE_OFF), |
| 179 | GPIO_GROUP(GPIOX_2, EE_OFF), |
| 180 | GPIO_GROUP(GPIOX_3, EE_OFF), |
| 181 | GPIO_GROUP(GPIOX_4, EE_OFF), |
| 182 | GPIO_GROUP(GPIOX_5, EE_OFF), |
| 183 | GPIO_GROUP(GPIOX_6, EE_OFF), |
| 184 | GPIO_GROUP(GPIOX_7, EE_OFF), |
| 185 | GPIO_GROUP(GPIOX_8, EE_OFF), |
| 186 | GPIO_GROUP(GPIOX_9, EE_OFF), |
| 187 | GPIO_GROUP(GPIOX_10, EE_OFF), |
| 188 | GPIO_GROUP(GPIOX_11, EE_OFF), |
| 189 | GPIO_GROUP(GPIOX_12, EE_OFF), |
| 190 | GPIO_GROUP(GPIOX_13, EE_OFF), |
| 191 | GPIO_GROUP(GPIOX_14, EE_OFF), |
| 192 | GPIO_GROUP(GPIOX_15, EE_OFF), |
| 193 | GPIO_GROUP(GPIOX_16, EE_OFF), |
| 194 | GPIO_GROUP(GPIOX_17, EE_OFF), |
| 195 | GPIO_GROUP(GPIOX_18, EE_OFF), |
| 196 | GPIO_GROUP(GPIOX_19, EE_OFF), |
| 197 | GPIO_GROUP(GPIOX_20, EE_OFF), |
| 198 | GPIO_GROUP(GPIOX_21, EE_OFF), |
| 199 | GPIO_GROUP(GPIOX_22, EE_OFF), |
| 200 | |
| 201 | GPIO_GROUP(GPIOCLK_0, EE_OFF), |
| 202 | GPIO_GROUP(GPIOCLK_1, EE_OFF), |
| 203 | GPIO_GROUP(GPIOCLK_2, EE_OFF), |
| 204 | GPIO_GROUP(GPIOCLK_3, EE_OFF), |
| 205 | |
| 206 | GPIO_GROUP(GPIO_TEST_N, EE_OFF), |
| 207 | |
| 208 | /* Bank X */ |
| 209 | GROUP(uart_tx_a, 4, 13), |
| 210 | GROUP(uart_rx_a, 4, 12), |
| 211 | GROUP(uart_cts_a, 4, 11), |
| 212 | GROUP(uart_rts_a, 4, 10), |
| 213 | |
| 214 | /* Bank Y */ |
| 215 | GROUP(uart_cts_c, 1, 19), |
| 216 | GROUP(uart_rts_c, 1, 18), |
| 217 | GROUP(uart_tx_c, 1, 17), |
| 218 | GROUP(uart_rx_c, 1, 16), |
| 219 | |
| 220 | /* Bank Z */ |
| 221 | GROUP(eth_mdio, 6, 1), |
| 222 | GROUP(eth_mdc, 6, 0), |
| 223 | GROUP(eth_clk_rx_clk, 6, 13), |
| 224 | GROUP(eth_rx_dv, 6, 12), |
| 225 | GROUP(eth_rxd0, 6, 11), |
| 226 | GROUP(eth_rxd1, 6, 10), |
| 227 | GROUP(eth_rxd2, 6, 9), |
| 228 | GROUP(eth_rxd3, 6, 8), |
| 229 | GROUP(eth_rgmii_tx_clk, 6, 7), |
| 230 | GROUP(eth_tx_en, 6, 6), |
| 231 | GROUP(eth_txd0, 6, 5), |
| 232 | GROUP(eth_txd1, 6, 4), |
| 233 | GROUP(eth_txd2, 6, 3), |
| 234 | GROUP(eth_txd3, 6, 2), |
| 235 | |
| 236 | /* Bank DV */ |
| 237 | GROUP(uart_tx_b, 2, 29), |
| 238 | GROUP(uart_rx_b, 2, 28), |
| 239 | GROUP(uart_cts_b, 2, 27), |
| 240 | GROUP(uart_rts_b, 2, 26), |
| 241 | |
| 242 | /* Bank BOOT */ |
| 243 | GROUP(emmc_nand_d07, 4, 30), |
| 244 | GROUP(emmc_clk, 4, 18), |
| 245 | GROUP(emmc_cmd, 4, 19), |
| 246 | GROUP(emmc_ds, 4, 31), |
| 247 | |
| 248 | /* Bank CARD */ |
| 249 | GROUP(sdcard_d1, 2, 14), |
| 250 | GROUP(sdcard_d0, 2, 15), |
| 251 | GROUP(sdcard_d3, 2, 12), |
| 252 | GROUP(sdcard_d2, 2, 13), |
| 253 | GROUP(sdcard_cmd, 2, 10), |
| 254 | GROUP(sdcard_clk, 2, 11), |
| 255 | }; |
| 256 | |
| 257 | static struct meson_pmx_group meson_gxbb_aobus_groups[] = { |
| 258 | GPIO_GROUP(GPIOAO_0, 0), |
| 259 | GPIO_GROUP(GPIOAO_1, 0), |
| 260 | GPIO_GROUP(GPIOAO_2, 0), |
| 261 | GPIO_GROUP(GPIOAO_3, 0), |
| 262 | GPIO_GROUP(GPIOAO_4, 0), |
| 263 | GPIO_GROUP(GPIOAO_5, 0), |
| 264 | GPIO_GROUP(GPIOAO_6, 0), |
| 265 | GPIO_GROUP(GPIOAO_7, 0), |
| 266 | GPIO_GROUP(GPIOAO_8, 0), |
| 267 | GPIO_GROUP(GPIOAO_9, 0), |
| 268 | GPIO_GROUP(GPIOAO_10, 0), |
| 269 | GPIO_GROUP(GPIOAO_11, 0), |
| 270 | GPIO_GROUP(GPIOAO_12, 0), |
| 271 | GPIO_GROUP(GPIOAO_13, 0), |
| 272 | |
| 273 | /* bank AO */ |
| 274 | GROUP(uart_tx_ao_b, 0, 26), |
| 275 | GROUP(uart_rx_ao_b, 0, 25), |
| 276 | GROUP(uart_tx_ao_a, 0, 12), |
| 277 | GROUP(uart_rx_ao_a, 0, 11), |
| 278 | GROUP(uart_cts_ao_a, 0, 10), |
| 279 | GROUP(uart_rts_ao_a, 0, 9), |
| 280 | GROUP(uart_cts_ao_b, 0, 8), |
| 281 | GROUP(uart_rts_ao_b, 0, 7), |
| 282 | GROUP(i2c_sck_ao, 0, 6), |
| 283 | GROUP(i2c_sda_ao, 0, 5), |
| 284 | GROUP(i2c_slave_sck_ao, 0, 2), |
| 285 | GROUP(i2c_slave_sda_ao, 0, 1), |
| 286 | }; |
| 287 | |
| 288 | static const char * const gpio_periphs_groups[] = { |
| 289 | "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4", |
| 290 | "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9", |
| 291 | "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14", |
| 292 | "GPIOZ_15", |
| 293 | |
| 294 | "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", |
| 295 | |
| 296 | "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", |
| 297 | "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", |
| 298 | "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", |
| 299 | "BOOT_15", "BOOT_16", "BOOT_17", |
| 300 | |
| 301 | "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", |
| 302 | "CARD_5", "CARD_6", |
| 303 | |
| 304 | "GPIODV_0", "GPIODV_1", "GPIODV_2", "GPIODV_3", "GPIODV_4", |
| 305 | "GPIODV_5", "GPIODV_6", "GPIODV_7", "GPIODV_8", "GPIODV_9", |
| 306 | "GPIODV_10", "GPIODV_11", "GPIODV_12", "GPIODV_13", "GPIODV_14", |
| 307 | "GPIODV_15", "GPIODV_16", "GPIODV_17", "GPIODV_18", "GPIODV_19", |
| 308 | "GPIODV_20", "GPIODV_21", "GPIODV_22", "GPIODV_23", "GPIODV_24", |
| 309 | "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29", |
| 310 | |
| 311 | "GPIOY_0", "GPIOY_1", "GPIOY_2", "GPIOY_3", "GPIOY_4", |
| 312 | "GPIOY_5", "GPIOY_6", "GPIOY_7", "GPIOY_8", "GPIOY_9", |
| 313 | "GPIOY_10", "GPIOY_11", "GPIOY_12", "GPIOY_13", "GPIOY_14", |
| 314 | "GPIOY_15", "GPIOY_16", |
| 315 | |
| 316 | "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", |
| 317 | "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", |
| 318 | "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14", |
| 319 | "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19", |
| 320 | "GPIOX_20", "GPIOX_21", "GPIOX_22", |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 321 | }; |
| 322 | |
| 323 | static const char * const emmc_groups[] = { |
| 324 | "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds", |
| 325 | }; |
| 326 | |
| 327 | static const char * const sdcard_groups[] = { |
| 328 | "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3", |
| 329 | "sdcard_cmd", "sdcard_clk", |
| 330 | }; |
| 331 | |
| 332 | static const char * const uart_a_groups[] = { |
| 333 | "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a", |
| 334 | }; |
| 335 | |
| 336 | static const char * const uart_b_groups[] = { |
| 337 | "uart_tx_b", "uart_rx_b", "uart_cts_b", "uart_rts_b", |
| 338 | }; |
| 339 | |
| 340 | static const char * const uart_c_groups[] = { |
| 341 | "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c", |
| 342 | }; |
| 343 | |
| 344 | static const char * const eth_groups[] = { |
| 345 | "eth_mdio", "eth_mdc", "eth_clk_rx_clk", "eth_rx_dv", |
| 346 | "eth_rxd0", "eth_rxd1", "eth_rxd2", "eth_rxd3", |
| 347 | "eth_rgmii_tx_clk", "eth_tx_en", |
| 348 | "eth_txd0", "eth_txd1", "eth_txd2", "eth_txd3", |
| 349 | }; |
| 350 | |
| 351 | static const char * const gpio_aobus_groups[] = { |
| 352 | "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", |
| 353 | "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", |
| 354 | "GPIOAO_10", "GPIOAO_11", "GPIOAO_12", "GPIOAO_13", |
Neil Armstrong | 9b93a3b | 2018-04-11 17:40:41 +0200 | [diff] [blame] | 355 | |
| 356 | "GPIO_TEST_N", |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 357 | }; |
| 358 | |
| 359 | static const char * const uart_ao_groups[] = { |
| 360 | "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a", |
| 361 | }; |
| 362 | |
| 363 | static const char * const uart_ao_b_groups[] = { |
| 364 | "uart_tx_ao_b", "uart_rx_ao_b", "uart_cts_ao_b", "uart_rts_ao_b", |
| 365 | }; |
| 366 | |
| 367 | static const char * const i2c_ao_groups[] = { |
| 368 | "i2c_sdk_ao", "i2c_sda_ao", |
| 369 | }; |
| 370 | |
| 371 | static const char * const i2c_slave_ao_groups[] = { |
| 372 | "i2c_slave_sdk_ao", "i2c_slave_sda_ao", |
| 373 | }; |
| 374 | |
| 375 | static struct meson_pmx_func meson_gxbb_periphs_functions[] = { |
| 376 | FUNCTION(gpio_periphs), |
| 377 | FUNCTION(emmc), |
| 378 | FUNCTION(sdcard), |
| 379 | FUNCTION(uart_a), |
| 380 | FUNCTION(uart_b), |
| 381 | FUNCTION(uart_c), |
| 382 | FUNCTION(eth), |
| 383 | }; |
| 384 | |
| 385 | static struct meson_pmx_func meson_gxbb_aobus_functions[] = { |
| 386 | FUNCTION(gpio_aobus), |
| 387 | FUNCTION(uart_ao), |
| 388 | FUNCTION(uart_ao_b), |
| 389 | FUNCTION(i2c_ao), |
| 390 | FUNCTION(i2c_slave_ao), |
| 391 | }; |
| 392 | |
Beniamino Galvani | 5aeb135 | 2017-07-10 00:30:04 +0200 | [diff] [blame] | 393 | static struct meson_bank meson_gxbb_periphs_banks[] = { |
| 394 | /* name first last pullen pull dir out in */ |
| 395 | BANK("X", PIN(GPIOX_0, EE_OFF), PIN(GPIOX_22, EE_OFF), 4, 0, 4, 0, 12, 0, 13, 0, 14, 0), |
| 396 | BANK("Y", PIN(GPIOY_0, EE_OFF), PIN(GPIOY_16, EE_OFF), 1, 0, 1, 0, 3, 0, 4, 0, 5, 0), |
| 397 | BANK("DV", PIN(GPIODV_0, EE_OFF), PIN(GPIODV_29, EE_OFF), 0, 0, 0, 0, 0, 0, 1, 0, 2, 0), |
| 398 | BANK("H", PIN(GPIOH_0, EE_OFF), PIN(GPIOH_3, EE_OFF), 1, 20, 1, 20, 3, 20, 4, 20, 5, 20), |
| 399 | BANK("Z", PIN(GPIOZ_0, EE_OFF), PIN(GPIOZ_15, EE_OFF), 3, 0, 3, 0, 9, 0, 10, 0, 11, 0), |
| 400 | BANK("CARD", PIN(CARD_0, EE_OFF), PIN(CARD_6, EE_OFF), 2, 20, 2, 20, 6, 20, 7, 20, 8, 20), |
| 401 | BANK("BOOT", PIN(BOOT_0, EE_OFF), PIN(BOOT_17, EE_OFF), 2, 0, 2, 0, 6, 0, 7, 0, 8, 0), |
| 402 | BANK("CLK", PIN(GPIOCLK_0, EE_OFF), PIN(GPIOCLK_3, EE_OFF), 3, 28, 3, 28, 9, 28, 10, 28, 11, 28), |
| 403 | }; |
| 404 | |
| 405 | static struct meson_bank meson_gxbb_aobus_banks[] = { |
| 406 | /* name first last pullen pull dir out in */ |
| 407 | BANK("AO", PIN(GPIOAO_0, 0), PIN(GPIOAO_13, 0), 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), |
| 408 | }; |
| 409 | |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 410 | struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = { |
| 411 | .name = "periphs-banks", |
Neil Armstrong | 9b93a3b | 2018-04-11 17:40:41 +0200 | [diff] [blame] | 412 | .pin_base = 15, |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 413 | .groups = meson_gxbb_periphs_groups, |
| 414 | .funcs = meson_gxbb_periphs_functions, |
Beniamino Galvani | 5aeb135 | 2017-07-10 00:30:04 +0200 | [diff] [blame] | 415 | .banks = meson_gxbb_periphs_banks, |
Neil Armstrong | 9b93a3b | 2018-04-11 17:40:41 +0200 | [diff] [blame] | 416 | .num_pins = 119, |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 417 | .num_groups = ARRAY_SIZE(meson_gxbb_periphs_groups), |
| 418 | .num_funcs = ARRAY_SIZE(meson_gxbb_periphs_functions), |
Beniamino Galvani | 5aeb135 | 2017-07-10 00:30:04 +0200 | [diff] [blame] | 419 | .num_banks = ARRAY_SIZE(meson_gxbb_periphs_banks), |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 420 | }; |
| 421 | |
| 422 | struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = { |
| 423 | .name = "aobus-banks", |
| 424 | .pin_base = 0, |
| 425 | .groups = meson_gxbb_aobus_groups, |
| 426 | .funcs = meson_gxbb_aobus_functions, |
Beniamino Galvani | 5aeb135 | 2017-07-10 00:30:04 +0200 | [diff] [blame] | 427 | .banks = meson_gxbb_aobus_banks, |
Neil Armstrong | 9b93a3b | 2018-04-11 17:40:41 +0200 | [diff] [blame] | 428 | .num_pins = 15, |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 429 | .num_groups = ARRAY_SIZE(meson_gxbb_aobus_groups), |
| 430 | .num_funcs = ARRAY_SIZE(meson_gxbb_aobus_functions), |
Beniamino Galvani | 5aeb135 | 2017-07-10 00:30:04 +0200 | [diff] [blame] | 431 | .num_banks = ARRAY_SIZE(meson_gxbb_aobus_banks), |
Beniamino Galvani | 2176d73 | 2016-08-16 11:49:49 +0200 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | static const struct udevice_id meson_gxbb_pinctrl_match[] = { |
| 435 | { |
| 436 | .compatible = "amlogic,meson-gxbb-periphs-pinctrl", |
| 437 | .data = (ulong)&meson_gxbb_periphs_pinctrl_data, |
| 438 | }, |
| 439 | { |
| 440 | .compatible = "amlogic,meson-gxbb-aobus-pinctrl", |
| 441 | .data = (ulong)&meson_gxbb_aobus_pinctrl_data, |
| 442 | }, |
| 443 | { /* sentinel */ } |
| 444 | }; |
| 445 | |
| 446 | U_BOOT_DRIVER(meson_gxbb_pinctrl) = { |
| 447 | .name = "meson-gxbb-pinctrl", |
| 448 | .id = UCLASS_PINCTRL, |
| 449 | .of_match = of_match_ptr(meson_gxbb_pinctrl_match), |
| 450 | .probe = meson_pinctrl_probe, |
| 451 | .priv_auto_alloc_size = sizeof(struct meson_pinctrl), |
| 452 | .ops = &meson_pinctrl_ops, |
| 453 | }; |