openwrt/target/linux/brcm63xx/patches-2.6.32/221-board-NB4.patch

552 lines
9.8 KiB
Diff

Index: linux-2.6.32.13/arch/mips/bcm63xx/boards/board_bcm963xx.c
===================================================================
--- linux-2.6.32.13.orig/arch/mips/bcm63xx/boards/board_bcm963xx.c 2010-05-27 21:45:09.000000000 -0400
+++ linux-2.6.32.13/arch/mips/bcm63xx/boards/board_bcm963xx.c 2010-05-27 21:46:39.000000000 -0400
@@ -17,6 +17,7 @@
#include <linux/ssb/ssb.h>
#include <linux/gpio_buttons.h>
#include <linux/input.h>
+#include <linux/nxp_74hc164.h>
#include <asm/addrspace.h>
#include <bcm63xx_board.h>
#include <bcm63xx_cpu.h>
@@ -33,6 +34,12 @@
#define PFX "board_bcm963xx: "
+#define NEUFBOX4_PID_OFFSET 0xff80
+#define NEUFBOX4_EXP_GPIO_BASE 64
+#define NEUFBOX4_GPIO_74HC164_DATA 7
+#define NEUFBOX4_GPIO_74HC164_CLK 6
+#define NXP_74HC64_GPIO(X) (NEUFBOX4_EXP_GPIO_BASE + (X))
+
static struct bcm963xx_nvram nvram;
static unsigned int mac_addr_used;
static struct board_info board;
@@ -697,6 +704,471 @@
.has_ohci0 = 1,
};
+
+static struct nxp_74hc164_platform_data neufbox4_74hc164_data = {
+ .gpio_base = NEUFBOX4_EXP_GPIO_BASE,
+ .gpio_pin_data = NEUFBOX4_GPIO_74HC164_DATA,
+ .gpio_pin_clk = NEUFBOX4_GPIO_74HC164_CLK,
+
+};
+
+static struct platform_device neufbox4_74hc164 = {
+ .name = NXP_74HC164_DRIVER_NAME,
+ .id = -1,
+ .dev = {
+ .platform_data = &neufbox4_74hc164_data,
+ }
+};
+
+static struct platform_device * __initdata neufbox4_devices[] = {
+ &neufbox4_74hc164,
+};
+
+static struct board_info __initdata board_nb4_ser_r0 = {
+ .name = "NB4-SER-r0",
+ .expected_cpu_id = 0x6358,
+
+ .has_enet0 = 1,
+ .has_enet1 = 1,
+ .has_pci = 1,
+
+ .enet0 = {
+ .has_phy = 1,
+ .use_internal_phy = 1,
+ },
+
+ .enet1 = {
+ .force_speed_100 = 1,
+ .force_duplex_full = 1,
+ },
+
+
+ .has_ohci0 = 1,
+ .has_pccard = 1,
+ .has_ehci0 = 1,
+
+ .has_udc0 = 1,
+
+ .leds = {
+ {
+ .name = "adsl",
+ .gpio = NXP_74HC64_GPIO(4),
+ .active_low = 1,
+ },
+ {
+ .name = "traffic",
+ .gpio = 2,
+ .active_low = 1,
+ },
+ {
+ .name = "tel",
+ .gpio = NXP_74HC64_GPIO(3),
+ .active_low = 1,
+ },
+ {
+ .name = "tv",
+ .gpio = NXP_74HC64_GPIO(2),
+ .active_low = 1,
+ },
+ {
+ .name = "wifi",
+ .gpio = 15,
+ .active_low = 1,
+ },
+ {
+ .name = "alarm",
+ .gpio = NXP_74HC64_GPIO(0),
+ .active_low = 1,
+ },
+ {
+ .name = "service:red",
+ .gpio = 29,
+ .active_low = 1,
+ },
+ {
+ .name = "service:green",
+ .gpio = 30,
+ .active_low = 1,
+ },
+ {
+ .name = "service:blue",
+ .gpio = 4,
+ .active_low = 1,
+ },
+ },
+ .buttons = {
+ {
+ .desc = "reset",
+ .gpio = 34,
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .threshold = 3,
+ },
+ {
+ .desc = "wps",
+ .gpio = 37,
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .threshold = 3,
+ },
+ },
+ .devs = neufbox4_devices,
+ .num_devs = ARRAY_SIZE(neufbox4_devices),
+};
+
+static struct board_info __initdata board_nb4_ser_r1 = {
+ .name = "NB4-SER-r1",
+ .expected_cpu_id = 0x6358,
+
+ .has_enet0 = 1,
+ .has_enet1 = 1,
+ .has_pci = 1,
+
+ .enet0 = {
+ .has_phy = 1,
+ .use_internal_phy = 1,
+ },
+
+ .enet1 = {
+ .force_speed_100 = 1,
+ .force_duplex_full = 1,
+ },
+
+
+ .has_ohci0 = 1,
+ .has_pccard = 1,
+ .has_ehci0 = 1,
+
+ .has_udc0 = 1,
+
+ .leds = {
+ {
+ .name = "adsl",
+ .gpio = NXP_74HC64_GPIO(4),
+ .active_low = 1,
+ },
+ {
+ .name = "traffic",
+ .gpio = 2,
+ .active_low = 1,
+ },
+ {
+ .name = "tel",
+ .gpio = NXP_74HC64_GPIO(3),
+ .active_low = 1,
+ },
+ {
+ .name = "tv",
+ .gpio = NXP_74HC64_GPIO(2),
+ .active_low = 1,
+ },
+ {
+ .name = "wifi",
+ .gpio = 15,
+ .active_low = 1,
+ },
+ {
+ .name = "alarm",
+ .gpio = NXP_74HC64_GPIO(0),
+ .active_low = 1,
+ },
+ {
+ .name = "service:red",
+ .gpio = 29,
+ .active_low = 1,
+ },
+ {
+ .name = "service:green",
+ .gpio = 30,
+ .active_low = 1,
+ },
+ {
+ .name = "service:blue",
+ .gpio = 4,
+ .active_low = 1,
+ },
+ },
+ .buttons = {
+ {
+ .desc = "reset",
+ .gpio = 34,
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .threshold = 3,
+ },
+ {
+ .desc = "wps",
+ .gpio = 37,
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .threshold = 3,
+ },
+ },
+ .devs = neufbox4_devices,
+ .num_devs = ARRAY_SIZE(neufbox4_devices),
+};
+
+static struct board_info __initdata board_nb4_ser_r2 = {
+ .name = "NB4-SER-r2",
+ .expected_cpu_id = 0x6358,
+
+ .has_enet0 = 1,
+ .has_enet1 = 1,
+ .has_pci = 1,
+
+ .enet0 = {
+ .has_phy = 1,
+ .use_internal_phy = 1,
+ },
+
+ .enet1 = {
+ .force_speed_100 = 1,
+ .force_duplex_full = 1,
+ },
+
+
+ .has_ohci0 = 1,
+ .has_pccard = 1,
+ .has_ehci0 = 1,
+
+ .leds = {
+ {
+ .name = "adsl",
+ .gpio = NXP_74HC64_GPIO(4),
+ .active_low = 1,
+ },
+ {
+ .name = "traffic",
+ .gpio = 2,
+ .active_low = 1,
+ },
+ {
+ .name = "tel",
+ .gpio = NXP_74HC64_GPIO(3),
+ .active_low = 1,
+ },
+ {
+ .name = "tv",
+ .gpio = NXP_74HC64_GPIO(2),
+ .active_low = 1,
+ },
+ {
+ .name = "wifi",
+ .gpio = 15,
+ .active_low = 1,
+ },
+ {
+ .name = "alarm",
+ .gpio = NXP_74HC64_GPIO(0),
+ .active_low = 1,
+ },
+ {
+ .name = "service:red",
+ .gpio = 29,
+ .active_low = 1,
+ },
+ {
+ .name = "service:green",
+ .gpio = 30,
+ .active_low = 1,
+ },
+ {
+ .name = "service:blue",
+ .gpio = 4,
+ .active_low = 1,
+ },
+ },
+ .buttons = {
+ {
+ .desc = "reset",
+ .gpio = 34,
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .threshold = 3,
+ },
+ {
+ .desc = "wps",
+ .gpio = 37,
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .threshold = 3,
+ },
+ },
+ .devs = neufbox4_devices,
+ .num_devs = ARRAY_SIZE(neufbox4_devices),
+};
+
+static struct board_info __initdata board_nb4_fxc_r1 = {
+ .name = "NB4-FXC-r1",
+ .expected_cpu_id = 0x6358,
+
+ .has_enet0 = 1,
+ .has_enet1 = 1,
+ .has_pci = 1,
+
+ .enet0 = {
+ .has_phy = 1,
+ .use_internal_phy = 1,
+ },
+
+ .enet1 = {
+ .force_speed_100 = 1,
+ .force_duplex_full = 1,
+ },
+
+
+ .has_ohci0 = 1,
+ .has_pccard = 1,
+ .has_ehci0 = 1,
+
+ .has_udc0 = 1,
+
+ .leds = {
+ {
+ .name = "adsl",
+ .gpio = NXP_74HC64_GPIO(4),
+ .active_low = 1,
+ },
+ {
+ .name = "traffic",
+ .gpio = 2,
+ },
+ {
+ .name = "tel",
+ .gpio = NXP_74HC64_GPIO(3),
+ .active_low = 1,
+ },
+ {
+ .name = "tv",
+ .gpio = NXP_74HC64_GPIO(2),
+ .active_low = 1,
+ },
+ {
+ .name = "wifi",
+ .gpio = 15,
+ },
+ {
+ .name = "alarm",
+ .gpio = NXP_74HC64_GPIO(0),
+ .active_low = 1,
+ },
+ {
+ .name = "service:red",
+ .gpio = 29,
+ },
+ {
+ .name = "service:green",
+ .gpio = 30,
+ },
+ {
+ .name = "service:blue",
+ .gpio = 4,
+ },
+ },
+ .buttons = {
+ {
+ .desc = "reset",
+ .gpio = 34,
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .threshold = 3,
+ },
+ {
+ .desc = "wps",
+ .gpio = 37,
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .threshold = 3,
+ },
+ },
+ .devs = neufbox4_devices,
+ .num_devs = ARRAY_SIZE(neufbox4_devices),
+};
+
+static struct board_info __initdata board_nb4_fxc_r2 = {
+ .name = "NB4-FXC-r2",
+ .expected_cpu_id = 0x6358,
+
+ .has_enet0 = 1,
+ .has_enet1 = 1,
+ .has_pci = 1,
+
+ .enet0 = {
+ .has_phy = 1,
+ .use_internal_phy = 1,
+ },
+
+ .enet1 = {
+ .force_speed_100 = 1,
+ .force_duplex_full = 1,
+ },
+
+
+ .has_ohci0 = 1,
+ .has_pccard = 1,
+ .has_ehci0 = 1,
+
+ .leds = {
+ {
+ .name = "adsl",
+ .gpio = NXP_74HC64_GPIO(4),
+ .active_low = 1,
+ },
+ {
+ .name = "traffic",
+ .gpio = 2,
+ },
+ {
+ .name = "tel",
+ .gpio = NXP_74HC64_GPIO(3),
+ .active_low = 1,
+ },
+ {
+ .name = "tv",
+ .gpio = NXP_74HC64_GPIO(2),
+ .active_low = 1,
+ },
+ {
+ .name = "wifi",
+ .gpio = 15,
+ },
+ {
+ .name = "alarm",
+ .gpio = NXP_74HC64_GPIO(0),
+ .active_low = 1,
+ },
+ {
+ .name = "service:red",
+ .gpio = 29,
+ },
+ {
+ .name = "service:green",
+ .gpio = 30,
+ },
+ {
+ .name = "service:blue",
+ .gpio = 4,
+ },
+ },
+ .buttons = {
+ {
+ .desc = "reset",
+ .gpio = 34,
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .threshold = 3,
+ },
+ {
+ .desc = "wps",
+ .gpio = 37,
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .threshold = 3,
+ },
+ },
+ .devs = neufbox4_devices,
+ .num_devs = ARRAY_SIZE(neufbox4_devices),
+};
#endif
/*
@@ -727,9 +1199,30 @@
&board_96358vw2,
&board_AGPFS0,
&board_DWVS0,
+ &board_nb4_ser_r0,
+ &board_nb4_ser_r1,
+ &board_nb4_ser_r2,
+ &board_nb4_fxc_r1,
+ &board_nb4_fxc_r2,
#endif
};
+static void __init neufbox4_nvram_fixup(void)
+{
+ u8 *boot_addr, *p;
+ u32 val;
+
+ if (BCMCPU_IS_6358() && (!strcmp(nvram.name, "96358VW"))) {
+ val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+ val &= MPI_CSBASE_BASE_MASK;
+ boot_addr = (u8 *)KSEG1ADDR(val);
+ /* Extract neufbox4 PID */
+ p = boot_addr + NEUFBOX4_PID_OFFSET;
+ if (!memcmp(p, "NB4-", 4))
+ memcpy(nvram.name, p, sizeof("NB4-XXX-rX"));
+ }
+}
+
/*
* early init callback, read nvram data from flash and checksum it
*/
@@ -777,6 +1270,9 @@
return;
}
+ /* Fixup broken neufbox4 board name */
+ neufbox4_nvram_fixup();
+
/* find board by name */
for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
if (strncmp(nvram.name, bcm963xx_boards[i]->name,
Index: linux-2.6.32.13/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
===================================================================
--- linux-2.6.32.13.orig/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h 2010-05-27 21:44:35.000000000 -0400
+++ linux-2.6.32.13/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h 2010-05-27 21:47:03.000000000 -0400
@@ -55,7 +55,7 @@
struct bcm63xx_dsp_platform_data dsp;
/* GPIO LEDs */
- struct gpio_led leds[5];
+ struct gpio_led leds[9];
/* Buttons */
struct gpio_button buttons[2];