ar71xx: add support for ubnt rocket-m ti
[openwrt.git] / target / linux / ar71xx / patches-3.18 / 904-MIPS-ath79-ubnt-rocket-m-ti-supprt.patch
1 Index: linux-3.18.14/arch/mips/ath79/mach-ubnt-xm.c
2 ===================================================================
3 --- linux-3.18.14.orig/arch/mips/ath79/mach-ubnt-xm.c
4 +++ linux-3.18.14/arch/mips/ath79/mach-ubnt-xm.c
5 @@ -21,6 +21,8 @@
6  #include <asm/mach-ath79/irq.h>
7  #include <asm/mach-ath79/ar71xx_regs.h>
8  
9 +#include <linux/platform_data/phy-at803x.h>
10 +
11  #include "common.h"
12  #include "dev-ap9x-pci.h"
13  #include "dev-eth.h"
14 @@ -404,6 +406,40 @@ static struct gpio_led ubnt_xw_leds_gpio
15         },
16  };
17  
18 +#define UBNT_ROCKET_TI_GPIO_LED_L1     16
19 +#define UBNT_ROCKET_TI_GPIO_LED_L2     17
20 +#define UBNT_ROCKET_TI_GPIO_LED_L3     18
21 +#define UBNT_ROCKET_TI_GPIO_LED_L4     19
22 +#define UBNT_ROCKET_TI_GPIO_LED_L5     20
23 +#define UBNT_ROCKET_TI_GPIO_LED_L6     21
24 +static struct gpio_led ubnt_rocket_ti_leds_gpio[] __initdata = {
25 +       {
26 +               .name           = "ubnt:green:link1",
27 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L1,
28 +               .active_low     = 1,
29 +       }, {
30 +               .name           = "ubnt:green:link2",
31 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L2,
32 +               .active_low     = 1,
33 +       }, {
34 +               .name           = "ubnt:green:link3",
35 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L3,
36 +               .active_low     = 1,
37 +       }, {
38 +               .name           = "ubnt:green:link4",
39 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L4,
40 +               .active_low     = 0,
41 +       }, {
42 +               .name           = "ubnt:green:link5",
43 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L5,
44 +               .active_low     = 0,
45 +       }, {
46 +               .name           = "ubnt:green:link6",
47 +               .gpio           = UBNT_ROCKET_TI_GPIO_LED_L6,
48 +               .active_low     = 0,
49 +       },
50 +};
51 +
52  static void __init ubnt_xw_init(void)
53  {
54         u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
55 @@ -477,6 +513,62 @@ static void __init ubnt_rocket_m_xw_setu
56         ath79_register_eth(0);
57  }
58  
59 +static struct at803x_platform_data ubnt_rocket_m_ti_at803_data = {
60 +       .disable_smarteee = 1,
61 +       .enable_rgmii_rx_delay = 1,
62 +       .enable_rgmii_tx_delay = 1,
63 +};
64 +static struct mdio_board_info ubnt_rocket_m_ti_mdio_info[] = {
65 +        {
66 +                .bus_id = "ag71xx-mdio.0",
67 +                .phy_addr = 4,
68 +                .platform_data = &ubnt_rocket_m_ti_at803_data,
69 +        },
70 +};
71 +
72 +static void __init ubnt_rocket_m_ti_setup(void)
73 +{
74 +       u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
75 +
76 +       ath79_register_m25p80(NULL);
77 +
78 +       ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio),
79 +                                ubnt_rocket_ti_leds_gpio);
80 +       ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
81 +                                        ARRAY_SIZE(ubnt_xm_gpio_keys),
82 +                                        ubnt_xm_gpio_keys);
83 +
84 +       ap91_pci_init(eeprom + 0x1000, NULL);
85 +
86 +       ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0);
87 +       ath79_setup_ar934x_eth_rx_delay(3, 3);
88 +       ath79_init_mac(ath79_eth0_data.mac_addr,
89 +                      eeprom + UAP_PRO_MAC0_OFFSET, 0);
90 +       ath79_init_mac(ath79_eth1_data.mac_addr,
91 +                      eeprom + UAP_PRO_MAC1_OFFSET, 0);
92 +
93 +       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
94 +       ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
95 +       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
96 +       ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev;
97 +       
98 +       mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info,
99 +                       ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info));
100 +       ath79_register_mdio(0, 0x0);
101 +
102 +
103 +       ath79_eth0_data.phy_mask = BIT(4);
104 +       /* read out from vendor */
105 +       ath79_eth0_pll_data.pll_1000 = 0x2000000;
106 +       ath79_eth0_pll_data.pll_10 = 0x1313;
107 +       ath79_register_eth(0);
108 +
109 +       ath79_register_mdio(1, 0x0);
110 +       ath79_eth1_data.phy_mask = BIT(3);
111 +       ath79_register_eth(1);
112 +}
113 +
114 +
115  MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
116              ubnt_nano_m_xw_setup);
117  
118 @@ -486,6 +578,9 @@ MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW,
119  MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
120              ubnt_rocket_m_xw_setup);
121  
122 +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI",
123 +            ubnt_rocket_m_ti_setup);
124 +
125  static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = {
126         {
127                 .name      = "ubnt:blue:wlan",
128 Index: linux-3.18.14/arch/mips/ath79/machtypes.h
129 ===================================================================
130 --- linux-3.18.14.orig/arch/mips/ath79/machtypes.h
131 +++ linux-3.18.14/arch/mips/ath79/machtypes.h
132 @@ -172,6 +172,7 @@ enum ath79_mach_type {
133         ATH79_MACH_UBNT_NANO_M_XW,      /* Ubiquiti NanoStation M XW */
134         ATH79_MACH_UBNT_ROCKET_M,       /* Ubiquiti Rocket M */
135         ATH79_MACH_UBNT_ROCKET_M_XW,    /* Ubiquiti Rocket M XW*/
136 +       ATH79_MACH_UBNT_ROCKET_M_TI,    /* Ubiquiti Rocket M TI*/
137         ATH79_MACH_UBNT_RSPRO,          /* Ubiquiti RouterStation Pro */
138         ATH79_MACH_UBNT_RS,             /* Ubiquiti RouterStation */
139         ATH79_MACH_UBNT_UAP_PRO,        /* Ubiquiti UniFi AP Pro */