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