diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-02-16 09:57:24 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-02-16 09:57:24 +0000 |
commit | cdd4982fef90503a4049688aa78f237420befd61 (patch) | |
tree | 497429d5775ca9f8d5eb089659929e09a958d7ed /target | |
parent | 3d60d69334f43e0da151208dffee850b26d34c3c (diff) | |
download | mtk-20170518-cdd4982fef90503a4049688aa78f237420befd61.zip mtk-20170518-cdd4982fef90503a4049688aa78f237420befd61.tar.gz mtk-20170518-cdd4982fef90503a4049688aa78f237420befd61.tar.bz2 |
remove squashfs repartitioning hacks from spiflash driver - will be ported to redboot parsing code later
SVN-Revision: 6308
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c | 70 |
1 files changed, 4 insertions, 66 deletions
diff --git a/target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c b/target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c index 6e6734d..067f32b 100644 --- a/target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c +++ b/target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c @@ -396,15 +396,9 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; static int spiflash_probe(struct platform_device *pdev) { - int result = -1, i, j; - u32 len; + int result = -1; int index, num_parts; struct mtd_info *mtd; - struct mtd_partition *mtd_parts; - char *buf; - struct mtd_partition *part; - struct squashfs_super_block *sb; - u32 config_start; spidata->spiflash_mmraddr = ioremap_nocache(SPI_FLASH_MMR, SPI_FLASH_MMR_SIZE); @@ -476,73 +470,17 @@ static int spiflash_probe(struct platform_device *pdev) } } #endif - /* parse redboot partitions */ num_parts = parse_mtd_partitions(mtd, part_probe_types, &spidata->parsed_parts, 0); - mtd_parts = kzalloc(sizeof(struct mtd_partition) * MAX_PARTS, GFP_KERNEL); - buf = kmalloc(mtd->erasesize, GFP_KERNEL); - sb = (struct squashfs_super_block *) buf; - for (i = j = 0; i < num_parts; i++, j++) { - part = &mtd_parts[j]; - memcpy(part, &spidata->parsed_parts[i], sizeof(struct mtd_partition)); - - if (!strcmp(part->name, ROOTFS_NAME)) { - /* create the root device */ - ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, i); - - part->size -= mtd->erasesize; - config_start = part->offset + part->size; - - while ((mtd->read(mtd, part->offset, mtd->erasesize, &len, buf) == 0) && - (len == mtd->erasesize) && - (*((u32 *) buf) == SQUASHFS_MAGIC) && - (sb->bytes_used > 0)) { - - /* this is squashfs, allocate another partition starting from the end of filesystem data */ - memcpy(&mtd_parts[j + 1], part, sizeof(struct mtd_partition)); - - len = (u32) sb->bytes_used; - len += (part->offset & 0x000fffff); - len += (mtd->erasesize - 1); - len &= ~(mtd->erasesize - 1); - len -= (part->offset & 0x000fffff); - - if (len + mtd->erasesize > part->size) - break; - - part = &mtd_parts[++j]; - - part->offset += len; - part->size -= len; - - part->name = kmalloc(10, GFP_KERNEL); - sprintf(part->name, "rootfs%d", j - i); - } - } - if (!strcmp(part->name, "RedBoot config")) { - /* add anoterh partition for the board config data */ - memcpy(&mtd_parts[j + 1], part, sizeof(struct mtd_partition)); - j++; - part = &mtd_parts[j]; - part->offset += part->size; - part->size = mtd->erasesize; - - part->name = kmalloc(16, GFP_KERNEL); - sprintf(part->name, "board_config"); - } - } - num_parts += j - i; - kfree(buf); - #ifdef SPIFLASH_DEBUG - printk (KERN_DEBUG "Found %d redboot partitions\n", num_parts); + printk (KERN_DEBUG "Found %d partitions\n", num_parts); #endif if (num_parts) { - result = add_mtd_partitions(mtd, mtd_parts, num_parts); + result = add_mtd_partitions(mtd, spidata->parsed_parts, num_parts); } else { #ifdef SPIFLASH_DEBUG - printk (KERN_DEBUG "Did not find any redboot partitions\n"); + printk (KERN_DEBUG "Did not find any partitions\n"); #endif kfree(mtd); kfree(spidata); |