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