bcm63xx: Improve CFE version mod patch.
authorJonas Gorski <jogo@openwrt.org>
Sun, 30 Jun 2013 13:10:05 +0000 (13:10 +0000)
committerJonas Gorski <jogo@openwrt.org>
Sun, 30 Jun 2013 13:10:05 +0000 (13:10 +0000)
Fix "cfe-" string length copy.
Check if there's an extra byte a.b.c-d.e / a.b.c-d.e-f.
Add support for Huawei CFE versions ("cfe-vd").

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Patchwork: http://patchwork.openwrt.org/patch/3766/
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 37101

target/linux/brcm63xx/patches-3.9/309-cfe_version_mod.patch
target/linux/brcm63xx/patches-3.9/403-6358-enet1-external-mii-clk.patch
target/linux/brcm63xx/patches-3.9/409-MIPS-BCM63XX-add-HS-SPI-platform-device-and-register.patch
target/linux/brcm63xx/patches-3.9/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch
target/linux/brcm63xx/patches-3.9/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
target/linux/brcm63xx/patches-3.9/420-BCM63XX-add-endian-check-for-ath9k.patch
target/linux/brcm63xx/patches-3.9/421-BCM63XX-add-led-pin-for-ath9k.patch
target/linux/brcm63xx/patches-3.9/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
target/linux/brcm63xx/patches-3.9/520-bcm63xx-add-support-for-96368MVWG-board.patch

index 0b4466f56fb7f915c5e62411f28af67530bfeb22..50cb14bca8a8080af6ddb3ba81a2347f03819609 100644 (file)
@@ -1,11 +1,27 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -837,6 +837,8 @@ void __init board_prom_init(void)
-       if (!memcmp(cfe, "cfe-v", 5))
-               snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
-                        cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
-+      else if (!memcmp(cfe, "cfe-", 4))
-+              snprintf(cfe_version, 16, "%s", (char *) &cfe[4]);
-       else
+@@ -834,10 +834,20 @@ void __init board_prom_init(void)
+       /* dump cfe version */
+       cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
+-      if (!memcmp(cfe, "cfe-v", 5))
+-              snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
+-                       cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
+-      else
++      if (strstarts(cfe, "cfe-")) {
++              if(cfe[4] == 'v') {
++                      if(cfe[5] == 'd')
++                              snprintf(cfe_version, 11, "%s", (char *) &cfe[5]);
++                      else if (cfe[10] > 0)
++                              snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u-%u",
++                                       cfe[5], cfe[6], cfe[7], cfe[8], cfe[9], cfe[10]);
++                      else
++                              snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
++                                       cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
++              } else {
++                      snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
++              }
++      } else
                strcpy(cfe_version, "unknown");
        printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
index 35feecd35737a468c1516d371e3fcadfea78dcbd..bc7225a6a6c96967f26a59269fe4eb59a91d209d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -902,6 +902,8 @@ void __init board_prom_init(void)
+@@ -910,6 +910,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 7cae6a9f78f434bef3f014969f24ebe3d144775b..7c0bd4860f826433c9939e53014943d83b0674d1 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>
-@@ -995,6 +996,7 @@ int __init board_register_devices(void)
+@@ -1003,6 +1004,7 @@ int __init board_register_devices(void)
                        pr_err(PFX "failed to register fallback SPROM\n");
        }
  #endif
index a20e8b15bdeea009b3fd880c8ffe2a00befb20a4..34c2ef928ec02b8ea45cfcb41a3f95450ebec9dc 100644 (file)
@@ -18,7 +18,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
  
  #include <uapi/linux/bcm933xx_hcs.h>
  #include <uapi/linux/bcm963xx_tag.h>
-@@ -950,6 +951,7 @@ int __init board_register_devices(void)
+@@ -958,6 +959,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);
-@@ -988,7 +990,8 @@ int __init board_register_devices(void)
+@@ -996,7 +998,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(
-@@ -1034,5 +1037,9 @@ int __init board_register_devices(void)
+@@ -1042,5 +1045,9 @@ int __init board_register_devices(void)
                platform_device_register(&bcm63xx_gpio_keys_device);
        }
  
index ccb8dc8a226eb1733c8dd66e41ce96afdbc76524..ac37b42cf9a1d046c92f545fae1b5829da7b90dc 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
-@@ -1009,7 +1009,7 @@ int __init board_register_devices(void)
+@@ -1017,7 +1017,7 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
index 64c51a451c8ce2bc46e37d25aa2661ae5c1d1b55..9016d148271e52a53cbffe011448fa6b4f702bf1 100644 (file)
@@ -39,7 +39,7 @@
                return;
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -1039,7 +1039,8 @@ int __init board_register_devices(void)
+@@ -1047,7 +1047,8 @@ int __init board_register_devices(void)
  
        /* register any fixups */
        for (i = 0; i < board.has_caldata; i++)
index e2a8ccdd575483dffb39119df66004792a579db2..6ef9d0f0d960ce048a9115a21d18151ee2869d73 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -1040,7 +1040,7 @@ int __init board_register_devices(void)
+@@ -1048,7 +1048,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 b7f9b2fced9074e08efeec8bf923460dfe5bab5d..1d1bff57ec43f4ac109b6f3919e43b35f4ec16a7 100644 (file)
@@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  #include <uapi/linux/bcm933xx_hcs.h>
  #include <uapi/linux/bcm963xx_tag.h>
-@@ -1038,9 +1039,19 @@ int __init board_register_devices(void)
+@@ -1046,9 +1047,19 @@ int __init board_register_devices(void)
        }
  
        /* register any fixups */
index 4dc77ea460729271cedb59934599b1bed81fd1fe..bc5bd3d83ee500689a5670b9a46c4ddf015e2812 100644 (file)
@@ -100,7 +100,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
  };
  
  /*
-@@ -2452,12 +2528,25 @@ void __init board_prom_init(void)
+@@ -2460,12 +2536,25 @@ void __init board_prom_init(void)
                bcm63xx_pci_enabled = 1;
                if (BCMCPU_IS_6348())
                        val |= GPIO_MODE_6348_G2_PCI;