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,112 @@ 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",
103 + .name = "ubnt:green:power",
106 + .default_state = LEDS_GPIO_DEFSTATE_ON,
110 +static void __init ubnt_airrouter_setup(void)
112 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
113 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
115 + ath79_register_m25p80(NULL);
116 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
118 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
119 + ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
121 + ath79_register_eth(1);
122 + ath79_register_eth(0);
123 + ath79_register_usb();
125 + ap91_pci_init(ee, NULL);
126 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
127 + ubnt_airrouter_leds_gpio);
129 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
130 + ARRAY_SIZE(ubnt_xm_gpio_keys),
131 + ubnt_xm_gpio_keys);
134 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
135 + ubnt_airrouter_setup);
137 +static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
139 + .name = "ubnt:orange:dome",
143 + .name = "ubnt:green:dome",
149 +static void __init ubnt_unifi_setup(void)
151 + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
152 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
154 + ath79_register_m25p80(NULL);
156 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
158 + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
159 + ath79_register_eth(0);
161 + ap91_pci_init(ee, NULL);
163 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
164 + ubnt_unifi_leds_gpio);
166 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
167 + ARRAY_SIZE(ubnt_xm_gpio_keys),
168 + ubnt_xm_gpio_keys);
171 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
173 --- a/arch/mips/ath79/Kconfig
174 +++ b/arch/mips/ath79/Kconfig
175 @@ -71,9 +71,11 @@ config ATH79_MACH_UBNT_XM
176 bool "Ubiquiti Networks XM (rev 1.0) board"
178 select ATH79_DEV_AP9X_PCI if PCI
179 + select ATH79_DEV_ETH
180 select ATH79_DEV_GPIO_BUTTONS
181 select ATH79_DEV_LEDS_GPIO
182 select ATH79_DEV_M25P80
183 + select ATH79_DEV_USB
185 Say 'Y' here if you want your kernel to support the
186 Ubiquiti Networks XM (rev 1.0) board.
187 --- a/arch/mips/ath79/machtypes.h
188 +++ b/arch/mips/ath79/machtypes.h
189 @@ -22,6 +22,11 @@ enum ath79_mach_type {
190 ATH79_MACH_AP81, /* Atheros AP81 reference board */
191 ATH79_MACH_DB120, /* Atheros DB120 reference board */
192 ATH79_MACH_PB44, /* Atheros PB44 reference board */
193 + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
194 + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
195 + ATH79_MACH_UBNT_NANO_M, /* Ubiquiti NanoStation M */
196 + ATH79_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */
197 + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
198 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */