e6d0ec35fa7596196c7e24fba29af770d2b2ad49
[openwrt/staging/pepe2k.git] /
1 From 24e660265f11dad63687c5529cf732538946a197 Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Fri, 24 Jan 2025 11:39:02 +0800
4 Subject: [PATCH] pinctrl: mediatek: update mt7981 pinctrl driver based on
5 upstream kernel
6
7 Update mt7981 pinctrl driver based on upstream kernel
8
9 Signed-off-by: Sam Shih <sam.shih@mediatek.com>
10 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
11 ---
12 drivers/pinctrl/mediatek/pinctrl-mt7981.c | 51 ++++++++++++++++++++---
13 1 file changed, 45 insertions(+), 6 deletions(-)
14
15 --- a/drivers/pinctrl/mediatek/pinctrl-mt7981.c
16 +++ b/drivers/pinctrl/mediatek/pinctrl-mt7981.c
17 @@ -569,6 +569,11 @@ static const struct mtk_pin_desc mt7981_
18 MT7981_TYPE1_PIN(56, "WF_HB10"),
19 };
20
21 +/* List all groups consisting of these pins dedicated to the enablement of
22 + * certain hardware block and the corresponding mode for all of the pins.
23 + * The hardware probably has multiple combinations of these pinouts.
24 + */
25 +
26 /* WA_AICE */
27 static const int mt7981_wa_aice1_pins[] = { 0, 1, };
28 static const int mt7981_wa_aice1_funcs[] = { 2, 2, };
29 @@ -632,6 +637,9 @@ static const int mt7981_wo0_jtag_1_funcs
30 static const int mt7981_uart2_0_pins[] = { 4, 5, 6, 7, };
31 static const int mt7981_uart2_0_funcs[] = { 3, 3, 3, 3, };
32
33 +static const int mt7981_uart2_0_tx_rx_pins[] = { 4, 5, };
34 +static const int mt7981_uart2_0_tx_rx_funcs[] = { 3, 3, };
35 +
36 /* GBE_LED0 */
37 static const int mt7981_gbe_led0_pins[] = { 8, };
38 static const int mt7981_gbe_led0_funcs[] = { 3, };
39 @@ -718,6 +726,17 @@ static const int mt7981_drv_vbus_pins[]
40 static const int mt7981_drv_vbus_funcs[] = { 1, };
41
42 /* EMMC */
43 +static const int mt7981_emmc_reset_pins[] = { 15, };
44 +static const int mt7981_emmc_reset_funcs[] = { 2, };
45 +
46 +static const int mt7981_emmc_4_pins[] = { 16, 17, 18, 19, 24, 25, };
47 +static const int mt7981_emmc_4_funcs[] = { 2, 2, 2, 2, 2, 2, };
48 +
49 +static const int mt7981_emmc_8_pins[] = {
50 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, };
51 +static const int mt7981_emmc_8_funcs[] = {
52 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, };
53 +
54 static const int mt7981_emmc_45_pins[] = {
55 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, };
56 static const int mt7981_emmc_45_funcs[] = {
57 @@ -754,6 +773,12 @@ static const int mt7981_uart1_0_funcs[]
58 static const int mt7981_uart1_1_pins[] = { 26, 27, 28, 29, };
59 static const int mt7981_uart1_1_funcs[] = { 2, 2, 2, 2, };
60
61 +static const int mt7981_uart1_2_pins[] = { 9, 10, };
62 +static const int mt7981_uart1_2_funcs[] = { 2, 2, };
63 +
64 +static const int mt7981_uart1_3_pins[] = { 26, 27, };
65 +static const int mt7981_uart1_3_funcs[] = { 2, 2, };
66 +
67 /* UART2 */
68 static const int mt7981_uart2_1_pins[] = { 22, 23, 24, 25, };
69 static const int mt7981_uart2_1_funcs[] = { 3, 3, 3, 3, };
70 @@ -832,6 +857,8 @@ static const struct mtk_group_desc mt798
71 PINCTRL_PIN_GROUP("wo0_jtag_0", mt7981_wo0_jtag_0),
72 /* @GPIO(4,7) WM_JTAG(3) */
73 PINCTRL_PIN_GROUP("uart2_0", mt7981_uart2_0),
74 + /* @GPIO(4,5) WM_JTAG(4) */
75 + PINCTRL_PIN_GROUP("uart2_0_tx_rx", mt7981_uart2_0_tx_rx),
76 /* @GPIO(8) GBE_LED0(3) */
77 PINCTRL_PIN_GROUP("gbe_led0", mt7981_gbe_led0),
78 /* @GPIO(4,6) PTA_EXT(4) */
79 @@ -844,7 +871,7 @@ static const struct mtk_group_desc mt798
80 PINCTRL_PIN_GROUP("spi1_0", mt7981_spi1_0),
81 /* @GPIO(6,7) I2C(5) */
82 PINCTRL_PIN_GROUP("i2c0_0", mt7981_i2c0_0),
83 - /* @GPIO(8): DFD_NTRST(6) */
84 + /* @GPIO(0,1,4,5): DFD_NTRST(6) */
85 PINCTRL_PIN_GROUP("dfd_ntrst", mt7981_dfd_ntrst),
86 /* @GPIO(9,10): WM_AICE(2) */
87 PINCTRL_PIN_GROUP("wm_aice1", mt7981_wm_aice1),
88 @@ -870,6 +897,12 @@ static const struct mtk_group_desc mt798
89 PINCTRL_PIN_GROUP("udi", mt7981_udi),
90 /* @GPIO(14) DRV_VBUS(1) */
91 PINCTRL_PIN_GROUP("drv_vbus", mt7981_drv_vbus),
92 + /* @GPIO(15): EMMC_RSTB(2) */
93 + PINCTRL_PIN_GROUP("emmc_reset", mt7981_emmc_reset),
94 + /* @GPIO(16,17,18,19,24,25): EMMC_DATx, EMMC_CLK, EMMC_CMD */
95 + PINCTRL_PIN_GROUP("emmc_4", mt7981_emmc_4),
96 + /* @GPIO(16,17,18,19,20,21,22,23,24,25): EMMC_DATx, EMMC_CLK, EMMC_CMD */
97 + PINCTRL_PIN_GROUP("emmc_8", mt7981_emmc_8),
98 /* @GPIO(15,25): EMMC(2) */
99 PINCTRL_PIN_GROUP("emmc_45", mt7981_emmc_45),
100 /* @GPIO(16,21): SNFI(3) */
101 @@ -888,8 +921,12 @@ static const struct mtk_group_desc mt798
102 PINCTRL_PIN_GROUP("uart1_0", mt7981_uart1_0),
103 /* @GPIO(26,29): UART1(2) */
104 PINCTRL_PIN_GROUP("uart1_1", mt7981_uart1_1),
105 + /* @GPIO(9,10): UART1(2) */
106 + PINCTRL_PIN_GROUP("uart1_2", mt7981_uart1_2),
107 + /* @GPIO(26,27): UART1(2) */
108 + PINCTRL_PIN_GROUP("uart1_3", mt7981_uart1_3),
109 /* @GPIO(22,25): UART2(3) */
110 - PINCTRL_PIN_GROUP("uart2_0", mt7981_uart2_1),
111 + PINCTRL_PIN_GROUP("uart2_1", mt7981_uart2_1),
112 /* @GPIO(22,24) PTA_EXT(4) */
113 PINCTRL_PIN_GROUP("pta_ext_1", mt7981_pta_ext_1),
114 /* @GPIO(20,21): WM_UART(4) */
115 @@ -964,9 +1001,10 @@ static const struct mtk_io_type_desc mt7
116 */
117 static const char *const mt7981_wa_aice_groups[] = { "wa_aice1", "wa_aice2",
118 "wm_aice1_1", "wa_aice3", "wm_aice1_2", };
119 -static const char *const mt7981_uart_groups[] = { "wm_uart_0", "uart2_0",
120 - "net_wo0_uart_txd_0", "net_wo0_uart_txd_1", "net_wo0_uart_txd_2",
121 - "uart1_0", "uart1_1", "uart2_0", "wm_aurt_1", "wm_aurt_2", "uart0", };
122 +static const char *const mt7981_uart_groups[] = { "net_wo0_uart_txd_0",
123 + "net_wo0_uart_txd_1", "net_wo0_uart_txd_2", "uart0", "uart1_0",
124 + "uart1_1", "uart1_2", "uart1_3", "uart2_0", "uart2_0_tx_rx", "uart2_1",
125 + "wm_uart_0", "wm_aurt_1", "wm_aurt_2", };
126 static const char *const mt7981_dfd_groups[] = { "dfd", "dfd_ntrst", };
127 static const char *const mt7981_wdt_groups[] = { "watchdog", "watchdog1", };
128 static const char *const mt7981_pcie_groups[] = { "pcie_pereset", "pcie_clk",
129 @@ -986,7 +1024,8 @@ static const char *const mt7981_i2c_grou
130 static const char *const mt7981_pcm_groups[] = { "pcm", };
131 static const char *const mt7981_udi_groups[] = { "udi", };
132 static const char *const mt7981_usb_groups[] = { "drv_vbus", };
133 -static const char *const mt7981_flash_groups[] = { "emmc_45", "snfi", };
134 +static const char *const mt7981_flash_groups[] = { "emmc_reset", "emmc_4",
135 + "emmc_8", "emmc_45", "snfi", };
136 static const char *const mt7981_ethernet_groups[] = { "smi_mdc_mdio",
137 "gbe_ext_mdc_mdio", "wf0_mode1", "wf0_mode3", "mt7531_int", };
138 static const char *const mt7981_ant_groups[] = { "ant_sel", };