tools/qemu: fix FreeBSD compile issue
[openwrt.git] / target / linux / brcm63xx / patches-2.6.35 / 221-board-NB4.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -17,6 +17,9 @@
4 #include <linux/ssb/ssb.h>
5 #include <linux/gpio_buttons.h>
6 #include <linux/input.h>
7 +#include <linux/spi/spi.h>
8 +#include <linux/spi/spi_gpio.h>
9 +#include <linux/spi/74x164.h>
10 #include <asm/addrspace.h>
11 #include <bcm63xx_board.h>
12 #include <bcm63xx_cpu.h>
13 @@ -34,6 +37,12 @@
14
15 #define PFX "board_bcm963xx: "
16
17 +#define NB4_PID_OFFSET 0xff80
18 +#define NB4_74X164_GPIO_BASE 64
19 +#define NB4_SPI_GPIO_MOSI 7
20 +#define NB4_SPI_GPIO_CLK 6
21 +#define NB4_74HC64_GPIO(X) (NB4_74X164_GPIO_BASE + (X))
22 +
23 static struct bcm963xx_nvram nvram;
24 static unsigned int mac_addr_used;
25 static struct board_info board;
26 @@ -749,6 +758,502 @@ static struct board_info __initdata boar
27
28 .has_ohci0 = 1,
29 };
30 +
31 +struct spi_gpio_platform_data nb4_spi_gpio_data = {
32 + .sck = NB4_SPI_GPIO_CLK,
33 + .mosi = NB4_SPI_GPIO_MOSI,
34 + .miso = SPI_GPIO_NO_MISO,
35 + .num_chipselect = 1,
36 +};
37 +
38 +
39 +static struct platform_device nb4_spi_gpio = {
40 + .name = "spi_gpio",
41 + .id = 1,
42 + .dev = {
43 + .platform_data = &nb4_spi_gpio_data,
44 + },
45 +};
46 +
47 +static struct platform_device * __initdata nb4_devices[] = {
48 + &nb4_spi_gpio,
49 +};
50 +
51 +const struct gen_74x164_chip_platform_data nb4_74x164_platform_data = {
52 + .base = NB4_74X164_GPIO_BASE
53 +};
54 +
55 +static struct spi_board_info nb4_spi_devices[] = {
56 + {
57 + .modalias = "74x164",
58 + .max_speed_hz = 781000,
59 + .bus_num = 1,
60 + .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT,
61 + .mode = SPI_MODE_0,
62 + .platform_data = &nb4_74x164_platform_data
63 + }
64 +};
65 +
66 +static struct board_info __initdata board_nb4_ser_r0 = {
67 + .name = "NB4-SER-r0",
68 + .expected_cpu_id = 0x6358,
69 +
70 + .has_uart0 = 1,
71 + .has_enet0 = 1,
72 + .has_enet1 = 1,
73 + .has_pci = 1,
74 +
75 + .enet0 = {
76 + .has_phy = 1,
77 + .use_internal_phy = 1,
78 + },
79 +
80 + .enet1 = {
81 + .force_speed_100 = 1,
82 + .force_duplex_full = 1,
83 + },
84 +
85 +
86 + .has_ohci0 = 1,
87 + .has_pccard = 1,
88 + .has_ehci0 = 1,
89 +
90 + .has_udc0 = 1,
91 +
92 + .leds = {
93 + {
94 + .name = "adsl",
95 + .gpio = NB4_74HC64_GPIO(4),
96 + .active_low = 1,
97 + },
98 + {
99 + .name = "traffic",
100 + .gpio = 2,
101 + .active_low = 1,
102 + },
103 + {
104 + .name = "tel",
105 + .gpio = NB4_74HC64_GPIO(3),
106 + .active_low = 1,
107 + },
108 + {
109 + .name = "tv",
110 + .gpio = NB4_74HC64_GPIO(2),
111 + .active_low = 1,
112 + },
113 + {
114 + .name = "wifi",
115 + .gpio = 15,
116 + .active_low = 1,
117 + },
118 + {
119 + .name = "alarm",
120 + .gpio = NB4_74HC64_GPIO(0),
121 + .active_low = 1,
122 + },
123 + {
124 + .name = "service:red",
125 + .gpio = 29,
126 + .active_low = 1,
127 + },
128 + {
129 + .name = "service:green",
130 + .gpio = 30,
131 + .active_low = 1,
132 + },
133 + {
134 + .name = "service:blue",
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 + .threshold = 3,
146 + },
147 + {
148 + .desc = "wps",
149 + .gpio = 37,
150 + .type = EV_KEY,
151 + .code = KEY_WPS_BUTTON,
152 + .threshold = 3,
153 + },
154 + },
155 + .devs = nb4_devices,
156 + .num_devs = ARRAY_SIZE(nb4_devices),
157 + .spis = nb4_spi_devices,
158 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
159 +};
160 +
161 +static struct board_info __initdata board_nb4_ser_r1 = {
162 + .name = "NB4-SER-r1",
163 + .expected_cpu_id = 0x6358,
164 +
165 + .has_uart0 = 1,
166 + .has_enet0 = 1,
167 + .has_enet1 = 1,
168 + .has_pci = 1,
169 +
170 + .enet0 = {
171 + .has_phy = 1,
172 + .use_internal_phy = 1,
173 + },
174 +
175 + .enet1 = {
176 + .force_speed_100 = 1,
177 + .force_duplex_full = 1,
178 + },
179 +
180 +
181 + .has_ohci0 = 1,
182 + .has_pccard = 1,
183 + .has_ehci0 = 1,
184 +
185 + .has_udc0 = 1,
186 +
187 + .leds = {
188 + {
189 + .name = "adsl",
190 + .gpio = NB4_74HC64_GPIO(4),
191 + .active_low = 1,
192 + },
193 + {
194 + .name = "traffic",
195 + .gpio = 2,
196 + .active_low = 1,
197 + },
198 + {
199 + .name = "tel",
200 + .gpio = NB4_74HC64_GPIO(3),
201 + .active_low = 1,
202 + },
203 + {
204 + .name = "tv",
205 + .gpio = NB4_74HC64_GPIO(2),
206 + .active_low = 1,
207 + },
208 + {
209 + .name = "wifi",
210 + .gpio = 15,
211 + .active_low = 1,
212 + },
213 + {
214 + .name = "alarm",
215 + .gpio = NB4_74HC64_GPIO(0),
216 + .active_low = 1,
217 + },
218 + {
219 + .name = "service:red",
220 + .gpio = 29,
221 + .active_low = 1,
222 + },
223 + {
224 + .name = "service:green",
225 + .gpio = 30,
226 + .active_low = 1,
227 + },
228 + {
229 + .name = "service:blue",
230 + .gpio = 4,
231 + .active_low = 1,
232 + },
233 + },
234 + .buttons = {
235 + {
236 + .desc = "reset",
237 + .gpio = 34,
238 + .type = EV_KEY,
239 + .code = KEY_RESTART,
240 + .threshold = 3,
241 + },
242 + {
243 + .desc = "wps",
244 + .gpio = 37,
245 + .type = EV_KEY,
246 + .code = KEY_WPS_BUTTON,
247 + .threshold = 3,
248 + },
249 + },
250 + .devs = nb4_devices,
251 + .num_devs = ARRAY_SIZE(nb4_devices),
252 + .spis = nb4_spi_devices,
253 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
254 +};
255 +
256 +static struct board_info __initdata board_nb4_ser_r2 = {
257 + .name = "NB4-SER-r2",
258 + .expected_cpu_id = 0x6358,
259 +
260 + .has_uart0 = 1,
261 + .has_enet0 = 1,
262 + .has_enet1 = 1,
263 + .has_pci = 1,
264 +
265 + .enet0 = {
266 + .has_phy = 1,
267 + .use_internal_phy = 1,
268 + },
269 +
270 + .enet1 = {
271 + .force_speed_100 = 1,
272 + .force_duplex_full = 1,
273 + },
274 +
275 +
276 + .has_ohci0 = 1,
277 + .has_pccard = 1,
278 + .has_ehci0 = 1,
279 +
280 + .leds = {
281 + {
282 + .name = "adsl",
283 + .gpio = NB4_74HC64_GPIO(4),
284 + .active_low = 1,
285 + },
286 + {
287 + .name = "traffic",
288 + .gpio = 2,
289 + .active_low = 1,
290 + },
291 + {
292 + .name = "tel",
293 + .gpio = NB4_74HC64_GPIO(3),
294 + .active_low = 1,
295 + },
296 + {
297 + .name = "tv",
298 + .gpio = NB4_74HC64_GPIO(2),
299 + .active_low = 1,
300 + },
301 + {
302 + .name = "wifi",
303 + .gpio = 15,
304 + .active_low = 1,
305 + },
306 + {
307 + .name = "alarm",
308 + .gpio = NB4_74HC64_GPIO(0),
309 + .active_low = 1,
310 + },
311 + {
312 + .name = "service:red",
313 + .gpio = 29,
314 + .active_low = 1,
315 + },
316 + {
317 + .name = "service:green",
318 + .gpio = 30,
319 + .active_low = 1,
320 + },
321 + {
322 + .name = "service:blue",
323 + .gpio = 4,
324 + .active_low = 1,
325 + },
326 + },
327 + .buttons = {
328 + {
329 + .desc = "reset",
330 + .gpio = 34,
331 + .type = EV_KEY,
332 + .code = KEY_RESTART,
333 + .threshold = 3,
334 + },
335 + {
336 + .desc = "wps",
337 + .gpio = 37,
338 + .type = EV_KEY,
339 + .code = KEY_WPS_BUTTON,
340 + .threshold = 3,
341 + },
342 + },
343 + .devs = nb4_devices,
344 + .num_devs = ARRAY_SIZE(nb4_devices),
345 + .spis = nb4_spi_devices,
346 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
347 +};
348 +
349 +static struct board_info __initdata board_nb4_fxc_r1 = {
350 + .name = "NB4-FXC-r1",
351 + .expected_cpu_id = 0x6358,
352 +
353 + .has_uart0 = 1,
354 + .has_enet0 = 1,
355 + .has_enet1 = 1,
356 + .has_pci = 1,
357 +
358 + .enet0 = {
359 + .has_phy = 1,
360 + .use_internal_phy = 1,
361 + },
362 +
363 + .enet1 = {
364 + .force_speed_100 = 1,
365 + .force_duplex_full = 1,
366 + },
367 +
368 +
369 + .has_ohci0 = 1,
370 + .has_pccard = 1,
371 + .has_ehci0 = 1,
372 +
373 + .has_udc0 = 1,
374 +
375 + .leds = {
376 + {
377 + .name = "adsl",
378 + .gpio = NB4_74HC64_GPIO(4),
379 + .active_low = 1,
380 + },
381 + {
382 + .name = "traffic",
383 + .gpio = 2,
384 + },
385 + {
386 + .name = "tel",
387 + .gpio = NB4_74HC64_GPIO(3),
388 + .active_low = 1,
389 + },
390 + {
391 + .name = "tv",
392 + .gpio = NB4_74HC64_GPIO(2),
393 + .active_low = 1,
394 + },
395 + {
396 + .name = "wifi",
397 + .gpio = 15,
398 + },
399 + {
400 + .name = "alarm",
401 + .gpio = NB4_74HC64_GPIO(0),
402 + .active_low = 1,
403 + },
404 + {
405 + .name = "service:red",
406 + .gpio = 29,
407 + },
408 + {
409 + .name = "service:green",
410 + .gpio = 30,
411 + },
412 + {
413 + .name = "service:blue",
414 + .gpio = 4,
415 + },
416 + },
417 + .buttons = {
418 + {
419 + .desc = "reset",
420 + .gpio = 34,
421 + .type = EV_KEY,
422 + .code = KEY_RESTART,
423 + .threshold = 3,
424 + },
425 + {
426 + .desc = "wps",
427 + .gpio = 37,
428 + .type = EV_KEY,
429 + .code = KEY_WPS_BUTTON,
430 + .threshold = 3,
431 + },
432 + },
433 + .devs = nb4_devices,
434 + .num_devs = ARRAY_SIZE(nb4_devices),
435 + .spis = nb4_spi_devices,
436 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
437 +};
438 +
439 +static struct board_info __initdata board_nb4_fxc_r2 = {
440 + .name = "NB4-FXC-r2",
441 + .expected_cpu_id = 0x6358,
442 +
443 + .has_uart0 = 1,
444 + .has_enet0 = 1,
445 + .has_enet1 = 1,
446 + .has_pci = 1,
447 +
448 + .enet0 = {
449 + .has_phy = 1,
450 + .use_internal_phy = 1,
451 + },
452 +
453 + .enet1 = {
454 + .force_speed_100 = 1,
455 + .force_duplex_full = 1,
456 + },
457 +
458 +
459 + .has_ohci0 = 1,
460 + .has_pccard = 1,
461 + .has_ehci0 = 1,
462 +
463 + .leds = {
464 + {
465 + .name = "adsl",
466 + .gpio = NB4_74HC64_GPIO(4),
467 + .active_low = 1,
468 + },
469 + {
470 + .name = "traffic",
471 + .gpio = 2,
472 + },
473 + {
474 + .name = "tel",
475 + .gpio = NB4_74HC64_GPIO(3),
476 + .active_low = 1,
477 + },
478 + {
479 + .name = "tv",
480 + .gpio = NB4_74HC64_GPIO(2),
481 + .active_low = 1,
482 + },
483 + {
484 + .name = "wifi",
485 + .gpio = 15,
486 + },
487 + {
488 + .name = "alarm",
489 + .gpio = NB4_74HC64_GPIO(0),
490 + .active_low = 1,
491 + },
492 + {
493 + .name = "service:red",
494 + .gpio = 29,
495 + },
496 + {
497 + .name = "service:green",
498 + .gpio = 30,
499 + },
500 + {
501 + .name = "service:blue",
502 + .gpio = 4,
503 + },
504 + },
505 + .buttons = {
506 + {
507 + .desc = "reset",
508 + .gpio = 34,
509 + .type = EV_KEY,
510 + .code = KEY_RESTART,
511 + .threshold = 3,
512 + },
513 + {
514 + .desc = "wps",
515 + .gpio = 37,
516 + .type = EV_KEY,
517 + .code = KEY_WPS_BUTTON,
518 + .threshold = 3,
519 + },
520 + },
521 + .devs = nb4_devices,
522 + .num_devs = ARRAY_SIZE(nb4_devices),
523 + .spis = nb4_spi_devices,
524 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
525 +};
526 #endif
527
528 /*
529 @@ -779,9 +1284,30 @@ static const struct board_info __initdat
530 &board_96358vw2,
531 &board_AGPFS0,
532 &board_DWVS0,
533 + &board_nb4_ser_r0,
534 + &board_nb4_ser_r1,
535 + &board_nb4_ser_r2,
536 + &board_nb4_fxc_r1,
537 + &board_nb4_fxc_r2,
538 #endif
539 };
540
541 +static void __init nb4_nvram_fixup(void)
542 +{
543 + u8 *boot_addr, *p;
544 + u32 val;
545 +
546 + if (BCMCPU_IS_6358() && (!strcmp(nvram.name, "96358VW"))) {
547 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
548 + val &= MPI_CSBASE_BASE_MASK;
549 + boot_addr = (u8 *)KSEG1ADDR(val);
550 + /* Extract nb4 PID */
551 + p = boot_addr + NB4_PID_OFFSET;
552 + if (!memcmp(p, "NB4-", 4))
553 + memcpy(nvram.name, p, sizeof("NB4-XXX-rX"));
554 + }
555 +}
556 +
557 /*
558 * Register a sane SPROMv2 to make the on-board
559 * bcm4318 WLAN work
560 @@ -899,6 +1425,9 @@ void __init board_prom_init(void)
561 return;
562 }
563
564 + /* Fixup broken nb4 board name */
565 + nb4_nvram_fixup();
566 +
567 /* find board by name */
568 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
569 if (strncmp(nvram.name, bcm963xx_boards[i]->name,
This page took 0.067114 seconds and 5 git commands to generate.