1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
4 #include <linux/init.h>
6 #include <linux/ath9k_platform.h>
7 +#include <linux/etherdevice.h>
9 #include <asm/mach-ath79/irq.h>
11 #include "dev-ap9x-pci.h"
13 #include "dev-gpio-buttons.h"
14 #include "dev-leds-gpio.h"
15 #include "dev-m25p80.h"
17 #include "machtypes.h"
20 #define UBNT_XM_GPIO_LED_L1 0
21 #define UBNT_XM_GPIO_LED_L2 1
24 static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
26 - .name = "ubnt-xm:red:link1",
27 + .name = "ubnt:red:link1",
28 .gpio = UBNT_XM_GPIO_LED_L1,
31 - .name = "ubnt-xm:orange:link2",
32 + .name = "ubnt:orange:link2",
33 .gpio = UBNT_XM_GPIO_LED_L2,
36 - .name = "ubnt-xm:green:link3",
37 + .name = "ubnt:green:link3",
38 .gpio = UBNT_XM_GPIO_LED_L3,
41 - .name = "ubnt-xm:green:link4",
42 + .name = "ubnt:green:link4",
43 .gpio = UBNT_XM_GPIO_LED_L4,
46 @@ -66,9 +68,13 @@ static struct gpio_keys_button ubnt_xm_g
50 +#define UBNT_M_WAN_PHYMASK BIT(4)
52 static void __init ubnt_xm_init(void)
54 u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR);
55 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
56 + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
58 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
60 @@ -79,9 +85,99 @@ static void __init ubnt_xm_init(void)
62 ath79_register_m25p80(NULL);
63 ap91_pci_init(eeprom, NULL);
65 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
66 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
67 + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
68 + ath79_register_eth(0);
71 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
73 "Ubiquiti Networks XM (rev 1.0) board",
76 +MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M",
79 +static void __init ubnt_rocket_m_setup(void)
82 + ath79_register_usb();
85 +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M",
86 + ubnt_rocket_m_setup);
88 +static void __init ubnt_nano_m_setup(void)
91 + ath79_register_eth(1);
94 +MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M",
97 +static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = {
99 + .name = "ubnt:green:globe",
105 +static void __init ubnt_airrouter_setup(void)
107 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
108 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
110 + ath79_register_m25p80(NULL);
111 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
113 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
114 + ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
116 + ath79_register_eth(1);
117 + ath79_register_eth(0);
118 + ath79_register_usb();
120 + ap91_pci_init(ee, NULL);
121 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
122 + ubnt_airrouter_leds_gpio);
125 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
126 + ubnt_airrouter_setup);
128 +static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
130 + .name = "ubnt:orange:dome",
134 + .name = "ubnt:green:dome",
140 +static void __init ubnt_unifi_setup(void)
142 + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
143 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
145 + ath79_register_m25p80(NULL);
147 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
149 + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
150 + ath79_register_eth(0);
152 + ap91_pci_init(ee, NULL);
154 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
155 + ubnt_unifi_leds_gpio);
158 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
160 --- a/arch/mips/ath79/Kconfig
161 +++ b/arch/mips/ath79/Kconfig
162 @@ -58,9 +58,11 @@ config ATH79_MACH_UBNT_XM
163 bool "Ubiquiti Networks XM (rev 1.0) board"
165 select ATH79_DEV_AP9X_PCI if PCI
166 + select ATH79_DEV_ETH
167 select ATH79_DEV_GPIO_BUTTONS
168 select ATH79_DEV_LEDS_GPIO
169 select ATH79_DEV_M25P80
170 + select ATH79_DEV_USB
172 Say 'Y' here if you want your kernel to support the
173 Ubiquiti Networks XM (rev 1.0) board.
174 --- a/arch/mips/ath79/machtypes.h
175 +++ b/arch/mips/ath79/machtypes.h
176 @@ -21,6 +21,11 @@ enum ath79_mach_type {
177 ATH79_MACH_AP81, /* Atheros AP81 reference board */
178 ATH79_MACH_DB120, /* Atheros DB120 reference board */
179 ATH79_MACH_PB44, /* Atheros PB44 reference board */
180 + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
181 + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
182 + ATH79_MACH_UBNT_NANO_M, /* Ubiquiti NanoStation M */
183 + ATH79_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */
184 + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
185 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */