|
15 | 15 | #include <asm/mipsregs.h>
|
16 | 16 | #include <asm/mach-ralink/ralink_regs.h>
|
17 | 17 | #include <asm/mach-ralink/mt7620.h>
|
18 |
| -#include <asm/mach-ralink/pinmux.h> |
19 | 18 |
|
20 | 19 | #include "common.h"
|
21 | 20 |
|
|
50 | 49 | /* does the board have sdram or ddram */
|
51 | 50 | static int dram_type;
|
52 | 51 |
|
53 |
| -static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 1, 2) }; |
54 |
| -static struct rt2880_pmx_func spi_grp[] = { FUNC("spi", 0, 3, 4) }; |
55 |
| -static struct rt2880_pmx_func uartlite_grp[] = { FUNC("uartlite", 0, 15, 2) }; |
56 |
| -static struct rt2880_pmx_func mdio_grp[] = { |
57 |
| - FUNC("mdio", MT7620_GPIO_MODE_MDIO, 22, 2), |
58 |
| - FUNC("refclk", MT7620_GPIO_MODE_MDIO_REFCLK, 22, 2), |
59 |
| -}; |
60 |
| -static struct rt2880_pmx_func rgmii1_grp[] = { FUNC("rgmii1", 0, 24, 12) }; |
61 |
| -static struct rt2880_pmx_func refclk_grp[] = { FUNC("spi refclk", 0, 37, 3) }; |
62 |
| -static struct rt2880_pmx_func ephy_grp[] = { FUNC("ephy", 0, 40, 5) }; |
63 |
| -static struct rt2880_pmx_func rgmii2_grp[] = { FUNC("rgmii2", 0, 60, 12) }; |
64 |
| -static struct rt2880_pmx_func wled_grp[] = { FUNC("wled", 0, 72, 1) }; |
65 |
| -static struct rt2880_pmx_func pa_grp[] = { FUNC("pa", 0, 18, 4) }; |
66 |
| -static struct rt2880_pmx_func uartf_grp[] = { |
67 |
| - FUNC("uartf", MT7620_GPIO_MODE_UARTF, 7, 8), |
68 |
| - FUNC("pcm uartf", MT7620_GPIO_MODE_PCM_UARTF, 7, 8), |
69 |
| - FUNC("pcm i2s", MT7620_GPIO_MODE_PCM_I2S, 7, 8), |
70 |
| - FUNC("i2s uartf", MT7620_GPIO_MODE_I2S_UARTF, 7, 8), |
71 |
| - FUNC("pcm gpio", MT7620_GPIO_MODE_PCM_GPIO, 11, 4), |
72 |
| - FUNC("gpio uartf", MT7620_GPIO_MODE_GPIO_UARTF, 7, 4), |
73 |
| - FUNC("gpio i2s", MT7620_GPIO_MODE_GPIO_I2S, 7, 4), |
74 |
| -}; |
75 |
| -static struct rt2880_pmx_func wdt_grp[] = { |
76 |
| - FUNC("wdt rst", 0, 17, 1), |
77 |
| - FUNC("wdt refclk", 0, 17, 1), |
78 |
| - }; |
79 |
| -static struct rt2880_pmx_func pcie_rst_grp[] = { |
80 |
| - FUNC("pcie rst", MT7620_GPIO_MODE_PCIE_RST, 36, 1), |
81 |
| - FUNC("pcie refclk", MT7620_GPIO_MODE_PCIE_REF, 36, 1) |
82 |
| -}; |
83 |
| -static struct rt2880_pmx_func nd_sd_grp[] = { |
84 |
| - FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15), |
85 |
| - FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13) |
86 |
| -}; |
87 |
| - |
88 |
| -static struct rt2880_pmx_group mt7620a_pinmux_data[] = { |
89 |
| - GRP("i2c", i2c_grp, 1, MT7620_GPIO_MODE_I2C), |
90 |
| - GRP("uartf", uartf_grp, MT7620_GPIO_MODE_UART0_MASK, |
91 |
| - MT7620_GPIO_MODE_UART0_SHIFT), |
92 |
| - GRP("spi", spi_grp, 1, MT7620_GPIO_MODE_SPI), |
93 |
| - GRP("uartlite", uartlite_grp, 1, MT7620_GPIO_MODE_UART1), |
94 |
| - GRP_G("wdt", wdt_grp, MT7620_GPIO_MODE_WDT_MASK, |
95 |
| - MT7620_GPIO_MODE_WDT_GPIO, MT7620_GPIO_MODE_WDT_SHIFT), |
96 |
| - GRP_G("mdio", mdio_grp, MT7620_GPIO_MODE_MDIO_MASK, |
97 |
| - MT7620_GPIO_MODE_MDIO_GPIO, MT7620_GPIO_MODE_MDIO_SHIFT), |
98 |
| - GRP("rgmii1", rgmii1_grp, 1, MT7620_GPIO_MODE_RGMII1), |
99 |
| - GRP("spi refclk", refclk_grp, 1, MT7620_GPIO_MODE_SPI_REF_CLK), |
100 |
| - GRP_G("pcie", pcie_rst_grp, MT7620_GPIO_MODE_PCIE_MASK, |
101 |
| - MT7620_GPIO_MODE_PCIE_GPIO, MT7620_GPIO_MODE_PCIE_SHIFT), |
102 |
| - GRP_G("nd_sd", nd_sd_grp, MT7620_GPIO_MODE_ND_SD_MASK, |
103 |
| - MT7620_GPIO_MODE_ND_SD_GPIO, MT7620_GPIO_MODE_ND_SD_SHIFT), |
104 |
| - GRP("rgmii2", rgmii2_grp, 1, MT7620_GPIO_MODE_RGMII2), |
105 |
| - GRP("wled", wled_grp, 1, MT7620_GPIO_MODE_WLED), |
106 |
| - GRP("ephy", ephy_grp, 1, MT7620_GPIO_MODE_EPHY), |
107 |
| - GRP("pa", pa_grp, 1, MT7620_GPIO_MODE_PA), |
108 |
| - { 0 } |
109 |
| -}; |
110 |
| - |
111 |
| -static struct rt2880_pmx_func pwm1_grp_mt7628[] = { |
112 |
| - FUNC("sdxc d6", 3, 19, 1), |
113 |
| - FUNC("utif", 2, 19, 1), |
114 |
| - FUNC("gpio", 1, 19, 1), |
115 |
| - FUNC("pwm1", 0, 19, 1), |
116 |
| -}; |
117 |
| - |
118 |
| -static struct rt2880_pmx_func pwm0_grp_mt7628[] = { |
119 |
| - FUNC("sdxc d7", 3, 18, 1), |
120 |
| - FUNC("utif", 2, 18, 1), |
121 |
| - FUNC("gpio", 1, 18, 1), |
122 |
| - FUNC("pwm0", 0, 18, 1), |
123 |
| -}; |
124 |
| - |
125 |
| -static struct rt2880_pmx_func uart2_grp_mt7628[] = { |
126 |
| - FUNC("sdxc d5 d4", 3, 20, 2), |
127 |
| - FUNC("pwm", 2, 20, 2), |
128 |
| - FUNC("gpio", 1, 20, 2), |
129 |
| - FUNC("uart2", 0, 20, 2), |
130 |
| -}; |
131 |
| - |
132 |
| -static struct rt2880_pmx_func uart1_grp_mt7628[] = { |
133 |
| - FUNC("sw_r", 3, 45, 2), |
134 |
| - FUNC("pwm", 2, 45, 2), |
135 |
| - FUNC("gpio", 1, 45, 2), |
136 |
| - FUNC("uart1", 0, 45, 2), |
137 |
| -}; |
138 |
| - |
139 |
| -static struct rt2880_pmx_func i2c_grp_mt7628[] = { |
140 |
| - FUNC("-", 3, 4, 2), |
141 |
| - FUNC("debug", 2, 4, 2), |
142 |
| - FUNC("gpio", 1, 4, 2), |
143 |
| - FUNC("i2c", 0, 4, 2), |
144 |
| -}; |
145 |
| - |
146 |
| -static struct rt2880_pmx_func refclk_grp_mt7628[] = { FUNC("refclk", 0, 37, 1) }; |
147 |
| -static struct rt2880_pmx_func perst_grp_mt7628[] = { FUNC("perst", 0, 36, 1) }; |
148 |
| -static struct rt2880_pmx_func wdt_grp_mt7628[] = { FUNC("wdt", 0, 38, 1) }; |
149 |
| -static struct rt2880_pmx_func spi_grp_mt7628[] = { FUNC("spi", 0, 7, 4) }; |
150 |
| - |
151 |
| -static struct rt2880_pmx_func sd_mode_grp_mt7628[] = { |
152 |
| - FUNC("jtag", 3, 22, 8), |
153 |
| - FUNC("utif", 2, 22, 8), |
154 |
| - FUNC("gpio", 1, 22, 8), |
155 |
| - FUNC("sdxc", 0, 22, 8), |
156 |
| -}; |
157 |
| - |
158 |
| -static struct rt2880_pmx_func uart0_grp_mt7628[] = { |
159 |
| - FUNC("-", 3, 12, 2), |
160 |
| - FUNC("-", 2, 12, 2), |
161 |
| - FUNC("gpio", 1, 12, 2), |
162 |
| - FUNC("uart0", 0, 12, 2), |
163 |
| -}; |
164 |
| - |
165 |
| -static struct rt2880_pmx_func i2s_grp_mt7628[] = { |
166 |
| - FUNC("antenna", 3, 0, 4), |
167 |
| - FUNC("pcm", 2, 0, 4), |
168 |
| - FUNC("gpio", 1, 0, 4), |
169 |
| - FUNC("i2s", 0, 0, 4), |
170 |
| -}; |
171 |
| - |
172 |
| -static struct rt2880_pmx_func spi_cs1_grp_mt7628[] = { |
173 |
| - FUNC("-", 3, 6, 1), |
174 |
| - FUNC("refclk", 2, 6, 1), |
175 |
| - FUNC("gpio", 1, 6, 1), |
176 |
| - FUNC("spi cs1", 0, 6, 1), |
177 |
| -}; |
178 |
| - |
179 |
| -static struct rt2880_pmx_func spis_grp_mt7628[] = { |
180 |
| - FUNC("pwm_uart2", 3, 14, 4), |
181 |
| - FUNC("utif", 2, 14, 4), |
182 |
| - FUNC("gpio", 1, 14, 4), |
183 |
| - FUNC("spis", 0, 14, 4), |
184 |
| -}; |
185 |
| - |
186 |
| -static struct rt2880_pmx_func gpio_grp_mt7628[] = { |
187 |
| - FUNC("pcie", 3, 11, 1), |
188 |
| - FUNC("refclk", 2, 11, 1), |
189 |
| - FUNC("gpio", 1, 11, 1), |
190 |
| - FUNC("gpio", 0, 11, 1), |
191 |
| -}; |
192 |
| - |
193 |
| -static struct rt2880_pmx_func p4led_kn_grp_mt7628[] = { |
194 |
| - FUNC("jtag", 3, 30, 1), |
195 |
| - FUNC("utif", 2, 30, 1), |
196 |
| - FUNC("gpio", 1, 30, 1), |
197 |
| - FUNC("p4led_kn", 0, 30, 1), |
198 |
| -}; |
199 |
| - |
200 |
| -static struct rt2880_pmx_func p3led_kn_grp_mt7628[] = { |
201 |
| - FUNC("jtag", 3, 31, 1), |
202 |
| - FUNC("utif", 2, 31, 1), |
203 |
| - FUNC("gpio", 1, 31, 1), |
204 |
| - FUNC("p3led_kn", 0, 31, 1), |
205 |
| -}; |
206 |
| - |
207 |
| -static struct rt2880_pmx_func p2led_kn_grp_mt7628[] = { |
208 |
| - FUNC("jtag", 3, 32, 1), |
209 |
| - FUNC("utif", 2, 32, 1), |
210 |
| - FUNC("gpio", 1, 32, 1), |
211 |
| - FUNC("p2led_kn", 0, 32, 1), |
212 |
| -}; |
213 |
| - |
214 |
| -static struct rt2880_pmx_func p1led_kn_grp_mt7628[] = { |
215 |
| - FUNC("jtag", 3, 33, 1), |
216 |
| - FUNC("utif", 2, 33, 1), |
217 |
| - FUNC("gpio", 1, 33, 1), |
218 |
| - FUNC("p1led_kn", 0, 33, 1), |
219 |
| -}; |
220 |
| - |
221 |
| -static struct rt2880_pmx_func p0led_kn_grp_mt7628[] = { |
222 |
| - FUNC("jtag", 3, 34, 1), |
223 |
| - FUNC("rsvd", 2, 34, 1), |
224 |
| - FUNC("gpio", 1, 34, 1), |
225 |
| - FUNC("p0led_kn", 0, 34, 1), |
226 |
| -}; |
227 |
| - |
228 |
| -static struct rt2880_pmx_func wled_kn_grp_mt7628[] = { |
229 |
| - FUNC("rsvd", 3, 35, 1), |
230 |
| - FUNC("rsvd", 2, 35, 1), |
231 |
| - FUNC("gpio", 1, 35, 1), |
232 |
| - FUNC("wled_kn", 0, 35, 1), |
233 |
| -}; |
234 |
| - |
235 |
| -static struct rt2880_pmx_func p4led_an_grp_mt7628[] = { |
236 |
| - FUNC("jtag", 3, 39, 1), |
237 |
| - FUNC("utif", 2, 39, 1), |
238 |
| - FUNC("gpio", 1, 39, 1), |
239 |
| - FUNC("p4led_an", 0, 39, 1), |
240 |
| -}; |
241 |
| - |
242 |
| -static struct rt2880_pmx_func p3led_an_grp_mt7628[] = { |
243 |
| - FUNC("jtag", 3, 40, 1), |
244 |
| - FUNC("utif", 2, 40, 1), |
245 |
| - FUNC("gpio", 1, 40, 1), |
246 |
| - FUNC("p3led_an", 0, 40, 1), |
247 |
| -}; |
248 |
| - |
249 |
| -static struct rt2880_pmx_func p2led_an_grp_mt7628[] = { |
250 |
| - FUNC("jtag", 3, 41, 1), |
251 |
| - FUNC("utif", 2, 41, 1), |
252 |
| - FUNC("gpio", 1, 41, 1), |
253 |
| - FUNC("p2led_an", 0, 41, 1), |
254 |
| -}; |
255 |
| - |
256 |
| -static struct rt2880_pmx_func p1led_an_grp_mt7628[] = { |
257 |
| - FUNC("jtag", 3, 42, 1), |
258 |
| - FUNC("utif", 2, 42, 1), |
259 |
| - FUNC("gpio", 1, 42, 1), |
260 |
| - FUNC("p1led_an", 0, 42, 1), |
261 |
| -}; |
262 |
| - |
263 |
| -static struct rt2880_pmx_func p0led_an_grp_mt7628[] = { |
264 |
| - FUNC("jtag", 3, 43, 1), |
265 |
| - FUNC("rsvd", 2, 43, 1), |
266 |
| - FUNC("gpio", 1, 43, 1), |
267 |
| - FUNC("p0led_an", 0, 43, 1), |
268 |
| -}; |
269 |
| - |
270 |
| -static struct rt2880_pmx_func wled_an_grp_mt7628[] = { |
271 |
| - FUNC("rsvd", 3, 44, 1), |
272 |
| - FUNC("rsvd", 2, 44, 1), |
273 |
| - FUNC("gpio", 1, 44, 1), |
274 |
| - FUNC("wled_an", 0, 44, 1), |
275 |
| -}; |
276 |
| - |
277 |
| -#define MT7628_GPIO_MODE_MASK 0x3 |
278 |
| - |
279 |
| -#define MT7628_GPIO_MODE_P4LED_KN 58 |
280 |
| -#define MT7628_GPIO_MODE_P3LED_KN 56 |
281 |
| -#define MT7628_GPIO_MODE_P2LED_KN 54 |
282 |
| -#define MT7628_GPIO_MODE_P1LED_KN 52 |
283 |
| -#define MT7628_GPIO_MODE_P0LED_KN 50 |
284 |
| -#define MT7628_GPIO_MODE_WLED_KN 48 |
285 |
| -#define MT7628_GPIO_MODE_P4LED_AN 42 |
286 |
| -#define MT7628_GPIO_MODE_P3LED_AN 40 |
287 |
| -#define MT7628_GPIO_MODE_P2LED_AN 38 |
288 |
| -#define MT7628_GPIO_MODE_P1LED_AN 36 |
289 |
| -#define MT7628_GPIO_MODE_P0LED_AN 34 |
290 |
| -#define MT7628_GPIO_MODE_WLED_AN 32 |
291 |
| -#define MT7628_GPIO_MODE_PWM1 30 |
292 |
| -#define MT7628_GPIO_MODE_PWM0 28 |
293 |
| -#define MT7628_GPIO_MODE_UART2 26 |
294 |
| -#define MT7628_GPIO_MODE_UART1 24 |
295 |
| -#define MT7628_GPIO_MODE_I2C 20 |
296 |
| -#define MT7628_GPIO_MODE_REFCLK 18 |
297 |
| -#define MT7628_GPIO_MODE_PERST 16 |
298 |
| -#define MT7628_GPIO_MODE_WDT 14 |
299 |
| -#define MT7628_GPIO_MODE_SPI 12 |
300 |
| -#define MT7628_GPIO_MODE_SDMODE 10 |
301 |
| -#define MT7628_GPIO_MODE_UART0 8 |
302 |
| -#define MT7628_GPIO_MODE_I2S 6 |
303 |
| -#define MT7628_GPIO_MODE_CS1 4 |
304 |
| -#define MT7628_GPIO_MODE_SPIS 2 |
305 |
| -#define MT7628_GPIO_MODE_GPIO 0 |
306 |
| - |
307 |
| -static struct rt2880_pmx_group mt7628an_pinmux_data[] = { |
308 |
| - GRP_G("pwm1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, |
309 |
| - 1, MT7628_GPIO_MODE_PWM1), |
310 |
| - GRP_G("pwm0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, |
311 |
| - 1, MT7628_GPIO_MODE_PWM0), |
312 |
| - GRP_G("uart2", uart2_grp_mt7628, MT7628_GPIO_MODE_MASK, |
313 |
| - 1, MT7628_GPIO_MODE_UART2), |
314 |
| - GRP_G("uart1", uart1_grp_mt7628, MT7628_GPIO_MODE_MASK, |
315 |
| - 1, MT7628_GPIO_MODE_UART1), |
316 |
| - GRP_G("i2c", i2c_grp_mt7628, MT7628_GPIO_MODE_MASK, |
317 |
| - 1, MT7628_GPIO_MODE_I2C), |
318 |
| - GRP("refclk", refclk_grp_mt7628, 1, MT7628_GPIO_MODE_REFCLK), |
319 |
| - GRP("perst", perst_grp_mt7628, 1, MT7628_GPIO_MODE_PERST), |
320 |
| - GRP("wdt", wdt_grp_mt7628, 1, MT7628_GPIO_MODE_WDT), |
321 |
| - GRP("spi", spi_grp_mt7628, 1, MT7628_GPIO_MODE_SPI), |
322 |
| - GRP_G("sdmode", sd_mode_grp_mt7628, MT7628_GPIO_MODE_MASK, |
323 |
| - 1, MT7628_GPIO_MODE_SDMODE), |
324 |
| - GRP_G("uart0", uart0_grp_mt7628, MT7628_GPIO_MODE_MASK, |
325 |
| - 1, MT7628_GPIO_MODE_UART0), |
326 |
| - GRP_G("i2s", i2s_grp_mt7628, MT7628_GPIO_MODE_MASK, |
327 |
| - 1, MT7628_GPIO_MODE_I2S), |
328 |
| - GRP_G("spi cs1", spi_cs1_grp_mt7628, MT7628_GPIO_MODE_MASK, |
329 |
| - 1, MT7628_GPIO_MODE_CS1), |
330 |
| - GRP_G("spis", spis_grp_mt7628, MT7628_GPIO_MODE_MASK, |
331 |
| - 1, MT7628_GPIO_MODE_SPIS), |
332 |
| - GRP_G("gpio", gpio_grp_mt7628, MT7628_GPIO_MODE_MASK, |
333 |
| - 1, MT7628_GPIO_MODE_GPIO), |
334 |
| - GRP_G("wled_an", wled_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
335 |
| - 1, MT7628_GPIO_MODE_WLED_AN), |
336 |
| - GRP_G("p0led_an", p0led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
337 |
| - 1, MT7628_GPIO_MODE_P0LED_AN), |
338 |
| - GRP_G("p1led_an", p1led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
339 |
| - 1, MT7628_GPIO_MODE_P1LED_AN), |
340 |
| - GRP_G("p2led_an", p2led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
341 |
| - 1, MT7628_GPIO_MODE_P2LED_AN), |
342 |
| - GRP_G("p3led_an", p3led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
343 |
| - 1, MT7628_GPIO_MODE_P3LED_AN), |
344 |
| - GRP_G("p4led_an", p4led_an_grp_mt7628, MT7628_GPIO_MODE_MASK, |
345 |
| - 1, MT7628_GPIO_MODE_P4LED_AN), |
346 |
| - GRP_G("wled_kn", wled_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
347 |
| - 1, MT7628_GPIO_MODE_WLED_KN), |
348 |
| - GRP_G("p0led_kn", p0led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
349 |
| - 1, MT7628_GPIO_MODE_P0LED_KN), |
350 |
| - GRP_G("p1led_kn", p1led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
351 |
| - 1, MT7628_GPIO_MODE_P1LED_KN), |
352 |
| - GRP_G("p2led_kn", p2led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
353 |
| - 1, MT7628_GPIO_MODE_P2LED_KN), |
354 |
| - GRP_G("p3led_kn", p3led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
355 |
| - 1, MT7628_GPIO_MODE_P3LED_KN), |
356 |
| - GRP_G("p4led_kn", p4led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, |
357 |
| - 1, MT7628_GPIO_MODE_P4LED_KN), |
358 |
| - { 0 } |
359 |
| -}; |
360 |
| - |
361 |
| -static inline int is_mt76x8(void) |
362 |
| -{ |
363 |
| - return ralink_soc == MT762X_SOC_MT7628AN || |
364 |
| - ralink_soc == MT762X_SOC_MT7688; |
365 |
| -} |
366 |
| - |
367 | 52 | static __init u32
|
368 | 53 | mt7620_calc_rate(u32 ref_rate, u32 mul, u32 div)
|
369 | 54 | {
|
@@ -710,9 +395,4 @@ void __init prom_soc_init(struct ralink_soc_info *soc_info)
|
710 | 395 | (pmu0 & PMU_SW_SET) ? ("sw") : ("hw"));
|
711 | 396 | pr_info("Digital PMU set to %s control\n",
|
712 | 397 | (pmu1 & DIG_SW_SEL) ? ("sw") : ("hw"));
|
713 |
| - |
714 |
| - if (is_mt76x8()) |
715 |
| - rt2880_pinmux_data = mt7628an_pinmux_data; |
716 |
| - else |
717 |
| - rt2880_pinmux_data = mt7620a_pinmux_data; |
718 | 398 | }
|
0 commit comments