summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-02-16 09:57:24 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-02-16 09:57:24 +0000
commitfc14823cc7d3d98ed5a21f12461fb3e122a45ee5 (patch)
treee5807aedb60d9ccd49c3f8afb248c77214be6727 /target
parent6869d66ad6e8d662dc124fc9103566cb1bd7454a (diff)
remove squashfs repartitioning hacks from spiflash driver - will be ported to redboot parsing code later
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6308 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/atheros-2.6/files/drivers/mtd/devices/spiflash.c70
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 6e6734d43..067f32b31 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);