summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-04-30 22:59:45 +0200
committerWolfgang Denk <wd@denx.de>2009-04-30 22:59:45 +0200
commitbf2ba6d46e1046e54e1de30b4df40e384a355195 (patch)
tree3f82a0ed854e07b10f9abb539a68e8ab16a63522 /drivers
parentfaf4fe76081c5b25129be1eaa85412124bfe180a (diff)
parentf8e2b3107ee00f2782f8ebf47e3f09cda4e2353a (diff)
Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/cfi_mtd.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c
index 9ac1c86cce..f03e4fbd72 100644
--- a/drivers/mtd/cfi_mtd.c
+++ b/drivers/mtd/cfi_mtd.c
@@ -142,22 +142,12 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
int sect_size = 0;
int sect;
+ /*
+ * Select the largest sector size as erasesize (e.g. for UBI)
+ */
for (sect = 0; sect < fi->sector_count; sect++) {
- if (!sect_size) {
+ if (flash_sector_size(fi, sect) > sect_size)
sect_size = flash_sector_size(fi, sect);
- continue;
- }
-
- if (sect_size != flash_sector_size(fi, sect)) {
- sect_size = 0;
- break;
- }
- }
-
- if (!sect_size) {
- puts("cfi-mtd: devices with multiple sector sizes are"
- "not supported\n");
- return -EINVAL;
}
mtd->erasesize = sect_size;