brcm47xx: this patch went upstream
[openwrt.git] / target / linux / ifxmips / files / drivers / mtd / maps / ifxmips.c
index 3a3569a..376fd0b 100644 (file)
@@ -102,11 +102,11 @@ static struct mtd_partition ifxmips_partitions[] = {
        {
                .name = "uboot_env",
                .offset = 0x00020000,
-               .size = 0x00010000,
+               .size = 0x0,
        },
        {
                .name = "kernel",
-               .offset = 0x00030000,
+               .offset = 0x0,
                .size = 0x0,
        },
        {
@@ -208,6 +208,10 @@ static int ifxmips_mtd_probe(struct platform_device *dev)
                                rootfs_part = i;
                }
        } else {
+               /* if the flash is 64k sectors, the kernel will reside at 0xb0030000
+                  if the flash is 128k sectors, the kernel will reside at 0xb0040000 */
+               ifxmips_partitions[1].size = ifxmips_mtd->erasesize;
+               ifxmips_partitions[2].offset = ifxmips_partitions[1].offset + ifxmips_mtd->erasesize;
                parts = &ifxmips_partitions[0];
        }
 
@@ -218,8 +222,8 @@ static int ifxmips_mtd_probe(struct platform_device *dev)
                if (detect_squashfs_partition(parts[kernel_part].offset + uimage_size)) {
                        printk(KERN_INFO "ifxmips_mtd: found a squashfs following the uImage\n");
                } else {
-                       uimage_size &= ~0xffff;
-                       uimage_size += 0x10000;
+                       uimage_size &= ~(ifxmips_mtd->erasesize -1);
+                       uimage_size += ifxmips_mtd->erasesize;
                }
 
                parts[kernel_part].size = uimage_size;
@@ -235,6 +239,7 @@ static int ifxmips_mtd_probe(struct platform_device *dev)
                        parts[3].size -= ifxmips_mtd->erasesize;
                        parts[4].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize;
                        parts[4].size = ifxmips_mtd->erasesize;
+                       ifxmips_meta_partition.size -= ifxmips_mtd->erasesize;
                } else {
                        num_parts--;
                }
@@ -244,7 +249,7 @@ static int ifxmips_mtd_probe(struct platform_device *dev)
        add_mtd_partitions(ifxmips_mtd, &ifxmips_meta_partition, 1);
 
        printk(KERN_INFO "ifxmips_mtd: added %s flash with %dMB\n",
-               ifxmips_map.name, ifxmips_mtd->size);
+               ifxmips_map.name, ((int)ifxmips_mtd->size) >> 20);
        return 0;
 }
 
This page took 0.031298 seconds and 4 git commands to generate.