8a1c770ba5cbb77426982e05c27c59f06eaf43cd
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.6 / 613-MIPS-ath79-ubnt-xm-add-unifi-outdoor.patch
1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
3 @@ -170,6 +170,19 @@ static struct gpio_led ubnt_unifi_leds_g
4 }
5 };
6
7 +static struct gpio_led ubnt_unifi_outdoor_leds_gpio[] __initdata = {
8 + {
9 + .name = "ubnt:orange:front",
10 + .gpio = 1,
11 + .active_low = 0,
12 + }, {
13 + .name = "ubnt:green:front",
14 + .gpio = 0,
15 + .active_low = 0,
16 + }
17 +};
18 +
19 +
20 static void __init ubnt_unifi_setup(void)
21 {
22 u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
23 @@ -194,3 +207,33 @@ static void __init ubnt_unifi_setup(void
24
25 MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
26 ubnt_unifi_setup);
27 +
28 +
29 +#define UBNT_UNIFIOD_PRI_PHYMASK BIT(4)
30 +#define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
31 +
32 +static void __init ubnt_unifi_outdoor_setup(void)
33 +{
34 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
35 + u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
36 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
37 +
38 + ath79_register_m25p80(NULL);
39 +
40 + ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK |
41 + UBNT_UNIFIOD_2ND_PHYMASK));
42 +
43 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
44 + ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
45 + ath79_register_eth(0);
46 + ath79_register_eth(1);
47 +
48 + ap91_pci_init(ee, NULL);
49 +
50 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio),
51 + ubnt_unifi_outdoor_leds_gpio);
52 +}
53 +
54 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR, "UBNT-U20",
55 + "Ubiquiti UniFiAP Outdoor",
56 + ubnt_unifi_outdoor_setup);
57 --- a/arch/mips/ath79/machtypes.h
58 +++ b/arch/mips/ath79/machtypes.h
59 @@ -97,6 +97,7 @@ enum ath79_mach_type {
60 ATH79_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */
61 ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */
62 ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
63 + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
64 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
65 ATH79_MACH_WHR_G301N, /* Buffalo WHR-G301N */
66 ATH79_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */