ar71xx: Add UBNT airGateway support
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.10 / 722-MIPS-ath79-add-airGateway-support.patch
1 --- a/arch/mips/ath79/mach-ubnt-xm.c 2014-07-18 02:43:23.110693216 +0000
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c 2014-07-18 03:20:28.542701485 +0000
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 @@ -389,3 +391,50 @@ static void __init ubnt_nano_m_xw_setup(
16
17 MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
18 ubnt_nano_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 void __init ubnt_airgateway_setup(void)
31 +{
32 + u32 t;
33 + u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
34 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
35 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
36 +
37 +
38 + ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
39 + AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
40 + AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
41 + AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
42 + AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
43 +
44 + t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
45 + t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
46 + ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
47 +
48 + ath79_register_m25p80(NULL);
49 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds),
50 + ubnt_airgateway_gpio_leds);
51 +
52 + ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
53 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
54 +
55 + ath79_register_mdio(0, 0x0);
56 +
57 + ath79_register_eth(1);
58 + ath79_register_eth(0);
59 +
60 + ath79_register_wmac(ee, NULL);
61 +}
62 +
63 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
64 + ubnt_airgateway_setup);
65 +
66 --- a/arch/mips/ath79/machtypes.h 2014-07-18 02:45:30.590693688 +0000
67 +++ b/arch/mips/ath79/machtypes.h 2014-07-18 02:51:02.490694922 +0000
68 @@ -143,6 +143,7 @@ enum ath79_mach_type {
69 ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
70 ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
71 ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
72 + ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
73 ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
74 ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
75 ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */