Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2019 MediaTek Inc. |
| 4 | * Author: Sam Shih <sam.shih@mediatek.com> |
| 5 | */ |
| 6 | |
| 7 | #include <dm.h> |
| 8 | |
| 9 | #include "pinctrl-mtk-common.h" |
| 10 | |
| 11 | #define MT7622_PIN(_number, _name) MTK_PIN(_number, _name, DRV_GRP1) |
| 12 | |
| 13 | #define PIN_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \ |
| 14 | PIN_FIELD_CALC(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, \ |
| 15 | _x_bits, 32, 0) |
| 16 | |
| 17 | #define PINS_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \ |
| 18 | PIN_FIELD_CALC(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, \ |
| 19 | _x_bits, 32, 1) |
| 20 | |
| 21 | static const struct mtk_pin_field_calc mt7622_pin_mode_range[] = { |
| 22 | PIN_FIELD(0, 0, 0x320, 0x10, 16, 4), |
| 23 | PIN_FIELD(1, 4, 0x3a0, 0x10, 16, 4), |
| 24 | PIN_FIELD(5, 5, 0x320, 0x10, 0, 4), |
| 25 | PINS_FIELD(6, 7, 0x300, 0x10, 4, 4), |
| 26 | PIN_FIELD(8, 9, 0x350, 0x10, 20, 4), |
| 27 | PINS_FIELD(10, 13, 0x300, 0x10, 8, 4), |
| 28 | PIN_FIELD(14, 15, 0x320, 0x10, 4, 4), |
| 29 | PIN_FIELD(16, 17, 0x320, 0x10, 20, 4), |
| 30 | PIN_FIELD(18, 21, 0x310, 0x10, 16, 4), |
| 31 | PIN_FIELD(22, 22, 0x380, 0x10, 16, 4), |
| 32 | PINS_FIELD(23, 24, 0x300, 0x10, 24, 4), |
| 33 | PINS_FIELD(25, 36, 0x300, 0x10, 12, 4), |
| 34 | PINS_FIELD(37, 50, 0x300, 0x10, 20, 4), |
| 35 | PIN_FIELD(51, 70, 0x330, 0x10, 4, 4), |
| 36 | PINS_FIELD(71, 72, 0x300, 0x10, 16, 4), |
| 37 | PIN_FIELD(73, 76, 0x310, 0x10, 0, 4), |
| 38 | PIN_FIELD(77, 77, 0x320, 0x10, 28, 4), |
| 39 | PIN_FIELD(78, 78, 0x320, 0x10, 12, 4), |
| 40 | PIN_FIELD(79, 82, 0x3a0, 0x10, 0, 4), |
| 41 | PIN_FIELD(83, 83, 0x350, 0x10, 28, 4), |
| 42 | PIN_FIELD(84, 84, 0x330, 0x10, 0, 4), |
| 43 | PIN_FIELD(85, 90, 0x360, 0x10, 4, 4), |
| 44 | PIN_FIELD(91, 94, 0x390, 0x10, 16, 4), |
| 45 | PIN_FIELD(95, 97, 0x380, 0x10, 20, 4), |
| 46 | PIN_FIELD(98, 101, 0x390, 0x10, 0, 4), |
| 47 | PIN_FIELD(102, 102, 0x360, 0x10, 0, 4), |
| 48 | }; |
| 49 | |
| 50 | static const struct mtk_pin_field_calc mt7622_pin_dir_range[] = { |
| 51 | PIN_FIELD(0, 102, 0x0, 0x10, 0, 1), |
| 52 | }; |
| 53 | |
| 54 | static const struct mtk_pin_field_calc mt7622_pin_di_range[] = { |
| 55 | PIN_FIELD(0, 102, 0x200, 0x10, 0, 1), |
| 56 | }; |
| 57 | |
| 58 | static const struct mtk_pin_field_calc mt7622_pin_do_range[] = { |
| 59 | PIN_FIELD(0, 102, 0x100, 0x10, 0, 1), |
| 60 | }; |
| 61 | |
| 62 | static const struct mtk_pin_field_calc mt7622_pin_smt_range[] = { |
| 63 | PIN_FIELD(0, 31, 0x920, 0x10, 0, 1), |
| 64 | PIN_FIELD(32, 50, 0xa20, 0x10, 0, 1), |
| 65 | PIN_FIELD(51, 70, 0x820, 0x10, 0, 1), |
| 66 | PIN_FIELD(71, 72, 0xb20, 0x10, 0, 1), |
| 67 | PIN_FIELD(73, 86, 0xb20, 0x10, 4, 1), |
| 68 | PIN_FIELD(87, 90, 0xc20, 0x10, 0, 1), |
| 69 | PIN_FIELD(91, 102, 0xb20, 0x10, 18, 1), |
| 70 | }; |
| 71 | |
| 72 | static const struct mtk_pin_field_calc mt7622_pin_pu_range[] = { |
| 73 | PIN_FIELD(0, 31, 0x930, 0x10, 0, 1), |
| 74 | PIN_FIELD(32, 50, 0xa30, 0x10, 0, 1), |
| 75 | PIN_FIELD(51, 70, 0x830, 0x10, 0, 1), |
| 76 | PIN_FIELD(71, 72, 0xb30, 0x10, 0, 1), |
| 77 | PIN_FIELD(73, 86, 0xb30, 0x10, 4, 1), |
| 78 | PIN_FIELD(87, 90, 0xc30, 0x10, 0, 1), |
| 79 | PIN_FIELD(91, 102, 0xb30, 0x10, 18, 1), |
| 80 | }; |
| 81 | |
| 82 | static const struct mtk_pin_field_calc mt7622_pin_pd_range[] = { |
| 83 | PIN_FIELD(0, 31, 0x940, 0x10, 0, 1), |
| 84 | PIN_FIELD(32, 50, 0xa40, 0x10, 0, 1), |
| 85 | PIN_FIELD(51, 70, 0x840, 0x10, 0, 1), |
| 86 | PIN_FIELD(71, 72, 0xb40, 0x10, 0, 1), |
| 87 | PIN_FIELD(73, 86, 0xb40, 0x10, 4, 1), |
| 88 | PIN_FIELD(87, 90, 0xc40, 0x10, 0, 1), |
| 89 | PIN_FIELD(91, 102, 0xb40, 0x10, 18, 1), |
| 90 | }; |
| 91 | |
| 92 | static const struct mtk_pin_field_calc mt7622_pin_e4_range[] = { |
| 93 | PIN_FIELD(0, 31, 0x960, 0x10, 0, 1), |
| 94 | PIN_FIELD(32, 50, 0xa60, 0x10, 0, 1), |
| 95 | PIN_FIELD(51, 70, 0x860, 0x10, 0, 1), |
| 96 | PIN_FIELD(71, 72, 0xb60, 0x10, 0, 1), |
| 97 | PIN_FIELD(73, 86, 0xb60, 0x10, 4, 1), |
| 98 | PIN_FIELD(87, 90, 0xc60, 0x10, 0, 1), |
| 99 | PIN_FIELD(91, 102, 0xb60, 0x10, 18, 1), |
| 100 | }; |
| 101 | |
| 102 | static const struct mtk_pin_field_calc mt7622_pin_e8_range[] = { |
| 103 | PIN_FIELD(0, 31, 0x970, 0x10, 0, 1), |
| 104 | PIN_FIELD(32, 50, 0xa70, 0x10, 0, 1), |
| 105 | PIN_FIELD(51, 70, 0x870, 0x10, 0, 1), |
| 106 | PIN_FIELD(71, 72, 0xb70, 0x10, 0, 1), |
| 107 | PIN_FIELD(73, 86, 0xb70, 0x10, 4, 1), |
| 108 | PIN_FIELD(87, 90, 0xc70, 0x10, 0, 1), |
| 109 | PIN_FIELD(91, 102, 0xb70, 0x10, 18, 1), |
| 110 | }; |
| 111 | |
| 112 | static const struct mtk_pin_reg_calc mt7622_reg_cals[PINCTRL_PIN_REG_MAX] = { |
| 113 | [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7622_pin_mode_range), |
| 114 | [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7622_pin_dir_range), |
| 115 | [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7622_pin_di_range), |
| 116 | [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7622_pin_do_range), |
| 117 | [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7622_pin_smt_range), |
| 118 | [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7622_pin_pu_range), |
| 119 | [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7622_pin_pd_range), |
| 120 | [PINCTRL_PIN_REG_E4] = MTK_RANGE(mt7622_pin_e4_range), |
| 121 | [PINCTRL_PIN_REG_E8] = MTK_RANGE(mt7622_pin_e8_range), |
| 122 | }; |
| 123 | |
| 124 | static const struct mtk_pin_desc mt7622_pins[] = { |
| 125 | MT7622_PIN(0, "GPIO_A"), |
| 126 | MT7622_PIN(1, "I2S1_IN"), |
| 127 | MT7622_PIN(2, "I2S1_OUT"), |
| 128 | MT7622_PIN(3, "I2S_BCLK"), |
| 129 | MT7622_PIN(4, "I2S_WS"), |
| 130 | MT7622_PIN(5, "I2S_MCLK"), |
| 131 | MT7622_PIN(6, "TXD0"), |
| 132 | MT7622_PIN(7, "RXD0"), |
| 133 | MT7622_PIN(8, "SPI_WP"), |
| 134 | MT7622_PIN(9, "SPI_HOLD"), |
| 135 | MT7622_PIN(10, "SPI_CLK"), |
| 136 | MT7622_PIN(11, "SPI_MOSI"), |
| 137 | MT7622_PIN(12, "SPI_MISO"), |
| 138 | MT7622_PIN(13, "SPI_CS"), |
| 139 | MT7622_PIN(14, "I2C_SDA"), |
| 140 | MT7622_PIN(15, "I2C_SCL"), |
| 141 | MT7622_PIN(16, "I2S2_IN"), |
| 142 | MT7622_PIN(17, "I2S3_IN"), |
| 143 | MT7622_PIN(18, "I2S4_IN"), |
| 144 | MT7622_PIN(19, "I2S2_OUT"), |
| 145 | MT7622_PIN(20, "I2S3_OUT"), |
| 146 | MT7622_PIN(21, "I2S4_OUT"), |
| 147 | MT7622_PIN(22, "GPIO_B"), |
| 148 | MT7622_PIN(23, "MDC"), |
| 149 | MT7622_PIN(24, "MDIO"), |
| 150 | MT7622_PIN(25, "G2_TXD0"), |
| 151 | MT7622_PIN(26, "G2_TXD1"), |
| 152 | MT7622_PIN(27, "G2_TXD2"), |
| 153 | MT7622_PIN(28, "G2_TXD3"), |
| 154 | MT7622_PIN(29, "G2_TXEN"), |
| 155 | MT7622_PIN(30, "G2_TXC"), |
| 156 | MT7622_PIN(31, "G2_RXD0"), |
| 157 | MT7622_PIN(32, "G2_RXD1"), |
| 158 | MT7622_PIN(33, "G2_RXD2"), |
| 159 | MT7622_PIN(34, "G2_RXD3"), |
| 160 | MT7622_PIN(35, "G2_RXDV"), |
| 161 | MT7622_PIN(36, "G2_RXC"), |
| 162 | MT7622_PIN(37, "NCEB"), |
| 163 | MT7622_PIN(38, "NWEB"), |
| 164 | MT7622_PIN(39, "NREB"), |
| 165 | MT7622_PIN(40, "NDL4"), |
| 166 | MT7622_PIN(41, "NDL5"), |
| 167 | MT7622_PIN(42, "NDL6"), |
| 168 | MT7622_PIN(43, "NDL7"), |
| 169 | MT7622_PIN(44, "NRB"), |
| 170 | MT7622_PIN(45, "NCLE"), |
| 171 | MT7622_PIN(46, "NALE"), |
| 172 | MT7622_PIN(47, "NDL0"), |
| 173 | MT7622_PIN(48, "NDL1"), |
| 174 | MT7622_PIN(49, "NDL2"), |
| 175 | MT7622_PIN(50, "NDL3"), |
| 176 | MT7622_PIN(51, "MDI_TP_P0"), |
| 177 | MT7622_PIN(52, "MDI_TN_P0"), |
| 178 | MT7622_PIN(53, "MDI_RP_P0"), |
| 179 | MT7622_PIN(54, "MDI_RN_P0"), |
| 180 | MT7622_PIN(55, "MDI_TP_P1"), |
| 181 | MT7622_PIN(56, "MDI_TN_P1"), |
| 182 | MT7622_PIN(57, "MDI_RP_P1"), |
| 183 | MT7622_PIN(58, "MDI_RN_P1"), |
| 184 | MT7622_PIN(59, "MDI_RP_P2"), |
| 185 | MT7622_PIN(60, "MDI_RN_P2"), |
| 186 | MT7622_PIN(61, "MDI_TP_P2"), |
| 187 | MT7622_PIN(62, "MDI_TN_P2"), |
| 188 | MT7622_PIN(63, "MDI_TP_P3"), |
| 189 | MT7622_PIN(64, "MDI_TN_P3"), |
| 190 | MT7622_PIN(65, "MDI_RP_P3"), |
| 191 | MT7622_PIN(66, "MDI_RN_P3"), |
| 192 | MT7622_PIN(67, "MDI_RP_P4"), |
| 193 | MT7622_PIN(68, "MDI_RN_P4"), |
| 194 | MT7622_PIN(69, "MDI_TP_P4"), |
| 195 | MT7622_PIN(70, "MDI_TN_P4"), |
| 196 | MT7622_PIN(71, "PMIC_SCL"), |
| 197 | MT7622_PIN(72, "PMIC_SDA"), |
| 198 | MT7622_PIN(73, "SPIC1_CLK"), |
| 199 | MT7622_PIN(74, "SPIC1_MOSI"), |
| 200 | MT7622_PIN(75, "SPIC1_MISO"), |
| 201 | MT7622_PIN(76, "SPIC1_CS"), |
| 202 | MT7622_PIN(77, "GPIO_D"), |
| 203 | MT7622_PIN(78, "WATCHDOG"), |
| 204 | MT7622_PIN(79, "RTS3_N"), |
| 205 | MT7622_PIN(80, "CTS3_N"), |
| 206 | MT7622_PIN(81, "TXD3"), |
| 207 | MT7622_PIN(82, "RXD3"), |
| 208 | MT7622_PIN(83, "PERST0_N"), |
| 209 | MT7622_PIN(84, "PERST1_N"), |
| 210 | MT7622_PIN(85, "WLED_N"), |
| 211 | MT7622_PIN(86, "EPHY_LED0_N"), |
| 212 | MT7622_PIN(87, "AUXIN0"), |
| 213 | MT7622_PIN(88, "AUXIN1"), |
| 214 | MT7622_PIN(89, "AUXIN2"), |
| 215 | MT7622_PIN(90, "AUXIN3"), |
| 216 | MT7622_PIN(91, "TXD4"), |
| 217 | MT7622_PIN(92, "RXD4"), |
| 218 | MT7622_PIN(93, "RTS4_N"), |
| 219 | MT7622_PIN(94, "CTS4_N"), |
| 220 | MT7622_PIN(95, "PWM1"), |
| 221 | MT7622_PIN(96, "PWM2"), |
| 222 | MT7622_PIN(97, "PWM3"), |
| 223 | MT7622_PIN(98, "PWM4"), |
| 224 | MT7622_PIN(99, "PWM5"), |
| 225 | MT7622_PIN(100, "PWM6"), |
| 226 | MT7622_PIN(101, "PWM7"), |
| 227 | MT7622_PIN(102, "GPIO_E"), |
| 228 | }; |
| 229 | |
| 230 | /* List all groups consisting of these pins dedicated to the enablement of |
| 231 | * certain hardware block and the corresponding mode for all of the pins. The |
| 232 | * hardware probably has multiple combinations of these pinouts. |
| 233 | */ |
| 234 | |
| 235 | /* EMMC */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 236 | static const int mt7622_emmc_pins[] = { |
| 237 | 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, }; |
| 238 | static const int mt7622_emmc_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 239 | |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 240 | static const int mt7622_emmc_rst_pins[] = { 37, }; |
| 241 | static const int mt7622_emmc_rst_funcs[] = { 1, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 242 | |
| 243 | /* LED for EPHY */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 244 | static const int mt7622_ephy_leds_pins[] = { 86, 91, 92, 93, 94, }; |
| 245 | static const int mt7622_ephy_leds_funcs[] = { 0, 0, 0, 0, 0, }; |
| 246 | static const int mt7622_ephy0_led_pins[] = { 86, }; |
| 247 | static const int mt7622_ephy0_led_funcs[] = { 0, }; |
| 248 | static const int mt7622_ephy1_led_pins[] = { 91, }; |
| 249 | static const int mt7622_ephy1_led_funcs[] = { 2, }; |
| 250 | static const int mt7622_ephy2_led_pins[] = { 92, }; |
| 251 | static const int mt7622_ephy2_led_funcs[] = { 2, }; |
| 252 | static const int mt7622_ephy3_led_pins[] = { 93, }; |
| 253 | static const int mt7622_ephy3_led_funcs[] = { 2, }; |
| 254 | static const int mt7622_ephy4_led_pins[] = { 94, }; |
| 255 | static const int mt7622_ephy4_led_funcs[] = { 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 256 | |
| 257 | /* Embedded Switch */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 258 | static const int mt7622_esw_pins[] = { |
| 259 | 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, |
| 260 | 69, 70, }; |
| 261 | static const int mt7622_esw_funcs[] = { |
| 262 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; |
| 263 | static const int mt7622_esw_p0_p1_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, }; |
| 264 | static const int mt7622_esw_p0_p1_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; |
| 265 | static const int mt7622_esw_p2_p3_p4_pins[] = { |
| 266 | 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; |
| 267 | static const int mt7622_esw_p2_p3_p4_funcs[] = { |
| 268 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 269 | /* RGMII via ESW */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 270 | static const int mt7622_rgmii_via_esw_pins[] = { |
| 271 | 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; |
| 272 | static const int mt7622_rgmii_via_esw_funcs[] = { |
| 273 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 274 | |
| 275 | /* RGMII via GMAC1 */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 276 | static const int mt7622_rgmii_via_gmac1_pins[] = { |
| 277 | 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, }; |
| 278 | static const int mt7622_rgmii_via_gmac1_funcs[] = { |
| 279 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 280 | |
| 281 | /* RGMII via GMAC2 */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 282 | static const int mt7622_rgmii_via_gmac2_pins[] = { |
| 283 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, }; |
| 284 | static const int mt7622_rgmii_via_gmac2_funcs[] = { |
| 285 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 286 | |
| 287 | /* I2C */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 288 | static const int mt7622_i2c0_pins[] = { 14, 15, }; |
| 289 | static const int mt7622_i2c0_funcs[] = { 0, 0, }; |
| 290 | static const int mt7622_i2c1_0_pins[] = { 55, 56, }; |
| 291 | static const int mt7622_i2c1_0_funcs[] = { 0, 0, }; |
| 292 | static const int mt7622_i2c1_1_pins[] = { 73, 74, }; |
| 293 | static const int mt7622_i2c1_1_funcs[] = { 3, 3, }; |
| 294 | static const int mt7622_i2c1_2_pins[] = { 87, 88, }; |
| 295 | static const int mt7622_i2c1_2_funcs[] = { 0, 0, }; |
| 296 | static const int mt7622_i2c2_0_pins[] = { 57, 58, }; |
| 297 | static const int mt7622_i2c2_0_funcs[] = { 0, 0, }; |
| 298 | static const int mt7622_i2c2_1_pins[] = { 75, 76, }; |
| 299 | static const int mt7622_i2c2_1_funcs[] = { 3, 3, }; |
| 300 | static const int mt7622_i2c2_2_pins[] = { 89, 90, }; |
| 301 | static const int mt7622_i2c2_2_funcs[] = { 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 302 | |
| 303 | /* I2S */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 304 | static const int mt7622_i2s_in_mclk_bclk_ws_pins[] = { 3, 4, 5, }; |
| 305 | static const int mt7622_i2s_in_mclk_bclk_ws_funcs[] = { 3, 3, 0, }; |
| 306 | static const int mt7622_i2s1_in_data_pins[] = { 1, }; |
| 307 | static const int mt7622_i2s1_in_data_funcs[] = { 0, }; |
| 308 | static const int mt7622_i2s2_in_data_pins[] = { 16, }; |
| 309 | static const int mt7622_i2s2_in_data_funcs[] = { 0, }; |
| 310 | static const int mt7622_i2s3_in_data_pins[] = { 17, }; |
| 311 | static const int mt7622_i2s3_in_data_funcs[] = { 0, }; |
| 312 | static const int mt7622_i2s4_in_data_pins[] = { 18, }; |
| 313 | static const int mt7622_i2s4_in_data_funcs[] = { 0, }; |
| 314 | static const int mt7622_i2s_out_mclk_bclk_ws_pins[] = { 3, 4, 5, }; |
| 315 | static const int mt7622_i2s_out_mclk_bclk_ws_funcs[] = { 0, 0, 0, }; |
| 316 | static const int mt7622_i2s1_out_data_pins[] = { 2, }; |
| 317 | static const int mt7622_i2s1_out_data_funcs[] = { 0, }; |
| 318 | static const int mt7622_i2s2_out_data_pins[] = { 19, }; |
| 319 | static const int mt7622_i2s2_out_data_funcs[] = { 0, }; |
| 320 | static const int mt7622_i2s3_out_data_pins[] = { 20, }; |
| 321 | static const int mt7622_i2s3_out_data_funcs[] = { 0, }; |
| 322 | static const int mt7622_i2s4_out_data_pins[] = { 21, }; |
| 323 | static const int mt7622_i2s4_out_data_funcs[] = { 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 324 | |
| 325 | /* IR */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 326 | static const int mt7622_ir_0_tx_pins[] = { 16, }; |
| 327 | static const int mt7622_ir_0_tx_funcs[] = { 4, }; |
| 328 | static const int mt7622_ir_1_tx_pins[] = { 59, }; |
| 329 | static const int mt7622_ir_1_tx_funcs[] = { 5, }; |
| 330 | static const int mt7622_ir_2_tx_pins[] = { 99, }; |
| 331 | static const int mt7622_ir_2_tx_funcs[] = { 3, }; |
| 332 | static const int mt7622_ir_0_rx_pins[] = { 17, }; |
| 333 | static const int mt7622_ir_0_rx_funcs[] = { 4, }; |
| 334 | static const int mt7622_ir_1_rx_pins[] = { 60, }; |
| 335 | static const int mt7622_ir_1_rx_funcs[] = { 5, }; |
| 336 | static const int mt7622_ir_2_rx_pins[] = { 100, }; |
| 337 | static const int mt7622_ir_2_rx_funcs[] = { 3, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 338 | |
| 339 | /* MDIO */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 340 | static const int mt7622_mdc_mdio_pins[] = { 23, 24, }; |
| 341 | static const int mt7622_mdc_mdio_funcs[] = { 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 342 | |
| 343 | /* PCIE */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 344 | static const int mt7622_pcie0_0_waken_pins[] = { 14, }; |
| 345 | static const int mt7622_pcie0_0_waken_funcs[] = { 2, }; |
| 346 | static const int mt7622_pcie0_0_clkreq_pins[] = { 15, }; |
| 347 | static const int mt7622_pcie0_0_clkreq_funcs[] = { 2, }; |
| 348 | static const int mt7622_pcie0_1_waken_pins[] = { 79, }; |
| 349 | static const int mt7622_pcie0_1_waken_funcs[] = { 4, }; |
| 350 | static const int mt7622_pcie0_1_clkreq_pins[] = { 80, }; |
| 351 | static const int mt7622_pcie0_1_clkreq_funcs[] = { 4, }; |
| 352 | static const int mt7622_pcie1_0_waken_pins[] = { 14, }; |
| 353 | static const int mt7622_pcie1_0_waken_funcs[] = { 3, }; |
| 354 | static const int mt7622_pcie1_0_clkreq_pins[] = { 15, }; |
| 355 | static const int mt7622_pcie1_0_clkreq_funcs[] = { 3, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 356 | |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 357 | static const int mt7622_pcie0_pad_perst_pins[] = { 83, }; |
| 358 | static const int mt7622_pcie0_pad_perst_funcs[] = { 0, }; |
| 359 | static const int mt7622_pcie1_pad_perst_pins[] = { 84, }; |
| 360 | static const int mt7622_pcie1_pad_perst_funcs[] = { 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 361 | |
| 362 | /* PMIC bus */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 363 | static const int mt7622_pmic_bus_pins[] = { 71, 72, }; |
| 364 | static const int mt7622_pmic_bus_funcs[] = { 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 365 | |
| 366 | /* Parallel NAND */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 367 | static const int mt7622_pnand_pins[] = { |
| 368 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, }; |
| 369 | static const int mt7622_pnand_funcs[] = { |
| 370 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 371 | |
| 372 | /* PWM */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 373 | static const int mt7622_pwm_ch1_0_pins[] = { 51, }; |
| 374 | static const int mt7622_pwm_ch1_0_funcs[] = { 3, }; |
| 375 | static const int mt7622_pwm_ch1_1_pins[] = { 73, }; |
| 376 | static const int mt7622_pwm_ch1_1_funcs[] = { 4, }; |
| 377 | static const int mt7622_pwm_ch1_2_pins[] = { 95, }; |
| 378 | static const int mt7622_pwm_ch1_2_funcs[] = { 0, }; |
| 379 | static const int mt7622_pwm_ch2_0_pins[] = { 52, }; |
| 380 | static const int mt7622_pwm_ch2_0_funcs[] = { 3, }; |
| 381 | static const int mt7622_pwm_ch2_1_pins[] = { 74, }; |
| 382 | static const int mt7622_pwm_ch2_1_funcs[] = { 4, }; |
| 383 | static const int mt7622_pwm_ch2_2_pins[] = { 96, }; |
| 384 | static const int mt7622_pwm_ch2_2_funcs[] = { 0, }; |
| 385 | static const int mt7622_pwm_ch3_0_pins[] = { 53, }; |
| 386 | static const int mt7622_pwm_ch3_0_funcs[] = { 3, }; |
| 387 | static const int mt7622_pwm_ch3_1_pins[] = { 75, }; |
| 388 | static const int mt7622_pwm_ch3_1_funcs[] = { 4, }; |
| 389 | static const int mt7622_pwm_ch3_2_pins[] = { 97, }; |
| 390 | static const int mt7622_pwm_ch3_2_funcs[] = { 0, }; |
| 391 | static const int mt7622_pwm_ch4_0_pins[] = { 54, }; |
| 392 | static const int mt7622_pwm_ch4_0_funcs[] = { 3, }; |
| 393 | static const int mt7622_pwm_ch4_1_pins[] = { 67, }; |
| 394 | static const int mt7622_pwm_ch4_1_funcs[] = { 3, }; |
| 395 | static const int mt7622_pwm_ch4_2_pins[] = { 76, }; |
| 396 | static const int mt7622_pwm_ch4_2_funcs[] = { 4, }; |
| 397 | static const int mt7622_pwm_ch4_3_pins[] = { 98, }; |
| 398 | static const int mt7622_pwm_ch4_3_funcs[] = { 0, }; |
| 399 | static const int mt7622_pwm_ch5_0_pins[] = { 68, }; |
| 400 | static const int mt7622_pwm_ch5_0_funcs[] = { 3, }; |
| 401 | static const int mt7622_pwm_ch5_1_pins[] = { 77, }; |
| 402 | static const int mt7622_pwm_ch5_1_funcs[] = { 4, }; |
| 403 | static const int mt7622_pwm_ch5_2_pins[] = { 99, }; |
| 404 | static const int mt7622_pwm_ch5_2_funcs[] = { 0, }; |
| 405 | static const int mt7622_pwm_ch6_0_pins[] = { 69, }; |
| 406 | static const int mt7622_pwm_ch6_0_funcs[] = { 3, }; |
| 407 | static const int mt7622_pwm_ch6_1_pins[] = { 78, }; |
| 408 | static const int mt7622_pwm_ch6_1_funcs[] = { 4, }; |
| 409 | static const int mt7622_pwm_ch6_2_pins[] = { 81, }; |
| 410 | static const int mt7622_pwm_ch6_2_funcs[] = { 4, }; |
| 411 | static const int mt7622_pwm_ch6_3_pins[] = { 100, }; |
| 412 | static const int mt7622_pwm_ch6_3_funcs[] = { 0, }; |
| 413 | static const int mt7622_pwm_ch7_0_pins[] = { 70, }; |
| 414 | static const int mt7622_pwm_ch7_0_funcs[] = { 3, }; |
| 415 | static const int mt7622_pwm_ch7_1_pins[] = { 82, }; |
| 416 | static const int mt7622_pwm_ch7_1_funcs[] = { 4, }; |
| 417 | static const int mt7622_pwm_ch7_2_pins[] = { 101, }; |
| 418 | static const int mt7622_pwm_ch7_2_funcs[] = { 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 419 | |
| 420 | /* SD */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 421 | static const int mt7622_sd_0_pins[] = { 16, 17, 18, 19, 20, 21, }; |
| 422 | static const int mt7622_sd_0_funcs[] = { 2, 2, 2, 2, 2, 2, }; |
| 423 | static const int mt7622_sd_1_pins[] = { 25, 26, 27, 28, 29, 30, }; |
| 424 | static const int mt7622_sd_1_funcs[] = { 2, 2, 2, 2, 2, 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 425 | |
| 426 | /* Serial NAND */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 427 | static const int mt7622_snfi_pins[] = { 8, 9, 10, 11, 12, 13, }; |
| 428 | static const int mt7622_snfi_funcs[] = { 2, 2, 2, 2, 2, 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 429 | |
| 430 | /* SPI NOR */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 431 | static const int mt7622_spi_pins[] = { 8, 9, 10, 11, 12, 13 }; |
| 432 | static const int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 433 | |
| 434 | /* SPIC */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 435 | static const int mt7622_spic0_0_pins[] = { 63, 64, 65, 66, }; |
| 436 | static const int mt7622_spic0_0_funcs[] = { 4, 4, 4, 4, }; |
| 437 | static const int mt7622_spic0_1_pins[] = { 79, 80, 81, 82, }; |
| 438 | static const int mt7622_spic0_1_funcs[] = { 3, 3, 3, 3, }; |
| 439 | static const int mt7622_spic1_0_pins[] = { 67, 68, 69, 70, }; |
| 440 | static const int mt7622_spic1_0_funcs[] = { 4, 4, 4, 4, }; |
| 441 | static const int mt7622_spic1_1_pins[] = { 73, 74, 75, 76, }; |
| 442 | static const int mt7622_spic1_1_funcs[] = { 0, 0, 0, 0, }; |
| 443 | static const int mt7622_spic2_0_pins[] = { 10, 11, 12, 13, }; |
| 444 | static const int mt7622_spic2_0_funcs[] = { 0, 0, 0, 0, }; |
| 445 | static const int mt7622_spic2_0_wp_hold_pins[] = { 8, 9, }; |
| 446 | static const int mt7622_spic2_0_wp_hold_funcs[] = { 0, 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 447 | |
| 448 | /* TDM */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 449 | static const int mt7622_tdm_0_out_mclk_bclk_ws_pins[] = { 8, 9, 10, }; |
| 450 | static const int mt7622_tdm_0_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; |
| 451 | static const int mt7622_tdm_0_in_mclk_bclk_ws_pins[] = { 11, 12, 13, }; |
| 452 | static const int mt7622_tdm_0_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; |
| 453 | static const int mt7622_tdm_0_out_data_pins[] = { 20, }; |
| 454 | static const int mt7622_tdm_0_out_data_funcs[] = { 3, }; |
| 455 | static const int mt7622_tdm_0_in_data_pins[] = { 21, }; |
| 456 | static const int mt7622_tdm_0_in_data_funcs[] = { 3, }; |
| 457 | static const int mt7622_tdm_1_out_mclk_bclk_ws_pins[] = { 57, 58, 59, }; |
| 458 | static const int mt7622_tdm_1_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; |
| 459 | static const int mt7622_tdm_1_in_mclk_bclk_ws_pins[] = { 60, 61, 62, }; |
| 460 | static const int mt7622_tdm_1_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, }; |
| 461 | static const int mt7622_tdm_1_out_data_pins[] = { 55, }; |
| 462 | static const int mt7622_tdm_1_out_data_funcs[] = { 3, }; |
| 463 | static const int mt7622_tdm_1_in_data_pins[] = { 56, }; |
| 464 | static const int mt7622_tdm_1_in_data_funcs[] = { 3, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 465 | |
| 466 | /* UART */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 467 | static const int mt7622_uart0_0_tx_rx_pins[] = { 6, 7, }; |
| 468 | static const int mt7622_uart0_0_tx_rx_funcs[] = { 0, 0, }; |
| 469 | static const int mt7622_uart1_0_tx_rx_pins[] = { 55, 56, }; |
| 470 | static const int mt7622_uart1_0_tx_rx_funcs[] = { 2, 2, }; |
| 471 | static const int mt7622_uart1_0_rts_cts_pins[] = { 57, 58, }; |
| 472 | static const int mt7622_uart1_0_rts_cts_funcs[] = { 2, 2, }; |
| 473 | static const int mt7622_uart1_1_tx_rx_pins[] = { 73, 74, }; |
| 474 | static const int mt7622_uart1_1_tx_rx_funcs[] = { 2, 2, }; |
| 475 | static const int mt7622_uart1_1_rts_cts_pins[] = { 75, 76, }; |
| 476 | static const int mt7622_uart1_1_rts_cts_funcs[] = { 2, 2, }; |
| 477 | static const int mt7622_uart2_0_tx_rx_pins[] = { 3, 4, }; |
| 478 | static const int mt7622_uart2_0_tx_rx_funcs[] = { 2, 2, }; |
| 479 | static const int mt7622_uart2_0_rts_cts_pins[] = { 1, 2, }; |
| 480 | static const int mt7622_uart2_0_rts_cts_funcs[] = { 2, 2, }; |
| 481 | static const int mt7622_uart2_1_tx_rx_pins[] = { 51, 52, }; |
| 482 | static const int mt7622_uart2_1_tx_rx_funcs[] = { 0, 0, }; |
| 483 | static const int mt7622_uart2_1_rts_cts_pins[] = { 53, 54, }; |
| 484 | static const int mt7622_uart2_1_rts_cts_funcs[] = { 0, 0, }; |
| 485 | static const int mt7622_uart2_2_tx_rx_pins[] = { 59, 60, }; |
| 486 | static const int mt7622_uart2_2_tx_rx_funcs[] = { 4, 4, }; |
| 487 | static const int mt7622_uart2_2_rts_cts_pins[] = { 61, 62, }; |
| 488 | static const int mt7622_uart2_2_rts_cts_funcs[] = { 4, 4, }; |
| 489 | static const int mt7622_uart2_3_tx_rx_pins[] = { 95, 96, }; |
| 490 | static const int mt7622_uart2_3_tx_rx_funcs[] = { 3, 3, }; |
| 491 | static const int mt7622_uart3_0_tx_rx_pins[] = { 57, 58, }; |
| 492 | static const int mt7622_uart3_0_tx_rx_funcs[] = { 5, 5, }; |
| 493 | static const int mt7622_uart3_1_tx_rx_pins[] = { 81, 82, }; |
| 494 | static const int mt7622_uart3_1_tx_rx_funcs[] = { 0, 0, }; |
| 495 | static const int mt7622_uart3_1_rts_cts_pins[] = { 79, 80, }; |
| 496 | static const int mt7622_uart3_1_rts_cts_funcs[] = { 0, 0, }; |
| 497 | static const int mt7622_uart4_0_tx_rx_pins[] = { 61, 62, }; |
| 498 | static const int mt7622_uart4_0_tx_rx_funcs[] = { 5, 5, }; |
| 499 | static const int mt7622_uart4_1_tx_rx_pins[] = { 91, 92, }; |
| 500 | static const int mt7622_uart4_1_tx_rx_funcs[] = { 0, 0, }; |
| 501 | static const int mt7622_uart4_1_rts_cts_pins[] = { 93, 94 }; |
| 502 | static const int mt7622_uart4_1_rts_cts_funcs[] = { 0, 0, }; |
| 503 | static const int mt7622_uart4_2_tx_rx_pins[] = { 97, 98, }; |
| 504 | static const int mt7622_uart4_2_tx_rx_funcs[] = { 2, 2, }; |
| 505 | static const int mt7622_uart4_2_rts_cts_pins[] = { 95, 96 }; |
| 506 | static const int mt7622_uart4_2_rts_cts_funcs[] = { 2, 2, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 507 | |
| 508 | /* Watchdog */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 509 | static const int mt7622_watchdog_pins[] = { 78, }; |
| 510 | static const int mt7622_watchdog_funcs[] = { 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 511 | |
| 512 | /* WLAN LED */ |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 513 | static const int mt7622_wled_pins[] = { 85, }; |
| 514 | static const int mt7622_wled_funcs[] = { 0, }; |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 515 | |
| 516 | static const struct mtk_group_desc mt7622_groups[] = { |
| 517 | PINCTRL_PIN_GROUP("emmc", mt7622_emmc), |
| 518 | PINCTRL_PIN_GROUP("emmc_rst", mt7622_emmc_rst), |
| 519 | PINCTRL_PIN_GROUP("ephy_leds", mt7622_ephy_leds), |
| 520 | PINCTRL_PIN_GROUP("ephy0_led", mt7622_ephy0_led), |
| 521 | PINCTRL_PIN_GROUP("ephy1_led", mt7622_ephy1_led), |
| 522 | PINCTRL_PIN_GROUP("ephy2_led", mt7622_ephy2_led), |
| 523 | PINCTRL_PIN_GROUP("ephy3_led", mt7622_ephy3_led), |
| 524 | PINCTRL_PIN_GROUP("ephy4_led", mt7622_ephy4_led), |
| 525 | PINCTRL_PIN_GROUP("esw", mt7622_esw), |
| 526 | PINCTRL_PIN_GROUP("esw_p0_p1", mt7622_esw_p0_p1), |
| 527 | PINCTRL_PIN_GROUP("esw_p2_p3_p4", mt7622_esw_p2_p3_p4), |
| 528 | PINCTRL_PIN_GROUP("rgmii_via_esw", mt7622_rgmii_via_esw), |
| 529 | PINCTRL_PIN_GROUP("rgmii_via_gmac1", mt7622_rgmii_via_gmac1), |
| 530 | PINCTRL_PIN_GROUP("rgmii_via_gmac2", mt7622_rgmii_via_gmac2), |
| 531 | PINCTRL_PIN_GROUP("i2c0", mt7622_i2c0), |
| 532 | PINCTRL_PIN_GROUP("i2c1_0", mt7622_i2c1_0), |
| 533 | PINCTRL_PIN_GROUP("i2c1_1", mt7622_i2c1_1), |
| 534 | PINCTRL_PIN_GROUP("i2c1_2", mt7622_i2c1_2), |
| 535 | PINCTRL_PIN_GROUP("i2c2_0", mt7622_i2c2_0), |
| 536 | PINCTRL_PIN_GROUP("i2c2_1", mt7622_i2c2_1), |
| 537 | PINCTRL_PIN_GROUP("i2c2_2", mt7622_i2c2_2), |
| 538 | PINCTRL_PIN_GROUP("i2s_out_mclk_bclk_ws", mt7622_i2s_out_mclk_bclk_ws), |
| 539 | PINCTRL_PIN_GROUP("i2s_in_mclk_bclk_ws", mt7622_i2s_in_mclk_bclk_ws), |
| 540 | PINCTRL_PIN_GROUP("i2s1_in_data", mt7622_i2s1_in_data), |
| 541 | PINCTRL_PIN_GROUP("i2s2_in_data", mt7622_i2s2_in_data), |
| 542 | PINCTRL_PIN_GROUP("i2s3_in_data", mt7622_i2s3_in_data), |
| 543 | PINCTRL_PIN_GROUP("i2s4_in_data", mt7622_i2s4_in_data), |
| 544 | PINCTRL_PIN_GROUP("i2s1_out_data", mt7622_i2s1_out_data), |
| 545 | PINCTRL_PIN_GROUP("i2s2_out_data", mt7622_i2s2_out_data), |
| 546 | PINCTRL_PIN_GROUP("i2s3_out_data", mt7622_i2s3_out_data), |
| 547 | PINCTRL_PIN_GROUP("i2s4_out_data", mt7622_i2s4_out_data), |
| 548 | PINCTRL_PIN_GROUP("ir_0_tx", mt7622_ir_0_tx), |
| 549 | PINCTRL_PIN_GROUP("ir_1_tx", mt7622_ir_1_tx), |
| 550 | PINCTRL_PIN_GROUP("ir_2_tx", mt7622_ir_2_tx), |
| 551 | PINCTRL_PIN_GROUP("ir_0_rx", mt7622_ir_0_rx), |
| 552 | PINCTRL_PIN_GROUP("ir_1_rx", mt7622_ir_1_rx), |
| 553 | PINCTRL_PIN_GROUP("ir_2_rx", mt7622_ir_2_rx), |
| 554 | PINCTRL_PIN_GROUP("mdc_mdio", mt7622_mdc_mdio), |
| 555 | PINCTRL_PIN_GROUP("pcie0_0_waken", mt7622_pcie0_0_waken), |
| 556 | PINCTRL_PIN_GROUP("pcie0_0_clkreq", mt7622_pcie0_0_clkreq), |
| 557 | PINCTRL_PIN_GROUP("pcie0_1_waken", mt7622_pcie0_1_waken), |
| 558 | PINCTRL_PIN_GROUP("pcie0_1_clkreq", mt7622_pcie0_1_clkreq), |
| 559 | PINCTRL_PIN_GROUP("pcie1_0_waken", mt7622_pcie1_0_waken), |
| 560 | PINCTRL_PIN_GROUP("pcie1_0_clkreq", mt7622_pcie1_0_clkreq), |
| 561 | PINCTRL_PIN_GROUP("pcie0_pad_perst", mt7622_pcie0_pad_perst), |
| 562 | PINCTRL_PIN_GROUP("pcie1_pad_perst", mt7622_pcie1_pad_perst), |
| 563 | PINCTRL_PIN_GROUP("par_nand", mt7622_pnand), |
| 564 | PINCTRL_PIN_GROUP("pmic_bus", mt7622_pmic_bus), |
| 565 | PINCTRL_PIN_GROUP("pwm_ch1_0", mt7622_pwm_ch1_0), |
| 566 | PINCTRL_PIN_GROUP("pwm_ch1_1", mt7622_pwm_ch1_1), |
| 567 | PINCTRL_PIN_GROUP("pwm_ch1_2", mt7622_pwm_ch1_2), |
| 568 | PINCTRL_PIN_GROUP("pwm_ch2_0", mt7622_pwm_ch2_0), |
| 569 | PINCTRL_PIN_GROUP("pwm_ch2_1", mt7622_pwm_ch2_1), |
| 570 | PINCTRL_PIN_GROUP("pwm_ch2_2", mt7622_pwm_ch2_2), |
| 571 | PINCTRL_PIN_GROUP("pwm_ch3_0", mt7622_pwm_ch3_0), |
| 572 | PINCTRL_PIN_GROUP("pwm_ch3_1", mt7622_pwm_ch3_1), |
| 573 | PINCTRL_PIN_GROUP("pwm_ch3_2", mt7622_pwm_ch3_2), |
| 574 | PINCTRL_PIN_GROUP("pwm_ch4_0", mt7622_pwm_ch4_0), |
| 575 | PINCTRL_PIN_GROUP("pwm_ch4_1", mt7622_pwm_ch4_1), |
| 576 | PINCTRL_PIN_GROUP("pwm_ch4_2", mt7622_pwm_ch4_2), |
| 577 | PINCTRL_PIN_GROUP("pwm_ch4_3", mt7622_pwm_ch4_3), |
| 578 | PINCTRL_PIN_GROUP("pwm_ch5_0", mt7622_pwm_ch5_0), |
| 579 | PINCTRL_PIN_GROUP("pwm_ch5_1", mt7622_pwm_ch5_1), |
| 580 | PINCTRL_PIN_GROUP("pwm_ch5_2", mt7622_pwm_ch5_2), |
| 581 | PINCTRL_PIN_GROUP("pwm_ch6_0", mt7622_pwm_ch6_0), |
| 582 | PINCTRL_PIN_GROUP("pwm_ch6_1", mt7622_pwm_ch6_1), |
| 583 | PINCTRL_PIN_GROUP("pwm_ch6_2", mt7622_pwm_ch6_2), |
| 584 | PINCTRL_PIN_GROUP("pwm_ch6_3", mt7622_pwm_ch6_3), |
| 585 | PINCTRL_PIN_GROUP("pwm_ch7_0", mt7622_pwm_ch7_0), |
| 586 | PINCTRL_PIN_GROUP("pwm_ch7_1", mt7622_pwm_ch7_1), |
| 587 | PINCTRL_PIN_GROUP("pwm_ch7_2", mt7622_pwm_ch7_2), |
| 588 | PINCTRL_PIN_GROUP("sd_0", mt7622_sd_0), |
| 589 | PINCTRL_PIN_GROUP("sd_1", mt7622_sd_1), |
| 590 | PINCTRL_PIN_GROUP("snfi", mt7622_snfi), |
| 591 | PINCTRL_PIN_GROUP("spi_nor", mt7622_spi), |
| 592 | PINCTRL_PIN_GROUP("spic0_0", mt7622_spic0_0), |
| 593 | PINCTRL_PIN_GROUP("spic0_1", mt7622_spic0_1), |
| 594 | PINCTRL_PIN_GROUP("spic1_0", mt7622_spic1_0), |
| 595 | PINCTRL_PIN_GROUP("spic1_1", mt7622_spic1_1), |
| 596 | PINCTRL_PIN_GROUP("spic2_0", mt7622_spic2_0), |
| 597 | PINCTRL_PIN_GROUP("spic2_0_wp_hold", mt7622_spic2_0_wp_hold), |
| 598 | PINCTRL_PIN_GROUP("tdm_0_out_mclk_bclk_ws", |
| 599 | mt7622_tdm_0_out_mclk_bclk_ws), |
| 600 | PINCTRL_PIN_GROUP("tdm_0_in_mclk_bclk_ws", |
| 601 | mt7622_tdm_0_in_mclk_bclk_ws), |
| 602 | PINCTRL_PIN_GROUP("tdm_0_out_data", mt7622_tdm_0_out_data), |
| 603 | PINCTRL_PIN_GROUP("tdm_0_in_data", mt7622_tdm_0_in_data), |
| 604 | PINCTRL_PIN_GROUP("tdm_1_out_mclk_bclk_ws", |
| 605 | mt7622_tdm_1_out_mclk_bclk_ws), |
| 606 | PINCTRL_PIN_GROUP("tdm_1_in_mclk_bclk_ws", |
| 607 | mt7622_tdm_1_in_mclk_bclk_ws), |
| 608 | PINCTRL_PIN_GROUP("tdm_1_out_data", mt7622_tdm_1_out_data), |
| 609 | PINCTRL_PIN_GROUP("tdm_1_in_data", mt7622_tdm_1_in_data), |
| 610 | PINCTRL_PIN_GROUP("uart0_0_tx_rx", mt7622_uart0_0_tx_rx), |
| 611 | PINCTRL_PIN_GROUP("uart1_0_tx_rx", mt7622_uart1_0_tx_rx), |
| 612 | PINCTRL_PIN_GROUP("uart1_0_rts_cts", mt7622_uart1_0_rts_cts), |
| 613 | PINCTRL_PIN_GROUP("uart1_1_tx_rx", mt7622_uart1_1_tx_rx), |
| 614 | PINCTRL_PIN_GROUP("uart1_1_rts_cts", mt7622_uart1_1_rts_cts), |
| 615 | PINCTRL_PIN_GROUP("uart2_0_tx_rx", mt7622_uart2_0_tx_rx), |
| 616 | PINCTRL_PIN_GROUP("uart2_0_rts_cts", mt7622_uart2_0_rts_cts), |
| 617 | PINCTRL_PIN_GROUP("uart2_1_tx_rx", mt7622_uart2_1_tx_rx), |
| 618 | PINCTRL_PIN_GROUP("uart2_1_rts_cts", mt7622_uart2_1_rts_cts), |
| 619 | PINCTRL_PIN_GROUP("uart2_2_tx_rx", mt7622_uart2_2_tx_rx), |
| 620 | PINCTRL_PIN_GROUP("uart2_2_rts_cts", mt7622_uart2_2_rts_cts), |
| 621 | PINCTRL_PIN_GROUP("uart2_3_tx_rx", mt7622_uart2_3_tx_rx), |
| 622 | PINCTRL_PIN_GROUP("uart3_0_tx_rx", mt7622_uart3_0_tx_rx), |
| 623 | PINCTRL_PIN_GROUP("uart3_1_tx_rx", mt7622_uart3_1_tx_rx), |
| 624 | PINCTRL_PIN_GROUP("uart3_1_rts_cts", mt7622_uart3_1_rts_cts), |
| 625 | PINCTRL_PIN_GROUP("uart4_0_tx_rx", mt7622_uart4_0_tx_rx), |
| 626 | PINCTRL_PIN_GROUP("uart4_1_tx_rx", mt7622_uart4_1_tx_rx), |
| 627 | PINCTRL_PIN_GROUP("uart4_1_rts_cts", mt7622_uart4_1_rts_cts), |
| 628 | PINCTRL_PIN_GROUP("uart4_2_tx_rx", mt7622_uart4_2_tx_rx), |
| 629 | PINCTRL_PIN_GROUP("uart4_2_rts_cts", mt7622_uart4_2_rts_cts), |
| 630 | PINCTRL_PIN_GROUP("watchdog", mt7622_watchdog), |
| 631 | PINCTRL_PIN_GROUP("wled", mt7622_wled), |
| 632 | }; |
| 633 | |
| 634 | /* Joint those groups owning the same capability in user point of view which |
| 635 | * allows that people tend to use through the device tree. |
| 636 | */ |
| 637 | static const char *const mt7622_emmc_groups[] = { "emmc", "emmc_rst", }; |
| 638 | static const char *const mt7622_ethernet_groups[] = { "esw", "esw_p0_p1", |
| 639 | "esw_p2_p3_p4", "mdc_mdio", |
| 640 | "rgmii_via_gmac1", |
| 641 | "rgmii_via_gmac2", |
| 642 | "rgmii_via_esw", }; |
| 643 | static const char *const mt7622_i2c_groups[] = { "i2c0", "i2c1_0", "i2c1_1", |
| 644 | "i2c1_2", "i2c2_0", "i2c2_1", |
| 645 | "i2c2_2", }; |
| 646 | static const char *const mt7622_i2s_groups[] = { "i2s_out_mclk_bclk_ws", |
| 647 | "i2s_in_mclk_bclk_ws", |
| 648 | "i2s1_in_data", "i2s2_in_data", |
| 649 | "i2s3_in_data", "i2s4_in_data", |
| 650 | "i2s1_out_data", "i2s2_out_data", |
| 651 | "i2s3_out_data", "i2s4_out_data", }; |
| 652 | static const char *const mt7622_ir_groups[] = { "ir_0_tx", "ir_1_tx", "ir_2_tx", |
| 653 | "ir_0_rx", "ir_1_rx", "ir_2_rx"}; |
| 654 | static const char *const mt7622_led_groups[] = { "ephy_leds", "ephy0_led", |
| 655 | "ephy1_led", "ephy2_led", |
| 656 | "ephy3_led", "ephy4_led", |
| 657 | "wled", }; |
| 658 | static const char *const mt7622_flash_groups[] = { "par_nand", "snfi", |
| 659 | "spi_nor"}; |
| 660 | static const char *const mt7622_pcie_groups[] = { "pcie0_0_waken", |
| 661 | "pcie0_0_clkreq", "pcie0_1_waken", |
| 662 | "pcie0_1_clkreq", "pcie1_0_waken", |
| 663 | "pcie1_0_clkreq", "pcie0_pad_perst", |
| 664 | "pcie1_pad_perst", }; |
| 665 | static const char *const mt7622_pmic_bus_groups[] = { "pmic_bus", }; |
| 666 | static const char *const mt7622_pwm_groups[] = { "pwm_ch1_0", "pwm_ch1_1", |
| 667 | "pwm_ch1_2", "pwm_ch2_0", |
| 668 | "pwm_ch2_1", "pwm_ch2_2", |
| 669 | "pwm_ch3_0", "pwm_ch3_1", |
| 670 | "pwm_ch3_2", "pwm_ch4_0", |
| 671 | "pwm_ch4_1", "pwm_ch4_2", |
| 672 | "pwm_ch4_3", "pwm_ch5_0", |
| 673 | "pwm_ch5_1", "pwm_ch5_2", |
| 674 | "pwm_ch6_0", "pwm_ch6_1", |
| 675 | "pwm_ch6_2", "pwm_ch6_3", |
| 676 | "pwm_ch7_0", "pwm_ch7_1", |
| 677 | "pwm_ch7_2", }; |
| 678 | static const char *const mt7622_sd_groups[] = { "sd_0", "sd_1", }; |
| 679 | static const char *const mt7622_spic_groups[] = { "spic0_0", "spic0_1", |
| 680 | "spic1_0", "spic1_1", "spic2_0", |
| 681 | "spic2_0_wp_hold", }; |
| 682 | static const char *const mt7622_tdm_groups[] = { "tdm_0_out_mclk_bclk_ws", |
| 683 | "tdm_0_in_mclk_bclk_ws", |
| 684 | "tdm_0_out_data", |
| 685 | "tdm_0_in_data", |
| 686 | "tdm_1_out_mclk_bclk_ws", |
| 687 | "tdm_1_in_mclk_bclk_ws", |
| 688 | "tdm_1_out_data", |
| 689 | "tdm_1_in_data", }; |
| 690 | |
| 691 | static const char *const mt7622_uart_groups[] = { "uart0_0_tx_rx", |
| 692 | "uart1_0_tx_rx", "uart1_0_rts_cts", |
| 693 | "uart1_1_tx_rx", "uart1_1_rts_cts", |
| 694 | "uart2_0_tx_rx", "uart2_0_rts_cts", |
| 695 | "uart2_1_tx_rx", "uart2_1_rts_cts", |
| 696 | "uart2_2_tx_rx", "uart2_2_rts_cts", |
| 697 | "uart2_3_tx_rx", |
| 698 | "uart3_0_tx_rx", |
| 699 | "uart3_1_tx_rx", "uart3_1_rts_cts", |
| 700 | "uart4_0_tx_rx", |
| 701 | "uart4_1_tx_rx", "uart4_1_rts_cts", |
| 702 | "uart4_2_tx_rx", |
| 703 | "uart4_2_rts_cts",}; |
| 704 | static const char *const mt7622_wdt_groups[] = { "watchdog", }; |
| 705 | |
| 706 | static const struct mtk_function_desc mt7622_functions[] = { |
| 707 | {"emmc", mt7622_emmc_groups, ARRAY_SIZE(mt7622_emmc_groups)}, |
| 708 | {"eth", mt7622_ethernet_groups, ARRAY_SIZE(mt7622_ethernet_groups)}, |
| 709 | {"i2c", mt7622_i2c_groups, ARRAY_SIZE(mt7622_i2c_groups)}, |
| 710 | {"i2s", mt7622_i2s_groups, ARRAY_SIZE(mt7622_i2s_groups)}, |
| 711 | {"ir", mt7622_ir_groups, ARRAY_SIZE(mt7622_ir_groups)}, |
| 712 | {"led", mt7622_led_groups, ARRAY_SIZE(mt7622_led_groups)}, |
| 713 | {"flash", mt7622_flash_groups, ARRAY_SIZE(mt7622_flash_groups)}, |
| 714 | {"pcie", mt7622_pcie_groups, ARRAY_SIZE(mt7622_pcie_groups)}, |
| 715 | {"pmic", mt7622_pmic_bus_groups, ARRAY_SIZE(mt7622_pmic_bus_groups)}, |
| 716 | {"pwm", mt7622_pwm_groups, ARRAY_SIZE(mt7622_pwm_groups)}, |
| 717 | {"sd", mt7622_sd_groups, ARRAY_SIZE(mt7622_sd_groups)}, |
| 718 | {"spi", mt7622_spic_groups, ARRAY_SIZE(mt7622_spic_groups)}, |
| 719 | {"tdm", mt7622_tdm_groups, ARRAY_SIZE(mt7622_tdm_groups)}, |
| 720 | {"uart", mt7622_uart_groups, ARRAY_SIZE(mt7622_uart_groups)}, |
| 721 | {"watchdog", mt7622_wdt_groups, ARRAY_SIZE(mt7622_wdt_groups)}, |
| 722 | }; |
| 723 | |
Weijie Gao | 7cb50cd | 2023-07-19 17:16:37 +0800 | [diff] [blame] | 724 | static const struct mtk_pinctrl_soc mt7622_data = { |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 725 | .name = "mt7622_pinctrl", |
| 726 | .reg_cal = mt7622_reg_cals, |
| 727 | .pins = mt7622_pins, |
| 728 | .npins = ARRAY_SIZE(mt7622_pins), |
| 729 | .grps = mt7622_groups, |
| 730 | .ngrps = ARRAY_SIZE(mt7622_groups), |
| 731 | .funcs = mt7622_functions, |
| 732 | .nfuncs = ARRAY_SIZE(mt7622_functions), |
Sam Shih | cf400b6 | 2020-01-10 16:30:28 +0800 | [diff] [blame] | 733 | .gpio_mode = 1, |
| 734 | .rev = MTK_PINCTRL_V0, |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 735 | }; |
| 736 | |
| 737 | static int mtk_pinctrl_mt7622_probe(struct udevice *dev) |
| 738 | { |
| 739 | return mtk_pinctrl_common_probe(dev, &mt7622_data); |
| 740 | } |
| 741 | |
| 742 | static const struct udevice_id mt7622_pctrl_match[] = { |
| 743 | { .compatible = "mediatek,mt7622-pinctrl" }, |
| 744 | { /* sentinel */ } |
| 745 | }; |
| 746 | |
| 747 | U_BOOT_DRIVER(mt7622_pinctrl) = { |
| 748 | .name = "mt7622_pinctrl", |
| 749 | .id = UCLASS_PINCTRL, |
| 750 | .of_match = mt7622_pctrl_match, |
| 751 | .ops = &mtk_pinctrl_ops, |
Chris Webb | f4df9f5 | 2024-07-31 11:01:31 +0100 | [diff] [blame] | 752 | .bind = mtk_pinctrl_common_bind, |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 753 | .probe = mtk_pinctrl_mt7622_probe, |
Simon Glass | 41575d8 | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 754 | .priv_auto = sizeof(struct mtk_pinctrl_priv), |
Sam Shih | a430149 | 2020-01-10 16:30:27 +0800 | [diff] [blame] | 755 | }; |