[brcm63xx] led and buttons support for board DWV-S0
[openwrt.git] / target / linux / brcm63xx / patches-3.8 / 016-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch
1 From 152addd3a965759b69fbdb9a76526f1f5070bc9a 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 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Some vendors modify the nvram layout moving the checksum to a different
10 place or dropping entirely, so reduce the checksum failure to a warning.
11
12 Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
13 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
14 ---
15
16 I'm not sure if it should be that "loud" (pr_warn) because users can't
17 actually do anything to fix it, so maybe pr_debug would be fine, too.
18
19  arch/mips/bcm63xx/boards/board_bcm963xx.c          |    5 +----
20  arch/mips/bcm63xx/nvram.c                          |    7 +++----
21  arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h |    4 +---
22  3 files changed, 5 insertions(+), 11 deletions(-)
23
24 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
25 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
26 @@ -745,10 +745,7 @@ void __init board_prom_init(void)
27                 strcpy(cfe_version, "unknown");
28         printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
29  
30 -       if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
31 -               printk(KERN_ERR PFX "invalid nvram checksum\n");
32 -               return;
33 -       }
34 +       bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
35  
36         board_name = bcm63xx_nvram_get_name();
37         /* find board by name */
38 --- a/arch/mips/bcm63xx/nvram.c
39 +++ b/arch/mips/bcm63xx/nvram.c
40 @@ -38,7 +38,7 @@ struct bcm963xx_nvram {
41  static struct bcm963xx_nvram nvram;
42  static int mac_addr_used;
43  
44 -int __init bcm63xx_nvram_init(void *addr)
45 +void __init bcm63xx_nvram_init(void *addr)
46  {
47         unsigned int check_len;
48         u32 crc, expected_crc;
49 @@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr
50         crc = crc32_le(~0, (u8 *)&nvram, check_len);
51  
52         if (crc != expected_crc)
53 -               return -EINVAL;
54 -
55 -       return 0;
56 +               pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
57 +                       expected_crc, crc);
58  }
59  
60  u8 *bcm63xx_nvram_get_name(void)
61 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
62 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
63 @@ -9,10 +9,8 @@
64   *
65   * Initialized the local nvram copy from the target address and checks
66   * its checksum.
67 - *
68 - * Returns 0 on success.
69   */
70 -int __init bcm63xx_nvram_init(void *nvram);
71 +void bcm63xx_nvram_init(void *nvram);
72  
73  /**
74   * bcm63xx_nvram_get_name() - returns the board name according to nvram