[target] generic: ESFQ patch, only include net/netfilter/nf_conntrack.h when CONFIG_N...
[openwrt.git] / target / linux / brcm63xx / files / drivers / mtd / maps / bcm963xx-flash.c
index bdb5799..e24a081 100644 (file)
@@ -134,7 +134,7 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
            sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr);
            sscanf(buf->bccfe.kernelLength, "%u", &kernellen);
            sscanf(buf->bccfe.totalLength, "%u", &totallen);
-           tagidcrc = buf->bccfe.tagIdCRC;
+           tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]);
            tagversion = &(buf->bccfe.tagVersion[0]);
            boardid = &(buf->bccfe.boardid[0]);
            break;
@@ -146,7 +146,7 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
            sscanf(buf->bc300.kernelAddress, "%u", &kerneladdr);
            sscanf(buf->bc300.kernelLength, "%u", &kernellen);
            sscanf(buf->bc300.totalLength, "%u", &totallen);
-           tagidcrc = buf->bc300.tagIdCRC;
+           tagidcrc = *(uint32_t *)&(buf->bc300.tagIdCRC[0]);
            tagversion = &(buf->bc300.tagVersion[0]);
            boardid = &(buf->bc300.boardid[0]);
            break;
@@ -158,21 +158,21 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
            sscanf(buf->ag306.kernelAddress, "%u", &kerneladdr);
            sscanf(buf->ag306.kernelLength, "%u", &kernellen);
            sscanf(buf->ag306.totalLength, "%u", &totallen);
-           tagidcrc = buf->ag306.tagIdCRC;
+           tagidcrc = *(uint32_t *)&(buf->ag306.tagIdCRC[0]);
            tagversion = &(buf->ag306.tagVersion[0]);
            boardid = &(buf->ag306.boardid[0]);
            break;
          case 3:
-           matchtagid = "bc308";
-           tagid = &(buf->bc308.tagId[0]);
-           sscanf(buf->bc308.rootAddress,"%u", &rootfsaddr);
-           sscanf(buf->bc308.rootLength, "%u", &rootfslen);
-           sscanf(buf->bc308.kernelAddress, "%u", &kerneladdr);
-           sscanf(buf->bc308.kernelLength, "%u", &kernellen);
-           sscanf(buf->bc308.totalLength, "%u", &totallen);
-           tagidcrc = buf->bc308.tagIdCRC;
-           tagversion = &(buf->bc308.tagVersion[0]);
-           boardid = &(buf->bc308.boardid[0]);
+           matchtagid = "bc221";
+           tagid = &(buf->bc221.tagId[0]);
+           sscanf(buf->bc221.rootAddress,"%u", &rootfsaddr);
+           sscanf(buf->bc221.rootLength, "%u", &rootfslen);
+           sscanf(buf->bc221.kernelAddress, "%u", &kerneladdr);
+           sscanf(buf->bc221.kernelLength, "%u", &kernellen);
+           sscanf(buf->bc221.totalLength, "%u", &totallen);
+           tagidcrc = *(uint32_t *)&(buf->bc221.tagIdCRC[0]);
+           tagversion = &(buf->bc221.tagVersion[0]);
+           boardid = &(buf->bc221.boardid[0]);
            break;
          case 4:
            matchtagid = "bc310";
@@ -182,7 +182,7 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
            sscanf(buf->bc310.kernelAddress, "%u", &kerneladdr);
            sscanf(buf->bc310.kernelLength, "%u", &kernellen);
            sscanf(buf->bc310.totalLength, "%u", &totallen);
-           tagidcrc = buf->bc310.tagIdCRC;
+           tagidcrc = *(uint32_t *)&(buf->bc310.tagIdCRC[0]);
            tagversion = &(buf->bc310.tagVersion[0]);
            boardid = &(buf->bc310.boardid[0]);
            break;
@@ -191,16 +191,23 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
            continue;
          }
 
-         calctagidcrc = tagcrc32(IMAGETAG_CRC_START, tagid, TAGID_LEN);
-         if (tagidcrc = calctagidcrc) {
+         calctagidcrc = htonl(tagcrc32(IMAGETAG_CRC_START, tagid, TAGID_LEN));
+         if (tagidcrc == calctagidcrc) {
            tagid_match = true;
            break;
          }
        }
 
        if (!tagid_match) {
-         printk(KERN_ERR PFX "Failed to find a valid tag id\n");
-         return -EIO;
+           tagid = "bcram";
+           sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr);
+           sscanf(buf->bccfe.rootLength, "%u", &rootfslen);
+           sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr);
+           sscanf(buf->bccfe.kernelLength, "%u", &kernellen);
+           sscanf(buf->bccfe.totalLength, "%u", &totallen);
+           tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]);
+           tagversion = &(buf->bccfe.tagVersion[0]);
+           boardid = &(buf->bccfe.boardid[0]);
        }
 
        printk(KERN_INFO PFX "CFE boot tag found with version %s, board type %s, and tagid %s.\n",tagversion,boardid,tagid);
@@ -261,8 +268,9 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition *
        parts[curpart].size = master->size - parts[0].size - parts[3].size;
        
        for (i = 0; i < nrparts; i++)
-               printk(KERN_INFO PFX "Partition %d is %s offset %x and length %x\n", i, parts[i].name, parts[i].offset, parts[i].size);
+               printk(KERN_INFO PFX "Partition %d is %s offset %llx and length %llx\n", i, parts[i].name, parts[i].offset, parts[i].size);
 
+       printk(KERN_INFO PFX "Spare partition is %x offset and length %x\n", spareaddr, sparelen);
        *pparts = parts;
        vfree(buf);
 
@@ -326,7 +334,7 @@ static int bcm963xx_probe(struct platform_device *pdev)
        } else {
                printk(KERN_INFO PFX "assuming RedBoot bootloader\n");
                if (bcm963xx_mtd_info->size > 0x00400000) {
-                       printk(KERN_INFO PFX "Support for extended flash memory size : 0x%08X ; ONLY 64MBIT SUPPORT\n", bcm963xx_mtd_info->size);
+                       printk(KERN_INFO PFX "Support for extended flash memory size : 0x%llx ; ONLY 64MBIT SUPPORT\n", bcm963xx_mtd_info->size);
                        bcm963xx_map.virt = (u32)(EXTENDED_SIZE);
                }
 
This page took 0.027414 seconds and 4 git commands to generate.