mirror of https://github.com/hak5/openwrt-owl.git
bcm63xx: make nvram checksum failures non fatal
fixes #12982. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 35605owl
parent
162b8e23a5
commit
485e52e1d8
|
@ -1,49 +0,0 @@
|
|||
From fb1e2c8a1073297f4674ca90c7d533de5187d158 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 9 Feb 2013 12:09:53 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: handle huawei nvram layout
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Huawei uses a custom nvram layout, extending it with additional 32
|
||||
byte field. This pushes also the checksum further, causing it to
|
||||
always fail the check.
|
||||
|
||||
Add an additional crc check for handling this modified nvram layout
|
||||
based on the different size.
|
||||
|
||||
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/nvram.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -59,8 +59,24 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
|
||||
crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
|
||||
- if (crc != expected_crc)
|
||||
+ if (crc != expected_crc) {
|
||||
+ /* huawei uses a modified nvram that is 32 bytes longer */
|
||||
+ if (nvram.version == 2 && !strncmp(nvram.name, "HW5", 3)) {
|
||||
+ check_len += 32;
|
||||
+
|
||||
+ /* restore old value */
|
||||
+ nvram.checksum_old = expected_crc;
|
||||
+ expected_crc = *(u32 *)&nvram.reserved3[28];
|
||||
+ /* zero the checksum field */
|
||||
+ memset(&nvram.reserved3[28], 0, 4);
|
||||
+
|
||||
+ crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
+
|
||||
+ if (crc == expected_crc)
|
||||
+ return 0;
|
||||
+ }
|
||||
return -EINVAL;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 12 Feb 2013 22:00:10 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: make nvram checksum failure non fatal
|
||||
|
||||
Some vendors modify the nvram layout moving the checksum to a different
|
||||
place or drop it entirely, so reduce the checksum failure to a warning.
|
||||
|
||||
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 5 +----
|
||||
arch/mips/bcm63xx/nvram.c | 7 +++----
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 4 +---
|
||||
3 files changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -745,10 +745,7 @@ void __init board_prom_init(void)
|
||||
strcpy(cfe_version, "unknown");
|
||||
printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
|
||||
|
||||
- if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
|
||||
- printk(KERN_ERR PFX "invalid nvram checksum\n");
|
||||
- return;
|
||||
- }
|
||||
+ bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
|
||||
board_name = bcm63xx_nvram_get_name();
|
||||
/* find board by name */
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
|
||||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
-int __init bcm63xx_nvram_init(void *addr)
|
||||
+void __init bcm63xx_nvram_init(void *addr)
|
||||
{
|
||||
unsigned int check_len;
|
||||
u32 crc, expected_crc;
|
||||
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
|
||||
if (crc != expected_crc)
|
||||
- return -EINVAL;
|
||||
-
|
||||
- return 0;
|
||||
+ pr_warn("nvram checksum invalid (expected %08x, actual %08x)\n",
|
||||
+ expected_crc, crc);
|
||||
}
|
||||
|
||||
u8 *bcm63xx_nvram_get_name(void)
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -9,10 +9,8 @@
|
||||
*
|
||||
* Initialized the local nvram copy from the target address and checks
|
||||
* its checksum.
|
||||
- *
|
||||
- * Returns 0 on success.
|
||||
*/
|
||||
-int __init bcm63xx_nvram_init(void *nvram);
|
||||
+void bcm63xx_nvram_init(void *nvram);
|
||||
|
||||
/**
|
||||
* bcm63xx_nvram_get_name() - returns the board name according to nvram
|
|
@ -53,7 +53,7 @@
|
|||
};
|
||||
|
||||
static struct board_info __initdata board_FAST2404 = {
|
||||
@@ -826,11 +851,23 @@ static struct platform_device bcm63xx_gp
|
||||
@@ -823,11 +848,23 @@ static struct platform_device bcm63xx_gp
|
||||
.dev.platform_data = &bcm63xx_led_data,
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
|||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
|
||||
@@ -876,5 +913,16 @@ int __init board_register_devices(void)
|
||||
@@ -873,5 +910,16 @@ int __init board_register_devices(void)
|
||||
|
||||
platform_device_register(&bcm63xx_gpio_leds);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -867,6 +867,7 @@ static struct platform_device bcm63xx_gp
|
||||
@@ -864,6 +864,7 @@ static struct platform_device bcm63xx_gp
|
||||
int __init board_register_devices(void)
|
||||
{
|
||||
int button_count = 0;
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -908,10 +909,16 @@ int __init board_register_devices(void)
|
||||
@@ -905,10 +906,16 @@ int __init board_register_devices(void)
|
||||
|
||||
bcm63xx_flash_register();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -907,6 +907,9 @@ int __init board_register_devices(void)
|
||||
@@ -904,6 +904,9 @@ int __init board_register_devices(void)
|
||||
|
||||
bcm63xx_spi_register();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <asm/addrspace.h>
|
||||
#include <bcm63xx_board.h>
|
||||
#include <bcm63xx_cpu.h>
|
||||
@@ -910,6 +911,9 @@ int __init board_register_devices(void)
|
||||
@@ -907,6 +908,9 @@ int __init board_register_devices(void)
|
||||
if (board.num_devs)
|
||||
platform_add_devices(board.devs, board.num_devs);
|
||||
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
/*
|
||||
* early init callback, read nvram data from flash and checksum it
|
||||
*/
|
||||
@@ -776,6 +805,11 @@ void __init board_prom_init(void)
|
||||
return;
|
||||
}
|
||||
@@ -773,6 +802,11 @@ void __init board_prom_init(void)
|
||||
|
||||
bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
|
||||
+ if (strcmp(cfe_version, "unknown") != 0) {
|
||||
+ /* cfe present */
|
||||
|
|
|
@ -71,7 +71,7 @@ Subject: [PATCH 31/72] MIPS: BCM63XX: register ohci device.
|
|||
#include <bcm63xx_dev_usb_usbd.h>
|
||||
#include <board_bcm963xx.h>
|
||||
|
||||
@@ -926,6 +927,9 @@ int __init board_register_devices(void)
|
||||
@@ -923,6 +924,9 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ Subject: [PATCH 33/72] MIPS: BCM63XX: register ehci device.
|
|||
#include <bcm63xx_dev_usb_usbd.h>
|
||||
#include <board_bcm963xx.h>
|
||||
|
||||
@@ -927,6 +928,9 @@ int __init board_register_devices(void)
|
||||
@@ -924,6 +925,9 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -862,6 +862,8 @@ void __init board_prom_init(void)
|
||||
@@ -859,6 +859,8 @@ void __init board_prom_init(void)
|
||||
if (BCMCPU_IS_6348())
|
||||
val |= GPIO_MODE_6348_G3_EXT_MII |
|
||||
GPIO_MODE_6348_G0_EXT_MII;
|
||||
|
|
|
@ -13,7 +13,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -930,6 +930,10 @@ int __init board_register_devices(void)
|
||||
@@ -927,6 +927,10 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#include <bcm63xx_dev_pcmcia.h>
|
||||
#include <bcm63xx_dev_spi.h>
|
||||
#include <bcm63xx_dev_usb_ohci.h>
|
||||
@@ -955,6 +956,7 @@ int __init board_register_devices(void)
|
||||
@@ -952,6 +953,7 @@ int __init board_register_devices(void)
|
||||
pr_err(PFX "failed to register fallback SPROM\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
@@ -121,3 +123,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
@@ -104,3 +106,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
|
||||
|
@ -35,7 +35,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -32,4 +32,6 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
@@ -30,4 +30,6 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
*/
|
||||
int bcm63xx_nvram_get_mac_address(u8 *mac);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
|
||||
@@ -910,6 +911,7 @@ int __init board_register_devices(void)
|
||||
@@ -907,6 +908,7 @@ int __init board_register_devices(void)
|
||||
{
|
||||
int button_count = 0;
|
||||
int led_count = 0;
|
||||
|
@ -26,7 +26,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -948,7 +950,8 @@ int __init board_register_devices(void)
|
||||
@@ -945,7 +947,8 @@ int __init board_register_devices(void)
|
||||
* do this after registering enet devices
|
||||
*/
|
||||
#ifdef CONFIG_SSB_PCIHOST
|
||||
|
@ -36,7 +36,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
if (ssb_arch_register_fallback_sprom(
|
||||
@@ -990,5 +993,9 @@ int __init board_register_devices(void)
|
||||
@@ -987,5 +990,9 @@ int __init board_register_devices(void)
|
||||
platform_device_register(&bcm63xx_gpio_keys_device);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
|
|||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -969,7 +969,7 @@ int __init board_register_devices(void)
|
||||
@@ -966,7 +966,7 @@ int __init board_register_devices(void)
|
||||
if (board.num_spis)
|
||||
spi_register_board_info(board.spis, board.num_spis);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ Subject: [PATCH] BCM63XX: add endian check for ath9k
|
|||
return;
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -995,7 +995,8 @@ int __init board_register_devices(void)
|
||||
@@ -992,7 +992,8 @@ int __init board_register_devices(void)
|
||||
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
|
|
|
@ -2,7 +2,7 @@ From: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
Subject: BCM63XX: add led pin for ath9k
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -996,7 +996,7 @@ int __init board_register_devices(void)
|
||||
@@ -993,7 +993,7 @@ int __init board_register_devices(void)
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
|
||||
|
|
|
@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
|
|||
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
|
||||
@@ -994,9 +995,19 @@ int __init board_register_devices(void)
|
||||
@@ -991,9 +992,19 @@ int __init board_register_devices(void)
|
||||
}
|
||||
|
||||
/* register any fixups */
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
+ if (boot_addr == (u8 *)0xbf800000) {
|
||||
+ u8 *tmp_boot_addr = (u8*)0xbfc00000;
|
||||
+
|
||||
+ if (!bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET) &&
|
||||
+ !strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) {
|
||||
+ bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
+ if(!strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) {
|
||||
+ printk(KERN_INFO PFX "V2500V: nvram bank 0\n");
|
||||
+ boot_addr = tmp_boot_addr;
|
||||
+ }
|
||||
|
|
|
@ -100,7 +100,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
|
|||
};
|
||||
|
||||
/*
|
||||
@@ -2412,12 +2488,25 @@ void __init board_prom_init(void)
|
||||
@@ -2409,12 +2485,25 @@ void __init board_prom_init(void)
|
||||
bcm63xx_pci_enabled = 1;
|
||||
if (BCMCPU_IS_6348())
|
||||
val |= GPIO_MODE_6348_G2_PCI;
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
+char nvram_buf[NVRAM_SPACE];
|
||||
+EXPORT_SYMBOL(nvram_buf);
|
||||
+
|
||||
int __init bcm63xx_nvram_init(void *addr)
|
||||
void __init bcm63xx_nvram_init(void *addr)
|
||||
{
|
||||
unsigned int check_len;
|
||||
@@ -47,6 +54,7 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
@@ -47,6 +54,7 @@ void __init bcm63xx_nvram_init(void *add
|
||||
|
||||
/* extract nvram data */
|
||||
memcpy(&nvram, addr, sizeof(nvram));
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
From fb1e2c8a1073297f4674ca90c7d533de5187d158 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 9 Feb 2013 12:09:53 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: handle huawei nvram layout
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Huawei uses a custom nvram layout, extending it with additional 32
|
||||
byte field. This pushes also the checksum further, causing it to
|
||||
always fail the check.
|
||||
|
||||
Add an additional crc check for handling this modified nvram layout
|
||||
based on the different size.
|
||||
|
||||
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/nvram.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -59,8 +59,24 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
|
||||
crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
|
||||
- if (crc != expected_crc)
|
||||
+ if (crc != expected_crc) {
|
||||
+ /* huawei uses a modified nvram that is 32 bytes longer */
|
||||
+ if (nvram.version == 2 && !strncmp(nvram.name, "HW5", 3)) {
|
||||
+ check_len += 32;
|
||||
+
|
||||
+ /* restore old value */
|
||||
+ nvram.checksum_old = expected_crc;
|
||||
+ expected_crc = *(u32 *)&nvram.reserved3[28];
|
||||
+ /* zero the checksum field */
|
||||
+ memset(&nvram.reserved3[28], 0, 4);
|
||||
+
|
||||
+ crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
+
|
||||
+ if (crc == expected_crc)
|
||||
+ return 0;
|
||||
+ }
|
||||
return -EINVAL;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 12 Feb 2013 22:00:10 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: make nvram checksum failure non fatal
|
||||
|
||||
Some vendors modify the nvram layout moving the checksum to a different
|
||||
place or drop it entirely, so reduce the checksum failure to a warning.
|
||||
|
||||
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 5 +----
|
||||
arch/mips/bcm63xx/nvram.c | 7 +++----
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 4 +---
|
||||
3 files changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -747,10 +747,7 @@ void __init board_prom_init(void)
|
||||
strcpy(cfe_version, "unknown");
|
||||
printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
|
||||
|
||||
- if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
|
||||
- printk(KERN_ERR PFX "invalid nvram checksum\n");
|
||||
- return;
|
||||
- }
|
||||
+ bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
|
||||
board_name = bcm63xx_nvram_get_name();
|
||||
/* find board by name */
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
|
||||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
-int __init bcm63xx_nvram_init(void *addr)
|
||||
+void __init bcm63xx_nvram_init(void *addr)
|
||||
{
|
||||
unsigned int check_len;
|
||||
u32 crc, expected_crc;
|
||||
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
||||
|
||||
if (crc != expected_crc)
|
||||
- return -EINVAL;
|
||||
-
|
||||
- return 0;
|
||||
+ pr_warn("nvram checksum invalid (expected %08x, actual %08x)\n",
|
||||
+ expected_crc, crc);
|
||||
}
|
||||
|
||||
u8 *bcm63xx_nvram_get_name(void)
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -9,10 +9,8 @@
|
||||
*
|
||||
* Initialized the local nvram copy from the target address and checks
|
||||
* its checksum.
|
||||
- *
|
||||
- * Returns 0 on success.
|
||||
*/
|
||||
-int __init bcm63xx_nvram_init(void *nvram);
|
||||
+void bcm63xx_nvram_init(void *nvram);
|
||||
|
||||
/**
|
||||
* bcm63xx_nvram_get_name() - returns the board name according to nvram
|
|
@ -53,7 +53,7 @@
|
|||
};
|
||||
|
||||
static struct board_info __initdata board_FAST2404 = {
|
||||
@@ -828,11 +853,23 @@ static struct platform_device bcm63xx_gp
|
||||
@@ -825,11 +850,23 @@ static struct platform_device bcm63xx_gp
|
||||
.dev.platform_data = &bcm63xx_led_data,
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
|||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
|
||||
@@ -884,5 +921,16 @@ int __init board_register_devices(void)
|
||||
@@ -881,5 +918,16 @@ int __init board_register_devices(void)
|
||||
|
||||
platform_device_register(&bcm63xx_gpio_leds);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -869,6 +869,7 @@ static struct platform_device bcm63xx_gp
|
||||
@@ -866,6 +866,7 @@ static struct platform_device bcm63xx_gp
|
||||
int __init board_register_devices(void)
|
||||
{
|
||||
int button_count = 0;
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -916,10 +917,16 @@ int __init board_register_devices(void)
|
||||
@@ -913,10 +914,16 @@ int __init board_register_devices(void)
|
||||
|
||||
bcm63xx_flash_register();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -915,6 +915,9 @@ int __init board_register_devices(void)
|
||||
@@ -912,6 +912,9 @@ int __init board_register_devices(void)
|
||||
|
||||
bcm63xx_spi_register();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <asm/addrspace.h>
|
||||
#include <bcm63xx_board.h>
|
||||
#include <bcm63xx_cpu.h>
|
||||
@@ -918,6 +919,9 @@ int __init board_register_devices(void)
|
||||
@@ -915,6 +916,9 @@ int __init board_register_devices(void)
|
||||
if (board.num_devs)
|
||||
platform_add_devices(board.devs, board.num_devs);
|
||||
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
/*
|
||||
* early init callback, read nvram data from flash and checksum it
|
||||
*/
|
||||
@@ -778,6 +807,11 @@ void __init board_prom_init(void)
|
||||
return;
|
||||
}
|
||||
@@ -775,6 +804,11 @@ void __init board_prom_init(void)
|
||||
|
||||
bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
|
||||
+ if (strcmp(cfe_version, "unknown") != 0) {
|
||||
+ /* cfe present */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -862,6 +862,8 @@ void __init board_prom_init(void)
|
||||
@@ -859,6 +859,8 @@ void __init board_prom_init(void)
|
||||
if (BCMCPU_IS_6348())
|
||||
val |= GPIO_MODE_6348_G3_EXT_MII |
|
||||
GPIO_MODE_6348_G0_EXT_MII;
|
||||
|
|
|
@ -13,7 +13,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -930,6 +930,10 @@ int __init board_register_devices(void)
|
||||
@@ -927,6 +927,10 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#include <bcm63xx_dev_pcmcia.h>
|
||||
#include <bcm63xx_dev_spi.h>
|
||||
#include <bcm63xx_dev_usb_ehci.h>
|
||||
@@ -955,6 +956,7 @@ int __init board_register_devices(void)
|
||||
@@ -952,6 +953,7 @@ int __init board_register_devices(void)
|
||||
pr_err(PFX "failed to register fallback SPROM\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
@@ -121,3 +123,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
@@ -104,3 +106,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
|
||||
|
@ -35,7 +35,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -32,4 +32,6 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
@@ -30,4 +30,6 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
*/
|
||||
int bcm63xx_nvram_get_mac_address(u8 *mac);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
|
||||
@@ -910,6 +911,7 @@ int __init board_register_devices(void)
|
||||
@@ -907,6 +908,7 @@ int __init board_register_devices(void)
|
||||
{
|
||||
int button_count = 0;
|
||||
int led_count = 0;
|
||||
|
@ -26,7 +26,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -948,7 +950,8 @@ int __init board_register_devices(void)
|
||||
@@ -945,7 +947,8 @@ int __init board_register_devices(void)
|
||||
* do this after registering enet devices
|
||||
*/
|
||||
#ifdef CONFIG_SSB_PCIHOST
|
||||
|
@ -36,7 +36,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
|||
memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
if (ssb_arch_register_fallback_sprom(
|
||||
@@ -990,5 +993,9 @@ int __init board_register_devices(void)
|
||||
@@ -987,5 +990,9 @@ int __init board_register_devices(void)
|
||||
platform_device_register(&bcm63xx_gpio_keys_device);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
|
|||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -969,7 +969,7 @@ int __init board_register_devices(void)
|
||||
@@ -966,7 +966,7 @@ int __init board_register_devices(void)
|
||||
if (board.num_spis)
|
||||
spi_register_board_info(board.spis, board.num_spis);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
return;
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -995,7 +995,8 @@ int __init board_register_devices(void)
|
||||
@@ -992,7 +992,8 @@ int __init board_register_devices(void)
|
||||
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -996,7 +996,7 @@ int __init board_register_devices(void)
|
||||
@@ -993,7 +993,7 @@ int __init board_register_devices(void)
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
|
||||
|
|
|
@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
|
|||
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
|
||||
@@ -994,9 +995,19 @@ int __init board_register_devices(void)
|
||||
@@ -991,9 +992,19 @@ int __init board_register_devices(void)
|
||||
}
|
||||
|
||||
/* register any fixups */
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
+ if (boot_addr == (u8 *)0xbf800000) {
|
||||
+ u8 *tmp_boot_addr = (u8*)0xbfc00000;
|
||||
+
|
||||
+ if (!bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET) &&
|
||||
+ !strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) {
|
||||
+ bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET);
|
||||
+ if (!strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) {
|
||||
+ printk(KERN_INFO PFX "V2500V: nvram bank 0\n");
|
||||
+ boot_addr = tmp_boot_addr;
|
||||
+ }
|
||||
|
|
|
@ -100,7 +100,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
|
|||
};
|
||||
|
||||
/*
|
||||
@@ -2412,12 +2488,25 @@ void __init board_prom_init(void)
|
||||
@@ -2409,12 +2485,25 @@ void __init board_prom_init(void)
|
||||
bcm63xx_pci_enabled = 1;
|
||||
if (BCMCPU_IS_6348())
|
||||
val |= GPIO_MODE_6348_G2_PCI;
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
+char nvram_buf[NVRAM_SPACE];
|
||||
+EXPORT_SYMBOL(nvram_buf);
|
||||
+
|
||||
int __init bcm63xx_nvram_init(void *addr)
|
||||
void __init bcm63xx_nvram_init(void *addr)
|
||||
{
|
||||
unsigned int check_len;
|
||||
@@ -47,6 +54,7 @@ int __init bcm63xx_nvram_init(void *addr
|
||||
@@ -47,6 +54,7 @@ void __init bcm63xx_nvram_init(void *add
|
||||
|
||||
/* extract nvram data */
|
||||
memcpy(&nvram, addr, sizeof(nvram));
|
||||
|
|
Loading…
Reference in New Issue