ar71xx: add support for linux 4.4
[openwrt.git] / target / linux / ar71xx / patches-4.4 / 610-MIPS-ath79-UBNT-add-airGateway-pro-support.patch
1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
3 @@ -642,3 +642,59 @@ static void __init ubnt_airgateway_setup
4  MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
5              ubnt_airgateway_setup);
6  
7 +static struct gpio_led ubnt_airgateway_pro_gpio_leds[] __initdata = {
8 +       {
9 +               .name      = "ubnt:blue:wlan",
10 +               .gpio      = 13,
11 +       }, {
12 +               .name      = "ubnt:white:status",
13 +               .gpio      = 17,
14 +       },
15 +};
16 +
17 +
18 +static struct gpio_keys_button airgateway_pro_gpio_keys[] __initdata = {
19 +       {
20 +               .desc           = "reset",
21 +               .type           = EV_KEY,
22 +               .code           = KEY_RESTART,
23 +               .debounce_interval      = UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
24 +               .gpio           = 12,
25 +               .active_low     = 1,
26 +       }
27 +};
28 +
29 +static void __init ubnt_airgateway_pro_setup(void)
30 +{
31 +       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
32 +       u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
33 +
34 +       ath79_register_m25p80(NULL);
35 +       ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds),
36 +                                ubnt_airgateway_pro_gpio_leds);
37 +
38 +       ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
39 +                                       ARRAY_SIZE(airgateway_pro_gpio_keys),
40 +                                       airgateway_pro_gpio_keys);
41 +
42 +       ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
43 +       ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
44 +
45 +
46 +       ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
47 +
48 +       ath79_register_mdio(1, 0x0);
49 +
50 +       /* GMAC0 is left unused in this configuration */
51 +
52 +       /* GMAC1 is connected to MAC0 on the internal switch */
53 +       /* The PoE/WAN port connects to port 5 on the internal switch */
54 +       /* The LAN port connects to port 4 on the internal switch */
55 +       ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
56 +       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
57 +       ath79_register_eth(1);
58 +
59 +}
60 +
61 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
62 +            ubnt_airgateway_pro_setup);