ar71xx: merge board specific patches into one
[openwrt/staging/chunkeey.git] / target / linux / ar71xx / patches-3.14 / 722-MIPS-ath79-add-airGateway-support.patch
1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
3 @@ -17,9 +17,11 @@
4 #include <linux/etherdevice.h>
5 #include <linux/ar8216_platform.h>
6
7 +#include <asm/mach-ath79/ath79.h>
8 #include <asm/mach-ath79/irq.h>
9 #include <asm/mach-ath79/ar71xx_regs.h>
10
11 +#include "common.h"
12 #include "dev-ap9x-pci.h"
13 #include "dev-eth.h"
14 #include "dev-gpio-buttons.h"
15 @@ -452,3 +454,65 @@ MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW,
16
17 MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW",
18 ubnt_loco_m_xw_setup);
19 +
20 +static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
21 + {
22 + .name = "ubnt:blue:wlan",
23 + .gpio = 0,
24 + }, {
25 + .name = "ubnt:white:status",
26 + .gpio = 1,
27 + },
28 +};
29 +
30 +static struct gpio_keys_button airgateway_gpio_keys[] __initdata = {
31 + {
32 + .desc = "reset",
33 + .type = EV_KEY,
34 + .code = KEY_RESTART,
35 + .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
36 + .gpio = 12,
37 + .active_low = 1,
38 + }
39 +};
40 +
41 +static void __init ubnt_airgateway_setup(void)
42 +{
43 + u32 t;
44 + u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
45 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
46 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
47 +
48 +
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);
54 +
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);
58 +
59 + ath79_register_m25p80(NULL);
60 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds),
61 + ubnt_airgateway_gpio_leds);
62 +
63 + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
64 + ARRAY_SIZE(airgateway_gpio_keys),
65 + airgateway_gpio_keys);
66 +
67 + ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
68 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
69 +
70 + ath79_register_mdio(0, 0x0);
71 +
72 + ath79_register_eth(1);
73 + ath79_register_eth(0);
74 +
75 + ath79_register_wmac(ee, NULL);
76 +}
77 +
78 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
79 + ubnt_airgateway_setup);
80 +