brcm63xx: add preliminary support for 3.13
[openwrt.git] / target / linux / brcm63xx / patches-3.13 / 309-cfe_version_mod.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -835,10 +835,20 @@ void __init board_prom_init(void)
4  
5         /* dump cfe version */
6         cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
7 -       if (!memcmp(cfe, "cfe-v", 5))
8 -               snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
9 -                        cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
10 -       else
11 +       if (strstarts(cfe, "cfe-")) {
12 +               if(cfe[4] == 'v') {
13 +                       if(cfe[5] == 'd')
14 +                               snprintf(cfe_version, 11, "%s", (char *) &cfe[5]);
15 +                       else if (cfe[10] > 0)
16 +                               snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u-%u",
17 +                                        cfe[5], cfe[6], cfe[7], cfe[8], cfe[9], cfe[10]);
18 +                       else
19 +                               snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
20 +                                        cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
21 +               } else {
22 +                       snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
23 +               }
24 +       } else
25                 strcpy(cfe_version, "unknown");
26         printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
27