bcm63xx: switch to linux 3.8
[openwrt/staging/chunkeey.git] / target / linux / brcm63xx / patches-3.8 / 119-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch
1 From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 12 Feb 2013 22:00:10 +0100
4 Subject: [PATCH] MIPS: BCM63XX: make nvram checksum failure non fatal
5
6 Some vendors modify the nvram layout moving the checksum to a different
7 place or drop it entirely, so reduce the checksum failure to a warning.
8
9 Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
10 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
11 ---
12 arch/mips/bcm63xx/boards/board_bcm963xx.c | 5 +----
13 arch/mips/bcm63xx/nvram.c | 7 +++----
14 arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 4 +---
15 3 files changed, 5 insertions(+), 11 deletions(-)
16
17 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
18 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
19 @@ -747,10 +747,7 @@ void __init board_prom_init(void)
20 strcpy(cfe_version, "unknown");
21 printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
22
23 - if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
24 - printk(KERN_ERR PFX "invalid nvram checksum\n");
25 - return;
26 - }
27 + bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
28
29 board_name = bcm63xx_nvram_get_name();
30 /* find board by name */
31 --- a/arch/mips/bcm63xx/nvram.c
32 +++ b/arch/mips/bcm63xx/nvram.c
33 @@ -38,7 +38,7 @@ struct bcm963xx_nvram {
34 static struct bcm963xx_nvram nvram;
35 static int mac_addr_used;
36
37 -int __init bcm63xx_nvram_init(void *addr)
38 +void __init bcm63xx_nvram_init(void *addr)
39 {
40 unsigned int check_len;
41 u32 crc, expected_crc;
42 @@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr
43 crc = crc32_le(~0, (u8 *)&nvram, check_len);
44
45 if (crc != expected_crc)
46 - return -EINVAL;
47 -
48 - return 0;
49 + pr_warn("nvram checksum invalid (expected %08x, actual %08x)\n",
50 + expected_crc, crc);
51 }
52
53 u8 *bcm63xx_nvram_get_name(void)
54 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
55 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
56 @@ -9,10 +9,8 @@
57 *
58 * Initialized the local nvram copy from the target address and checks
59 * its checksum.
60 - *
61 - * Returns 0 on success.
62 */
63 -int __init bcm63xx_nvram_init(void *nvram);
64 +void bcm63xx_nvram_init(void *nvram);
65
66 /**
67 * bcm63xx_nvram_get_name() - returns the board name according to nvram