kernel: fix bluetooth and zsmalloc for 3.14
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.13 / 501-board-NB4.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -15,6 +15,8 @@
4 #include <linux/gpio_keys.h>
5 #include <linux/input.h>
6 #include <linux/spi/spi.h>
7 +#include <linux/spi/spi_gpio.h>
8 +#include <linux/spi/74x164.h>
9 #include <asm/addrspace.h>
10 #include <bcm63xx_board.h>
11 #include <bcm63xx_cpu.h>
12 @@ -49,6 +51,12 @@
13 #define CFE_OFFSET_64K 0x10000
14 #define CFE_OFFSET_128K 0x20000
15
16 +#define NB4_PID_OFFSET 0xff80
17 +#define NB4_74X164_GPIO_BASE 64
18 +#define NB4_SPI_GPIO_MOSI 7
19 +#define NB4_SPI_GPIO_CLK 6
20 +#define NB4_74HC64_GPIO(X) (NB4_74X164_GPIO_BASE + (X))
21 +
22 static struct board_info board;
23
24 /*
25 @@ -755,6 +763,601 @@ static struct board_info __initdata boar
26
27 .has_ohci0 = 1,
28 };
29 +
30 +struct spi_gpio_platform_data nb4_spi_gpio_data = {
31 + .sck = NB4_SPI_GPIO_CLK,
32 + .mosi = NB4_SPI_GPIO_MOSI,
33 + .miso = SPI_GPIO_NO_MISO,
34 + .num_chipselect = 1,
35 +};
36 +
37 +
38 +static struct platform_device nb4_spi_gpio = {
39 + .name = "spi_gpio",
40 + .id = 1,
41 + .dev = {
42 + .platform_data = &nb4_spi_gpio_data,
43 + },
44 +};
45 +
46 +static struct platform_device * __initdata nb4_devices[] = {
47 + &nb4_spi_gpio,
48 +};
49 +
50 +const struct gen_74x164_chip_platform_data nb4_74x164_platform_data = {
51 + .base = NB4_74X164_GPIO_BASE
52 +};
53 +
54 +static struct spi_board_info nb4_spi_devices[] = {
55 + {
56 + .modalias = "74x164",
57 + .max_speed_hz = 781000,
58 + .bus_num = 1,
59 + .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT,
60 + .mode = SPI_MODE_0,
61 + .platform_data = &nb4_74x164_platform_data
62 + }
63 +};
64 +
65 +static struct board_info __initdata board_nb4_ser_r0 = {
66 + .name = "NB4-SER-r0",
67 + .expected_cpu_id = 0x6358,
68 +
69 + .has_uart0 = 1,
70 + .has_enet0 = 1,
71 + .has_enet1 = 1,
72 + .has_pci = 1,
73 +
74 + .enet0 = {
75 + .has_phy = 1,
76 + .use_internal_phy = 1,
77 + },
78 +
79 + .enet1 = {
80 + .has_phy = 1,
81 + .phy_id = 0,
82 + .force_speed_100 = 1,
83 + .force_duplex_full = 1,
84 + },
85 +
86 +
87 + .has_ohci0 = 1,
88 + .has_pccard = 1,
89 + .has_ehci0 = 1,
90 + .num_usbh_ports = 2,
91 +
92 + .leds = {
93 + {
94 + .name = "NB4-SER-r0:white:adsl",
95 + .gpio = NB4_74HC64_GPIO(4),
96 + .active_low = 1,
97 + },
98 + {
99 + .name = "NB4-SER-r0:white:traffic",
100 + .gpio = 2,
101 + .active_low = 1,
102 + },
103 + {
104 + .name = "NB4-SER-r0:white:tel",
105 + .gpio = NB4_74HC64_GPIO(3),
106 + .active_low = 1,
107 + },
108 + {
109 + .name = "NB4-SER-r0:white:tv",
110 + .gpio = NB4_74HC64_GPIO(2),
111 + .active_low = 1,
112 + },
113 + {
114 + .name = "NB4-SER-r0:white:wifi",
115 + .gpio = 15,
116 + .active_low = 1,
117 + },
118 + {
119 + .name = "NB4-SER-r0:white:alarm",
120 + .gpio = NB4_74HC64_GPIO(0),
121 + .active_low = 1,
122 + },
123 + {
124 + .name = "NB4-SER-r0:red:service",
125 + .gpio = 29,
126 + .active_low = 1,
127 + },
128 + {
129 + .name = "NB4-SER-r0:green:service",
130 + .gpio = 30,
131 + .active_low = 1,
132 + },
133 + {
134 + .name = "NB4-SER-r0:blue:service",
135 + .gpio = 4,
136 + .active_low = 1,
137 + },
138 + },
139 + .buttons = {
140 + {
141 + .desc = "reset",
142 + .gpio = 34,
143 + .type = EV_KEY,
144 + .code = KEY_RESTART,
145 + .active_low = 1,
146 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
147 + },
148 + {
149 + .desc = "wps",
150 + .gpio = 37,
151 + .type = EV_KEY,
152 + .code = KEY_WPS_BUTTON,
153 + .active_low = 1,
154 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
155 + },
156 + {
157 + .desc = "service",
158 + .gpio = 27,
159 + .type = EV_KEY,
160 + .code = BTN_0,
161 + .active_low = 1,
162 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
163 + },
164 + {
165 + .desc = "clip",
166 + .gpio = 31,
167 + .type = EV_KEY,
168 + .code = BTN_1,
169 + .active_low = 1,
170 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
171 + },
172 + },
173 + .devs = nb4_devices,
174 + .num_devs = ARRAY_SIZE(nb4_devices),
175 + .spis = nb4_spi_devices,
176 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
177 +};
178 +
179 +static struct board_info __initdata board_nb4_ser_r1 = {
180 + .name = "NB4-SER-r1",
181 + .expected_cpu_id = 0x6358,
182 +
183 + .has_uart0 = 1,
184 + .has_enet0 = 1,
185 + .has_enet1 = 1,
186 + .has_pci = 1,
187 +
188 + .enet0 = {
189 + .has_phy = 1,
190 + .use_internal_phy = 1,
191 + },
192 +
193 + .enet1 = {
194 + .has_phy = 1,
195 + .phy_id = 0,
196 + .force_speed_100 = 1,
197 + .force_duplex_full = 1,
198 + },
199 +
200 +
201 + .has_ohci0 = 1,
202 + .has_pccard = 1,
203 + .has_ehci0 = 1,
204 + .num_usbh_ports = 2,
205 +
206 + .leds = {
207 + {
208 + .name = "NB4-SER-r1:white:adsl",
209 + .gpio = NB4_74HC64_GPIO(4),
210 + .active_low = 1,
211 + },
212 + {
213 + .name = "NB4-SER-r1:white:traffic",
214 + .gpio = 2,
215 + .active_low = 1,
216 + },
217 + {
218 + .name = "NB4-SER-r1:white:tel",
219 + .gpio = NB4_74HC64_GPIO(3),
220 + .active_low = 1,
221 + },
222 + {
223 + .name = "NB4-SER-r1:white:tv",
224 + .gpio = NB4_74HC64_GPIO(2),
225 + .active_low = 1,
226 + },
227 + {
228 + .name = "NB4-SER-r1:white:wifi",
229 + .gpio = 15,
230 + .active_low = 1,
231 + },
232 + {
233 + .name = "NB4-SER-r1:white:alarm",
234 + .gpio = NB4_74HC64_GPIO(0),
235 + .active_low = 1,
236 + },
237 + {
238 + .name = "NB4-SER-r1:red:service",
239 + .gpio = 29,
240 + .active_low = 1,
241 + },
242 + {
243 + .name = "NB4-SER-r1:green:service",
244 + .gpio = 30,
245 + .active_low = 1,
246 + },
247 + {
248 + .name = "NB4-SER-r1:blue:service",
249 + .gpio = 4,
250 + .active_low = 1,
251 + },
252 + },
253 + .buttons = {
254 + {
255 + .desc = "reset",
256 + .gpio = 34,
257 + .type = EV_KEY,
258 + .code = KEY_RESTART,
259 + .active_low = 1,
260 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
261 + },
262 + {
263 + .desc = "wps",
264 + .gpio = 37,
265 + .type = EV_KEY,
266 + .code = KEY_WPS_BUTTON,
267 + .active_low = 1,
268 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
269 + },
270 + {
271 + .desc = "service",
272 + .gpio = 27,
273 + .type = EV_KEY,
274 + .code = BTN_0,
275 + .active_low = 1,
276 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
277 + },
278 + {
279 + .desc = "clip",
280 + .gpio = 31,
281 + .type = EV_KEY,
282 + .code = BTN_1,
283 + .active_low = 1,
284 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
285 + },
286 + },
287 + .devs = nb4_devices,
288 + .num_devs = ARRAY_SIZE(nb4_devices),
289 + .spis = nb4_spi_devices,
290 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
291 +};
292 +
293 +static struct board_info __initdata board_nb4_ser_r2 = {
294 + .name = "NB4-SER-r2",
295 + .expected_cpu_id = 0x6358,
296 +
297 + .has_uart0 = 1,
298 + .has_enet0 = 1,
299 + .has_enet1 = 1,
300 + .has_pci = 1,
301 +
302 + .enet0 = {
303 + .has_phy = 1,
304 + .use_internal_phy = 1,
305 + },
306 +
307 + .enet1 = {
308 + .has_phy = 1,
309 + .phy_id = 0,
310 + .force_speed_100 = 1,
311 + .force_duplex_full = 1,
312 + },
313 +
314 +
315 + .has_ohci0 = 1,
316 + .has_pccard = 1,
317 + .has_ehci0 = 1,
318 + .num_usbh_ports = 2,
319 +
320 + .leds = {
321 + {
322 + .name = "NB4-SER-r2:white:adsl",
323 + .gpio = NB4_74HC64_GPIO(4),
324 + .active_low = 1,
325 + },
326 + {
327 + .name = "NB4-SER-r2:white:traffic",
328 + .gpio = 2,
329 + .active_low = 1,
330 + },
331 + {
332 + .name = "NB4-SER-r2:white:tel",
333 + .gpio = NB4_74HC64_GPIO(3),
334 + .active_low = 1,
335 + },
336 + {
337 + .name = "NB4-SER-r2:white:tv",
338 + .gpio = NB4_74HC64_GPIO(2),
339 + .active_low = 1,
340 + },
341 + {
342 + .name = "NB4-SER-r2:white:wifi",
343 + .gpio = 15,
344 + .active_low = 1,
345 + },
346 + {
347 + .name = "NB4-SER-r2:white:alarm",
348 + .gpio = NB4_74HC64_GPIO(0),
349 + .active_low = 1,
350 + },
351 + {
352 + .name = "NB4-SER-r2:red:service",
353 + .gpio = 29,
354 + .active_low = 1,
355 + },
356 + {
357 + .name = "NB4-SER-r2:green:service",
358 + .gpio = 30,
359 + .active_low = 1,
360 + },
361 + {
362 + .name = "NB4-SER-r2:blue:service",
363 + .gpio = 4,
364 + .active_low = 1,
365 + },
366 + },
367 + .buttons = {
368 + {
369 + .desc = "reset",
370 + .gpio = 34,
371 + .type = EV_KEY,
372 + .code = KEY_RESTART,
373 + .active_low = 1,
374 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
375 + },
376 + {
377 + .desc = "wps",
378 + .gpio = 37,
379 + .type = EV_KEY,
380 + .code = KEY_WPS_BUTTON,
381 + .active_low = 1,
382 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
383 + },
384 + {
385 + .desc = "service",
386 + .gpio = 27,
387 + .type = EV_KEY,
388 + .code = BTN_0,
389 + .active_low = 1,
390 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
391 + },
392 + {
393 + .desc = "clip",
394 + .gpio = 31,
395 + .type = EV_KEY,
396 + .code = BTN_1,
397 + .active_low = 1,
398 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
399 + },
400 + },
401 + .devs = nb4_devices,
402 + .num_devs = ARRAY_SIZE(nb4_devices),
403 + .spis = nb4_spi_devices,
404 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
405 +};
406 +
407 +static struct board_info __initdata board_nb4_fxc_r1 = {
408 + .name = "NB4-FXC-r1",
409 + .expected_cpu_id = 0x6358,
410 +
411 + .has_uart0 = 1,
412 + .has_enet0 = 1,
413 + .has_enet1 = 1,
414 + .has_pci = 1,
415 +
416 + .enet0 = {
417 + .has_phy = 1,
418 + .use_internal_phy = 1,
419 + },
420 +
421 + .enet1 = {
422 + .has_phy = 1,
423 + .phy_id = 0,
424 + .force_speed_100 = 1,
425 + .force_duplex_full = 1,
426 + },
427 +
428 +
429 + .has_ohci0 = 1,
430 + .has_pccard = 1,
431 + .has_ehci0 = 1,
432 + .num_usbh_ports = 2,
433 +
434 + .leds = {
435 + {
436 + .name = "NB4-FXC-r1:white:adsl",
437 + .gpio = NB4_74HC64_GPIO(4),
438 + .active_low = 1,
439 + },
440 + {
441 + .name = "NB4-FXC-r1:white:traffic",
442 + .gpio = 2,
443 + },
444 + {
445 + .name = "NB4-FXC-r1:white:tel",
446 + .gpio = NB4_74HC64_GPIO(3),
447 + .active_low = 1,
448 + },
449 + {
450 + .name = "NB4-FXC-r1:white:tv",
451 + .gpio = NB4_74HC64_GPIO(2),
452 + .active_low = 1,
453 + },
454 + {
455 + .name = "NB4-FXC-r1:white:wifi",
456 + .gpio = 15,
457 + },
458 + {
459 + .name = "NB4-FXC-r1:white:alarm",
460 + .gpio = NB4_74HC64_GPIO(0),
461 + .active_low = 1,
462 + },
463 + {
464 + .name = "NB4-FXC-r1:red:service",
465 + .gpio = 29,
466 + },
467 + {
468 + .name = "NB4-FXC-r1:green:service",
469 + .gpio = 30,
470 + },
471 + {
472 + .name = "NB4-FXC-r1:blue:service",
473 + .gpio = 4,
474 + },
475 + },
476 + .buttons = {
477 + {
478 + .desc = "reset",
479 + .gpio = 34,
480 + .type = EV_KEY,
481 + .code = KEY_RESTART,
482 + .active_low = 1,
483 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
484 + },
485 + {
486 + .desc = "wps",
487 + .gpio = 37,
488 + .type = EV_KEY,
489 + .code = KEY_WPS_BUTTON,
490 + .active_low = 1,
491 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
492 + },
493 + {
494 + .desc = "service",
495 + .gpio = 27,
496 + .type = EV_KEY,
497 + .code = BTN_0,
498 + .active_low = 1,
499 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
500 + },
501 + {
502 + .desc = "clip",
503 + .gpio = 31,
504 + .type = EV_KEY,
505 + .code = BTN_1,
506 + .active_low = 1,
507 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
508 + },
509 + },
510 + .devs = nb4_devices,
511 + .num_devs = ARRAY_SIZE(nb4_devices),
512 + .spis = nb4_spi_devices,
513 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
514 +};
515 +
516 +static struct board_info __initdata board_nb4_fxc_r2 = {
517 + .name = "NB4-FXC-r2",
518 + .expected_cpu_id = 0x6358,
519 +
520 + .has_uart0 = 1,
521 + .has_enet0 = 1,
522 + .has_enet1 = 1,
523 + .has_pci = 1,
524 +
525 + .enet0 = {
526 + .has_phy = 1,
527 + .use_internal_phy = 1,
528 + },
529 +
530 + .enet1 = {
531 + .has_phy = 1,
532 + .phy_id = 0,
533 + .force_speed_100 = 1,
534 + .force_duplex_full = 1,
535 + },
536 +
537 +
538 + .has_ohci0 = 1,
539 + .has_pccard = 1,
540 + .has_ehci0 = 1,
541 + .num_usbh_ports = 2,
542 +
543 + .leds = {
544 + {
545 + .name = "NB4-FXC-r2:white:adsl",
546 + .gpio = NB4_74HC64_GPIO(4),
547 + .active_low = 1,
548 + },
549 + {
550 + .name = "NB4-FXC-r2:white:traffic",
551 + .gpio = 2,
552 + },
553 + {
554 + .name = "NB4-FXC-r2:white:tel",
555 + .gpio = NB4_74HC64_GPIO(3),
556 + .active_low = 1,
557 + },
558 + {
559 + .name = "NB4-FXC-r2:white:tv",
560 + .gpio = NB4_74HC64_GPIO(2),
561 + .active_low = 1,
562 + },
563 + {
564 + .name = "NB4-FXC-r2:white:wifi",
565 + .gpio = 15,
566 + },
567 + {
568 + .name = "NB4-FXC-r2:white:alarm",
569 + .gpio = NB4_74HC64_GPIO(0),
570 + .active_low = 1,
571 + },
572 + {
573 + .name = "NB4-FXC-r2:red:service",
574 + .gpio = 29,
575 + },
576 + {
577 + .name = "NB4-FXC-r2:green:service",
578 + .gpio = 30,
579 + },
580 + {
581 + .name = "NB4-FXC-r2:blue:service",
582 + .gpio = 4,
583 + },
584 + },
585 + .buttons = {
586 + {
587 + .desc = "reset",
588 + .gpio = 34,
589 + .type = EV_KEY,
590 + .code = KEY_RESTART,
591 + .active_low = 1,
592 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
593 + },
594 + {
595 + .desc = "wps",
596 + .gpio = 37,
597 + .type = EV_KEY,
598 + .code = KEY_WPS_BUTTON,
599 + .active_low = 1,
600 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
601 + },
602 + {
603 + .desc = "service",
604 + .gpio = 27,
605 + .type = EV_KEY,
606 + .code = BTN_0,
607 + .active_low = 1,
608 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
609 + },
610 + {
611 + .desc = "clip",
612 + .gpio = 31,
613 + .type = EV_KEY,
614 + .code = BTN_1,
615 + .active_low = 1,
616 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
617 + },
618 + },
619 + .devs = nb4_devices,
620 + .num_devs = ARRAY_SIZE(nb4_devices),
621 + .spis = nb4_spi_devices,
622 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
623 +};
624 #endif
625
626 /*
627 @@ -791,6 +1394,11 @@ static const struct board_info __initcon
628 &board_96358vw2,
629 &board_AGPFS0,
630 &board_DWVS0,
631 + &board_nb4_ser_r0,
632 + &board_nb4_ser_r1,
633 + &board_nb4_ser_r2,
634 + &board_nb4_fxc_r1,
635 + &board_nb4_fxc_r2,
636 #endif
637 };
638
639 @@ -845,6 +1453,16 @@ static void __init boardid_fixup(u8 *boo
640 struct bcm_tag *tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_64K);
641 char *board_name = (char *)bcm63xx_nvram_get_name();
642
643 + if (BCMCPU_IS_6358() && (!strcmp(board_name, "96358VW"))) {
644 + u8 *p = boot_addr + NB4_PID_OFFSET;
645 +
646 + /* Extract nb4 PID */
647 + if (!memcmp(p, "NB4-", 4)) {
648 + memcpy(board_name, p, sizeof("NB4-XXX-rX"));
649 + return;
650 + }
651 + }
652 +
653 /* check if bcm_tag is at 64k offset */
654 if (strncmp(board_name, tag->board_id, BOARDID_LEN) != 0) {
655 /* else try 128k */