bcm63xx: make nvram checksum failures non fatal
authorJonas Gorski <jogo@openwrt.org>
Fri, 15 Feb 2013 12:23:49 +0000 (12:23 +0000)
committerJonas Gorski <jogo@openwrt.org>
Fri, 15 Feb 2013 12:23:49 +0000 (12:23 +0000)
fixes #12982.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 35605

40 files changed:
target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch [deleted file]
target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.7/300-reset_buttons.patch
target/linux/brcm63xx/patches-3.7/301-led_count.patch
target/linux/brcm63xx/patches-3.7/302-extended-platform-devices.patch
target/linux/brcm63xx/patches-3.7/303-spi-board-info.patch
target/linux/brcm63xx/patches-3.7/304-boardid_fixup.patch
target/linux/brcm63xx/patches-3.7/401-MIPS-BCM63XX-register-ohci-device.patch
target/linux/brcm63xx/patches-3.7/403-MIPS-BCM63XX-register-ehci-device.patch
target/linux/brcm63xx/patches-3.7/408-6358-enet1-external-mii-clk.patch
target/linux/brcm63xx/patches-3.7/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch
target/linux/brcm63xx/patches-3.7/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch
target/linux/brcm63xx/patches-3.7/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
target/linux/brcm63xx/patches-3.7/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch
target/linux/brcm63xx/patches-3.7/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
target/linux/brcm63xx/patches-3.7/444-BCM63XX-add-endian-check-for-ath9k.patch
target/linux/brcm63xx/patches-3.7/445-BCM63XX-add-led-pin-for-ath9k.patch
target/linux/brcm63xx/patches-3.7/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
target/linux/brcm63xx/patches-3.7/511-board_V2500V.patch
target/linux/brcm63xx/patches-3.7/520-bcm63xx-add-support-for-96368MVWG-board.patch
target/linux/brcm63xx/patches-3.7/800-wl_exports.patch
target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch [deleted file]
target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.8/300-reset_buttons.patch
target/linux/brcm63xx/patches-3.8/301-led_count.patch
target/linux/brcm63xx/patches-3.8/302-extended-platform-devices.patch
target/linux/brcm63xx/patches-3.8/303-spi-board-info.patch
target/linux/brcm63xx/patches-3.8/304-boardid_fixup.patch
target/linux/brcm63xx/patches-3.8/408-6358-enet1-external-mii-clk.patch
target/linux/brcm63xx/patches-3.8/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch
target/linux/brcm63xx/patches-3.8/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch
target/linux/brcm63xx/patches-3.8/429-MIPS-BCM63XX-export-PSI-size-from-nvram.patch
target/linux/brcm63xx/patches-3.8/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch
target/linux/brcm63xx/patches-3.8/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
target/linux/brcm63xx/patches-3.8/444-BCM63XX-add-endian-check-for-ath9k.patch
target/linux/brcm63xx/patches-3.8/445-BCM63XX-add-led-pin-for-ath9k.patch
target/linux/brcm63xx/patches-3.8/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
target/linux/brcm63xx/patches-3.8/511-board_V2500V.patch
target/linux/brcm63xx/patches-3.8/520-bcm63xx-add-support-for-96368MVWG-board.patch
target/linux/brcm63xx/patches-3.8/800-wl_exports.patch

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
deleted file mode 100644 (file)
index 14d8339..0000000
+++ /dev/null
@@ -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;
- }
diff --git a/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch b/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch
new file mode 100644 (file)
index 0000000..2822031
--- /dev/null
@@ -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
index 6bdfdc830bdec899ed17adf00d469e8ee847e96e..8d8df70b901fd4bf307e809b43615759acab58ea 100644 (file)
@@ -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);
  
index 7271db576098d26b3a13967102019ec338a92c42..bb49b3dc745d6e1547f68ccabf0a840a82ebe4e6 100644 (file)
@@ -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();
  
index 1d1cf9824ea941eadc72a9fd8522985b42d37f34..eb663f3d81b9dc5f5b543bb988c7113da2cb1b61 100644 (file)
@@ -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();
  
index 13ff4c42024b641b6d815f6c56d1694d8231616a..0133531b49d18a6576c5a247170f6a4cc64b8cfd 100644 (file)
@@ -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);
  
index 9df5e56d8039da694f36b59aac6d066a8012429b..8163ce23a36ba642d5c2c21bfd0f99cae4e64b54 100644 (file)
@@ -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 */
index 8e8a422c0068463e2c0700a753d8686c1c9624e1..80ff1c2e39943f98ca18e1dbd82ec95d026f1e5f 100644 (file)
@@ -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);
  
index 1c5615f8766d154dd43c285ed7b02e7a2f428270..10af68907684d9c7272374c5ab006affceb79d13 100644 (file)
@@ -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);
  
index a678c8ade0ec546cdf7cbed1e1d8c35dc3dfb626..6b4886de38131f7a8fef528293205375ac209612 100644 (file)
@@ -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;
index dab4613ecf39ef8c2a02229af5dae1874b345208..5dec8253e467f054bbc0ae6b58badb1635dedaee 100644 (file)
@@ -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);
  
index ee3b5d436423b04376c40af5088bf2f64f688c81..15240ce9a92c09c7fea29e375154eafb175c3f45 100644 (file)
@@ -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
index 3c3559a1788b43dbe8f922c92b4458715bc54c19..6841338f5fe953013ea0c6a6e578fc27b27e9c2e 100644 (file)
@@ -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);
  
index 71f3a14ec769461443f785a769f20381cf341e07..033a8a50c4db9d9f5f51ae9656f18500344158e7 100644 (file)
@@ -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);
        }
  
index 08d6a9133f82f6375a067e5be72e0b20274b8c06..fb3b4f0cec9fec5fabcaf717de8ea1c111369079 100644 (file)
@@ -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);
  
index cfe18cc9be3777e70be24d891ee5348b32881a0c..2127bf39802980da9769db4de02cda1ac17eab8c 100644 (file)
@@ -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++)
index 6baf0c2588d19f6781a243100981d252c7556d4f..cb724e60ac9ebc48ad4491fb1bdb60b1e00087e9 100644 (file)
@@ -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,
index c7176e0a4cb1d4dadf2cefe2922041d5e00752f4..033cdb43b55f54cd32f8a281069cbc32ba3fa873 100644 (file)
@@ -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 */
index 402336fdc62d93b93b1b92bb15474887d30d8e1c..20ce84cfd54ac5236af71288edfd89f733450e6e 100644 (file)
@@ -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;
 +              }
index e69d83d90daf08082204c4d3dd56d186d88e581f..c3b2c165438b81eb6c5cda6968b53b12b9be1f85 100644 (file)
@@ -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;
index ccb8710dfe52036d1cffb2666200d07693b14c83..4d8a23893de6683502a73c396733c3c36edda8ef 100644 (file)
 +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));
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
deleted file mode 100644 (file)
index 14d8339..0000000
+++ /dev/null
@@ -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;
- }
diff --git a/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch b/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch
new file mode 100644 (file)
index 0000000..3486c00
--- /dev/null
@@ -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
index 8057c7918e6f3b2c7edbcb7389936ff99fd26dc9..4415836512a2997920ea9a125528cae688e8548b 100644 (file)
@@ -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);
  
index 1c6797933c9cf610c3884067d470aa13bd8b5b6d..c85405ac1a0e1edc531a68cebf56e464639853d0 100644 (file)
@@ -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();
  
index 871dd0bb20cd118966b88f8c4931d717bbfafe9f..54cddc4cd034ad109ffeeb83ffc40dae5cc011ed 100644 (file)
@@ -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();
  
index 1858f6189dde3446e76aa4fe4625f86c1d01b7ff..a1ba0cc3ea3d1a9f17349e731b6090ab4a8cd68a 100644 (file)
@@ -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);
  
index a1d2f8ed1551e13bce99cf4db18468504026b52e..f29ad6f1f3c73ce6a4079c3bd4e2b7cf8efbf452 100644 (file)
@@ -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 */
index 4c4a02f86af97bf0511176b1a96706f2103430db..4ead53f2a2e66e74c2694e34be842c5d86a092e8 100644 (file)
@@ -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;
index c10acd065f0588133c087910ba71fe7dc8d28328..ef615197258e56b944c28715f8c8f65fbb5591eb 100644 (file)
@@ -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);
  
index ab6225d379686cbfb9f3c38600483a7cc57649cd..babe04a8020b5ed28ef69201c6975d49a28e089f 100644 (file)
@@ -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
index 3c3559a1788b43dbe8f922c92b4458715bc54c19..6841338f5fe953013ea0c6a6e578fc27b27e9c2e 100644 (file)
@@ -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);
  
index 5f3de7da86511736bf03afb3f4b6b8941e0e2266..06d0b1b3993410ad7721368ba551edc3046e78f7 100644 (file)
@@ -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);
        }
  
index 08d6a9133f82f6375a067e5be72e0b20274b8c06..fb3b4f0cec9fec5fabcaf717de8ea1c111369079 100644 (file)
@@ -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);
  
index 70be6840cc52ffd92c646d13c17f49e4aedee2a9..bdcb3e04d968bafea2ad4c3667b9f3c5be4abf15 100644 (file)
@@ -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++)
index e56031fa6512e27d989a0b8e302ea926811110b9..4f771798c5cbee4a243ef2488a596ae9565f8cc1 100644 (file)
@@ -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,
index e6190057af6733f0130b4e44b64e188227f61460..039e98828e72c44e80290f120009ca29b01f7707 100644 (file)
@@ -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 */
index 402336fdc62d93b93b1b92bb15474887d30d8e1c..899a8940635f47f4827cfdcae0b09e163dec5481 100644 (file)
@@ -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;
 +              }
index e69d83d90daf08082204c4d3dd56d186d88e581f..c3b2c165438b81eb6c5cda6968b53b12b9be1f85 100644 (file)
@@ -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;
index ccb8710dfe52036d1cffb2666200d07693b14c83..4d8a23893de6683502a73c396733c3c36edda8ef 100644 (file)
 +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));