1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
4 #include <linux/etherdevice.h>
5 #include <linux/ar8216_platform.h>
7 +#include <asm/mach-ath79/ath79.h>
8 #include <asm/mach-ath79/irq.h>
9 #include <asm/mach-ath79/ar71xx_regs.h>
12 #include "dev-ap9x-pci.h"
14 #include "dev-gpio-buttons.h"
15 @@ -389,3 +391,65 @@ static void __init ubnt_nano_m_xw_setup(
17 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
18 ubnt_nano_m_xw_setup);
20 +static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
22 + .name = "ubnt:blue:wlan",
25 + .name = "ubnt:white:status",
30 +static struct gpio_keys_button airgateway_gpio_keys[] __initdata = {
34 + .code = KEY_RESTART,
35 + .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
41 +static void __init ubnt_airgateway_setup(void)
44 + u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
45 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
46 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
49 + ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
50 + AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
51 + AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
52 + AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
53 + AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
55 + t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
56 + t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
57 + ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
59 + ath79_register_m25p80(NULL);
60 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds),
61 + ubnt_airgateway_gpio_leds);
63 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
64 + ARRAY_SIZE(airgateway_gpio_keys),
65 + airgateway_gpio_keys);
67 + ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
68 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
70 + ath79_register_mdio(0, 0x0);
72 + ath79_register_eth(1);
73 + ath79_register_eth(0);
75 + ath79_register_wmac(ee, NULL);
78 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
79 + ubnt_airgateway_setup);
81 --- a/arch/mips/ath79/machtypes.h
82 +++ b/arch/mips/ath79/machtypes.h
83 @@ -143,6 +143,7 @@ enum ath79_mach_type {
84 ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
85 ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
86 ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
87 + ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
88 ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
89 ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
90 ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */