[PATCH] [MTD][OneNAND] Detect the MLC OneNAND from Technology Register (0xF006h)
Kyungmin Park
kyungmin.park at samsung.com
Mon Dec 10 21:44:45 EST 2007
Set correct values if the detected chip is MLC
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
drivers/mtd/onenand/onenand_base.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 18c79ee..bfc8399 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2571,8 +2571,8 @@ static void onenand_resume(struct mtd_info *mtd)
*/
int onenand_scan(struct mtd_info *mtd, int maxchips)
{
- int i;
struct onenand_chip *this = mtd->priv;
+ int i, MLC;
if (!this->read_word)
this->read_word = onenand_readw;
@@ -2628,6 +2628,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
this->state = FL_READY;
init_waitqueue_head(&this->wq);
spin_lock_init(&this->chip_lock);
+ MLC = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
/*
* Allow subpage writes up to oobsize.
@@ -2652,6 +2653,10 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
break;
}
+ /* Don't allow the sub-page write in MLC */
+ if (MLC)
+ mtd->subpage_sft = 0;
+
this->subpagesize = mtd->writesize >> mtd->subpage_sft;
/*
@@ -2670,6 +2675,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
/* Fill in remaining MTD driver data */
mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
+ if (MLC)
+ mtd->flags &= ~MTD_OOB_WRITEABLE;
mtd->erase = onenand_erase;
mtd->point = NULL;
mtd->unpoint = NULL;
--
1.5.0.6
More information about the linux-mtd
mailing list