brcm63xx: use dtb board detection for NB6
[openwrt.git] / target / linux / brcm63xx / patches-3.14 / 534-board_hw556.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -12,6 +12,7 @@
4  #include <linux/string.h>
5  #include <linux/gpio_keys.h>
6  #include <linux/input.h>
7 +#include <linux/pci_ids.h>
8  #include <linux/platform_device.h>
9  #include <linux/spi/spi.h>
10  #include <linux/spi/spi_gpio.h>
11 @@ -3006,6 +3007,495 @@ static struct board_info __initdata boar
12         },
13  };
14  
15 +static struct board_info __initdata board_HW556 = {
16 +       .name                                   = "HW556",
17 +       .expected_cpu_id                        = 0x6358,
18 +
19 +       .has_uart0                              = 1,
20 +       .has_pci                                = 1,
21 +       .has_ohci0                              = 1,
22 +       .has_ehci0                              = 1,
23 +       .num_usbh_ports                         = 2,
24 +
25 +       .has_caldata                            = 1,
26 +       .caldata = {
27 +               {
28 +                       .caldata_offset         = 0xe00000,
29 +               },
30 +       },
31 +
32 +       .has_enet1                              = 1,
33 +       .enet1 = {
34 +               .has_phy                        = 1,
35 +               .phy_id                         = 0,
36 +               .force_speed_100                = 1,
37 +               .force_duplex_full              = 1,
38 +       },
39 +
40 +       .leds = {
41 +               {
42 +                       .name                   = "HW556:red:message",
43 +                       .gpio                   = 0,
44 +                       .active_low             = 1,
45 +               },
46 +               {
47 +                       .name                   = "HW556:red:hspa",
48 +                       .gpio                   = 1,
49 +                       .active_low             = 1,
50 +               },
51 +               {
52 +                       .name                   = "HW556:red:dsl",
53 +                       .gpio                   = 2,
54 +                       .active_low             = 1,
55 +               },
56 +               {
57 +                       .name                   = "HW556:red:power",
58 +                       .gpio                   = 3,
59 +                       .active_low             = 1,
60 +                       .default_trigger        = "default-on",
61 +               },
62 +               {
63 +                       .name                   = "HW556:red:all",
64 +                       .gpio                   = 6,
65 +                       .active_low             = 1,
66 +                       .default_trigger        = "default-on",
67 +               },
68 +       },
69 +
70 +       .buttons = {
71 +               {
72 +                       .desc                   = "help",
73 +                       .gpio                   = 8,
74 +                       .active_low             = 1,
75 +                       .type                   = EV_KEY,
76 +                       .code                   = KEY_HELP,
77 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
78 +               },
79 +               {
80 +                       .desc                   = "wlan",
81 +                       .gpio                   = 9,
82 +                       .active_low             = 1,
83 +                       .type                   = EV_KEY,
84 +                       .code                   = KEY_WLAN,
85 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
86 +               },
87 +               {
88 +                       .desc                   = "restart",
89 +                       .gpio                   = 10,
90 +                       .active_low             = 1,
91 +                       .type                   = EV_KEY,
92 +                       .code                   = KEY_RESTART,
93 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
94 +               },
95 +               {
96 +                       .desc                   = "reset",
97 +                       .gpio                   = 11,
98 +                       .active_low             = 1,
99 +                       .type                   = EV_KEY,
100 +                       .code                   = KEY_CONFIG,
101 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
102 +               },
103 +       },
104 +};
105 +static struct board_info __initdata board_HW556_A = {
106 +       .name                                   = "HW556_A",
107 +       .of_board_id                            = "huawei,hg556a-a",
108 +       .expected_cpu_id                        = 0x6358,
109 +
110 +       .has_uart0                              = 1,
111 +       .has_pci                                = 1,
112 +       .has_ohci0                              = 1,
113 +       .has_ehci0                              = 1,
114 +       .num_usbh_ports                         = 2,
115 +
116 +       .has_caldata                            = 1,
117 +       .caldata = {
118 +               {
119 +                       .vendor                 = PCI_VENDOR_ID_RALINK,
120 +                       .caldata_offset         = 0xeffe00,
121 +                       .slot                   = 1,
122 +                       .eeprom                 = "rt2x00.eeprom",
123 +               },
124 +       },
125 +
126 +       .has_enet1                              = 1,
127 +       .enet1 = {
128 +               .has_phy                        = 1,
129 +               .phy_id                         = 0,
130 +               .force_speed_100                = 1,
131 +               .force_duplex_full              = 1,
132 +       },
133 +
134 +       .leds = {
135 +               {
136 +                       .name                   = "HW556:green:lan1",
137 +                       .gpio                   = 0,
138 +                       .active_low             = 1,
139 +               },
140 +               {
141 +                       .name                   = "HW556:green:lan2",
142 +                       .gpio                   = 1,
143 +                       .active_low             = 1,
144 +               },
145 +               {
146 +                       .name                   = "HW556:red:dsl",
147 +                       .gpio                   = 2,
148 +                       .active_low             = 1,
149 +               },
150 +               {
151 +                       .name                   = "HW556:red:power",
152 +                       .gpio                   = 3,
153 +                       .active_low             = 1,
154 +                       .default_trigger        = "default-on",
155 +               },
156 +               {
157 +                       .name                   = "HW556:red:message",
158 +                       .gpio                   = 12,
159 +                       .active_low             = 1,
160 +               },
161 +               {
162 +                       .name                   = "HW556:red:lan1",
163 +                       .gpio                   = 13,
164 +                       .active_low             = 1,
165 +               },
166 +               {
167 +                       .name                   = "HW556:red:hspa",
168 +                       .gpio                   = 15,
169 +                       .active_low             = 1,
170 +               },
171 +               {
172 +                       .name                   = "HW556:red:lan2",
173 +                       .gpio                   = 22,
174 +                       .active_low             = 1,
175 +               },
176 +               {
177 +                       .name                   = "HW556:green:lan3",
178 +                       .gpio                   = 23,
179 +                       .active_low             = 1,
180 +               },
181 +               {
182 +                       .name                   = "HW556:red:lan3",
183 +                       .gpio                   = 26,
184 +                       .active_low             = 1,
185 +               },
186 +               {
187 +                       .name                   = "HW556:green:lan4",
188 +                       .gpio                   = 27,
189 +                       .active_low             = 1,
190 +               },
191 +               {
192 +                       .name                   = "HW556:red:lan4",
193 +                       .gpio                   = 28,
194 +                       .active_low             = 1,
195 +               },
196 +       },
197 +
198 +       .buttons = {
199 +               {
200 +                       .desc                   = "help",
201 +                       .gpio                   = 8,
202 +                       .active_low             = 1,
203 +                       .type                   = EV_KEY,
204 +                       .code                   = KEY_HELP,
205 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
206 +               },
207 +               {
208 +                       .desc                   = "wlan",
209 +                       .gpio                   = 9,
210 +                       .active_low             = 1,
211 +                       .type                   = EV_KEY,
212 +                       .code                   = KEY_WLAN,
213 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
214 +               },
215 +               {
216 +                       .desc                   = "restart",
217 +                       .gpio                   = 10,
218 +                       .active_low             = 1,
219 +                       .type                   = EV_KEY,
220 +                       .code                   = KEY_RESTART,
221 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
222 +               },
223 +               {
224 +                       .desc                   = "reset",
225 +                       .gpio                   = 11,
226 +                       .active_low             = 1,
227 +                       .type                   = EV_KEY,
228 +                       .code                   = KEY_CONFIG,
229 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
230 +               },
231 +       },
232 +};
233 +static struct board_info __initdata board_HW556_B = {
234 +       .name                                   = "HW556_B",
235 +       .of_board_id                            = "huawei,hg556a-b",
236 +       .expected_cpu_id                        = 0x6358,
237 +
238 +       .has_uart0                              = 1,
239 +       .has_pci                                = 1,
240 +       .has_ohci0                              = 1,
241 +       .has_ehci0                              = 1,
242 +       .num_usbh_ports                         = 2,
243 +
244 +       .has_caldata                            = 1,
245 +       .caldata = {
246 +               {
247 +                       .vendor                 = PCI_VENDOR_ID_ATHEROS,
248 +                       .caldata_offset         = 0xf7e000,
249 +                       .slot                   = 1,
250 +                       .endian_check           = 1,
251 +                       .led_pin                = 2,
252 +               },
253 +       },
254 +
255 +       .has_enet1                              = 1,
256 +       .enet1 = {
257 +               .has_phy                        = 1,
258 +               .phy_id                         = 0,
259 +               .force_speed_100                = 1,
260 +               .force_duplex_full              = 1,
261 +       },
262 +
263 +       .leds = {
264 +               {
265 +                       .name                   = "HW556:red:message",
266 +                       .gpio                   = 0,
267 +                       .active_low             = 1,
268 +               },
269 +               {
270 +                       .name                   = "HW556:red:hspa",
271 +                       .gpio                   = 1,
272 +                       .active_low             = 1,
273 +               },
274 +               {
275 +                       .name                   = "HW556:red:dsl",
276 +                       .gpio                   = 2,
277 +                       .active_low             = 1,
278 +               },
279 +               {
280 +                       .name                   = "HW556:red:power",
281 +                       .gpio                   = 3,
282 +                       .active_low             = 1,
283 +                       .default_trigger        = "default-on",
284 +               },
285 +               {
286 +                       .name                   = "HW556:red:all",
287 +                       .gpio                   = 6,
288 +                       .active_low             = 1,
289 +                       .default_trigger        = "default-on",
290 +               },
291 +               {
292 +                       .name                   = "HW556:green:lan1",
293 +                       .gpio                   = 12,
294 +                       .active_low             = 1,
295 +               },
296 +               {
297 +                       .name                   = "HW556:red:lan1",
298 +                       .gpio                   = 13,
299 +                       .active_low             = 1,
300 +               },
301 +               {
302 +                       .name                   = "HW556:green:lan2",
303 +                       .gpio                   = 15,
304 +                       .active_low             = 1,
305 +               },
306 +               {
307 +                       .name                   = "HW556:red:lan2",
308 +                       .gpio                   = 22,
309 +                       .active_low             = 1,
310 +               },
311 +               {
312 +                       .name                   = "HW556:green:lan3",
313 +                       .gpio                   = 23,
314 +                       .active_low             = 1,
315 +               },
316 +               {
317 +                       .name                   = "HW556:red:lan3",
318 +                       .gpio                   = 26,
319 +                       .active_low             = 1,
320 +               },
321 +               {
322 +                       .name                   = "HW556:green:lan4",
323 +                       .gpio                   = 27,
324 +                       .active_low             = 1,
325 +               },
326 +               {
327 +                       .name                   = "HW556:red:lan4",
328 +                       .gpio                   = 28,
329 +                       .active_low             = 1,
330 +               },
331 +       },
332 +
333 +       .buttons = {
334 +               {
335 +                       .desc                   = "help",
336 +                       .gpio                   = 8,
337 +                       .active_low             = 1,
338 +                       .type                   = EV_KEY,
339 +                       .code                   = KEY_HELP,
340 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
341 +               },
342 +               {
343 +                       .desc                   = "wlan",
344 +                       .gpio                   = 9,
345 +                       .active_low             = 1,
346 +                       .type                   = EV_KEY,
347 +                       .code                   = KEY_WLAN,
348 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
349 +               },
350 +               {
351 +                       .desc                   = "restart",
352 +                       .gpio                   = 10,
353 +                       .active_low             = 1,
354 +                       .type                   = EV_KEY,
355 +                       .code                   = KEY_RESTART,
356 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
357 +               },
358 +               {
359 +                       .desc                   = "reset",
360 +                       .gpio                   = 11,
361 +                       .active_low             = 1,
362 +                       .type                   = EV_KEY,
363 +                       .code                   = KEY_CONFIG,
364 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
365 +               },
366 +       },
367 +};
368 +static struct board_info __initdata board_HW556_C = {
369 +       .name                                   = "HW556_C",
370 +       .of_board_id                            = "huawei,hg556a-c",
371 +       .expected_cpu_id                        = 0x6358,
372 +
373 +       .has_uart0                              = 1,
374 +       .has_pci                                = 1,
375 +       .has_ohci0                              = 1,
376 +       .has_ehci0                              = 1,
377 +       .num_usbh_ports                         = 2,
378 +
379 +       .has_caldata                            = 1,
380 +       .caldata = {
381 +               {
382 +                       .vendor                 = PCI_VENDOR_ID_ATHEROS,
383 +                       .caldata_offset         = 0xefe000,
384 +                       .slot                   = 1,
385 +                       .endian_check           = 1,
386 +                       .led_pin                = 2,
387 +               },
388 +       },
389 +
390 +       .has_enet1                              = 1,
391 +       .enet1 = {
392 +               .has_phy                        = 1,
393 +               .phy_id                         = 0,
394 +               .force_speed_100                = 1,
395 +               .force_duplex_full              = 1,
396 +       },
397 +
398 +       .leds = {
399 +               {
400 +                       .name                   = "HW556:red:message",
401 +                       .gpio                   = 0,
402 +                       .active_low             = 1,
403 +               },
404 +               {
405 +                       .name                   = "HW556:red:hspa",
406 +                       .gpio                   = 1,
407 +                       .active_low             = 1,
408 +               },
409 +               {
410 +                       .name                   = "HW556:red:dsl",
411 +                       .gpio                   = 2,
412 +                       .active_low             = 1,
413 +               },
414 +               {
415 +                       .name                   = "HW556:red:power",
416 +                       .gpio                   = 3,
417 +                       .active_low             = 1,
418 +                       .default_trigger        = "default-on",
419 +               },
420 +               {
421 +                       .name                   = "HW556:red:all",
422 +                       .gpio                   = 6,
423 +                       .active_low             = 1,
424 +                       .default_trigger        = "default-on",
425 +               },
426 +               {
427 +                       .name                   = "HW556:green:lan1",
428 +                       .gpio                   = 12,
429 +                       .active_low             = 1,
430 +               },
431 +               {
432 +                       .name                   = "HW556:red:lan1",
433 +                       .gpio                   = 13,
434 +                       .active_low             = 1,
435 +               },
436 +               {
437 +                       .name                   = "HW556:green:lan2",
438 +                       .gpio                   = 15,
439 +                       .active_low             = 1,
440 +               },
441 +               {
442 +                       .name                   = "HW556:red:lan2",
443 +                       .gpio                   = 22,
444 +                       .active_low             = 1,
445 +               },
446 +               {
447 +                       .name                   = "HW556:green:lan3",
448 +                       .gpio                   = 23,
449 +                       .active_low             = 1,
450 +               },
451 +               {
452 +                       .name                   = "HW556:red:lan3",
453 +                       .gpio                   = 26,
454 +                       .active_low             = 1,
455 +               },
456 +               {
457 +                       .name                   = "HW556:green:lan4",
458 +                       .gpio                   = 27,
459 +                       .active_low             = 1,
460 +               },
461 +               {
462 +                       .name                   = "HW556:red:lan4",
463 +                       .gpio                   = 28,
464 +                       .active_low             = 1,
465 +               },
466 +       },
467 +
468 +       .buttons = {
469 +               {
470 +                       .desc                   = "help",
471 +                       .gpio                   = 8,
472 +                       .active_low             = 1,
473 +                       .type                   = EV_KEY,
474 +                       .code                   = KEY_HELP,
475 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
476 +               },
477 +               {
478 +                       .desc                   = "wlan",
479 +                       .gpio                   = 9,
480 +                       .active_low             = 1,
481 +                       .type                   = EV_KEY,
482 +                       .code                   = KEY_WLAN,
483 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
484 +               },
485 +               {
486 +                       .desc                   = "restart",
487 +                       .gpio                   = 10,
488 +                       .active_low             = 1,
489 +                       .type                   = EV_KEY,
490 +                       .code                   = KEY_RESTART,
491 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
492 +               },
493 +               {
494 +                       .desc                   = "reset",
495 +                       .gpio                   = 11,
496 +                       .active_low             = 1,
497 +                       .type                   = EV_KEY,
498 +                       .code                   = KEY_CONFIG,
499 +                       .debounce_interval      = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
500 +               },
501 +       },
502 +};
503 +
504   /* T-Home Speedport W 303V Typ B */
505  static struct board_info __initdata board_spw303v = {
506         .name                   = "96358-502V",
507 @@ -3447,6 +3937,10 @@ static const struct board_info __initcon
508         &board_nb4_fxc_r2,
509         &board_ct6373_1,
510         &board_HW553,
511 +       &board_HW556,
512 +       &board_HW556_A,
513 +       &board_HW556_B,
514 +       &board_HW556_C,
515         &board_spw303v,
516         &board_DVAG3810BN,
517  #endif
518 --- a/drivers/mtd/bcm63xxpart.c
519 +++ b/drivers/mtd/bcm63xxpart.c
520 @@ -224,6 +224,11 @@ static int bcm63xx_parse_cfe_partitions(
521                               BCM63XX_CFE_BLOCK_SIZE);
522  
523         cfelen = cfe_erasesize;
524 +
525 +       /* Fix HW556 MX29LV128DB */
526 +       if (!strncmp(bcm63xx_nvram_get_name(), "HW556", 5))
527 +               cfelen = 0x20000;
528 +
529         nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;
530         nvramlen = roundup(nvramlen, cfe_erasesize);
531         nvramaddr = master->size - nvramlen;