* [PATCH] [MTD][OneNAND] Detect the MLC OneNAND from Technology Register (0xF006h)
@ 2007-12-11 2:44 Kyungmin Park
0 siblings, 0 replies; only message in thread
From: Kyungmin Park @ 2007-12-11 2:44 UTC (permalink / raw)
To: dwmw2; +Cc: linux-mtd
Set correct values if the detected chip is MLC
Signed-off-by: Kyungmin Park <kyungmin.park@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-11 2:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11 2:44 [PATCH] [MTD][OneNAND] Detect the MLC OneNAND from Technology Register (0xF006h) Kyungmin Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox