1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
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>
14 #define CFE_OFFSET_64K 0x10000
15 #define CFE_OFFSET_128K 0x20000
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))
23 static struct bcm963xx_nvram nvram;
24 static unsigned int mac_addr_used;
25 static struct board_info board;
26 @@ -780,6 +789,502 @@ static struct board_info __initdata boar
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,
39 +static struct platform_device nb4_spi_gpio = {
43 + .platform_data = &nb4_spi_gpio_data,
47 +static struct platform_device * __initdata nb4_devices[] = {
51 +const struct gen_74x164_chip_platform_data nb4_74x164_platform_data = {
52 + .base = NB4_74X164_GPIO_BASE
55 +static struct spi_board_info nb4_spi_devices[] = {
57 + .modalias = "74x164",
58 + .max_speed_hz = 781000,
60 + .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT,
62 + .platform_data = &nb4_74x164_platform_data
66 +static struct board_info __initdata board_nb4_ser_r0 = {
67 + .name = "NB4-SER-r0",
68 + .expected_cpu_id = 0x6358,
77 + .use_internal_phy = 1,
81 + .force_speed_100 = 1,
82 + .force_duplex_full = 1,
95 + .gpio = NB4_74HC64_GPIO(4),
105 + .gpio = NB4_74HC64_GPIO(3),
110 + .gpio = NB4_74HC64_GPIO(2),
120 + .gpio = NB4_74HC64_GPIO(0),
124 + .name = "service:red",
129 + .name = "service:green",
134 + .name = "service:blue",
144 + .code = KEY_RESTART,
151 + .code = KEY_WPS_BUTTON,
155 + .devs = nb4_devices,
156 + .num_devs = ARRAY_SIZE(nb4_devices),
157 + .spis = nb4_spi_devices,
158 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
161 +static struct board_info __initdata board_nb4_ser_r1 = {
162 + .name = "NB4-SER-r1",
163 + .expected_cpu_id = 0x6358,
172 + .use_internal_phy = 1,
176 + .force_speed_100 = 1,
177 + .force_duplex_full = 1,
190 + .gpio = NB4_74HC64_GPIO(4),
200 + .gpio = NB4_74HC64_GPIO(3),
205 + .gpio = NB4_74HC64_GPIO(2),
215 + .gpio = NB4_74HC64_GPIO(0),
219 + .name = "service:red",
224 + .name = "service:green",
229 + .name = "service:blue",
239 + .code = KEY_RESTART,
246 + .code = KEY_WPS_BUTTON,
250 + .devs = nb4_devices,
251 + .num_devs = ARRAY_SIZE(nb4_devices),
252 + .spis = nb4_spi_devices,
253 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
256 +static struct board_info __initdata board_nb4_ser_r2 = {
257 + .name = "NB4-SER-r2",
258 + .expected_cpu_id = 0x6358,
267 + .use_internal_phy = 1,
271 + .force_speed_100 = 1,
272 + .force_duplex_full = 1,
283 + .gpio = NB4_74HC64_GPIO(4),
293 + .gpio = NB4_74HC64_GPIO(3),
298 + .gpio = NB4_74HC64_GPIO(2),
308 + .gpio = NB4_74HC64_GPIO(0),
312 + .name = "service:red",
317 + .name = "service:green",
322 + .name = "service:blue",
332 + .code = KEY_RESTART,
339 + .code = KEY_WPS_BUTTON,
343 + .devs = nb4_devices,
344 + .num_devs = ARRAY_SIZE(nb4_devices),
345 + .spis = nb4_spi_devices,
346 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
349 +static struct board_info __initdata board_nb4_fxc_r1 = {
350 + .name = "NB4-FXC-r1",
351 + .expected_cpu_id = 0x6358,
360 + .use_internal_phy = 1,
364 + .force_speed_100 = 1,
365 + .force_duplex_full = 1,
378 + .gpio = NB4_74HC64_GPIO(4),
387 + .gpio = NB4_74HC64_GPIO(3),
392 + .gpio = NB4_74HC64_GPIO(2),
401 + .gpio = NB4_74HC64_GPIO(0),
405 + .name = "service:red",
409 + .name = "service:green",
413 + .name = "service:blue",
422 + .code = KEY_RESTART,
429 + .code = KEY_WPS_BUTTON,
433 + .devs = nb4_devices,
434 + .num_devs = ARRAY_SIZE(nb4_devices),
435 + .spis = nb4_spi_devices,
436 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
439 +static struct board_info __initdata board_nb4_fxc_r2 = {
440 + .name = "NB4-FXC-r2",
441 + .expected_cpu_id = 0x6358,
450 + .use_internal_phy = 1,
454 + .force_speed_100 = 1,
455 + .force_duplex_full = 1,
466 + .gpio = NB4_74HC64_GPIO(4),
475 + .gpio = NB4_74HC64_GPIO(3),
480 + .gpio = NB4_74HC64_GPIO(2),
489 + .gpio = NB4_74HC64_GPIO(0),
493 + .name = "service:red",
497 + .name = "service:green",
501 + .name = "service:blue",
510 + .code = KEY_RESTART,
517 + .code = KEY_WPS_BUTTON,
521 + .devs = nb4_devices,
522 + .num_devs = ARRAY_SIZE(nb4_devices),
523 + .spis = nb4_spi_devices,
524 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
529 @@ -810,9 +1315,30 @@ static const struct board_info __initdat
541 +static void __init nb4_nvram_fixup(void)
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"));
558 * Register a sane SPROMv2 to make the on-board
560 @@ -953,6 +1479,9 @@ void __init board_prom_init(void)
561 boardid_fixup(boot_addr);
564 + /* Fixup broken nb4 board name */
567 /* find board by name */
568 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
569 if (strncmp(nvram.name, bcm963xx_boards[i]->name,