ar71xx: ar934x_nfc: allow to control DMA data swap via platform data
[openwrt.git] / target / linux / ar71xx / patches-3.6 / 608-MIPS-ath79-ubnt-xm-add-more-boards.patch
1 --- a/arch/mips/ath79/mach-ubnt-xm.c
2 +++ b/arch/mips/ath79/mach-ubnt-xm.c
3 @@ -13,15 +13,17 @@
4  #include <linux/init.h>
5  #include <linux/pci.h>
6  #include <linux/ath9k_platform.h>
7 +#include <linux/etherdevice.h>
8  
9  #include <asm/mach-ath79/irq.h>
10  
11  #include "dev-ap9x-pci.h"
12 +#include "dev-eth.h"
13  #include "dev-gpio-buttons.h"
14  #include "dev-leds-gpio.h"
15  #include "dev-m25p80.h"
16 +#include "dev-usb.h"
17  #include "machtypes.h"
18 -#include "pci.h"
19  
20  #define UBNT_XM_GPIO_LED_L1            0
21  #define UBNT_XM_GPIO_LED_L2            1
22 @@ -37,19 +39,19 @@
23  
24  static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
25         {
26 -               .name           = "ubnt-xm:red:link1",
27 +               .name           = "ubnt:red:link1",
28                 .gpio           = UBNT_XM_GPIO_LED_L1,
29                 .active_low     = 0,
30         }, {
31 -               .name           = "ubnt-xm:orange:link2",
32 +               .name           = "ubnt:orange:link2",
33                 .gpio           = UBNT_XM_GPIO_LED_L2,
34                 .active_low     = 0,
35         }, {
36 -               .name           = "ubnt-xm:green:link3",
37 +               .name           = "ubnt:green:link3",
38                 .gpio           = UBNT_XM_GPIO_LED_L3,
39                 .active_low     = 0,
40         }, {
41 -               .name           = "ubnt-xm:green:link4",
42 +               .name           = "ubnt:green:link4",
43                 .gpio           = UBNT_XM_GPIO_LED_L4,
44                 .active_low     = 0,
45         },
46 @@ -66,9 +68,13 @@ static struct gpio_keys_button ubnt_xm_g
47         }
48  };
49  
50 +#define UBNT_M_WAN_PHYMASK     BIT(4)
51 +
52  static void __init ubnt_xm_init(void)
53  {
54         u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR);
55 +       u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
56 +       u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
57  
58         ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
59                                  ubnt_xm_leds_gpio);
60 @@ -79,9 +85,112 @@ static void __init ubnt_xm_init(void)
61  
62         ath79_register_m25p80(NULL);
63         ap91_pci_init(eeprom, NULL);
64 +
65 +       ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
66 +       ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
67 +       ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
68 +       ath79_register_eth(0);
69  }
70  
71  MIPS_MACHINE(ATH79_MACH_UBNT_XM,
72              "UBNT-XM",
73              "Ubiquiti Networks XM (rev 1.0) board",
74              ubnt_xm_init);
75 +
76 +MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M",
77 +            ubnt_xm_init);
78 +
79 +static void __init ubnt_rocket_m_setup(void)
80 +{
81 +       ubnt_xm_init();
82 +       ath79_register_usb();
83 +}
84 +
85 +MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M",
86 +            ubnt_rocket_m_setup);
87 +
88 +static void __init ubnt_nano_m_setup(void)
89 +{
90 +       ubnt_xm_init();
91 +       ath79_register_eth(1);
92 +}
93 +
94 +MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M",
95 +            ubnt_nano_m_setup);
96 +
97 +static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = {
98 +       {
99 +               .name           = "ubnt:green:globe",
100 +               .gpio           = 0,
101 +               .active_low     = 1,
102 +       }, {
103 +               .name           = "ubnt:green:power",
104 +               .gpio           = 11,
105 +               .active_low     = 1,
106 +               .default_state  = LEDS_GPIO_DEFSTATE_ON,
107 +       }
108 +};
109 +
110 +static void __init ubnt_airrouter_setup(void)
111 +{
112 +       u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
113 +       u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
114 +
115 +       ath79_register_m25p80(NULL);
116 +       ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
117 +
118 +       ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
119 +       ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
120 +
121 +       ath79_register_eth(1);
122 +       ath79_register_eth(0);
123 +       ath79_register_usb();
124 +
125 +       ap91_pci_init(ee, NULL);
126 +       ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
127 +                                ubnt_airrouter_leds_gpio);
128 +
129 +       ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
130 +                                        ARRAY_SIZE(ubnt_xm_gpio_keys),
131 +                                        ubnt_xm_gpio_keys);
132 +}
133 +
134 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
135 +            ubnt_airrouter_setup);
136 +
137 +static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
138 +       {
139 +               .name           = "ubnt:orange:dome",
140 +               .gpio           = 1,
141 +               .active_low     = 0,
142 +       }, {
143 +               .name           = "ubnt:green:dome",
144 +               .gpio           = 0,
145 +               .active_low     = 0,
146 +       }
147 +};
148 +
149 +static void __init ubnt_unifi_setup(void)
150 +{
151 +       u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
152 +       u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
153 +
154 +       ath79_register_m25p80(NULL);
155 +
156 +       ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
157 +
158 +       ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
159 +       ath79_register_eth(0);
160 +
161 +       ap91_pci_init(ee, NULL);
162 +
163 +       ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
164 +                                ubnt_unifi_leds_gpio);
165 +
166 +       ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
167 +                                        ARRAY_SIZE(ubnt_xm_gpio_keys),
168 +                                        ubnt_xm_gpio_keys);
169 +}
170 +
171 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
172 +            ubnt_unifi_setup);
173 --- a/arch/mips/ath79/Kconfig
174 +++ b/arch/mips/ath79/Kconfig
175 @@ -71,9 +71,11 @@ config ATH79_MACH_UBNT_XM
176         bool "Ubiquiti Networks XM (rev 1.0) board"
177         select SOC_AR724X
178         select ATH79_DEV_AP9X_PCI if PCI
179 +       select ATH79_DEV_ETH
180         select ATH79_DEV_GPIO_BUTTONS
181         select ATH79_DEV_LEDS_GPIO
182         select ATH79_DEV_M25P80
183 +       select ATH79_DEV_USB
184         help
185           Say 'Y' here if you want your kernel to support the
186           Ubiquiti Networks XM (rev 1.0) board.
187 --- a/arch/mips/ath79/machtypes.h
188 +++ b/arch/mips/ath79/machtypes.h
189 @@ -22,6 +22,11 @@ enum ath79_mach_type {
190         ATH79_MACH_AP81,                /* Atheros AP81 reference board */
191         ATH79_MACH_DB120,               /* Atheros DB120 reference board */
192         ATH79_MACH_PB44,                /* Atheros PB44 reference board */
193 +       ATH79_MACH_UBNT_AIRROUTER,      /* Ubiquiti AirRouter */
194 +       ATH79_MACH_UBNT_BULLET_M,       /* Ubiquiti Bullet M */
195 +       ATH79_MACH_UBNT_NANO_M,         /* Ubiquiti NanoStation M */
196 +       ATH79_MACH_UBNT_ROCKET_M,       /* Ubiquiti Rocket M */
197 +       ATH79_MACH_UBNT_UNIFI,          /* Ubiquiti Unifi */
198         ATH79_MACH_UBNT_XM,             /* Ubiquiti Networks XM board rev 1.0 */
199  };
200