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