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_keys.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 @@ -666,6 +675,496 @@ 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,
93 + .gpio = NB4_74HC64_GPIO(4),
103 + .gpio = NB4_74HC64_GPIO(3),
108 + .gpio = NB4_74HC64_GPIO(2),
118 + .gpio = NB4_74HC64_GPIO(0),
122 + .name = "service:red",
127 + .name = "service:green",
132 + .name = "service:blue",
142 + .code = KEY_RESTART,
143 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
149 + .code = KEY_WPS_BUTTON,
150 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
153 + .devs = nb4_devices,
154 + .num_devs = ARRAY_SIZE(nb4_devices),
155 + .spis = nb4_spi_devices,
156 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
159 +static struct board_info __initdata board_nb4_ser_r1 = {
160 + .name = "NB4-SER-r1",
161 + .expected_cpu_id = 0x6358,
170 + .use_internal_phy = 1,
174 + .force_speed_100 = 1,
175 + .force_duplex_full = 1,
186 + .gpio = NB4_74HC64_GPIO(4),
196 + .gpio = NB4_74HC64_GPIO(3),
201 + .gpio = NB4_74HC64_GPIO(2),
211 + .gpio = NB4_74HC64_GPIO(0),
215 + .name = "service:red",
220 + .name = "service:green",
225 + .name = "service:blue",
235 + .code = KEY_RESTART,
236 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
242 + .code = KEY_WPS_BUTTON,
243 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
246 + .devs = nb4_devices,
247 + .num_devs = ARRAY_SIZE(nb4_devices),
248 + .spis = nb4_spi_devices,
249 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
252 +static struct board_info __initdata board_nb4_ser_r2 = {
253 + .name = "NB4-SER-r2",
254 + .expected_cpu_id = 0x6358,
263 + .use_internal_phy = 1,
267 + .force_speed_100 = 1,
268 + .force_duplex_full = 1,
279 + .gpio = NB4_74HC64_GPIO(4),
289 + .gpio = NB4_74HC64_GPIO(3),
294 + .gpio = NB4_74HC64_GPIO(2),
304 + .gpio = NB4_74HC64_GPIO(0),
308 + .name = "service:red",
313 + .name = "service:green",
318 + .name = "service:blue",
328 + .code = KEY_RESTART,
329 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
335 + .code = KEY_WPS_BUTTON,
336 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
339 + .devs = nb4_devices,
340 + .num_devs = ARRAY_SIZE(nb4_devices),
341 + .spis = nb4_spi_devices,
342 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
345 +static struct board_info __initdata board_nb4_fxc_r1 = {
346 + .name = "NB4-FXC-r1",
347 + .expected_cpu_id = 0x6358,
356 + .use_internal_phy = 1,
360 + .force_speed_100 = 1,
361 + .force_duplex_full = 1,
372 + .gpio = NB4_74HC64_GPIO(4),
381 + .gpio = NB4_74HC64_GPIO(3),
386 + .gpio = NB4_74HC64_GPIO(2),
395 + .gpio = NB4_74HC64_GPIO(0),
399 + .name = "service:red",
403 + .name = "service:green",
407 + .name = "service:blue",
416 + .code = KEY_RESTART,
417 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
423 + .code = KEY_WPS_BUTTON,
424 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
427 + .devs = nb4_devices,
428 + .num_devs = ARRAY_SIZE(nb4_devices),
429 + .spis = nb4_spi_devices,
430 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
433 +static struct board_info __initdata board_nb4_fxc_r2 = {
434 + .name = "NB4-FXC-r2",
435 + .expected_cpu_id = 0x6358,
444 + .use_internal_phy = 1,
448 + .force_speed_100 = 1,
449 + .force_duplex_full = 1,
460 + .gpio = NB4_74HC64_GPIO(4),
469 + .gpio = NB4_74HC64_GPIO(3),
474 + .gpio = NB4_74HC64_GPIO(2),
483 + .gpio = NB4_74HC64_GPIO(0),
487 + .name = "service:red",
491 + .name = "service:green",
495 + .name = "service:blue",
504 + .code = KEY_RESTART,
505 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
511 + .code = KEY_WPS_BUTTON,
512 + .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
515 + .devs = nb4_devices,
516 + .num_devs = ARRAY_SIZE(nb4_devices),
517 + .spis = nb4_spi_devices,
518 + .num_spis = ARRAY_SIZE(nb4_spi_devices),
523 @@ -696,9 +1195,30 @@ static const struct board_info __initdat
535 +static void __init nb4_nvram_fixup(void)
540 + if (BCMCPU_IS_6358() && (!strcmp(nvram.name, "96358VW"))) {
541 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
542 + val &= MPI_CSBASE_BASE_MASK;
543 + boot_addr = (u8 *)KSEG1ADDR(val);
544 + /* Extract nb4 PID */
545 + p = boot_addr + NB4_PID_OFFSET;
546 + if (!memcmp(p, "NB4-", 4))
547 + memcpy(nvram.name, p, sizeof("NB4-XXX-rX"));
552 * Register a sane SPROMv2 to make the on-board
554 @@ -854,6 +1374,9 @@ void __init board_prom_init(void)
555 boardid_fixup(boot_addr);
558 + /* Fixup broken nb4 board name */
561 /* find board by name */
562 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
563 if (strncmp(nvram.name, bcm963xx_boards[i]->name,