18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * The MT7629 driver based on Linux generic pinctrl binding. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2018 MediaTek Inc. 68c2ecf20Sopenharmony_ci * Author: Ryder Lee <ryder.lee@mediatek.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "pinctrl-moore.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define MT7629_PIN(_number, _name, _eint_n) \ 128c2ecf20Sopenharmony_ci MTK_PIN(_number, _name, 0, _eint_n, DRV_GRP1) 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_mode_range[] = { 158c2ecf20Sopenharmony_ci PIN_FIELD(0, 78, 0x300, 0x10, 0, 4), 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_dir_range[] = { 198c2ecf20Sopenharmony_ci PIN_FIELD(0, 78, 0x0, 0x10, 0, 1), 208c2ecf20Sopenharmony_ci}; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_di_range[] = { 238c2ecf20Sopenharmony_ci PIN_FIELD(0, 78, 0x200, 0x10, 0, 1), 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_do_range[] = { 278c2ecf20Sopenharmony_ci PIN_FIELD(0, 78, 0x100, 0x10, 0, 1), 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_ies_range[] = { 318c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1000, 0x10, 0, 1), 328c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2000, 0x10, 0, 1), 338c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3000, 0x10, 0, 1), 348c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4000, 0x10, 0, 1), 358c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5000, 0x10, 0, 1), 368c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6000, 0x10, 0, 1), 378c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7000, 0x10, 0, 1), 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_smt_range[] = { 418c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1100, 0x10, 0, 1), 428c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2100, 0x10, 0, 1), 438c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3100, 0x10, 0, 1), 448c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4100, 0x10, 0, 1), 458c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5100, 0x10, 0, 1), 468c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6100, 0x10, 0, 1), 478c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7100, 0x10, 0, 1), 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_pullen_range[] = { 518c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1400, 0x10, 0, 1), 528c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2400, 0x10, 0, 1), 538c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3400, 0x10, 0, 1), 548c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4400, 0x10, 0, 1), 558c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5400, 0x10, 0, 1), 568c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6400, 0x10, 0, 1), 578c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7400, 0x10, 0, 1), 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_pullsel_range[] = { 618c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1500, 0x10, 0, 1), 628c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2500, 0x10, 0, 1), 638c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3500, 0x10, 0, 1), 648c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4500, 0x10, 0, 1), 658c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5500, 0x10, 0, 1), 668c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6500, 0x10, 0, 1), 678c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7500, 0x10, 0, 1), 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_drv_range[] = { 718c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1600, 0x10, 0, 4), 728c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2600, 0x10, 0, 4), 738c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3600, 0x10, 0, 4), 748c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4600, 0x10, 0, 4), 758c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5600, 0x10, 0, 4), 768c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6600, 0x10, 0, 4), 778c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7600, 0x10, 0, 4), 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_tdsel_range[] = { 818c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1200, 0x10, 0, 4), 828c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2200, 0x10, 0, 4), 838c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3200, 0x10, 0, 4), 848c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4200, 0x10, 0, 4), 858c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5200, 0x10, 0, 4), 868c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6200, 0x10, 0, 4), 878c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7200, 0x10, 0, 4), 888c2ecf20Sopenharmony_ci}; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_cistatic const struct mtk_pin_field_calc mt7629_pin_rdsel_range[] = { 918c2ecf20Sopenharmony_ci PIN_FIELD(0, 10, 0x1300, 0x10, 0, 4), 928c2ecf20Sopenharmony_ci PIN_FIELD(11, 18, 0x2300, 0x10, 0, 4), 938c2ecf20Sopenharmony_ci PIN_FIELD(19, 32, 0x3300, 0x10, 0, 4), 948c2ecf20Sopenharmony_ci PIN_FIELD(33, 48, 0x4300, 0x10, 0, 4), 958c2ecf20Sopenharmony_ci PIN_FIELD(49, 50, 0x5300, 0x10, 0, 4), 968c2ecf20Sopenharmony_ci PIN_FIELD(51, 69, 0x6300, 0x10, 0, 4), 978c2ecf20Sopenharmony_ci PIN_FIELD(70, 78, 0x7300, 0x10, 0, 4), 988c2ecf20Sopenharmony_ci}; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_cistatic const struct mtk_pin_reg_calc mt7629_reg_cals[] = { 1018c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7629_pin_mode_range), 1028c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7629_pin_dir_range), 1038c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7629_pin_di_range), 1048c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7629_pin_do_range), 1058c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7629_pin_ies_range), 1068c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7629_pin_smt_range), 1078c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt7629_pin_pullsel_range), 1088c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt7629_pin_pullen_range), 1098c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7629_pin_drv_range), 1108c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt7629_pin_tdsel_range), 1118c2ecf20Sopenharmony_ci [PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt7629_pin_rdsel_range), 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistatic const struct mtk_pin_desc mt7629_pins[] = { 1158c2ecf20Sopenharmony_ci MT7629_PIN(0, "TOP_5G_CLK", 53), 1168c2ecf20Sopenharmony_ci MT7629_PIN(1, "TOP_5G_DATA", 54), 1178c2ecf20Sopenharmony_ci MT7629_PIN(2, "WF0_5G_HB0", 55), 1188c2ecf20Sopenharmony_ci MT7629_PIN(3, "WF0_5G_HB1", 56), 1198c2ecf20Sopenharmony_ci MT7629_PIN(4, "WF0_5G_HB2", 57), 1208c2ecf20Sopenharmony_ci MT7629_PIN(5, "WF0_5G_HB3", 58), 1218c2ecf20Sopenharmony_ci MT7629_PIN(6, "WF0_5G_HB4", 59), 1228c2ecf20Sopenharmony_ci MT7629_PIN(7, "WF0_5G_HB5", 60), 1238c2ecf20Sopenharmony_ci MT7629_PIN(8, "WF0_5G_HB6", 61), 1248c2ecf20Sopenharmony_ci MT7629_PIN(9, "XO_REQ", 9), 1258c2ecf20Sopenharmony_ci MT7629_PIN(10, "TOP_RST_N", 10), 1268c2ecf20Sopenharmony_ci MT7629_PIN(11, "SYS_WATCHDOG", 11), 1278c2ecf20Sopenharmony_ci MT7629_PIN(12, "EPHY_LED0_N_JTDO", 12), 1288c2ecf20Sopenharmony_ci MT7629_PIN(13, "EPHY_LED1_N_JTDI", 13), 1298c2ecf20Sopenharmony_ci MT7629_PIN(14, "EPHY_LED2_N_JTMS", 14), 1308c2ecf20Sopenharmony_ci MT7629_PIN(15, "EPHY_LED3_N_JTCLK", 15), 1318c2ecf20Sopenharmony_ci MT7629_PIN(16, "EPHY_LED4_N_JTRST_N", 16), 1328c2ecf20Sopenharmony_ci MT7629_PIN(17, "WF2G_LED_N", 17), 1338c2ecf20Sopenharmony_ci MT7629_PIN(18, "WF5G_LED_N", 18), 1348c2ecf20Sopenharmony_ci MT7629_PIN(19, "I2C_SDA", 19), 1358c2ecf20Sopenharmony_ci MT7629_PIN(20, "I2C_SCL", 20), 1368c2ecf20Sopenharmony_ci MT7629_PIN(21, "GPIO_9", 21), 1378c2ecf20Sopenharmony_ci MT7629_PIN(22, "GPIO_10", 22), 1388c2ecf20Sopenharmony_ci MT7629_PIN(23, "GPIO_11", 23), 1398c2ecf20Sopenharmony_ci MT7629_PIN(24, "GPIO_12", 24), 1408c2ecf20Sopenharmony_ci MT7629_PIN(25, "UART1_TXD", 25), 1418c2ecf20Sopenharmony_ci MT7629_PIN(26, "UART1_RXD", 26), 1428c2ecf20Sopenharmony_ci MT7629_PIN(27, "UART1_CTS", 27), 1438c2ecf20Sopenharmony_ci MT7629_PIN(28, "UART1_RTS", 28), 1448c2ecf20Sopenharmony_ci MT7629_PIN(29, "UART2_TXD", 29), 1458c2ecf20Sopenharmony_ci MT7629_PIN(30, "UART2_RXD", 30), 1468c2ecf20Sopenharmony_ci MT7629_PIN(31, "UART2_CTS", 31), 1478c2ecf20Sopenharmony_ci MT7629_PIN(32, "UART2_RTS", 32), 1488c2ecf20Sopenharmony_ci MT7629_PIN(33, "MDI_TP_P1", 33), 1498c2ecf20Sopenharmony_ci MT7629_PIN(34, "MDI_TN_P1", 34), 1508c2ecf20Sopenharmony_ci MT7629_PIN(35, "MDI_RP_P1", 35), 1518c2ecf20Sopenharmony_ci MT7629_PIN(36, "MDI_RN_P1", 36), 1528c2ecf20Sopenharmony_ci MT7629_PIN(37, "MDI_RP_P2", 37), 1538c2ecf20Sopenharmony_ci MT7629_PIN(38, "MDI_RN_P2", 38), 1548c2ecf20Sopenharmony_ci MT7629_PIN(39, "MDI_TP_P2", 39), 1558c2ecf20Sopenharmony_ci MT7629_PIN(40, "MDI_TN_P2", 40), 1568c2ecf20Sopenharmony_ci MT7629_PIN(41, "MDI_TP_P3", 41), 1578c2ecf20Sopenharmony_ci MT7629_PIN(42, "MDI_TN_P3", 42), 1588c2ecf20Sopenharmony_ci MT7629_PIN(43, "MDI_RP_P3", 43), 1598c2ecf20Sopenharmony_ci MT7629_PIN(44, "MDI_RN_P3", 44), 1608c2ecf20Sopenharmony_ci MT7629_PIN(45, "MDI_RP_P4", 45), 1618c2ecf20Sopenharmony_ci MT7629_PIN(46, "MDI_RN_P4", 46), 1628c2ecf20Sopenharmony_ci MT7629_PIN(47, "MDI_TP_P4", 47), 1638c2ecf20Sopenharmony_ci MT7629_PIN(48, "MDI_TN_P4", 48), 1648c2ecf20Sopenharmony_ci MT7629_PIN(49, "SMI_MDC", 49), 1658c2ecf20Sopenharmony_ci MT7629_PIN(50, "SMI_MDIO", 50), 1668c2ecf20Sopenharmony_ci MT7629_PIN(51, "PCIE_PERESET_N", 51), 1678c2ecf20Sopenharmony_ci MT7629_PIN(52, "PWM_0", 52), 1688c2ecf20Sopenharmony_ci MT7629_PIN(53, "GPIO_0", 0), 1698c2ecf20Sopenharmony_ci MT7629_PIN(54, "GPIO_1", 1), 1708c2ecf20Sopenharmony_ci MT7629_PIN(55, "GPIO_2", 2), 1718c2ecf20Sopenharmony_ci MT7629_PIN(56, "GPIO_3", 3), 1728c2ecf20Sopenharmony_ci MT7629_PIN(57, "GPIO_4", 4), 1738c2ecf20Sopenharmony_ci MT7629_PIN(58, "GPIO_5", 5), 1748c2ecf20Sopenharmony_ci MT7629_PIN(59, "GPIO_6", 6), 1758c2ecf20Sopenharmony_ci MT7629_PIN(60, "GPIO_7", 7), 1768c2ecf20Sopenharmony_ci MT7629_PIN(61, "GPIO_8", 8), 1778c2ecf20Sopenharmony_ci MT7629_PIN(62, "SPI_CLK", 62), 1788c2ecf20Sopenharmony_ci MT7629_PIN(63, "SPI_CS", 63), 1798c2ecf20Sopenharmony_ci MT7629_PIN(64, "SPI_MOSI", 64), 1808c2ecf20Sopenharmony_ci MT7629_PIN(65, "SPI_MISO", 65), 1818c2ecf20Sopenharmony_ci MT7629_PIN(66, "SPI_WP", 66), 1828c2ecf20Sopenharmony_ci MT7629_PIN(67, "SPI_HOLD", 67), 1838c2ecf20Sopenharmony_ci MT7629_PIN(68, "UART0_TXD", 68), 1848c2ecf20Sopenharmony_ci MT7629_PIN(69, "UART0_RXD", 69), 1858c2ecf20Sopenharmony_ci MT7629_PIN(70, "TOP_2G_CLK", 70), 1868c2ecf20Sopenharmony_ci MT7629_PIN(71, "TOP_2G_DATA", 71), 1878c2ecf20Sopenharmony_ci MT7629_PIN(72, "WF0_2G_HB0", 72), 1888c2ecf20Sopenharmony_ci MT7629_PIN(73, "WF0_2G_HB1", 73), 1898c2ecf20Sopenharmony_ci MT7629_PIN(74, "WF0_2G_HB2", 74), 1908c2ecf20Sopenharmony_ci MT7629_PIN(75, "WF0_2G_HB3", 75), 1918c2ecf20Sopenharmony_ci MT7629_PIN(76, "WF0_2G_HB4", 76), 1928c2ecf20Sopenharmony_ci MT7629_PIN(77, "WF0_2G_HB5", 77), 1938c2ecf20Sopenharmony_ci MT7629_PIN(78, "WF0_2G_HB6", 78), 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci/* List all groups consisting of these pins dedicated to the enablement of 1978c2ecf20Sopenharmony_ci * certain hardware block and the corresponding mode for all of the pins. 1988c2ecf20Sopenharmony_ci * The hardware probably has multiple combinations of these pinouts. 1998c2ecf20Sopenharmony_ci */ 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* LED for EPHY */ 2028c2ecf20Sopenharmony_cistatic int mt7629_ephy_leds_pins[] = { 12, 13, 14, 15, 16, 17, 18, }; 2038c2ecf20Sopenharmony_cistatic int mt7629_ephy_leds_funcs[] = { 1, 1, 1, 1, 1, 1, 1, }; 2048c2ecf20Sopenharmony_cistatic int mt7629_ephy_led0_pins[] = { 12, }; 2058c2ecf20Sopenharmony_cistatic int mt7629_ephy_led0_funcs[] = { 1, }; 2068c2ecf20Sopenharmony_cistatic int mt7629_ephy_led1_pins[] = { 13, }; 2078c2ecf20Sopenharmony_cistatic int mt7629_ephy_led1_funcs[] = { 1, }; 2088c2ecf20Sopenharmony_cistatic int mt7629_ephy_led2_pins[] = { 14, }; 2098c2ecf20Sopenharmony_cistatic int mt7629_ephy_led2_funcs[] = { 1, }; 2108c2ecf20Sopenharmony_cistatic int mt7629_ephy_led3_pins[] = { 15, }; 2118c2ecf20Sopenharmony_cistatic int mt7629_ephy_led3_funcs[] = { 1, }; 2128c2ecf20Sopenharmony_cistatic int mt7629_ephy_led4_pins[] = { 16, }; 2138c2ecf20Sopenharmony_cistatic int mt7629_ephy_led4_funcs[] = { 1, }; 2148c2ecf20Sopenharmony_cistatic int mt7629_wf2g_led_pins[] = { 17, }; 2158c2ecf20Sopenharmony_cistatic int mt7629_wf2g_led_funcs[] = { 1, }; 2168c2ecf20Sopenharmony_cistatic int mt7629_wf5g_led_pins[] = { 18, }; 2178c2ecf20Sopenharmony_cistatic int mt7629_wf5g_led_funcs[] = { 1, }; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/* Watchdog */ 2208c2ecf20Sopenharmony_cistatic int mt7629_watchdog_pins[] = { 11, }; 2218c2ecf20Sopenharmony_cistatic int mt7629_watchdog_funcs[] = { 1, }; 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/* LED for GPHY */ 2248c2ecf20Sopenharmony_cistatic int mt7629_gphy_leds_0_pins[] = { 21, 22, 23, }; 2258c2ecf20Sopenharmony_cistatic int mt7629_gphy_leds_0_funcs[] = { 2, 2, 2, }; 2268c2ecf20Sopenharmony_cistatic int mt7629_gphy_led1_0_pins[] = { 21, }; 2278c2ecf20Sopenharmony_cistatic int mt7629_gphy_led1_0_funcs[] = { 2, }; 2288c2ecf20Sopenharmony_cistatic int mt7629_gphy_led2_0_pins[] = { 22, }; 2298c2ecf20Sopenharmony_cistatic int mt7629_gphy_led2_0_funcs[] = { 2, }; 2308c2ecf20Sopenharmony_cistatic int mt7629_gphy_led3_0_pins[] = { 23, }; 2318c2ecf20Sopenharmony_cistatic int mt7629_gphy_led3_0_funcs[] = { 2, }; 2328c2ecf20Sopenharmony_cistatic int mt7629_gphy_leds_1_pins[] = { 57, 58, 59, }; 2338c2ecf20Sopenharmony_cistatic int mt7629_gphy_leds_1_funcs[] = { 1, 1, 1, }; 2348c2ecf20Sopenharmony_cistatic int mt7629_gphy_led1_1_pins[] = { 57, }; 2358c2ecf20Sopenharmony_cistatic int mt7629_gphy_led1_1_funcs[] = { 1, }; 2368c2ecf20Sopenharmony_cistatic int mt7629_gphy_led2_1_pins[] = { 58, }; 2378c2ecf20Sopenharmony_cistatic int mt7629_gphy_led2_1_funcs[] = { 1, }; 2388c2ecf20Sopenharmony_cistatic int mt7629_gphy_led3_1_pins[] = { 59, }; 2398c2ecf20Sopenharmony_cistatic int mt7629_gphy_led3_1_funcs[] = { 1, }; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci/* I2C */ 2428c2ecf20Sopenharmony_cistatic int mt7629_i2c_0_pins[] = { 19, 20, }; 2438c2ecf20Sopenharmony_cistatic int mt7629_i2c_0_funcs[] = { 1, 1, }; 2448c2ecf20Sopenharmony_cistatic int mt7629_i2c_1_pins[] = { 53, 54, }; 2458c2ecf20Sopenharmony_cistatic int mt7629_i2c_1_funcs[] = { 1, 1, }; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci/* SPI */ 2488c2ecf20Sopenharmony_cistatic int mt7629_spi_0_pins[] = { 21, 22, 23, 24, }; 2498c2ecf20Sopenharmony_cistatic int mt7629_spi_0_funcs[] = { 1, 1, 1, 1, }; 2508c2ecf20Sopenharmony_cistatic int mt7629_spi_1_pins[] = { 62, 63, 64, 65, }; 2518c2ecf20Sopenharmony_cistatic int mt7629_spi_1_funcs[] = { 1, 1, 1, 1, }; 2528c2ecf20Sopenharmony_cistatic int mt7629_spi_wp_pins[] = { 66, }; 2538c2ecf20Sopenharmony_cistatic int mt7629_spi_wp_funcs[] = { 1, }; 2548c2ecf20Sopenharmony_cistatic int mt7629_spi_hold_pins[] = { 67, }; 2558c2ecf20Sopenharmony_cistatic int mt7629_spi_hold_funcs[] = { 1, }; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/* UART */ 2588c2ecf20Sopenharmony_cistatic int mt7629_uart1_0_txd_rxd_pins[] = { 25, 26, }; 2598c2ecf20Sopenharmony_cistatic int mt7629_uart1_0_txd_rxd_funcs[] = { 1, 1, }; 2608c2ecf20Sopenharmony_cistatic int mt7629_uart1_1_txd_rxd_pins[] = { 53, 54, }; 2618c2ecf20Sopenharmony_cistatic int mt7629_uart1_1_txd_rxd_funcs[] = { 2, 2, }; 2628c2ecf20Sopenharmony_cistatic int mt7629_uart2_0_txd_rxd_pins[] = { 29, 30, }; 2638c2ecf20Sopenharmony_cistatic int mt7629_uart2_0_txd_rxd_funcs[] = { 1, 1, }; 2648c2ecf20Sopenharmony_cistatic int mt7629_uart2_1_txd_rxd_pins[] = { 57, 58, }; 2658c2ecf20Sopenharmony_cistatic int mt7629_uart2_1_txd_rxd_funcs[] = { 2, 2, }; 2668c2ecf20Sopenharmony_cistatic int mt7629_uart1_0_cts_rts_pins[] = { 27, 28, }; 2678c2ecf20Sopenharmony_cistatic int mt7629_uart1_0_cts_rts_funcs[] = { 1, 1, }; 2688c2ecf20Sopenharmony_cistatic int mt7629_uart1_1_cts_rts_pins[] = { 55, 56, }; 2698c2ecf20Sopenharmony_cistatic int mt7629_uart1_1_cts_rts_funcs[] = { 2, 2, }; 2708c2ecf20Sopenharmony_cistatic int mt7629_uart2_0_cts_rts_pins[] = { 31, 32, }; 2718c2ecf20Sopenharmony_cistatic int mt7629_uart2_0_cts_rts_funcs[] = { 1, 1, }; 2728c2ecf20Sopenharmony_cistatic int mt7629_uart2_1_cts_rts_pins[] = { 59, 60, }; 2738c2ecf20Sopenharmony_cistatic int mt7629_uart2_1_cts_rts_funcs[] = { 2, 2, }; 2748c2ecf20Sopenharmony_cistatic int mt7629_uart0_txd_rxd_pins[] = { 68, 69, }; 2758c2ecf20Sopenharmony_cistatic int mt7629_uart0_txd_rxd_funcs[] = { 1, 1, }; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci/* MDC/MDIO */ 2788c2ecf20Sopenharmony_cistatic int mt7629_mdc_mdio_pins[] = { 49, 50, }; 2798c2ecf20Sopenharmony_cistatic int mt7629_mdc_mdio_funcs[] = { 1, 1, }; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/* PCIE */ 2828c2ecf20Sopenharmony_cistatic int mt7629_pcie_pereset_pins[] = { 51, }; 2838c2ecf20Sopenharmony_cistatic int mt7629_pcie_pereset_funcs[] = { 1, }; 2848c2ecf20Sopenharmony_cistatic int mt7629_pcie_wake_pins[] = { 55, }; 2858c2ecf20Sopenharmony_cistatic int mt7629_pcie_wake_funcs[] = { 1, }; 2868c2ecf20Sopenharmony_cistatic int mt7629_pcie_clkreq_pins[] = { 56, }; 2878c2ecf20Sopenharmony_cistatic int mt7629_pcie_clkreq_funcs[] = { 1, }; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* PWM */ 2908c2ecf20Sopenharmony_cistatic int mt7629_pwm_0_pins[] = { 52, }; 2918c2ecf20Sopenharmony_cistatic int mt7629_pwm_0_funcs[] = { 1, }; 2928c2ecf20Sopenharmony_cistatic int mt7629_pwm_1_pins[] = { 61, }; 2938c2ecf20Sopenharmony_cistatic int mt7629_pwm_1_funcs[] = { 2, }; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* WF 2G */ 2968c2ecf20Sopenharmony_cistatic int mt7629_wf0_2g_pins[] = { 70, 71, 72, 73, 74, 75, 76, 77, 78, }; 2978c2ecf20Sopenharmony_cistatic int mt7629_wf0_2g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* WF 5G */ 3008c2ecf20Sopenharmony_cistatic int mt7629_wf0_5g_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, }; 3018c2ecf20Sopenharmony_cistatic int mt7629_wf0_5g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci/* SNFI */ 3048c2ecf20Sopenharmony_cistatic int mt7629_snfi_pins[] = { 62, 63, 64, 65, 66, 67 }; 3058c2ecf20Sopenharmony_cistatic int mt7629_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 }; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/* SPI NOR */ 3088c2ecf20Sopenharmony_cistatic int mt7629_snor_pins[] = { 62, 63, 64, 65, 66, 67 }; 3098c2ecf20Sopenharmony_cistatic int mt7629_snor_funcs[] = { 1, 1, 1, 1, 1, 1 }; 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_cistatic const struct group_desc mt7629_groups[] = { 3128c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_leds", mt7629_ephy_leds), 3138c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_led0", mt7629_ephy_led0), 3148c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_led1", mt7629_ephy_led1), 3158c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_led2", mt7629_ephy_led2), 3168c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_led3", mt7629_ephy_led3), 3178c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("ephy_led4", mt7629_ephy_led4), 3188c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("wf2g_led", mt7629_wf2g_led), 3198c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("wf5g_led", mt7629_wf5g_led), 3208c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("watchdog", mt7629_watchdog), 3218c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_leds_0", mt7629_gphy_leds_0), 3228c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led1_0", mt7629_gphy_led1_0), 3238c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led2_0", mt7629_gphy_led2_0), 3248c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led3_0", mt7629_gphy_led3_0), 3258c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_leds_1", mt7629_gphy_leds_1), 3268c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led1_1", mt7629_gphy_led1_1), 3278c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led2_1", mt7629_gphy_led2_1), 3288c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("gphy_led3_1", mt7629_gphy_led3_1), 3298c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("i2c_0", mt7629_i2c_0), 3308c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("i2c_1", mt7629_i2c_1), 3318c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("spi_0", mt7629_spi_0), 3328c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("spi_1", mt7629_spi_1), 3338c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("spi_wp", mt7629_spi_wp), 3348c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("spi_hold", mt7629_spi_hold), 3358c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart1_0_txd_rxd", mt7629_uart1_0_txd_rxd), 3368c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart1_1_txd_rxd", mt7629_uart1_1_txd_rxd), 3378c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart2_0_txd_rxd", mt7629_uart2_0_txd_rxd), 3388c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart2_1_txd_rxd", mt7629_uart2_1_txd_rxd), 3398c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart1_0_cts_rts", mt7629_uart1_0_cts_rts), 3408c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart1_1_cts_rts", mt7629_uart1_1_cts_rts), 3418c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart2_0_cts_rts", mt7629_uart2_0_cts_rts), 3428c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart2_1_cts_rts", mt7629_uart2_1_cts_rts), 3438c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("uart0_txd_rxd", mt7629_uart0_txd_rxd), 3448c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("mdc_mdio", mt7629_mdc_mdio), 3458c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("pcie_pereset", mt7629_pcie_pereset), 3468c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("pcie_wake", mt7629_pcie_wake), 3478c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("pcie_clkreq", mt7629_pcie_clkreq), 3488c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("pwm_0", mt7629_pwm_0), 3498c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("pwm_1", mt7629_pwm_1), 3508c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("wf0_5g", mt7629_wf0_5g), 3518c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("wf0_2g", mt7629_wf0_2g), 3528c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("snfi", mt7629_snfi), 3538c2ecf20Sopenharmony_ci PINCTRL_PIN_GROUP("spi_nor", mt7629_snor), 3548c2ecf20Sopenharmony_ci}; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci/* Joint those groups owning the same capability in user point of view which 3578c2ecf20Sopenharmony_ci * allows that people tend to use through the device tree. 3588c2ecf20Sopenharmony_ci */ 3598c2ecf20Sopenharmony_cistatic const char *mt7629_ethernet_groups[] = { "mdc_mdio", }; 3608c2ecf20Sopenharmony_cistatic const char *mt7629_i2c_groups[] = { "i2c_0", "i2c_1", }; 3618c2ecf20Sopenharmony_cistatic const char *mt7629_led_groups[] = { "ephy_leds", "ephy_led0", 3628c2ecf20Sopenharmony_ci "ephy_led1", "ephy_led2", 3638c2ecf20Sopenharmony_ci "ephy_led3", "ephy_led4", 3648c2ecf20Sopenharmony_ci "wf2g_led", "wf5g_led", 3658c2ecf20Sopenharmony_ci "gphy_leds_0", "gphy_led1_0", 3668c2ecf20Sopenharmony_ci "gphy_led2_0", "gphy_led3_0", 3678c2ecf20Sopenharmony_ci "gphy_leds_1", "gphy_led1_1", 3688c2ecf20Sopenharmony_ci "gphy_led2_1", "gphy_led3_1",}; 3698c2ecf20Sopenharmony_cistatic const char *mt7629_pcie_groups[] = { "pcie_pereset", "pcie_wake", 3708c2ecf20Sopenharmony_ci "pcie_clkreq", }; 3718c2ecf20Sopenharmony_cistatic const char *mt7629_pwm_groups[] = { "pwm_0", "pwm_1", }; 3728c2ecf20Sopenharmony_cistatic const char *mt7629_spi_groups[] = { "spi_0", "spi_1", "spi_wp", 3738c2ecf20Sopenharmony_ci "spi_hold", }; 3748c2ecf20Sopenharmony_cistatic const char *mt7629_uart_groups[] = { "uart1_0_txd_rxd", 3758c2ecf20Sopenharmony_ci "uart1_1_txd_rxd", 3768c2ecf20Sopenharmony_ci "uart2_0_txd_rxd", 3778c2ecf20Sopenharmony_ci "uart2_1_txd_rxd", 3788c2ecf20Sopenharmony_ci "uart1_0_cts_rts", 3798c2ecf20Sopenharmony_ci "uart1_1_cts_rts", 3808c2ecf20Sopenharmony_ci "uart2_0_cts_rts", 3818c2ecf20Sopenharmony_ci "uart2_1_cts_rts", 3828c2ecf20Sopenharmony_ci "uart0_txd_rxd", }; 3838c2ecf20Sopenharmony_cistatic const char *mt7629_wdt_groups[] = { "watchdog", }; 3848c2ecf20Sopenharmony_cistatic const char *mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", }; 3858c2ecf20Sopenharmony_cistatic const char *mt7629_flash_groups[] = { "snfi", "spi_nor" }; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_cistatic const struct function_desc mt7629_functions[] = { 3888c2ecf20Sopenharmony_ci {"eth", mt7629_ethernet_groups, ARRAY_SIZE(mt7629_ethernet_groups)}, 3898c2ecf20Sopenharmony_ci {"i2c", mt7629_i2c_groups, ARRAY_SIZE(mt7629_i2c_groups)}, 3908c2ecf20Sopenharmony_ci {"led", mt7629_led_groups, ARRAY_SIZE(mt7629_led_groups)}, 3918c2ecf20Sopenharmony_ci {"pcie", mt7629_pcie_groups, ARRAY_SIZE(mt7629_pcie_groups)}, 3928c2ecf20Sopenharmony_ci {"pwm", mt7629_pwm_groups, ARRAY_SIZE(mt7629_pwm_groups)}, 3938c2ecf20Sopenharmony_ci {"spi", mt7629_spi_groups, ARRAY_SIZE(mt7629_spi_groups)}, 3948c2ecf20Sopenharmony_ci {"uart", mt7629_uart_groups, ARRAY_SIZE(mt7629_uart_groups)}, 3958c2ecf20Sopenharmony_ci {"watchdog", mt7629_wdt_groups, ARRAY_SIZE(mt7629_wdt_groups)}, 3968c2ecf20Sopenharmony_ci {"wifi", mt7629_wifi_groups, ARRAY_SIZE(mt7629_wifi_groups)}, 3978c2ecf20Sopenharmony_ci {"flash", mt7629_flash_groups, ARRAY_SIZE(mt7629_flash_groups)}, 3988c2ecf20Sopenharmony_ci}; 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_cistatic const struct mtk_eint_hw mt7629_eint_hw = { 4018c2ecf20Sopenharmony_ci .port_mask = 7, 4028c2ecf20Sopenharmony_ci .ports = 7, 4038c2ecf20Sopenharmony_ci .ap_num = ARRAY_SIZE(mt7629_pins), 4048c2ecf20Sopenharmony_ci .db_cnt = 16, 4058c2ecf20Sopenharmony_ci}; 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_cistatic struct mtk_pin_soc mt7629_data = { 4088c2ecf20Sopenharmony_ci .reg_cal = mt7629_reg_cals, 4098c2ecf20Sopenharmony_ci .pins = mt7629_pins, 4108c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(mt7629_pins), 4118c2ecf20Sopenharmony_ci .grps = mt7629_groups, 4128c2ecf20Sopenharmony_ci .ngrps = ARRAY_SIZE(mt7629_groups), 4138c2ecf20Sopenharmony_ci .funcs = mt7629_functions, 4148c2ecf20Sopenharmony_ci .nfuncs = ARRAY_SIZE(mt7629_functions), 4158c2ecf20Sopenharmony_ci .eint_hw = &mt7629_eint_hw, 4168c2ecf20Sopenharmony_ci .gpio_m = 0, 4178c2ecf20Sopenharmony_ci .ies_present = true, 4188c2ecf20Sopenharmony_ci .base_names = mtk_default_register_base_names, 4198c2ecf20Sopenharmony_ci .nbase_names = ARRAY_SIZE(mtk_default_register_base_names), 4208c2ecf20Sopenharmony_ci .bias_disable_set = mtk_pinconf_bias_disable_set_rev1, 4218c2ecf20Sopenharmony_ci .bias_disable_get = mtk_pinconf_bias_disable_get_rev1, 4228c2ecf20Sopenharmony_ci .bias_set = mtk_pinconf_bias_set_rev1, 4238c2ecf20Sopenharmony_ci .bias_get = mtk_pinconf_bias_get_rev1, 4248c2ecf20Sopenharmony_ci .drive_set = mtk_pinconf_drive_set_rev1, 4258c2ecf20Sopenharmony_ci .drive_get = mtk_pinconf_drive_get_rev1, 4268c2ecf20Sopenharmony_ci}; 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_cistatic const struct of_device_id mt7629_pinctrl_of_match[] = { 4298c2ecf20Sopenharmony_ci { .compatible = "mediatek,mt7629-pinctrl", }, 4308c2ecf20Sopenharmony_ci {} 4318c2ecf20Sopenharmony_ci}; 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistatic int mt7629_pinctrl_probe(struct platform_device *pdev) 4348c2ecf20Sopenharmony_ci{ 4358c2ecf20Sopenharmony_ci return mtk_moore_pinctrl_probe(pdev, &mt7629_data); 4368c2ecf20Sopenharmony_ci} 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_cistatic struct platform_driver mt7629_pinctrl_driver = { 4398c2ecf20Sopenharmony_ci .driver = { 4408c2ecf20Sopenharmony_ci .name = "mt7629-pinctrl", 4418c2ecf20Sopenharmony_ci .of_match_table = mt7629_pinctrl_of_match, 4428c2ecf20Sopenharmony_ci }, 4438c2ecf20Sopenharmony_ci .probe = mt7629_pinctrl_probe, 4448c2ecf20Sopenharmony_ci}; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_cistatic int __init mt7629_pinctrl_init(void) 4478c2ecf20Sopenharmony_ci{ 4488c2ecf20Sopenharmony_ci return platform_driver_register(&mt7629_pinctrl_driver); 4498c2ecf20Sopenharmony_ci} 4508c2ecf20Sopenharmony_ciarch_initcall(mt7629_pinctrl_init); 451