2 * Ubiquiti Networks XM (rev 1.0) board support
4 * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
6 * Derived from: mach-pb44.c
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.
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>
22 #include <asm/mach-ath79/ath79.h>
23 #include <asm/mach-ath79/irq.h>
24 #include <asm/mach-ath79/ar71xx_regs.h>
26 #include <linux/platform_data/phy-at803x.h>
29 #include "dev-ap9x-pci.h"
31 #include "dev-gpio-buttons.h"
32 #include "dev-leds-gpio.h"
33 #include "dev-m25p80.h"
36 #include "machtypes.h"
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
43 #define UBNT_XM_GPIO_BTN_RESET 12
45 #define UBNT_XM_KEYS_POLL_INTERVAL 20
46 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
48 #define UBNT_XM_EEPROM_ADDR 0x1fff1000
50 static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
52 .name = "ubnt:red:link1",
53 .gpio = UBNT_XM_GPIO_LED_L1,
56 .name = "ubnt:orange:link2",
57 .gpio = UBNT_XM_GPIO_LED_L2,
60 .name = "ubnt:green:link3",
61 .gpio = UBNT_XM_GPIO_LED_L3,
64 .name = "ubnt:green:link4",
65 .gpio = UBNT_XM_GPIO_LED_L4,
70 static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = {
75 .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
76 .gpio = UBNT_XM_GPIO_BTN_RESET,
81 #define UBNT_M_WAN_PHYMASK BIT(4)
83 static void __init ubnt_xm_init(void)
85 u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR);
86 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
87 u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
89 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
92 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
93 ARRAY_SIZE(ubnt_xm_gpio_keys),
96 ath79_register_m25p80(NULL);
97 ap91_pci_init(eeprom, NULL);
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);
107 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
109 "Ubiquiti Networks XM (rev 1.0) board",
112 MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M",
115 static void __init ubnt_rocket_m_setup(void)
118 ath79_register_usb();
121 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M",
122 ubnt_rocket_m_setup);
124 static void __init ubnt_nano_m_setup(void)
127 ath79_register_eth(1);
130 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M",
133 static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = {
135 .name = "ubnt:green:globe",
139 .name = "ubnt:green:power",
142 .default_state = LEDS_GPIO_DEFSTATE_ON,
146 static void __init ubnt_airrouter_setup(void)
148 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
149 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
151 ath79_register_m25p80(NULL);
152 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
154 ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
155 ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
157 ath79_register_eth(1);
158 ath79_register_eth(0);
159 ath79_register_usb();
161 ap91_pci_init(ee, NULL);
162 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
163 ubnt_airrouter_leds_gpio);
165 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
166 ARRAY_SIZE(ubnt_xm_gpio_keys),
170 MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
171 ubnt_airrouter_setup);
173 static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
175 .name = "ubnt:orange:dome",
179 .name = "ubnt:green:dome",
185 static struct gpio_led ubnt_unifi_outdoor_leds_gpio[] __initdata = {
187 .name = "ubnt:orange:front",
191 .name = "ubnt:green:front",
197 static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio[] __initdata = {
199 .name = "ubnt:white:front",
203 .name = "ubnt:blue:front",
210 static void __init ubnt_unifi_setup(void)
212 u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
213 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
215 ath79_register_m25p80(NULL);
217 ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
219 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
220 ath79_register_eth(0);
222 ap91_pci_init(ee, NULL);
224 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
225 ubnt_unifi_leds_gpio);
227 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
228 ARRAY_SIZE(ubnt_xm_gpio_keys),
232 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
236 #define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
237 #define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
239 static void __init ubnt_unifi_outdoor_setup(void)
241 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
242 u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
243 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
245 ath79_register_m25p80(NULL);
247 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
248 UBNT_UNIFIOD_2ND_PHYMASK));
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);
255 ap91_pci_init(ee, NULL);
257 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio),
258 ubnt_unifi_outdoor_leds_gpio);
260 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
261 ARRAY_SIZE(ubnt_xm_gpio_keys),
265 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR, "UBNT-U20",
266 "Ubiquiti UniFiAP Outdoor",
267 ubnt_unifi_outdoor_setup);
270 static void __init ubnt_unifi_outdoor_plus_setup(void)
272 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
273 u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
274 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
276 ath79_register_m25p80(NULL);
278 ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
279 UBNT_UNIFIOD_2ND_PHYMASK));
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);
286 ap9x_pci_get_wmac_data(0)->ubnt_hsr = true;
287 ap91_pci_init(ee, NULL);
289 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio),
290 ubnt_unifi_outdoor_plus_leds_gpio);
292 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
293 ARRAY_SIZE(ubnt_xm_gpio_keys),
297 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, "UBNT-UOP",
298 "Ubiquiti UniFiAP Outdoor+",
299 ubnt_unifi_outdoor_plus_setup);
302 static struct gpio_led ubnt_uap_pro_gpio_leds[] __initdata = {
304 .name = "ubnt:white:dome",
307 .name = "ubnt:blue:dome",
312 static struct gpio_keys_button uap_pro_gpio_keys[] __initdata = {
317 .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
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,
331 static struct ar8327_platform_data uap_pro_ar8327_data = {
332 .pad0_cfg = &uap_pro_ar8327_pad0_cfg,
335 .speed = AR8327_PORT_SPEED_1000,
342 static struct mdio_board_info uap_pro_mdio0_info[] = {
344 .bus_id = "ag71xx-mdio.0",
346 .platform_data = &uap_pro_ar8327_data,
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
355 static void __init ubnt_uap_pro_setup(void)
357 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
359 ath79_register_m25p80(NULL);
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),
367 ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
368 ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
370 ath79_register_mdio(0, 0x0);
371 mdiobus_register_board_info(uap_pro_mdio0_info,
372 ARRAY_SIZE(uap_pro_mdio0_info));
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);
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);
386 MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro",
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
394 static struct gpio_led ubnt_xw_leds_gpio[] __initdata = {
396 .name = "ubnt:red:link1",
397 .gpio = UBNT_XW_GPIO_LED_L1,
400 .name = "ubnt:orange:link2",
401 .gpio = UBNT_XW_GPIO_LED_L2,
404 .name = "ubnt:green:link3",
405 .gpio = UBNT_XW_GPIO_LED_L3,
408 .name = "ubnt:green:link4",
409 .gpio = UBNT_XW_GPIO_LED_L4,
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 = {
422 .name = "ubnt:green:link1",
423 .gpio = UBNT_ROCKET_TI_GPIO_LED_L1,
426 .name = "ubnt:green:link2",
427 .gpio = UBNT_ROCKET_TI_GPIO_LED_L2,
430 .name = "ubnt:green:link3",
431 .gpio = UBNT_ROCKET_TI_GPIO_LED_L3,
434 .name = "ubnt:green:link4",
435 .gpio = UBNT_ROCKET_TI_GPIO_LED_L4,
438 .name = "ubnt:green:link5",
439 .gpio = UBNT_ROCKET_TI_GPIO_LED_L5,
442 .name = "ubnt:green:link6",
443 .gpio = UBNT_ROCKET_TI_GPIO_LED_L6,
448 static void __init ubnt_xw_init(void)
450 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
452 ath79_register_m25p80(NULL);
454 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
456 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
457 ARRAY_SIZE(ubnt_xm_gpio_keys),
460 ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
461 ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
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);
468 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
469 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
472 static void __init ubnt_nano_m_xw_setup(void)
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);
484 static struct at803x_platform_data ubnt_loco_m_xw_at803x_data = {
489 static struct mdio_board_info ubnt_loco_m_xw_mdio_info[] = {
491 .bus_id = "ag71xx-mdio.0",
493 .platform_data = &ubnt_loco_m_xw_at803x_data,
497 static void __init ubnt_loco_m_xw_setup(void)
501 mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info,
502 ARRAY_SIZE(ubnt_loco_m_xw_mdio_info));
504 ath79_register_mdio(0, ~BIT(1));
505 ath79_eth0_data.phy_mask = BIT(1);
506 ath79_register_eth(0);
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
513 static struct gpio_led ubnt_lbe_m5_leds_gpio[] __initdata = {
515 .name = "ubnt:green:lan",
516 .gpio = UBNT_LBE_M5_GPIO_LED_LAN,
519 .name = "ubnt:green:wlan",
520 .gpio = UBNT_LBE_M5_GPIO_LED_WLAN,
523 .name = "ubnt:green:sys",
524 .gpio = UBNT_LBE_M5_GPIO_LED_SYS,
529 static void __init ubnt_lbe_m5_setup(void)
531 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
533 ath79_register_m25p80(NULL);
535 ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
536 ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
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),
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);
549 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
550 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
552 gpio_request_one(0, GPIOF_OUT_INIT_LOW | GPIOF_ACTIVE_LOW |
553 GPIOF_EXPORT_DIR_FIXED, "SPI nWP");
555 mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info,
556 ARRAY_SIZE(ubnt_loco_m_xw_mdio_info));
558 ath79_register_mdio(0, ~BIT(1));
559 ath79_eth0_data.phy_mask = BIT(1);
560 ath79_register_eth(0);
563 static void __init ubnt_rocket_m_xw_setup(void)
565 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
567 ath79_register_m25p80(NULL);
569 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
571 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
572 ARRAY_SIZE(ubnt_xm_gpio_keys),
575 ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
576 ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
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);
582 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
583 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
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);
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,
596 static struct mdio_board_info ubnt_rocket_m_ti_mdio_info[] = {
598 .bus_id = "ag71xx-mdio.0",
600 .platform_data = &ubnt_rocket_m_ti_at803_data,
604 static void __init ubnt_rocket_m_ti_setup(void)
606 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
608 ath79_register_m25p80(NULL);
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),
616 ap91_pci_init(eeprom + 0x1000, NULL);
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);
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;
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);
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);
641 ath79_register_mdio(1, 0x0);
642 ath79_eth1_data.phy_mask = BIT(3);
643 ath79_register_eth(1);
647 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
648 ubnt_nano_m_xw_setup);
650 MIPS_MACHINE(ATH79_MACH_UBNT_LBE_M5, "UBNT-LBE-M5", "Ubiquiti Litebeam M5",
653 MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
654 ubnt_loco_m_xw_setup);
656 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
657 ubnt_rocket_m_xw_setup);
659 MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M_XW, "UBNT-BM-XW", "Ubiquiti Bullet M XW",
660 ubnt_rocket_m_xw_setup);
662 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
663 ubnt_rocket_m_ti_setup);
665 static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
667 .name = "ubnt:blue:wlan",
670 .name = "ubnt:white:status",
675 static struct gpio_keys_button airgateway_gpio_keys[] __initdata = {
680 .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
686 static void __init ubnt_airgateway_setup(void)
689 u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
690 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
691 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
694 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
695 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
696 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
697 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
698 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
700 t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
701 t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
702 ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
704 ath79_register_m25p80(NULL);
705 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds),
706 ubnt_airgateway_gpio_leds);
708 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
709 ARRAY_SIZE(airgateway_gpio_keys),
710 airgateway_gpio_keys);
712 ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
713 ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
715 ath79_register_mdio(0, 0x0);
717 ath79_register_eth(1);
718 ath79_register_eth(0);
720 ath79_register_wmac(ee, NULL);
723 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
724 ubnt_airgateway_setup);
726 static struct gpio_led ubnt_airgateway_pro_gpio_leds[] __initdata = {
728 .name = "ubnt:blue:wlan",
731 .name = "ubnt:white:status",
737 static struct gpio_keys_button airgateway_pro_gpio_keys[] __initdata = {
742 .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
748 static void __init ubnt_airgateway_pro_setup(void)
750 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
751 u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
753 ath79_register_m25p80(NULL);
754 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds),
755 ubnt_airgateway_pro_gpio_leds);
757 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
758 ARRAY_SIZE(airgateway_pro_gpio_keys),
759 airgateway_pro_gpio_keys);
761 ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
762 ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
765 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
767 ath79_register_mdio(1, 0x0);
769 /* GMAC0 is left unused in this configuration */
771 /* GMAC1 is connected to MAC0 on the internal switch */
772 /* The PoE/WAN port connects to port 5 on the internal switch */
773 /* The LAN port connects to port 4 on the internal switch */
774 ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
775 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
776 ath79_register_eth(1);
780 MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
781 ubnt_airgateway_pro_setup);