mtd: onenand: fix 4KiB page onenand chip recognition

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Oct 24 20:59:10 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=edb44b9b9cbff71f6aa9bebc384ee1896c8bfc2c
Commit:     edb44b9b9cbff71f6aa9bebc384ee1896c8bfc2c
Parent:     940fe282aeda984d32ca9e3d2be7df1b4c5161b1
Author:     Roman Tereshonkov <roman.tereshonkov at nokia.com>
AuthorDate: Mon Oct 11 14:47:32 2010 +0300
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Oct 25 01:13:20 2010 +0100

    mtd: onenand: fix 4KiB page onenand chip recognition
    
    For 4Gib non-DDP chip it does not follow that it is always 4KiB page chip.
    The number of data buffers is checked and if it is equal to 1
    we suppose that it is 4KiB page onenand chip.
    
    Signed-off-by: Roman Tereshonkov <roman.tereshonkov at nokia.com>
    Acked-by: Kyungmin Park <kyungmin.park at samsung.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/onenand/onenand_base.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 33e0dbb..6b3a875 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3365,18 +3365,19 @@ static int onenand_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
 static void onenand_check_features(struct mtd_info *mtd)
 {
 	struct onenand_chip *this = mtd->priv;
-	unsigned int density, process;
+	unsigned int density, process, numbufs;
 
 	/* Lock scheme depends on density and process */
 	density = onenand_get_density(this->device_id);
 	process = this->version_id >> ONENAND_VERSION_PROCESS_SHIFT;
+	numbufs = this->read_word(this->base + ONENAND_REG_NUM_BUFFERS) >> 8;
 
 	/* Lock scheme */
 	switch (density) {
 	case ONENAND_DEVICE_DENSITY_4Gb:
 		if (ONENAND_IS_DDP(this))
 			this->options |= ONENAND_HAS_2PLANE;
-		else
+		else if (numbufs == 1)
 			this->options |= ONENAND_HAS_4KB_PAGE;
 
 	case ONENAND_DEVICE_DENSITY_2Gb:



More information about the linux-mtd-cvs mailing list