From: Jonas Gorski Date: Fri, 15 Feb 2013 12:23:49 +0000 (+0000) Subject: bcm63xx: make nvram checksum failures non fatal X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=485e52e1d8325c433ee6351a441dc2dd70948814;p=openwrt%2Fstaging%2Fansuel.git bcm63xx: make nvram checksum failures non fatal fixes #12982. Signed-off-by: Jonas Gorski SVN-Revision: 35605 --- 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 index 14d83394be..0000000000 --- a/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-handle-huawei-nvram-layout.patch +++ /dev/null @@ -1,49 +0,0 @@ -From fb1e2c8a1073297f4674ca90c7d533de5187d158 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -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 -Signed-off-by: Jonas Gorski ---- - 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 index 0000000000..2822031909 --- /dev/null +++ b/target/linux/brcm63xx/patches-3.7/108-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch @@ -0,0 +1,67 @@ +From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +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 +Signed-off-by: Jonas Gorski +--- + 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 diff --git a/target/linux/brcm63xx/patches-3.7/300-reset_buttons.patch b/target/linux/brcm63xx/patches-3.7/300-reset_buttons.patch index 6bdfdc830b..8d8df70b90 100644 --- a/target/linux/brcm63xx/patches-3.7/300-reset_buttons.patch +++ b/target/linux/brcm63xx/patches-3.7/300-reset_buttons.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/301-led_count.patch b/target/linux/brcm63xx/patches-3.7/301-led_count.patch index 7271db5760..bb49b3dc74 100644 --- a/target/linux/brcm63xx/patches-3.7/301-led_count.patch +++ b/target/linux/brcm63xx/patches-3.7/301-led_count.patch @@ -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(); diff --git a/target/linux/brcm63xx/patches-3.7/302-extended-platform-devices.patch b/target/linux/brcm63xx/patches-3.7/302-extended-platform-devices.patch index 1d1cf9824e..eb663f3d81 100644 --- a/target/linux/brcm63xx/patches-3.7/302-extended-platform-devices.patch +++ b/target/linux/brcm63xx/patches-3.7/302-extended-platform-devices.patch @@ -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(); diff --git a/target/linux/brcm63xx/patches-3.7/303-spi-board-info.patch b/target/linux/brcm63xx/patches-3.7/303-spi-board-info.patch index 13ff4c4202..0133531b49 100644 --- a/target/linux/brcm63xx/patches-3.7/303-spi-board-info.patch +++ b/target/linux/brcm63xx/patches-3.7/303-spi-board-info.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/304-boardid_fixup.patch b/target/linux/brcm63xx/patches-3.7/304-boardid_fixup.patch index 9df5e56d80..8163ce23a3 100644 --- a/target/linux/brcm63xx/patches-3.7/304-boardid_fixup.patch +++ b/target/linux/brcm63xx/patches-3.7/304-boardid_fixup.patch @@ -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 */ diff --git a/target/linux/brcm63xx/patches-3.7/401-MIPS-BCM63XX-register-ohci-device.patch b/target/linux/brcm63xx/patches-3.7/401-MIPS-BCM63XX-register-ohci-device.patch index 8e8a422c00..80ff1c2e39 100644 --- a/target/linux/brcm63xx/patches-3.7/401-MIPS-BCM63XX-register-ohci-device.patch +++ b/target/linux/brcm63xx/patches-3.7/401-MIPS-BCM63XX-register-ohci-device.patch @@ -71,7 +71,7 @@ Subject: [PATCH 31/72] MIPS: BCM63XX: register ohci device. #include #include -@@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/403-MIPS-BCM63XX-register-ehci-device.patch b/target/linux/brcm63xx/patches-3.7/403-MIPS-BCM63XX-register-ehci-device.patch index 1c5615f876..10af689076 100644 --- a/target/linux/brcm63xx/patches-3.7/403-MIPS-BCM63XX-register-ehci-device.patch +++ b/target/linux/brcm63xx/patches-3.7/403-MIPS-BCM63XX-register-ehci-device.patch @@ -52,7 +52,7 @@ Subject: [PATCH 33/72] MIPS: BCM63XX: register ehci device. #include #include -@@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/408-6358-enet1-external-mii-clk.patch b/target/linux/brcm63xx/patches-3.7/408-6358-enet1-external-mii-clk.patch index a678c8ade0..6b4886de38 100644 --- a/target/linux/brcm63xx/patches-3.7/408-6358-enet1-external-mii-clk.patch +++ b/target/linux/brcm63xx/patches-3.7/408-6358-enet1-external-mii-clk.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-3.7/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch b/target/linux/brcm63xx/patches-3.7/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch index dab4613ecf..5dec8253e4 100644 --- a/target/linux/brcm63xx/patches-3.7/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch +++ b/target/linux/brcm63xx/patches-3.7/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch b/target/linux/brcm63xx/patches-3.7/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch index ee3b5d4364..15240ce9a9 100644 --- a/target/linux/brcm63xx/patches-3.7/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch +++ b/target/linux/brcm63xx/patches-3.7/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch @@ -36,7 +36,7 @@ Signed-off-by: Jonas Gorski #include #include #include -@@ -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 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 3c3559a178..6841338f5f 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 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 +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); diff --git a/target/linux/brcm63xx/patches-3.7/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch b/target/linux/brcm63xx/patches-3.7/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch index 71f3a14ec7..033a8a50c4 100644 --- a/target/linux/brcm63xx/patches-3.7/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch +++ b/target/linux/brcm63xx/patches-3.7/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch @@ -18,7 +18,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data #include -@@ -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); } diff --git a/target/linux/brcm63xx/patches-3.7/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch b/target/linux/brcm63xx/patches-3.7/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch index 08d6a9133f..fb3b4f0cec 100644 --- a/target/linux/brcm63xx/patches-3.7/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch +++ b/target/linux/brcm63xx/patches-3.7/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.7/444-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/brcm63xx/patches-3.7/444-BCM63XX-add-endian-check-for-ath9k.patch index cfe18cc9be..2127bf3980 100644 --- a/target/linux/brcm63xx/patches-3.7/444-BCM63XX-add-endian-check-for-ath9k.patch +++ b/target/linux/brcm63xx/patches-3.7/444-BCM63XX-add-endian-check-for-ath9k.patch @@ -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++) diff --git a/target/linux/brcm63xx/patches-3.7/445-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/brcm63xx/patches-3.7/445-BCM63XX-add-led-pin-for-ath9k.patch index 6baf0c2588..cb724e60ac 100644 --- a/target/linux/brcm63xx/patches-3.7/445-BCM63XX-add-led-pin-for-ath9k.patch +++ b/target/linux/brcm63xx/patches-3.7/445-BCM63XX-add-led-pin-for-ath9k.patch @@ -2,7 +2,7 @@ From: Álvaro Fernández Rojas 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, diff --git a/target/linux/brcm63xx/patches-3.7/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch b/target/linux/brcm63xx/patches-3.7/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch index c7176e0a4c..033cdb43b5 100644 --- a/target/linux/brcm63xx/patches-3.7/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch +++ b/target/linux/brcm63xx/patches-3.7/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch @@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices #include -@@ -994,9 +995,19 @@ int __init board_register_devices(void) +@@ -991,9 +992,19 @@ int __init board_register_devices(void) } /* register any fixups */ diff --git a/target/linux/brcm63xx/patches-3.7/511-board_V2500V.patch b/target/linux/brcm63xx/patches-3.7/511-board_V2500V.patch index 402336fdc6..20ce84cfd5 100644 --- a/target/linux/brcm63xx/patches-3.7/511-board_V2500V.patch +++ b/target/linux/brcm63xx/patches-3.7/511-board_V2500V.patch @@ -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; + } diff --git a/target/linux/brcm63xx/patches-3.7/520-bcm63xx-add-support-for-96368MVWG-board.patch b/target/linux/brcm63xx/patches-3.7/520-bcm63xx-add-support-for-96368MVWG-board.patch index e69d83d90d..c3b2c16543 100644 --- a/target/linux/brcm63xx/patches-3.7/520-bcm63xx-add-support-for-96368MVWG-board.patch +++ b/target/linux/brcm63xx/patches-3.7/520-bcm63xx-add-support-for-96368MVWG-board.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-3.7/800-wl_exports.patch b/target/linux/brcm63xx/patches-3.7/800-wl_exports.patch index ccb8710dfe..4d8a23893d 100644 --- a/target/linux/brcm63xx/patches-3.7/800-wl_exports.patch +++ b/target/linux/brcm63xx/patches-3.7/800-wl_exports.patch @@ -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)); 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 index 14d83394be..0000000000 --- a/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-handle-huawei-nvram-layout.patch +++ /dev/null @@ -1,49 +0,0 @@ -From fb1e2c8a1073297f4674ca90c7d533de5187d158 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -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 -Signed-off-by: Jonas Gorski ---- - 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 index 0000000000..3486c00e2f --- /dev/null +++ b/target/linux/brcm63xx/patches-3.8/119-MIPS-BCM63XX-make-nvram-checksum-failure-non-fatal.patch @@ -0,0 +1,67 @@ +From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +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 +Signed-off-by: Jonas Gorski +--- + 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 diff --git a/target/linux/brcm63xx/patches-3.8/300-reset_buttons.patch b/target/linux/brcm63xx/patches-3.8/300-reset_buttons.patch index 8057c7918e..4415836512 100644 --- a/target/linux/brcm63xx/patches-3.8/300-reset_buttons.patch +++ b/target/linux/brcm63xx/patches-3.8/300-reset_buttons.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.8/301-led_count.patch b/target/linux/brcm63xx/patches-3.8/301-led_count.patch index 1c6797933c..c85405ac1a 100644 --- a/target/linux/brcm63xx/patches-3.8/301-led_count.patch +++ b/target/linux/brcm63xx/patches-3.8/301-led_count.patch @@ -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(); diff --git a/target/linux/brcm63xx/patches-3.8/302-extended-platform-devices.patch b/target/linux/brcm63xx/patches-3.8/302-extended-platform-devices.patch index 871dd0bb20..54cddc4cd0 100644 --- a/target/linux/brcm63xx/patches-3.8/302-extended-platform-devices.patch +++ b/target/linux/brcm63xx/patches-3.8/302-extended-platform-devices.patch @@ -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(); diff --git a/target/linux/brcm63xx/patches-3.8/303-spi-board-info.patch b/target/linux/brcm63xx/patches-3.8/303-spi-board-info.patch index 1858f6189d..a1ba0cc3ea 100644 --- a/target/linux/brcm63xx/patches-3.8/303-spi-board-info.patch +++ b/target/linux/brcm63xx/patches-3.8/303-spi-board-info.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -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); diff --git a/target/linux/brcm63xx/patches-3.8/304-boardid_fixup.patch b/target/linux/brcm63xx/patches-3.8/304-boardid_fixup.patch index a1d2f8ed15..f29ad6f1f3 100644 --- a/target/linux/brcm63xx/patches-3.8/304-boardid_fixup.patch +++ b/target/linux/brcm63xx/patches-3.8/304-boardid_fixup.patch @@ -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 */ diff --git a/target/linux/brcm63xx/patches-3.8/408-6358-enet1-external-mii-clk.patch b/target/linux/brcm63xx/patches-3.8/408-6358-enet1-external-mii-clk.patch index 4c4a02f86a..4ead53f2a2 100644 --- a/target/linux/brcm63xx/patches-3.8/408-6358-enet1-external-mii-clk.patch +++ b/target/linux/brcm63xx/patches-3.8/408-6358-enet1-external-mii-clk.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-3.8/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch b/target/linux/brcm63xx/patches-3.8/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch index c10acd065f..ef61519725 100644 --- a/target/linux/brcm63xx/patches-3.8/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch +++ b/target/linux/brcm63xx/patches-3.8/415-bcm63xx_enet-add-support-for-bcm6368-internal-ethern.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.8/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch b/target/linux/brcm63xx/patches-3.8/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch index ab6225d379..babe04a802 100644 --- a/target/linux/brcm63xx/patches-3.8/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch +++ b/target/linux/brcm63xx/patches-3.8/425-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch @@ -37,7 +37,7 @@ Signed-off-by: Jonas Gorski #include #include #include -@@ -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 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 3c3559a178..6841338f5f 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 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 +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); diff --git a/target/linux/brcm63xx/patches-3.8/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch b/target/linux/brcm63xx/patches-3.8/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch index 5f3de7da86..06d0b1b399 100644 --- a/target/linux/brcm63xx/patches-3.8/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch +++ b/target/linux/brcm63xx/patches-3.8/432-BCM63XX-allow-providing-fixup-data-in-board-data.patch @@ -18,7 +18,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data #include -@@ -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); } diff --git a/target/linux/brcm63xx/patches-3.8/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch b/target/linux/brcm63xx/patches-3.8/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch index 08d6a9133f..fb3b4f0cec 100644 --- a/target/linux/brcm63xx/patches-3.8/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch +++ b/target/linux/brcm63xx/patches-3.8/437-MIPS-BCM63XX-pass-caldata-info-to-flash.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.8/444-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/brcm63xx/patches-3.8/444-BCM63XX-add-endian-check-for-ath9k.patch index 70be6840cc..bdcb3e04d9 100644 --- a/target/linux/brcm63xx/patches-3.8/444-BCM63XX-add-endian-check-for-ath9k.patch +++ b/target/linux/brcm63xx/patches-3.8/444-BCM63XX-add-endian-check-for-ath9k.patch @@ -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++) diff --git a/target/linux/brcm63xx/patches-3.8/445-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/brcm63xx/patches-3.8/445-BCM63XX-add-led-pin-for-ath9k.patch index e56031fa65..4f771798c5 100644 --- a/target/linux/brcm63xx/patches-3.8/445-BCM63XX-add-led-pin-for-ath9k.patch +++ b/target/linux/brcm63xx/patches-3.8/445-BCM63XX-add-led-pin-for-ath9k.patch @@ -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, diff --git a/target/linux/brcm63xx/patches-3.8/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch b/target/linux/brcm63xx/patches-3.8/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch index e6190057af..039e98828e 100644 --- a/target/linux/brcm63xx/patches-3.8/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch +++ b/target/linux/brcm63xx/patches-3.8/446-BCM63XX-add-a-fixup-for-rt2x00-devices.patch @@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices #include -@@ -994,9 +995,19 @@ int __init board_register_devices(void) +@@ -991,9 +992,19 @@ int __init board_register_devices(void) } /* register any fixups */ diff --git a/target/linux/brcm63xx/patches-3.8/511-board_V2500V.patch b/target/linux/brcm63xx/patches-3.8/511-board_V2500V.patch index 402336fdc6..899a894063 100644 --- a/target/linux/brcm63xx/patches-3.8/511-board_V2500V.patch +++ b/target/linux/brcm63xx/patches-3.8/511-board_V2500V.patch @@ -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; + } diff --git a/target/linux/brcm63xx/patches-3.8/520-bcm63xx-add-support-for-96368MVWG-board.patch b/target/linux/brcm63xx/patches-3.8/520-bcm63xx-add-support-for-96368MVWG-board.patch index e69d83d90d..c3b2c16543 100644 --- a/target/linux/brcm63xx/patches-3.8/520-bcm63xx-add-support-for-96368MVWG-board.patch +++ b/target/linux/brcm63xx/patches-3.8/520-bcm63xx-add-support-for-96368MVWG-board.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-3.8/800-wl_exports.patch b/target/linux/brcm63xx/patches-3.8/800-wl_exports.patch index ccb8710dfe..4d8a23893d 100644 --- a/target/linux/brcm63xx/patches-3.8/800-wl_exports.patch +++ b/target/linux/brcm63xx/patches-3.8/800-wl_exports.patch @@ -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));