OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Ubiquiti Networks XM (rev 1.0) board support |
||
3 | * |
||
4 | * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> |
||
5 | * |
||
6 | * Derived from: mach-pb44.c |
||
7 | * |
||
8 | * This program is free software; you can redistribute it and/or modify it |
||
9 | * under the terms of the GNU General Public License version 2 as published |
||
10 | * by the Free Software Foundation. |
||
11 | */ |
||
12 | |||
13 | #include <linux/init.h> |
||
14 | #include <linux/pci.h> |
||
15 | #include <linux/gpio.h> |
||
16 | #include <linux/platform_device.h> |
||
17 | #include <linux/ath9k_platform.h> |
||
18 | #include <linux/etherdevice.h> |
||
19 | #include <linux/ar8216_platform.h> |
||
20 | #include <linux/platform_data/phy-at803x.h> |
||
21 | |||
22 | #include <asm/mach-ath79/ath79.h> |
||
23 | #include <asm/mach-ath79/irq.h> |
||
24 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
25 | |||
26 | #include <linux/platform_data/phy-at803x.h> |
||
27 | |||
28 | #include "common.h" |
||
29 | #include "dev-ap9x-pci.h" |
||
30 | #include "dev-eth.h" |
||
31 | #include "dev-gpio-buttons.h" |
||
32 | #include "dev-leds-gpio.h" |
||
33 | #include "dev-m25p80.h" |
||
34 | #include "dev-usb.h" |
||
35 | #include "dev-wmac.h" |
||
36 | #include "machtypes.h" |
||
37 | |||
38 | #define UBNT_XM_GPIO_LED_L1 0 |
||
39 | #define UBNT_XM_GPIO_LED_L2 1 |
||
40 | #define UBNT_XM_GPIO_LED_L3 11 |
||
41 | #define UBNT_XM_GPIO_LED_L4 7 |
||
42 | |||
43 | #define UBNT_XM_GPIO_BTN_RESET 12 |
||
44 | |||
45 | #define UBNT_XM_KEYS_POLL_INTERVAL 20 |
||
46 | #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) |
||
47 | |||
48 | #define UBNT_XM_EEPROM_ADDR 0x1fff1000 |
||
49 | |||
50 | static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { |
||
51 | { |
||
52 | .name = "ubnt:red:link1", |
||
53 | .gpio = UBNT_XM_GPIO_LED_L1, |
||
54 | .active_low = 0, |
||
55 | }, { |
||
56 | .name = "ubnt:orange:link2", |
||
57 | .gpio = UBNT_XM_GPIO_LED_L2, |
||
58 | .active_low = 0, |
||
59 | }, { |
||
60 | .name = "ubnt:green:link3", |
||
61 | .gpio = UBNT_XM_GPIO_LED_L3, |
||
62 | .active_low = 0, |
||
63 | }, { |
||
64 | .name = "ubnt:green:link4", |
||
65 | .gpio = UBNT_XM_GPIO_LED_L4, |
||
66 | .active_low = 0, |
||
67 | }, |
||
68 | }; |
||
69 | |||
70 | static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = { |
||
71 | { |
||
72 | .desc = "reset", |
||
73 | .type = EV_KEY, |
||
74 | .code = KEY_RESTART, |
||
75 | .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, |
||
76 | .gpio = UBNT_XM_GPIO_BTN_RESET, |
||
77 | .active_low = 1, |
||
78 | } |
||
79 | }; |
||
80 | |||
81 | #define UBNT_M_WAN_PHYMASK BIT(4) |
||
82 | |||
83 | static void __init ubnt_xm_init(void) |
||
84 | { |
||
85 | u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR); |
||
86 | u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
87 | u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); |
||
88 | |||
89 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio), |
||
90 | ubnt_xm_leds_gpio); |
||
91 | |||
92 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
93 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
94 | ubnt_xm_gpio_keys); |
||
95 | |||
96 | ath79_register_m25p80(NULL); |
||
97 | ap91_pci_init(eeprom, NULL); |
||
98 | |||
99 | ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); |
||
100 | ath79_eth0_data.speed = SPEED_100; |
||
101 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
102 | ath79_eth1_data.speed = SPEED_100; |
||
103 | ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); |
||
104 | ath79_register_eth(0); |
||
105 | } |
||
106 | |||
107 | MIPS_MACHINE(ATH79_MACH_UBNT_XM, |
||
108 | "UBNT-XM", |
||
109 | "Ubiquiti Networks XM (rev 1.0) board", |
||
110 | ubnt_xm_init); |
||
111 | |||
112 | MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M", |
||
113 | ubnt_xm_init); |
||
114 | |||
115 | static void __init ubnt_rocket_m_setup(void) |
||
116 | { |
||
117 | ubnt_xm_init(); |
||
118 | ath79_register_usb(); |
||
119 | } |
||
120 | |||
121 | MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M", |
||
122 | ubnt_rocket_m_setup); |
||
123 | |||
124 | static void __init ubnt_nano_m_setup(void) |
||
125 | { |
||
126 | ubnt_xm_init(); |
||
127 | ath79_register_eth(1); |
||
128 | } |
||
129 | |||
130 | MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M", |
||
131 | ubnt_nano_m_setup); |
||
132 | |||
133 | static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = { |
||
134 | { |
||
135 | .name = "ubnt:green:globe", |
||
136 | .gpio = 0, |
||
137 | .active_low = 1, |
||
138 | }, { |
||
139 | .name = "ubnt:green:power", |
||
140 | .gpio = 11, |
||
141 | .active_low = 1, |
||
142 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
||
143 | } |
||
144 | }; |
||
145 | |||
146 | static void __init ubnt_airrouter_setup(void) |
||
147 | { |
||
148 | u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
149 | u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); |
||
150 | |||
151 | ath79_register_m25p80(NULL); |
||
152 | ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); |
||
153 | |||
154 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
155 | ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1); |
||
156 | |||
157 | ath79_register_eth(1); |
||
158 | ath79_register_eth(0); |
||
159 | ath79_register_usb(); |
||
160 | |||
161 | ap91_pci_init(ee, NULL); |
||
162 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio), |
||
163 | ubnt_airrouter_leds_gpio); |
||
164 | |||
165 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
166 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
167 | ubnt_xm_gpio_keys); |
||
168 | } |
||
169 | |||
170 | MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter", |
||
171 | ubnt_airrouter_setup); |
||
172 | |||
173 | static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = { |
||
174 | { |
||
175 | .name = "ubnt:orange:dome", |
||
176 | .gpio = 1, |
||
177 | .active_low = 0, |
||
178 | }, { |
||
179 | .name = "ubnt:green:dome", |
||
180 | .gpio = 0, |
||
181 | .active_low = 0, |
||
182 | } |
||
183 | }; |
||
184 | |||
185 | static struct gpio_led ubnt_unifi_outdoor_leds_gpio[] __initdata = { |
||
186 | { |
||
187 | .name = "ubnt:orange:front", |
||
188 | .gpio = 1, |
||
189 | .active_low = 0, |
||
190 | }, { |
||
191 | .name = "ubnt:green:front", |
||
192 | .gpio = 0, |
||
193 | .active_low = 0, |
||
194 | } |
||
195 | }; |
||
196 | |||
197 | static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio[] __initdata = { |
||
198 | { |
||
199 | .name = "ubnt:white:front", |
||
200 | .gpio = 1, |
||
201 | .active_low = 0, |
||
202 | }, { |
||
203 | .name = "ubnt:blue:front", |
||
204 | .gpio = 0, |
||
205 | .active_low = 0, |
||
206 | } |
||
207 | }; |
||
208 | |||
209 | |||
210 | static void __init ubnt_unifi_setup(void) |
||
211 | { |
||
212 | u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); |
||
213 | u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); |
||
214 | |||
215 | ath79_register_m25p80(NULL); |
||
216 | |||
217 | ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); |
||
218 | |||
219 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
||
220 | ath79_register_eth(0); |
||
221 | |||
222 | ap91_pci_init(ee, NULL); |
||
223 | |||
224 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio), |
||
225 | ubnt_unifi_leds_gpio); |
||
226 | |||
227 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
228 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
229 | ubnt_xm_gpio_keys); |
||
230 | } |
||
231 | |||
232 | MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi", |
||
233 | ubnt_unifi_setup); |
||
234 | |||
235 | |||
236 | #define UBNT_UNIFIOD_PRI_PHYMASK BIT(4) |
||
237 | #define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) |
||
238 | |||
239 | static void __init ubnt_unifi_outdoor_setup(void) |
||
240 | { |
||
241 | u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
242 | u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); |
||
243 | u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); |
||
244 | |||
245 | ath79_register_m25p80(NULL); |
||
246 | |||
247 | ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK | |
||
248 | UBNT_UNIFIOD_2ND_PHYMASK)); |
||
249 | |||
250 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
251 | ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); |
||
252 | ath79_register_eth(0); |
||
253 | ath79_register_eth(1); |
||
254 | |||
255 | ap91_pci_init(ee, NULL); |
||
256 | |||
257 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio), |
||
258 | ubnt_unifi_outdoor_leds_gpio); |
||
259 | |||
260 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
261 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
262 | ubnt_xm_gpio_keys); |
||
263 | } |
||
264 | |||
265 | MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR, "UBNT-U20", |
||
266 | "Ubiquiti UniFiAP Outdoor", |
||
267 | ubnt_unifi_outdoor_setup); |
||
268 | |||
269 | |||
270 | static void __init ubnt_unifi_outdoor_plus_setup(void) |
||
271 | { |
||
272 | u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
273 | u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); |
||
274 | u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); |
||
275 | |||
276 | ath79_register_m25p80(NULL); |
||
277 | |||
278 | ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK | |
||
279 | UBNT_UNIFIOD_2ND_PHYMASK)); |
||
280 | |||
281 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
282 | ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); |
||
283 | ath79_register_eth(0); |
||
284 | ath79_register_eth(1); |
||
285 | |||
286 | ap9x_pci_get_wmac_data(0)->ubnt_hsr = true; |
||
287 | ap91_pci_init(ee, NULL); |
||
288 | |||
289 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio), |
||
290 | ubnt_unifi_outdoor_plus_leds_gpio); |
||
291 | |||
292 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
293 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
294 | ubnt_xm_gpio_keys); |
||
295 | } |
||
296 | |||
297 | MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, "UBNT-UOP", |
||
298 | "Ubiquiti UniFiAP Outdoor+", |
||
299 | ubnt_unifi_outdoor_plus_setup); |
||
300 | |||
301 | |||
302 | static struct gpio_led ubnt_uap_pro_gpio_leds[] __initdata = { |
||
303 | { |
||
304 | .name = "ubnt:white:dome", |
||
305 | .gpio = 12, |
||
306 | }, { |
||
307 | .name = "ubnt:blue:dome", |
||
308 | .gpio = 13, |
||
309 | } |
||
310 | }; |
||
311 | |||
312 | static struct gpio_keys_button uap_pro_gpio_keys[] __initdata = { |
||
313 | { |
||
314 | .desc = "reset", |
||
315 | .type = EV_KEY, |
||
316 | .code = KEY_RESTART, |
||
317 | .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, |
||
318 | .gpio = 17, |
||
319 | .active_low = 1, |
||
320 | } |
||
321 | }; |
||
322 | |||
323 | static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg = { |
||
324 | .mode = AR8327_PAD_MAC_RGMII, |
||
325 | .txclk_delay_en = true, |
||
326 | .rxclk_delay_en = true, |
||
327 | .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, |
||
328 | .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, |
||
329 | }; |
||
330 | |||
331 | static struct ar8327_platform_data uap_pro_ar8327_data = { |
||
332 | .pad0_cfg = &uap_pro_ar8327_pad0_cfg, |
||
333 | .port0_cfg = { |
||
334 | .force_link = 1, |
||
335 | .speed = AR8327_PORT_SPEED_1000, |
||
336 | .duplex = 1, |
||
337 | .txpause = 1, |
||
338 | .rxpause = 1, |
||
339 | }, |
||
340 | }; |
||
341 | |||
342 | static struct mdio_board_info uap_pro_mdio0_info[] = { |
||
343 | { |
||
344 | .bus_id = "ag71xx-mdio.0", |
||
3 | office | 345 | .phy_addr = 0, |
1 | office | 346 | .platform_data = &uap_pro_ar8327_data, |
347 | }, |
||
348 | }; |
||
349 | |||
350 | #define UAP_PRO_MAC0_OFFSET 0x0000 |
||
351 | #define UAP_PRO_MAC1_OFFSET 0x0006 |
||
352 | #define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000 |
||
353 | #define UAP_PRO_PCI_CALDATA_OFFSET 0x5000 |
||
354 | |||
355 | static void __init ubnt_uap_pro_setup(void) |
||
356 | { |
||
357 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
358 | |||
359 | ath79_register_m25p80(NULL); |
||
360 | |||
361 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds), |
||
362 | ubnt_uap_pro_gpio_leds); |
||
363 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
364 | ARRAY_SIZE(uap_pro_gpio_keys), |
||
365 | uap_pro_gpio_keys); |
||
366 | |||
367 | ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); |
||
368 | ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); |
||
369 | |||
370 | ath79_register_mdio(0, 0x0); |
||
371 | mdiobus_register_board_info(uap_pro_mdio0_info, |
||
372 | ARRAY_SIZE(uap_pro_mdio0_info)); |
||
373 | |||
374 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); |
||
375 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
376 | eeprom + UAP_PRO_MAC0_OFFSET, 0); |
||
377 | |||
378 | /* GMAC0 is connected to an AR8327 switch */ |
||
379 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
380 | ath79_eth0_data.phy_mask = BIT(0); |
||
381 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
||
382 | ath79_eth0_pll_data.pll_1000 = 0x06000000; |
||
383 | ath79_register_eth(0); |
||
384 | } |
||
385 | |||
386 | MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro", |
||
387 | ubnt_uap_pro_setup); |
||
388 | |||
389 | #define UBNT_XW_GPIO_LED_L1 11 |
||
390 | #define UBNT_XW_GPIO_LED_L2 16 |
||
391 | #define UBNT_XW_GPIO_LED_L3 13 |
||
392 | #define UBNT_XW_GPIO_LED_L4 14 |
||
393 | |||
394 | static struct gpio_led ubnt_xw_leds_gpio[] __initdata = { |
||
395 | { |
||
396 | .name = "ubnt:red:link1", |
||
397 | .gpio = UBNT_XW_GPIO_LED_L1, |
||
398 | .active_low = 1, |
||
399 | }, { |
||
400 | .name = "ubnt:orange:link2", |
||
401 | .gpio = UBNT_XW_GPIO_LED_L2, |
||
402 | .active_low = 1, |
||
403 | }, { |
||
404 | .name = "ubnt:green:link3", |
||
405 | .gpio = UBNT_XW_GPIO_LED_L3, |
||
406 | .active_low = 1, |
||
407 | }, { |
||
408 | .name = "ubnt:green:link4", |
||
409 | .gpio = UBNT_XW_GPIO_LED_L4, |
||
410 | .active_low = 1, |
||
411 | }, |
||
412 | }; |
||
413 | |||
414 | #define UBNT_ROCKET_TI_GPIO_LED_L1 16 |
||
415 | #define UBNT_ROCKET_TI_GPIO_LED_L2 17 |
||
416 | #define UBNT_ROCKET_TI_GPIO_LED_L3 18 |
||
417 | #define UBNT_ROCKET_TI_GPIO_LED_L4 19 |
||
418 | #define UBNT_ROCKET_TI_GPIO_LED_L5 20 |
||
419 | #define UBNT_ROCKET_TI_GPIO_LED_L6 21 |
||
420 | static struct gpio_led ubnt_rocket_ti_leds_gpio[] __initdata = { |
||
421 | { |
||
422 | .name = "ubnt:green:link1", |
||
423 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L1, |
||
424 | .active_low = 1, |
||
425 | }, { |
||
426 | .name = "ubnt:green:link2", |
||
427 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L2, |
||
428 | .active_low = 1, |
||
429 | }, { |
||
430 | .name = "ubnt:green:link3", |
||
431 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L3, |
||
432 | .active_low = 1, |
||
433 | }, { |
||
434 | .name = "ubnt:green:link4", |
||
435 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L4, |
||
436 | .active_low = 0, |
||
437 | }, { |
||
438 | .name = "ubnt:green:link5", |
||
439 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L5, |
||
440 | .active_low = 0, |
||
441 | }, { |
||
442 | .name = "ubnt:green:link6", |
||
443 | .gpio = UBNT_ROCKET_TI_GPIO_LED_L6, |
||
444 | .active_low = 0, |
||
445 | }, |
||
446 | }; |
||
447 | |||
448 | static void __init ubnt_xw_init(void) |
||
449 | { |
||
450 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
451 | |||
452 | ath79_register_m25p80(NULL); |
||
453 | |||
454 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio), |
||
455 | ubnt_xw_leds_gpio); |
||
456 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
457 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
458 | ubnt_xm_gpio_keys); |
||
459 | |||
460 | ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); |
||
461 | ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); |
||
462 | |||
463 | |||
464 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0_SLAVE); |
||
465 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
466 | eeprom + UAP_PRO_MAC0_OFFSET, 0); |
||
467 | |||
468 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
469 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
||
470 | } |
||
471 | |||
472 | static void __init ubnt_nano_m_xw_setup(void) |
||
473 | { |
||
474 | ubnt_xw_init(); |
||
475 | |||
476 | /* GMAC0 is connected to an AR8326 switch */ |
||
477 | ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5))); |
||
478 | ath79_eth0_data.phy_mask = (BIT(0) | BIT(1) | BIT(5)); |
||
479 | ath79_eth0_data.speed = SPEED_100; |
||
480 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
481 | ath79_register_eth(0); |
||
482 | } |
||
483 | |||
484 | static struct at803x_platform_data ubnt_loco_m_xw_at803x_data = { |
||
485 | .has_reset_gpio = 1, |
||
486 | .reset_gpio = 0, |
||
487 | }; |
||
488 | |||
489 | static struct mdio_board_info ubnt_loco_m_xw_mdio_info[] = { |
||
490 | { |
||
491 | .bus_id = "ag71xx-mdio.0", |
||
3 | office | 492 | .phy_addr = 1, |
1 | office | 493 | .platform_data = &ubnt_loco_m_xw_at803x_data, |
494 | }, |
||
495 | }; |
||
496 | |||
497 | static void __init ubnt_loco_m_xw_setup(void) |
||
498 | { |
||
499 | ubnt_xw_init(); |
||
500 | |||
501 | mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info, |
||
502 | ARRAY_SIZE(ubnt_loco_m_xw_mdio_info)); |
||
503 | |||
504 | ath79_register_mdio(0, ~BIT(1)); |
||
505 | ath79_eth0_data.phy_mask = BIT(1); |
||
506 | ath79_register_eth(0); |
||
507 | } |
||
508 | |||
509 | #define UBNT_LBE_M5_GPIO_LED_LAN 13 |
||
510 | #define UBNT_LBE_M5_GPIO_LED_WLAN 14 |
||
511 | #define UBNT_LBE_M5_GPIO_LED_SYS 16 |
||
512 | |||
513 | static struct gpio_led ubnt_lbe_m5_leds_gpio[] __initdata = { |
||
514 | { |
||
515 | .name = "ubnt:green:lan", |
||
516 | .gpio = UBNT_LBE_M5_GPIO_LED_LAN, |
||
517 | .active_low = 1, |
||
518 | }, { |
||
519 | .name = "ubnt:green:wlan", |
||
520 | .gpio = UBNT_LBE_M5_GPIO_LED_WLAN, |
||
521 | .active_low = 1, |
||
522 | }, { |
||
523 | .name = "ubnt:green:sys", |
||
524 | .gpio = UBNT_LBE_M5_GPIO_LED_SYS, |
||
525 | .active_low = 1, |
||
526 | }, |
||
527 | }; |
||
528 | |||
529 | static void __init ubnt_lbe_m5_setup(void) |
||
530 | { |
||
531 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
532 | |||
533 | ath79_register_m25p80(NULL); |
||
534 | |||
535 | ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); |
||
536 | ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); |
||
537 | |||
538 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_lbe_m5_leds_gpio), |
||
539 | ubnt_lbe_m5_leds_gpio); |
||
540 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
541 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
542 | ubnt_xm_gpio_keys); |
||
543 | |||
544 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | |
||
545 | AR934X_ETH_CFG_MII_GMAC0_SLAVE); |
||
546 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
547 | eeprom + UAP_PRO_MAC0_OFFSET, 0); |
||
548 | |||
549 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
550 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
||
551 | |||
552 | gpio_request_one(0, GPIOF_OUT_INIT_LOW | GPIOF_ACTIVE_LOW | |
||
553 | GPIOF_EXPORT_DIR_FIXED, "SPI nWP"); |
||
554 | |||
555 | mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info, |
||
556 | ARRAY_SIZE(ubnt_loco_m_xw_mdio_info)); |
||
557 | |||
558 | ath79_register_mdio(0, ~BIT(1)); |
||
559 | ath79_eth0_data.phy_mask = BIT(1); |
||
560 | ath79_register_eth(0); |
||
561 | } |
||
562 | |||
563 | static void __init ubnt_rocket_m_xw_setup(void) |
||
564 | { |
||
565 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
566 | |||
567 | ath79_register_m25p80(NULL); |
||
568 | |||
569 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio), |
||
570 | ubnt_xw_leds_gpio); |
||
571 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
572 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
573 | ubnt_xm_gpio_keys); |
||
574 | |||
575 | ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); |
||
576 | ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); |
||
577 | |||
578 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); |
||
579 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
580 | eeprom + UAP_PRO_MAC0_OFFSET, 0); |
||
581 | |||
582 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
583 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
||
584 | |||
585 | ath79_register_mdio(0, ~BIT(4)); |
||
586 | ath79_eth0_data.phy_mask = BIT(4); |
||
587 | ath79_eth0_pll_data.pll_1000 = 0x06000000; |
||
588 | ath79_register_eth(0); |
||
589 | } |
||
590 | |||
591 | static struct at803x_platform_data ubnt_rocket_m_ti_at803_data = { |
||
592 | .disable_smarteee = 1, |
||
593 | .enable_rgmii_rx_delay = 1, |
||
594 | .enable_rgmii_tx_delay = 1, |
||
595 | }; |
||
596 | static struct mdio_board_info ubnt_rocket_m_ti_mdio_info[] = { |
||
597 | { |
||
598 | .bus_id = "ag71xx-mdio.0", |
||
3 | office | 599 | .phy_addr = 4, |
1 | office | 600 | .platform_data = &ubnt_rocket_m_ti_at803_data, |
601 | }, |
||
602 | }; |
||
603 | |||
604 | static void __init ubnt_rocket_m_ti_setup(void) |
||
605 | { |
||
606 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
607 | |||
608 | ath79_register_m25p80(NULL); |
||
609 | |||
610 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio), |
||
611 | ubnt_rocket_ti_leds_gpio); |
||
612 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
613 | ARRAY_SIZE(ubnt_xm_gpio_keys), |
||
614 | ubnt_xm_gpio_keys); |
||
615 | |||
616 | ap91_pci_init(eeprom + 0x1000, NULL); |
||
617 | |||
618 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); |
||
619 | ath79_setup_ar934x_eth_rx_delay(3, 3); |
||
620 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
621 | eeprom + UAP_PRO_MAC0_OFFSET, 0); |
||
622 | ath79_init_mac(ath79_eth1_data.mac_addr, |
||
623 | eeprom + UAP_PRO_MAC1_OFFSET, 0); |
||
624 | |||
625 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
626 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
||
627 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; |
||
628 | ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; |
||
629 | |||
630 | mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info, |
||
631 | ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info)); |
||
632 | ath79_register_mdio(0, 0x0); |
||
633 | |||
634 | |||
635 | ath79_eth0_data.phy_mask = BIT(4); |
||
636 | /* read out from vendor */ |
||
637 | ath79_eth0_pll_data.pll_1000 = 0x2000000; |
||
638 | ath79_eth0_pll_data.pll_10 = 0x1313; |
||
639 | ath79_register_eth(0); |
||
640 | |||
641 | ath79_register_mdio(1, 0x0); |
||
642 | ath79_eth1_data.phy_mask = BIT(3); |
||
643 | ath79_register_eth(1); |
||
644 | } |
||
645 | |||
646 | |||
647 | MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW", |
||
648 | ubnt_nano_m_xw_setup); |
||
649 | |||
650 | MIPS_MACHINE(ATH79_MACH_UBNT_LBE_M5, "UBNT-LBE-M5", "Ubiquiti Litebeam M5", |
||
651 | ubnt_lbe_m5_setup); |
||
652 | |||
653 | MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW", |
||
654 | ubnt_loco_m_xw_setup); |
||
655 | |||
656 | MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW", |
||
657 | ubnt_rocket_m_xw_setup); |
||
658 | |||
659 | MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI", |
||
660 | ubnt_rocket_m_ti_setup); |
||
661 | |||
662 | static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = { |
||
663 | { |
||
664 | .name = "ubnt:blue:wlan", |
||
665 | .gpio = 0, |
||
666 | }, { |
||
667 | .name = "ubnt:white:status", |
||
668 | .gpio = 1, |
||
669 | }, |
||
670 | }; |
||
671 | |||
672 | static struct gpio_keys_button airgateway_gpio_keys[] __initdata = { |
||
673 | { |
||
674 | .desc = "reset", |
||
675 | .type = EV_KEY, |
||
676 | .code = KEY_RESTART, |
||
677 | .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, |
||
678 | .gpio = 12, |
||
679 | .active_low = 1, |
||
680 | } |
||
681 | }; |
||
682 | |||
683 | static void __init ubnt_airgateway_setup(void) |
||
684 | { |
||
685 | u32 t; |
||
686 | u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
687 | u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); |
||
688 | u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); |
||
689 | |||
690 | |||
691 | ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | |
||
692 | AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | |
||
693 | AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | |
||
694 | AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | |
||
695 | AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); |
||
696 | |||
697 | t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); |
||
698 | t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; |
||
699 | ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); |
||
700 | |||
701 | ath79_register_m25p80(NULL); |
||
702 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds), |
||
703 | ubnt_airgateway_gpio_leds); |
||
704 | |||
705 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
706 | ARRAY_SIZE(airgateway_gpio_keys), |
||
707 | airgateway_gpio_keys); |
||
708 | |||
709 | ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0); |
||
710 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
711 | |||
712 | ath79_register_mdio(0, 0x0); |
||
713 | |||
714 | ath79_register_eth(1); |
||
715 | ath79_register_eth(0); |
||
716 | |||
717 | ath79_register_wmac(ee, NULL); |
||
718 | } |
||
719 | |||
720 | MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway", |
||
721 | ubnt_airgateway_setup); |
||
722 | |||
723 | static struct gpio_led ubnt_airgateway_pro_gpio_leds[] __initdata = { |
||
724 | { |
||
725 | .name = "ubnt:blue:wlan", |
||
726 | .gpio = 13, |
||
727 | }, { |
||
728 | .name = "ubnt:white:status", |
||
729 | .gpio = 17, |
||
730 | }, |
||
731 | }; |
||
732 | |||
733 | |||
734 | static struct gpio_keys_button airgateway_pro_gpio_keys[] __initdata = { |
||
735 | { |
||
736 | .desc = "reset", |
||
737 | .type = EV_KEY, |
||
738 | .code = KEY_RESTART, |
||
739 | .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, |
||
740 | .gpio = 12, |
||
741 | .active_low = 1, |
||
742 | } |
||
743 | }; |
||
744 | |||
745 | static void __init ubnt_airgateway_pro_setup(void) |
||
746 | { |
||
747 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); |
||
748 | u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000); |
||
749 | |||
750 | ath79_register_m25p80(NULL); |
||
751 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds), |
||
752 | ubnt_airgateway_pro_gpio_leds); |
||
753 | |||
754 | ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, |
||
755 | ARRAY_SIZE(airgateway_pro_gpio_keys), |
||
756 | airgateway_pro_gpio_keys); |
||
757 | |||
758 | ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); |
||
759 | ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); |
||
760 | |||
761 | |||
762 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); |
||
763 | |||
764 | ath79_register_mdio(1, 0x0); |
||
765 | |||
766 | /* GMAC0 is left unused in this configuration */ |
||
767 | |||
768 | /* GMAC1 is connected to MAC0 on the internal switch */ |
||
769 | /* The PoE/WAN port connects to port 5 on the internal switch */ |
||
770 | /* The LAN port connects to port 4 on the internal switch */ |
||
771 | ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0); |
||
772 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; |
||
773 | ath79_register_eth(1); |
||
774 | |||
775 | } |
||
776 | |||
777 | MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP, "UBNT-AGWP", "Ubiquiti AirGateway Pro", |
||
778 | ubnt_airgateway_pro_setup); |