summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-04-20 22:50:22 +0200
committerWolfgang Denk <wd@denx.de>2011-04-20 22:50:22 +0200
commitafe0414b2e7cdd2d0536b2a45550758c62ee31e6 (patch)
tree547b9c83ccb2850ac08e414496b439c63fcc85bd /drivers
parenta94028338c8cfc55665cecb04aeb4f70785db0e1 (diff)
parente1f703810ed12dadb9151f8074bbe731a240f719 (diff)
downloadu-boot-imx-afe0414b2e7cdd2d0536b2a45550758c62ee31e6.zip
u-boot-imx-afe0414b2e7cdd2d0536b2a45550758c62ee31e6.tar.gz
u-boot-imx-afe0414b2e7cdd2d0536b2a45550758c62ee31e6.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/nand_base.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index fa286a8..52f8575 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2461,20 +2461,24 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd,
/* check version */
val = le16_to_cpu(p->revision);
- if (val == 1 || val > (1 << 4)) {
- printk(KERN_INFO "%s: unsupported ONFI "
- "version: %d\n", __func__, val);
- return 0;
- }
-
- if (val & (1 << 4))
+ if (val & (1 << 5))
+ chip->onfi_version = 23;
+ else if (val & (1 << 4))
chip->onfi_version = 22;
else if (val & (1 << 3))
chip->onfi_version = 21;
else if (val & (1 << 2))
chip->onfi_version = 20;
- else
+ else if (val & (1 << 1))
chip->onfi_version = 10;
+ else
+ chip->onfi_version = 0;
+
+ if (!chip->onfi_version) {
+ printk(KERN_INFO "%s: unsupported ONFI "
+ "version: %d\n", __func__, val);
+ return 0;
+ }
if (!mtd->name)
mtd->name = p->model;
@@ -2482,7 +2486,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd,
mtd->writesize = le32_to_cpu(p->byte_per_page);
mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
- chip->chipsize = le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
+ chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
*busw = 0;
if (le16_to_cpu(p->features) & 1)
*busw = NAND_BUSWIDTH_16;