pinctrl-mt7629.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2018 MediaTek Inc.
  4. * Author: Ryder Lee <ryder.lee@mediatek.com>
  5. */
  6. #include <dm.h>
  7. #include "pinctrl-mtk-common.h"
  8. #define PIN_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
  9. PIN_FIELD_CALC(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, \
  10. _x_bits, 32, false)
  11. #define MT7629_PIN(_number, _name) MTK_PIN(_number, _name, DRV_GRP1)
  12. static const struct mtk_pin_field_calc mt7629_pin_mode_range[] = {
  13. PIN_FIELD(0, 78, 0x300, 0x10, 0, 4),
  14. };
  15. static const struct mtk_pin_field_calc mt7629_pin_dir_range[] = {
  16. PIN_FIELD(0, 78, 0x0, 0x10, 0, 1),
  17. };
  18. static const struct mtk_pin_field_calc mt7629_pin_di_range[] = {
  19. PIN_FIELD(0, 78, 0x200, 0x10, 0, 1),
  20. };
  21. static const struct mtk_pin_field_calc mt7629_pin_do_range[] = {
  22. PIN_FIELD(0, 78, 0x100, 0x10, 0, 1),
  23. };
  24. static const struct mtk_pin_field_calc mt7629_pin_ies_range[] = {
  25. PIN_FIELD(0, 10, 0x1000, 0x10, 0, 1),
  26. PIN_FIELD(11, 18, 0x2000, 0x10, 0, 1),
  27. PIN_FIELD(19, 32, 0x3000, 0x10, 0, 1),
  28. PIN_FIELD(33, 48, 0x4000, 0x10, 0, 1),
  29. PIN_FIELD(49, 50, 0x5000, 0x10, 0, 1),
  30. PIN_FIELD(51, 69, 0x6000, 0x10, 0, 1),
  31. PIN_FIELD(70, 78, 0x7000, 0x10, 0, 1),
  32. };
  33. static const struct mtk_pin_field_calc mt7629_pin_smt_range[] = {
  34. PIN_FIELD(0, 10, 0x1100, 0x10, 0, 1),
  35. PIN_FIELD(11, 18, 0x2100, 0x10, 0, 1),
  36. PIN_FIELD(19, 32, 0x3100, 0x10, 0, 1),
  37. PIN_FIELD(33, 48, 0x4100, 0x10, 0, 1),
  38. PIN_FIELD(49, 50, 0x5100, 0x10, 0, 1),
  39. PIN_FIELD(51, 69, 0x6100, 0x10, 0, 1),
  40. PIN_FIELD(70, 78, 0x7100, 0x10, 0, 1),
  41. };
  42. static const struct mtk_pin_field_calc mt7629_pin_pullen_range[] = {
  43. PIN_FIELD(0, 10, 0x1400, 0x10, 0, 1),
  44. PIN_FIELD(11, 18, 0x2400, 0x10, 0, 1),
  45. PIN_FIELD(19, 32, 0x3400, 0x10, 0, 1),
  46. PIN_FIELD(33, 48, 0x4400, 0x10, 0, 1),
  47. PIN_FIELD(49, 50, 0x5400, 0x10, 0, 1),
  48. PIN_FIELD(51, 69, 0x6400, 0x10, 0, 1),
  49. PIN_FIELD(70, 78, 0x7400, 0x10, 0, 1),
  50. };
  51. static const struct mtk_pin_field_calc mt7629_pin_pullsel_range[] = {
  52. PIN_FIELD(0, 10, 0x1500, 0x10, 0, 1),
  53. PIN_FIELD(11, 18, 0x2500, 0x10, 0, 1),
  54. PIN_FIELD(19, 32, 0x3500, 0x10, 0, 1),
  55. PIN_FIELD(33, 48, 0x4500, 0x10, 0, 1),
  56. PIN_FIELD(49, 50, 0x5500, 0x10, 0, 1),
  57. PIN_FIELD(51, 69, 0x6500, 0x10, 0, 1),
  58. PIN_FIELD(70, 78, 0x7500, 0x10, 0, 1),
  59. };
  60. static const struct mtk_pin_field_calc mt7629_pin_drv_range[] = {
  61. PIN_FIELD(0, 10, 0x1600, 0x10, 0, 4),
  62. PIN_FIELD(11, 18, 0x2600, 0x10, 0, 4),
  63. PIN_FIELD(19, 32, 0x3600, 0x10, 0, 4),
  64. PIN_FIELD(33, 48, 0x4600, 0x10, 0, 4),
  65. PIN_FIELD(49, 50, 0x5600, 0x10, 0, 4),
  66. PIN_FIELD(51, 69, 0x6600, 0x10, 0, 4),
  67. PIN_FIELD(70, 78, 0x7600, 0x10, 0, 4),
  68. };
  69. static const struct mtk_pin_reg_calc mt7629_reg_cals[] = {
  70. [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7629_pin_mode_range),
  71. [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7629_pin_dir_range),
  72. [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7629_pin_di_range),
  73. [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7629_pin_do_range),
  74. [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7629_pin_ies_range),
  75. [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7629_pin_smt_range),
  76. [PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt7629_pin_pullsel_range),
  77. [PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt7629_pin_pullen_range),
  78. [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7629_pin_drv_range),
  79. };
  80. static const struct mtk_pin_desc mt7629_pins[] = {
  81. MT7629_PIN(0, "TOP_5G_CLK"),
  82. MT7629_PIN(1, "TOP_5G_DATA"),
  83. MT7629_PIN(2, "WF0_5G_HB0"),
  84. MT7629_PIN(3, "WF0_5G_HB1"),
  85. MT7629_PIN(4, "WF0_5G_HB2"),
  86. MT7629_PIN(5, "WF0_5G_HB3"),
  87. MT7629_PIN(6, "WF0_5G_HB4"),
  88. MT7629_PIN(7, "WF0_5G_HB5"),
  89. MT7629_PIN(8, "WF0_5G_HB6"),
  90. MT7629_PIN(9, "XO_REQ"),
  91. MT7629_PIN(10, "TOP_RST_N"),
  92. MT7629_PIN(11, "SYS_WATCHDOG"),
  93. MT7629_PIN(12, "EPHY_LED0_N_JTDO"),
  94. MT7629_PIN(13, "EPHY_LED1_N_JTDI"),
  95. MT7629_PIN(14, "EPHY_LED2_N_JTMS"),
  96. MT7629_PIN(15, "EPHY_LED3_N_JTCLK"),
  97. MT7629_PIN(16, "EPHY_LED4_N_JTRST_N"),
  98. MT7629_PIN(17, "WF2G_LED_N"),
  99. MT7629_PIN(18, "WF5G_LED_N"),
  100. MT7629_PIN(19, "I2C_SDA"),
  101. MT7629_PIN(20, "I2C_SCL"),
  102. MT7629_PIN(21, "GPIO_9"),
  103. MT7629_PIN(22, "GPIO_10"),
  104. MT7629_PIN(23, "GPIO_11"),
  105. MT7629_PIN(24, "GPIO_12"),
  106. MT7629_PIN(25, "UART1_TXD"),
  107. MT7629_PIN(26, "UART1_RXD"),
  108. MT7629_PIN(27, "UART1_CTS"),
  109. MT7629_PIN(28, "UART1_RTS"),
  110. MT7629_PIN(29, "UART2_TXD"),
  111. MT7629_PIN(30, "UART2_RXD"),
  112. MT7629_PIN(31, "UART2_CTS"),
  113. MT7629_PIN(32, "UART2_RTS"),
  114. MT7629_PIN(33, "MDI_TP_P1"),
  115. MT7629_PIN(34, "MDI_TN_P1"),
  116. MT7629_PIN(35, "MDI_RP_P1"),
  117. MT7629_PIN(36, "MDI_RN_P1"),
  118. MT7629_PIN(37, "MDI_RP_P2"),
  119. MT7629_PIN(38, "MDI_RN_P2"),
  120. MT7629_PIN(39, "MDI_TP_P2"),
  121. MT7629_PIN(40, "MDI_TN_P2"),
  122. MT7629_PIN(41, "MDI_TP_P3"),
  123. MT7629_PIN(42, "MDI_TN_P3"),
  124. MT7629_PIN(43, "MDI_RP_P3"),
  125. MT7629_PIN(44, "MDI_RN_P3"),
  126. MT7629_PIN(45, "MDI_RP_P4"),
  127. MT7629_PIN(46, "MDI_RN_P4"),
  128. MT7629_PIN(47, "MDI_TP_P4"),
  129. MT7629_PIN(48, "MDI_TN_P4"),
  130. MT7629_PIN(49, "SMI_MDC"),
  131. MT7629_PIN(50, "SMI_MDIO"),
  132. MT7629_PIN(51, "PCIE_PERESET_N"),
  133. MT7629_PIN(52, "PWM_0"),
  134. MT7629_PIN(53, "GPIO_0"),
  135. MT7629_PIN(54, "GPIO_1"),
  136. MT7629_PIN(55, "GPIO_2"),
  137. MT7629_PIN(56, "GPIO_3"),
  138. MT7629_PIN(57, "GPIO_4"),
  139. MT7629_PIN(58, "GPIO_5"),
  140. MT7629_PIN(59, "GPIO_6"),
  141. MT7629_PIN(60, "GPIO_7"),
  142. MT7629_PIN(61, "GPIO_8"),
  143. MT7629_PIN(62, "SPI_CLK"),
  144. MT7629_PIN(63, "SPI_CS"),
  145. MT7629_PIN(64, "SPI_MOSI"),
  146. MT7629_PIN(65, "SPI_MISO"),
  147. MT7629_PIN(66, "SPI_WP"),
  148. MT7629_PIN(67, "SPI_HOLD"),
  149. MT7629_PIN(68, "UART0_TXD"),
  150. MT7629_PIN(69, "UART0_RXD"),
  151. MT7629_PIN(70, "TOP_2G_CLK"),
  152. MT7629_PIN(71, "TOP_2G_DATA"),
  153. MT7629_PIN(72, "WF0_2G_HB0"),
  154. MT7629_PIN(73, "WF0_2G_HB1"),
  155. MT7629_PIN(74, "WF0_2G_HB2"),
  156. MT7629_PIN(75, "WF0_2G_HB3"),
  157. MT7629_PIN(76, "WF0_2G_HB4"),
  158. MT7629_PIN(77, "WF0_2G_HB5"),
  159. MT7629_PIN(78, "WF0_2G_HB6"),
  160. };
  161. /* List all groups consisting of these pins dedicated to the enablement of
  162. * certain hardware block and the corresponding mode for all of the pins.
  163. * The hardware probably has multiple combinations of these pinouts.
  164. */
  165. /* WF 5G */
  166. static const int mt7629_wf0_5g_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, };
  167. static const int mt7629_wf0_5g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
  168. /* LED for EPHY */
  169. static const int mt7629_ephy_leds_pins[] = { 12, 13, 14, 15, 16, 17, 18, };
  170. static const int mt7629_ephy_leds_funcs[] = { 1, 1, 1, 1, 1, 1, 1, };
  171. static const int mt7629_ephy_led0_pins[] = { 12, };
  172. static const int mt7629_ephy_led0_funcs[] = { 1, };
  173. static const int mt7629_ephy_led1_pins[] = { 13, };
  174. static const int mt7629_ephy_led1_funcs[] = { 1, };
  175. static const int mt7629_ephy_led2_pins[] = { 14, };
  176. static const int mt7629_ephy_led2_funcs[] = { 1, };
  177. static const int mt7629_ephy_led3_pins[] = { 15, };
  178. static const int mt7629_ephy_led3_funcs[] = { 1, };
  179. static const int mt7629_ephy_led4_pins[] = { 16, };
  180. static const int mt7629_ephy_led4_funcs[] = { 1, };
  181. static const int mt7629_wf2g_led_pins[] = { 17, };
  182. static const int mt7629_wf2g_led_funcs[] = { 1, };
  183. static const int mt7629_wf5g_led_pins[] = { 18, };
  184. static const int mt7629_wf5g_led_funcs[] = { 1, };
  185. /* LED for EPHY used as JTAG */
  186. static const int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, };
  187. static const int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, };
  188. /* Watchdog */
  189. static const int mt7629_watchdog_pins[] = { 11, };
  190. static const int mt7629_watchdog_funcs[] = { 1, };
  191. /* LED for GPHY */
  192. static const int mt7629_gphy_leds_0_pins[] = { 21, 22, 23, };
  193. static const int mt7629_gphy_leds_0_funcs[] = { 2, 2, 2, };
  194. static const int mt7629_gphy_led1_0_pins[] = { 21, };
  195. static const int mt7629_gphy_led1_0_funcs[] = { 2, };
  196. static const int mt7629_gphy_led2_0_pins[] = { 22, };
  197. static const int mt7629_gphy_led2_0_funcs[] = { 2, };
  198. static const int mt7629_gphy_led3_0_pins[] = { 23, };
  199. static const int mt7629_gphy_led3_0_funcs[] = { 2, };
  200. static const int mt7629_gphy_leds_1_pins[] = { 57, 58, 59, };
  201. static const int mt7629_gphy_leds_1_funcs[] = { 1, 1, 1, };
  202. static const int mt7629_gphy_led1_1_pins[] = { 57, };
  203. static const int mt7629_gphy_led1_1_funcs[] = { 1, };
  204. static const int mt7629_gphy_led2_1_pins[] = { 58, };
  205. static const int mt7629_gphy_led2_1_funcs[] = { 1, };
  206. static const int mt7629_gphy_led3_1_pins[] = { 59, };
  207. static const int mt7629_gphy_led3_1_funcs[] = { 1, };
  208. /* I2C */
  209. static const int mt7629_i2c_0_pins[] = { 19, 20, };
  210. static const int mt7629_i2c_0_funcs[] = { 1, 1, };
  211. static const int mt7629_i2c_1_pins[] = { 53, 54, };
  212. static const int mt7629_i2c_1_funcs[] = { 1, 1, };
  213. /* SPI */
  214. static const int mt7629_spi_0_pins[] = { 21, 22, 23, 24, };
  215. static const int mt7629_spi_0_funcs[] = { 1, 1, 1, 1, };
  216. static const int mt7629_spi_1_pins[] = { 62, 63, 64, 65, };
  217. static const int mt7629_spi_1_funcs[] = { 1, 1, 1, 1, };
  218. static const int mt7629_spi_wp_pins[] = { 66, };
  219. static const int mt7629_spi_wp_funcs[] = { 1, };
  220. static const int mt7629_spi_hold_pins[] = { 67, };
  221. static const int mt7629_spi_hold_funcs[] = { 1, };
  222. /* UART */
  223. static const int mt7629_uart1_0_txd_rxd_pins[] = { 25, 26, };
  224. static const int mt7629_uart1_0_txd_rxd_funcs[] = { 1, 1, };
  225. static const int mt7629_uart1_1_txd_rxd_pins[] = { 53, 54, };
  226. static const int mt7629_uart1_1_txd_rxd_funcs[] = { 2, 2, };
  227. static const int mt7629_uart2_0_txd_rxd_pins[] = { 29, 30, };
  228. static const int mt7629_uart2_0_txd_rxd_funcs[] = { 1, 1, };
  229. static const int mt7629_uart2_1_txd_rxd_pins[] = { 57, 58, };
  230. static const int mt7629_uart2_1_txd_rxd_funcs[] = { 2, 2, };
  231. static const int mt7629_uart1_0_cts_rts_pins[] = { 27, 28, };
  232. static const int mt7629_uart1_0_cts_rts_funcs[] = { 1, 1, };
  233. static const int mt7629_uart1_1_cts_rts_pins[] = { 55, 56, };
  234. static const int mt7629_uart1_1_cts_rts_funcs[] = { 2, 2, };
  235. static const int mt7629_uart2_0_cts_rts_pins[] = { 31, 32, };
  236. static const int mt7629_uart2_0_cts_rts_funcs[] = { 1, 1, };
  237. static const int mt7629_uart2_1_cts_rts_pins[] = { 59, 60, };
  238. static const int mt7629_uart2_1_cts_rts_funcs[] = { 2, 2, };
  239. static const int mt7629_uart0_txd_rxd_pins[] = { 68, 69, };
  240. static const int mt7629_uart0_txd_rxd_funcs[] = { 1, 1, };
  241. /* MDC/MDIO */
  242. static const int mt7629_mdc_mdio_pins[] = { 49, 50, };
  243. static const int mt7629_mdc_mdio_funcs[] = { 1, 1, };
  244. /* PCIE */
  245. static const int mt7629_pcie_pereset_pins[] = { 51, };
  246. static const int mt7629_pcie_pereset_funcs[] = { 1, };
  247. static const int mt7629_pcie_wake_pins[] = { 55, };
  248. static const int mt7629_pcie_wake_funcs[] = { 1, };
  249. static const int mt7629_pcie_clkreq_pins[] = { 56, };
  250. static const int mt7629_pcie_clkreq_funcs[] = { 1, };
  251. /* PWM */
  252. static const int mt7629_pwm_0_pins[] = { 52, };
  253. static const int mt7629_pwm_0_funcs[] = { 1, };
  254. static const int mt7629_pwm_1_pins[] = { 61, };
  255. static const int mt7629_pwm_1_funcs[] = { 2, };
  256. /* WF 2G */
  257. static const int mt7629_wf0_2g_pins[] = { 70, 71, 72, 73, 74, 75, 76, 77, 78, };
  258. static const int mt7629_wf0_2g_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, };
  259. /* SNFI */
  260. static const int mt7629_snfi_pins[] = { 62, 63, 64, 65, 66, 67 };
  261. static const int mt7629_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 };
  262. /* SPI NOR */
  263. static const int mt7629_snor_pins[] = { 62, 63, 64, 65, 66, 67 };
  264. static const int mt7629_snor_funcs[] = { 1, 1, 1, 1, 1, 1 };
  265. static const struct mtk_group_desc mt7629_groups[] = {
  266. PINCTRL_PIN_GROUP("wf0_5g", mt7629_wf0_5g),
  267. PINCTRL_PIN_GROUP("ephy_leds", mt7629_ephy_leds),
  268. PINCTRL_PIN_GROUP("ephy_led0", mt7629_ephy_led0),
  269. PINCTRL_PIN_GROUP("ephy_led1", mt7629_ephy_led1),
  270. PINCTRL_PIN_GROUP("ephy_led2", mt7629_ephy_led2),
  271. PINCTRL_PIN_GROUP("ephy_led3", mt7629_ephy_led3),
  272. PINCTRL_PIN_GROUP("ephy_led4", mt7629_ephy_led4),
  273. PINCTRL_PIN_GROUP("ephy_leds_jtag", mt7629_ephy_leds_jtag),
  274. PINCTRL_PIN_GROUP("wf2g_led", mt7629_wf2g_led),
  275. PINCTRL_PIN_GROUP("wf5g_led", mt7629_wf5g_led),
  276. PINCTRL_PIN_GROUP("watchdog", mt7629_watchdog),
  277. PINCTRL_PIN_GROUP("gphy_leds_0", mt7629_gphy_leds_0),
  278. PINCTRL_PIN_GROUP("gphy_led1_0", mt7629_gphy_led1_0),
  279. PINCTRL_PIN_GROUP("gphy_led2_0", mt7629_gphy_led2_0),
  280. PINCTRL_PIN_GROUP("gphy_led3_0", mt7629_gphy_led3_0),
  281. PINCTRL_PIN_GROUP("gphy_leds_1", mt7629_gphy_leds_1),
  282. PINCTRL_PIN_GROUP("gphy_led1_1", mt7629_gphy_led1_1),
  283. PINCTRL_PIN_GROUP("gphy_led2_1", mt7629_gphy_led2_1),
  284. PINCTRL_PIN_GROUP("gphy_led3_1", mt7629_gphy_led3_1),
  285. PINCTRL_PIN_GROUP("i2c_0", mt7629_i2c_0),
  286. PINCTRL_PIN_GROUP("i2c_1", mt7629_i2c_1),
  287. PINCTRL_PIN_GROUP("spi_0", mt7629_spi_0),
  288. PINCTRL_PIN_GROUP("spi_1", mt7629_spi_1),
  289. PINCTRL_PIN_GROUP("spi_wp", mt7629_spi_wp),
  290. PINCTRL_PIN_GROUP("spi_hold", mt7629_spi_hold),
  291. PINCTRL_PIN_GROUP("uart1_0_txd_rxd", mt7629_uart1_0_txd_rxd),
  292. PINCTRL_PIN_GROUP("uart1_1_txd_rxd", mt7629_uart1_1_txd_rxd),
  293. PINCTRL_PIN_GROUP("uart2_0_txd_rxd", mt7629_uart2_0_txd_rxd),
  294. PINCTRL_PIN_GROUP("uart2_1_txd_rxd", mt7629_uart2_1_txd_rxd),
  295. PINCTRL_PIN_GROUP("uart1_0_cts_rts", mt7629_uart1_0_cts_rts),
  296. PINCTRL_PIN_GROUP("uart1_1_cts_rts", mt7629_uart1_1_cts_rts),
  297. PINCTRL_PIN_GROUP("uart2_0_cts_rts", mt7629_uart2_0_cts_rts),
  298. PINCTRL_PIN_GROUP("uart2_1_cts_rts", mt7629_uart2_1_cts_rts),
  299. PINCTRL_PIN_GROUP("uart0_txd_rxd", mt7629_uart0_txd_rxd),
  300. PINCTRL_PIN_GROUP("mdc_mdio", mt7629_mdc_mdio),
  301. PINCTRL_PIN_GROUP("pcie_pereset", mt7629_pcie_pereset),
  302. PINCTRL_PIN_GROUP("pcie_wake", mt7629_pcie_wake),
  303. PINCTRL_PIN_GROUP("pcie_clkreq", mt7629_pcie_clkreq),
  304. PINCTRL_PIN_GROUP("pwm_0", mt7629_pwm_0),
  305. PINCTRL_PIN_GROUP("pwm_1", mt7629_pwm_1),
  306. PINCTRL_PIN_GROUP("wf0_2g", mt7629_wf0_2g),
  307. PINCTRL_PIN_GROUP("snfi", mt7629_snfi),
  308. PINCTRL_PIN_GROUP("spi_nor", mt7629_snor),
  309. };
  310. /* Joint those groups owning the same capability in user point of view which
  311. * allows that people tend to use through the device tree.
  312. */
  313. static const char *const mt7629_ethernet_groups[] = { "mdc_mdio", };
  314. static const char *const mt7629_i2c_groups[] = { "i2c_0", "i2c_1", };
  315. static const char *const mt7629_led_groups[] = { "ephy_leds", "ephy_led0",
  316. "ephy_led1", "ephy_led2",
  317. "ephy_led3", "ephy_led4",
  318. "wf2g_led", "wf5g_led",
  319. "gphy_leds_0", "gphy_led1_0",
  320. "gphy_led2_0", "gphy_led3_0",
  321. "gphy_leds_1", "gphy_led1_1",
  322. "gphy_led2_1", "gphy_led3_1",};
  323. static const char *const mt7629_pcie_groups[] = { "pcie_pereset", "pcie_wake",
  324. "pcie_clkreq", };
  325. static const char *const mt7629_pwm_groups[] = { "pwm_0", "pwm_1", };
  326. static const char *const mt7629_spi_groups[] = { "spi_0", "spi_1", "spi_wp",
  327. "spi_hold", };
  328. static const char *const mt7629_uart_groups[] = { "uart1_0_txd_rxd",
  329. "uart1_1_txd_rxd",
  330. "uart2_0_txd_rxd",
  331. "uart2_1_txd_rxd",
  332. "uart1_0_cts_rts",
  333. "uart1_1_cts_rts",
  334. "uart2_0_cts_rts",
  335. "uart2_1_cts_rts",
  336. "uart0_txd_rxd", };
  337. static const char *const mt7629_wdt_groups[] = { "watchdog", };
  338. static const char *const mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", };
  339. static const char *const mt7629_flash_groups[] = { "snfi", "spi_nor" };
  340. static const char *const mt7629_jtag_groups[] = { "ephy_leds_jtag" };
  341. static const struct mtk_function_desc mt7629_functions[] = {
  342. {"eth", mt7629_ethernet_groups, ARRAY_SIZE(mt7629_ethernet_groups)},
  343. {"i2c", mt7629_i2c_groups, ARRAY_SIZE(mt7629_i2c_groups)},
  344. {"led", mt7629_led_groups, ARRAY_SIZE(mt7629_led_groups)},
  345. {"pcie", mt7629_pcie_groups, ARRAY_SIZE(mt7629_pcie_groups)},
  346. {"pwm", mt7629_pwm_groups, ARRAY_SIZE(mt7629_pwm_groups)},
  347. {"spi", mt7629_spi_groups, ARRAY_SIZE(mt7629_spi_groups)},
  348. {"uart", mt7629_uart_groups, ARRAY_SIZE(mt7629_uart_groups)},
  349. {"watchdog", mt7629_wdt_groups, ARRAY_SIZE(mt7629_wdt_groups)},
  350. {"wifi", mt7629_wifi_groups, ARRAY_SIZE(mt7629_wifi_groups)},
  351. {"flash", mt7629_flash_groups, ARRAY_SIZE(mt7629_flash_groups)},
  352. {"jtag", mt7629_jtag_groups, ARRAY_SIZE(mt7629_jtag_groups)},
  353. };
  354. static const struct mtk_pinctrl_soc mt7629_data = {
  355. .name = "mt7629_pinctrl",
  356. .reg_cal = mt7629_reg_cals,
  357. .pins = mt7629_pins,
  358. .npins = ARRAY_SIZE(mt7629_pins),
  359. .grps = mt7629_groups,
  360. .ngrps = ARRAY_SIZE(mt7629_groups),
  361. .funcs = mt7629_functions,
  362. .nfuncs = ARRAY_SIZE(mt7629_functions),
  363. .gpio_mode = 0,
  364. .rev = MTK_PINCTRL_V1,
  365. };
  366. static int mtk_pinctrl_mt7629_probe(struct udevice *dev)
  367. {
  368. return mtk_pinctrl_common_probe(dev, &mt7629_data);
  369. }
  370. static const struct udevice_id mt7629_pctrl_match[] = {
  371. { .compatible = "mediatek,mt7629-pinctrl" },
  372. { /* sentinel */ }
  373. };
  374. U_BOOT_DRIVER(mt7629_pinctrl) = {
  375. .name = "mt7629_pinctrl",
  376. .id = UCLASS_PINCTRL,
  377. .of_match = mt7629_pctrl_match,
  378. .ops = &mtk_pinctrl_ops,
  379. .probe = mtk_pinctrl_mt7629_probe,
  380. .priv_auto = sizeof(struct mtk_pinctrl_priv),
  381. };