aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2013-02-10 12:31:31 +0000
committerJonas Gorski <jogo@openwrt.org>2013-02-10 12:31:31 +0000
commit3d89abe3bfee098fec6706a0a5b0f54305ee2dc0 (patch)
tree914241dd8c50fb4e365945002d3a338b5f928ba7 /target/linux
parent615488695159cb594213d6edb34bde732516297f (diff)
downloadupstream-3d89abe3bfee098fec6706a0a5b0f54305ee2dc0.tar.gz
upstream-3d89abe3bfee098fec6706a0a5b0f54305ee2dc0.tar.bz2
upstream-3d89abe3bfee098fec6706a0a5b0f54305ee2dc0.zip
bcm63xx: handle huawei nvram layout
Use a different length for calculating the nvram checksum on hauwei boards. Fixes boot on HW553 and HW556. Signed-off-by: Jonas Gorski <jogo@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35533 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch49
-rw-r--r--target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch2
-rw-r--r--target/linux/brcm63xx/patches-3.7/556-board_rta770w.patch4
-rw-r--r--target/linux/brcm63xx/patches-3.7/801-ssb_export_fallback_sprom.patch4
-rw-r--r--target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch49
-rw-r--r--target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch2
-rw-r--r--target/linux/brcm63xx/patches-3.8/556-board_rta770w.patch4
-rw-r--r--target/linux/brcm63xx/patches-3.8/801-ssb_export_fallback_sprom.patch4
8 files changed, 108 insertions, 10 deletions
diff --git a/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch b/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch
new file mode 100644
index 0000000000..14d83394be
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch
@@ -0,0 +1,49 @@
+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;
+ }
diff --git a/target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch b/target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
index bad4c4b9cc..3c3559a178 100644
--- a/target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
+++ b/target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
@@ -20,7 +20,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
static struct bcm963xx_nvram nvram;
static int mac_addr_used;
-@@ -105,3 +107,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
+@@ -121,3 +123,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
return 0;
}
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
diff --git a/target/linux/brcm63xx/patches-3.7/556-board_rta770w.patch b/target/linux/brcm63xx/patches-3.7/556-board_rta770w.patch
index e0eedad1e7..7528bd89b2 100644
--- a/target/linux/brcm63xx/patches-3.7/556-board_rta770w.patch
+++ b/target/linux/brcm63xx/patches-3.7/556-board_rta770w.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -796,6 +796,60 @@
+@@ -803,6 +803,60 @@ static struct board_info __initdata boar
},
},
};
@@ -61,7 +61,7 @@
#endif
/*
-@@ -3750,6 +3804,7 @@
+@@ -3757,6 +3811,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6345
&board_96345gw2,
&board_rta770bw,
diff --git a/target/linux/brcm63xx/patches-3.7/801-ssb_export_fallback_sprom.patch b/target/linux/brcm63xx/patches-3.7/801-ssb_export_fallback_sprom.patch
index 0d229fe317..ef62f445be 100644
--- a/target/linux/brcm63xx/patches-3.7/801-ssb_export_fallback_sprom.patch
+++ b/target/linux/brcm63xx/patches-3.7/801-ssb_export_fallback_sprom.patch
@@ -8,7 +8,7 @@
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/spi/74x164.h>
-@@ -3818,7 +3819,7 @@ static const struct board_info __initcon
+@@ -3873,7 +3874,7 @@ static const struct board_info __initcon
* bcm4318 WLAN work
*/
#ifdef CONFIG_SSB_PCIHOST
@@ -17,7 +17,7 @@
.revision = 0x02,
.board_rev = 0x17,
.country_code = 0x0,
-@@ -3838,6 +3839,7 @@ static struct ssb_sprom bcm63xx_sprom =
+@@ -3893,6 +3894,7 @@ static struct ssb_sprom bcm63xx_sprom =
.boardflags_lo = 0x2848,
.boardflags_hi = 0x0000,
};
diff --git a/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch b/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch
new file mode 100644
index 0000000000..14d83394be
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch
@@ -0,0 +1,49 @@
+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;
+ }
diff --git a/target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch b/target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
index bad4c4b9cc..3c3559a178 100644
--- a/target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
+++ b/target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
@@ -20,7 +20,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
static struct bcm963xx_nvram nvram;
static int mac_addr_used;
-@@ -105,3 +107,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
+@@ -121,3 +123,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
return 0;
}
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
diff --git a/target/linux/brcm63xx/patches-3.8/556-board_rta770w.patch b/target/linux/brcm63xx/patches-3.8/556-board_rta770w.patch
index e0eedad1e7..7528bd89b2 100644
--- a/target/linux/brcm63xx/patches-3.8/556-board_rta770w.patch
+++ b/target/linux/brcm63xx/patches-3.8/556-board_rta770w.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -796,6 +796,60 @@
+@@ -803,6 +803,60 @@ static struct board_info __initdata boar
},
},
};
@@ -61,7 +61,7 @@
#endif
/*
-@@ -3750,6 +3804,7 @@
+@@ -3757,6 +3811,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6345
&board_96345gw2,
&board_rta770bw,
diff --git a/target/linux/brcm63xx/patches-3.8/801-ssb_export_fallback_sprom.patch b/target/linux/brcm63xx/patches-3.8/801-ssb_export_fallback_sprom.patch
index 0d229fe317..ef62f445be 100644
--- a/target/linux/brcm63xx/patches-3.8/801-ssb_export_fallback_sprom.patch
+++ b/target/linux/brcm63xx/patches-3.8/801-ssb_export_fallback_sprom.patch
@@ -8,7 +8,7 @@
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/spi/74x164.h>
-@@ -3818,7 +3819,7 @@ static const struct board_info __initcon
+@@ -3873,7 +3874,7 @@ static const struct board_info __initcon
* bcm4318 WLAN work
*/
#ifdef CONFIG_SSB_PCIHOST
@@ -17,7 +17,7 @@
.revision = 0x02,
.board_rev = 0x17,
.country_code = 0x0,
-@@ -3838,6 +3839,7 @@ static struct ssb_sprom bcm63xx_sprom =
+@@ -3893,6 +3894,7 @@ static struct ssb_sprom bcm63xx_sprom =
.boardflags_lo = 0x2848,
.boardflags_hi = 0x0000,
};