diff options
author | John Crispin <john@openwrt.org> | 2008-07-05 23:06:07 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2008-07-05 23:06:07 +0000 |
commit | 3e2c38b0fba0839aa7e82d209693282ef976e196 (patch) | |
tree | 274923eaab55abff5f8e77ead8e9d639becb874c /target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c | |
parent | 7866f69cbe157e001f000c5e327d7783156ed363 (diff) | |
download | master-31e0f0ae-3e2c38b0fba0839aa7e82d209693282ef976e196.tar.gz master-31e0f0ae-3e2c38b0fba0839aa7e82d209693282ef976e196.tar.bz2 master-31e0f0ae-3e2c38b0fba0839aa7e82d209693282ef976e196.zip |
lots of ifxmips fixes and features
SVN-Revision: 11673
Diffstat (limited to 'target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c')
-rw-r--r-- | target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c index 98359eb9fa..b3692e72a0 100644 --- a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c +++ b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c @@ -27,6 +27,7 @@ #include <linux/mtd/partitions.h> #include <linux/mtd/cfi.h> #include <asm/ifxmips/ifxmips.h> +#include <asm/ifxmips/ifxmips_prom.h> #include <asm/ifxmips/ifxmips_ebu.h> #include <linux/magic.h> #include <linux/platform_device.h> @@ -90,14 +91,14 @@ ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_ } static struct mtd_partition -ifxmips_partitions[4] = { +ifxmips_partitions[] = { { - name:"U-Boot", + name:"uboot", offset:0x00000000, size:0x00020000, }, { - name:"U-Boot-Env", + name:"uboot_env", offset:0x00020000, size:0x00010000, }, @@ -111,6 +112,11 @@ ifxmips_partitions[4] = { offset:0x0, size:0x0, }, + { + name:"board_config", + offset:0x0, + size:0x0, + }, }; int @@ -122,6 +128,18 @@ find_uImage_size(unsigned long start_offset){ } int +find_brn_block(unsigned long start_offset){ + unsigned char temp[9]; + ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 8); + temp[8] = '\0'; + printk(KERN_INFO "data in brn block %s\n", temp); + if(memcmp(temp, "BRN-BOOT", 8) == 0) + return 1; + else + return 0; +} + +int detect_squashfs_partition(unsigned long start_offset){ unsigned long temp; ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 4); @@ -170,12 +188,19 @@ ifxmips_mtd_probe(struct platform_device *dev) uimage_size += 0x10000; } + parts = &ifxmips_partitions[0]; ifxmips_partitions[2].size = uimage_size; ifxmips_partitions[3].offset = ifxmips_partitions[2].offset + ifxmips_partitions[2].size; ifxmips_partitions[3].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - ifxmips_partitions[3].offset; - - parts = &ifxmips_partitions[0]; - add_mtd_partitions(ifxmips_mtd, parts, 4); + if(ifxmips_has_brn_block()) + { + ifxmips_partitions[3].size -= ifxmips_mtd->erasesize; + ifxmips_partitions[4].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize; + ifxmips_partitions[4].size = ifxmips_mtd->erasesize; + add_mtd_partitions(ifxmips_mtd, parts, 5); + } else { + add_mtd_partitions(ifxmips_mtd, parts, 4); + } printk(KERN_INFO "ifxmips_mtd: added ifxmips flash with %dMB\n", ifxmips_mtd->size >> 20); return 0; |