1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
3 @@ -186,6 +186,19 @@ static struct gpio_led ubnt_unifi_outdoo
7 +static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio[] __initdata = {
9 + .name = "ubnt:white:front",
13 + .name = "ubnt:blue:front",
20 static void __init ubnt_unifi_setup(void)
22 u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
23 @@ -245,6 +258,38 @@ MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDO
24 "Ubiquiti UniFiAP Outdoor",
25 ubnt_unifi_outdoor_setup);
28 +static void __init ubnt_unifi_outdoor_plus_setup(void)
30 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
31 + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
32 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
34 + ath79_register_m25p80(NULL);
36 + ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
37 + UBNT_UNIFIOD_2ND_PHYMASK));
39 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
40 + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
41 + ath79_register_eth(0);
42 + ath79_register_eth(1);
44 + ap91_pci_init(ee, NULL);
46 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio),
47 + ubnt_unifi_outdoor_plus_leds_gpio);
49 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
50 + ARRAY_SIZE(ubnt_xm_gpio_keys),
54 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, "UBNT-UOP",
55 + "Ubiquiti UniFiAP Outdoor+",
56 + ubnt_unifi_outdoor_plus_setup);
59 static struct gpio_led ubnt_uap_pro_gpio_leds[] __initdata = {
61 .name = "ubnt:white:dome",
62 @@ -332,3 +377,78 @@ static void __init ubnt_uap_pro_setup(vo
63 MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro",
66 +#define UBNT_XW_GPIO_LED_L1 11
67 +#define UBNT_XW_GPIO_LED_L2 16
68 +#define UBNT_XW_GPIO_LED_L3 13
69 +#define UBNT_XW_GPIO_LED_L4 14
71 +static struct gpio_led ubnt_xw_leds_gpio[] __initdata = {
73 + .name = "ubnt:red:link1",
74 + .gpio = UBNT_XW_GPIO_LED_L1,
77 + .name = "ubnt:orange:link2",
78 + .gpio = UBNT_XW_GPIO_LED_L2,
81 + .name = "ubnt:green:link3",
82 + .gpio = UBNT_XW_GPIO_LED_L3,
85 + .name = "ubnt:green:link4",
86 + .gpio = UBNT_XW_GPIO_LED_L4,
91 +static void __init ubnt_xw_init(void)
93 + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
95 + ath79_register_m25p80(NULL);
97 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
99 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
100 + ARRAY_SIZE(ubnt_xm_gpio_keys),
101 + ubnt_xm_gpio_keys);
103 + ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
104 + ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
107 + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0_SLAVE);
108 + ath79_init_mac(ath79_eth0_data.mac_addr,
109 + eeprom + UAP_PRO_MAC0_OFFSET, 0);
111 + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
112 + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
115 +static void __init ubnt_nano_m_xw_setup(void)
119 + /* GMAC0 is connected to an AR8326 switch */
120 + ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
121 + ath79_eth0_data.phy_mask = (BIT(0) | BIT(1) | BIT(5));
122 + ath79_eth0_data.speed = SPEED_100;
123 + ath79_eth0_data.duplex = DUPLEX_FULL;
124 + ath79_register_eth(0);
127 +static void __init ubnt_loco_m_xw_setup(void)
131 + ath79_register_mdio(0, ~BIT(1));
132 + ath79_eth0_data.phy_mask = BIT(1);
133 + ath79_register_eth(0);
136 +MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
137 + ubnt_nano_m_xw_setup);
139 +MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
140 + ubnt_loco_m_xw_setup);