brcm47xx: Add support for kernel 4.9
[openwrt/openwrt.git] / target / linux / brcm47xx / patches-4.9 / 030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch
1 From 36b3b702c20e67b18070159dfba80d2084836928 Mon Sep 17 00:00:00 2001
2 From: Dan Haab <dhaab@luxul.com>
3 Date: Mon, 23 Jan 2017 12:50:38 -0700
4 Subject: [PATCH] MIPS: BCM47XX: Add Luxul devices to the database
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 So far only Luxul XWR-1750 router was supported. This adds a set of
10 other Luxul devices based on BCM47XX. It's a standard support for LEDs
11 and buttons.
12
13 Signed-off-by: Dan Haab <dhaab@luxul.com>
14 Cc: Hauke Mehrtens <hauke@hauke-m.de>
15 Cc: Rafał Miłecki <zajec5@gmail.com>
16 Cc: linux-mips@linux-mips.org
17 Patchwork: https://patchwork.linux-mips.org/patch/15106/
18 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
19 ---
20 arch/mips/bcm47xx/board.c | 9 +++
21 arch/mips/bcm47xx/buttons.c | 72 +++++++++++++++++++
22 arch/mips/bcm47xx/leds.c | 81 ++++++++++++++++++++++
23 arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 9 +++
24 4 files changed, 171 insertions(+)
25
26 --- a/arch/mips/bcm47xx/board.c
27 +++ b/arch/mips/bcm47xx/board.c
28 @@ -149,6 +149,15 @@ struct bcm47xx_board_type_list2 bcm47xx_
29 /* board_id */
30 static const
31 struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
32 + {{BCM47XX_BOARD_LUXUL_ABR_4400_V1, "Luxul ABR-4400 V1"}, "luxul_abr4400_v1"},
33 + {{BCM47XX_BOARD_LUXUL_XAP_310_V1, "Luxul XAP-310 V1"}, "luxul_xap310_v1"},
34 + {{BCM47XX_BOARD_LUXUL_XAP_1210_V1, "Luxul XAP-1210 V1"}, "luxul_xap1210_v1"},
35 + {{BCM47XX_BOARD_LUXUL_XAP_1230_V1, "Luxul XAP-1230 V1"}, "luxul_xap1230_v1"},
36 + {{BCM47XX_BOARD_LUXUL_XAP_1240_V1, "Luxul XAP-1240 V1"}, "luxul_xap1240_v1"},
37 + {{BCM47XX_BOARD_LUXUL_XAP_1500_V1, "Luxul XAP-1500 V1"}, "luxul_xap1500_v1"},
38 + {{BCM47XX_BOARD_LUXUL_XBR_4400_V1, "Luxul XBR-4400 V1"}, "luxul_xbr4400_v1"},
39 + {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Luxul XVW-P30 V1"}, "luxul_xvwp30_v1"},
40 + {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"},
41 {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"},
42 {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
43 {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
44 --- a/arch/mips/bcm47xx/buttons.c
45 +++ b/arch/mips/bcm47xx/buttons.c
46 @@ -308,6 +308,51 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __in
47 /* Luxul */
48
49 static const struct gpio_keys_button
50 +bcm47xx_buttons_luxul_abr_4400_v1[] = {
51 + BCM47XX_GPIO_KEY(14, KEY_RESTART),
52 +};
53 +
54 +static const struct gpio_keys_button
55 +bcm47xx_buttons_luxul_xap_310_v1[] = {
56 + BCM47XX_GPIO_KEY(20, KEY_RESTART),
57 +};
58 +
59 +static const struct gpio_keys_button
60 +bcm47xx_buttons_luxul_xap_1210_v1[] = {
61 + BCM47XX_GPIO_KEY(8, KEY_RESTART),
62 +};
63 +
64 +static const struct gpio_keys_button
65 +bcm47xx_buttons_luxul_xap_1230_v1[] = {
66 + BCM47XX_GPIO_KEY(8, KEY_RESTART),
67 +};
68 +
69 +static const struct gpio_keys_button
70 +bcm47xx_buttons_luxul_xap_1240_v1[] = {
71 + BCM47XX_GPIO_KEY(8, KEY_RESTART),
72 +};
73 +
74 +static const struct gpio_keys_button
75 +bcm47xx_buttons_luxul_xap_1500_v1[] = {
76 + BCM47XX_GPIO_KEY(14, KEY_RESTART),
77 +};
78 +
79 +static const struct gpio_keys_button
80 +bcm47xx_buttons_luxul_xbr_4400_v1[] = {
81 + BCM47XX_GPIO_KEY(14, KEY_RESTART),
82 +};
83 +
84 +static const struct gpio_keys_button
85 +bcm47xx_buttons_luxul_xvw_p30_v1[] = {
86 + BCM47XX_GPIO_KEY(20, KEY_RESTART),
87 +};
88 +
89 +static const struct gpio_keys_button
90 +bcm47xx_buttons_luxul_xwr_600_v1[] = {
91 + BCM47XX_GPIO_KEY(8, KEY_RESTART),
92 +};
93 +
94 +static const struct gpio_keys_button
95 bcm47xx_buttons_luxul_xwr_1750_v1[] = {
96 BCM47XX_GPIO_KEY(14, BTN_TASK),
97 };
98 @@ -567,6 +612,33 @@ int __init bcm47xx_buttons_register(void
99 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
100 break;
101
102 + case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
103 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
104 + break;
105 + case BCM47XX_BOARD_LUXUL_XAP_310_V1:
106 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
107 + break;
108 + case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
109 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
110 + break;
111 + case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
112 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
113 + break;
114 + case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
115 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
116 + break;
117 + case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
118 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
119 + break;
120 + case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
121 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
122 + break;
123 + case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
124 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
125 + break;
126 + case BCM47XX_BOARD_LUXUL_XWR_600_V1:
127 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
128 + break;
129 case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
130 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
131 break;
132 --- a/arch/mips/bcm47xx/leds.c
133 +++ b/arch/mips/bcm47xx/leds.c
134 @@ -373,6 +373,60 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initc
135 /* Luxul */
136
137 static const struct gpio_led
138 +bcm47xx_leds_luxul_abr_4400_v1[] __initconst = {
139 + BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
140 + BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"),
141 +};
142 +
143 +static const struct gpio_led
144 +bcm47xx_leds_luxul_xap_310_v1[] __initconst = {
145 + BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
146 +};
147 +
148 +static const struct gpio_led
149 +bcm47xx_leds_luxul_xap_1210_v1[] __initconst = {
150 + BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
151 +};
152 +
153 +static const struct gpio_led
154 +bcm47xx_leds_luxul_xap_1230_v1[] __initconst = {
155 + BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
156 + BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF),
157 + BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
158 +};
159 +
160 +static const struct gpio_led
161 +bcm47xx_leds_luxul_xap_1240_v1[] __initconst = {
162 + BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
163 + BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF),
164 + BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
165 +};
166 +
167 +static const struct gpio_led
168 +bcm47xx_leds_luxul_xap_1500_v1[] __initconst = {
169 + BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 1, "timer"),
170 +};
171 +
172 +static const struct gpio_led
173 +bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = {
174 + BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
175 + BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"),
176 +};
177 +
178 +static const struct gpio_led
179 +bcm47xx_leds_luxul_xvw_p30_v1[] __initconst = {
180 + BCM47XX_GPIO_LED_TRIGGER(0, "blue", "status", 1, "timer"),
181 + BCM47XX_GPIO_LED(1, "green", "link", 1, LEDS_GPIO_DEFSTATE_OFF),
182 +};
183 +
184 +static const struct gpio_led
185 +bcm47xx_leds_luxul_xwr_600_v1[] __initconst = {
186 + BCM47XX_GPIO_LED(3, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
187 + BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
188 + BCM47XX_GPIO_LED(9, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
189 +};
190 +
191 +static const struct gpio_led
192 bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = {
193 BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
194 BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
195 @@ -633,6 +687,33 @@ void __init bcm47xx_leds_register(void)
196 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
197 break;
198
199 + case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
200 + bcm47xx_set_pdata(bcm47xx_leds_luxul_abr_4400_v1);
201 + break;
202 + case BCM47XX_BOARD_LUXUL_XAP_310_V1:
203 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_310_v1);
204 + break;
205 + case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
206 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1210_v1);
207 + break;
208 + case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
209 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1230_v1);
210 + break;
211 + case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
212 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1240_v1);
213 + break;
214 + case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
215 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1);
216 + break;
217 + case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
218 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1);
219 + break;
220 + case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
221 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xvw_p30_v1);
222 + break;
223 + case BCM47XX_BOARD_LUXUL_XWR_600_V1:
224 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_600_v1);
225 + break;
226 case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
227 bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1);
228 break;
229 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
230 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
231 @@ -80,6 +80,15 @@ enum bcm47xx_board {
232 BCM47XX_BOARD_LINKSYS_WRT610NV2,
233 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
234
235 + BCM47XX_BOARD_LUXUL_ABR_4400_V1,
236 + BCM47XX_BOARD_LUXUL_XAP_310_V1,
237 + BCM47XX_BOARD_LUXUL_XAP_1210_V1,
238 + BCM47XX_BOARD_LUXUL_XAP_1230_V1,
239 + BCM47XX_BOARD_LUXUL_XAP_1240_V1,
240 + BCM47XX_BOARD_LUXUL_XAP_1500_V1,
241 + BCM47XX_BOARD_LUXUL_XBR_4400_V1,
242 + BCM47XX_BOARD_LUXUL_XVW_P30_V1,
243 + BCM47XX_BOARD_LUXUL_XWR_600_V1,
244 BCM47XX_BOARD_LUXUL_XWR_1750_V1,
245
246 BCM47XX_BOARD_MICROSOFT_MN700,