ramips: use gpio-keys-polled instead of gpio-buttons
[openwrt.git] / target / linux / ar71xx / patches-3.2 / 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,99 @@ 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 +};
104 +
105 +static void __init ubnt_airrouter_setup(void)
106 +{
107 + u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
108 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
109 +
110 + ath79_register_m25p80(NULL);
111 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
112 +
113 + ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
114 + ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1);
115 +
116 + ath79_register_eth(1);
117 + ath79_register_eth(0);
118 + ath79_register_usb();
119 +
120 + ap91_pci_init(ee, NULL);
121 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio),
122 + ubnt_airrouter_leds_gpio);
123 +}
124 +
125 +MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter",
126 + ubnt_airrouter_setup);
127 +
128 +static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = {
129 + {
130 + .name = "ubnt:orange:dome",
131 + .gpio = 1,
132 + .active_low = 0,
133 + }, {
134 + .name = "ubnt:green:dome",
135 + .gpio = 0,
136 + .active_low = 0,
137 + }
138 +};
139 +
140 +static void __init ubnt_unifi_setup(void)
141 +{
142 + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
143 + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
144 +
145 + ath79_register_m25p80(NULL);
146 +
147 + ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK);
148 +
149 + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
150 + ath79_register_eth(0);
151 +
152 + ap91_pci_init(ee, NULL);
153 +
154 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio),
155 + ubnt_unifi_leds_gpio);
156 +}
157 +
158 +MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi",
159 + ubnt_unifi_setup);
160 --- a/arch/mips/ath79/Kconfig
161 +++ b/arch/mips/ath79/Kconfig
162 @@ -58,9 +58,11 @@ config ATH79_MACH_UBNT_XM
163 bool "Ubiquiti Networks XM (rev 1.0) board"
164 select SOC_AR724X
165 select ATH79_DEV_AP9X_PCI if PCI
166 + select ATH79_DEV_ETH
167 select ATH79_DEV_GPIO_BUTTONS
168 select ATH79_DEV_LEDS_GPIO
169 select ATH79_DEV_M25P80
170 + select ATH79_DEV_USB
171 help
172 Say 'Y' here if you want your kernel to support the
173 Ubiquiti Networks XM (rev 1.0) board.
174 --- a/arch/mips/ath79/machtypes.h
175 +++ b/arch/mips/ath79/machtypes.h
176 @@ -21,6 +21,11 @@ enum ath79_mach_type {
177 ATH79_MACH_AP81, /* Atheros AP81 reference board */
178 ATH79_MACH_DB120, /* Atheros DB120 reference board */
179 ATH79_MACH_PB44, /* Atheros PB44 reference board */
180 + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */
181 + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
182 + ATH79_MACH_UBNT_NANO_M, /* Ubiquiti NanoStation M */
183 + ATH79_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */
184 + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
185 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
186 };
187
This page took 0.05594 seconds and 5 git commands to generate.