Skip to contentSkip to conversation

onenand_wait and onenane_read

PATCH Kyungmin Park 1 participant 1 message Dec 29, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 4 lines

onenand_wait does not return an error if there is an ecc failure i.e.

ecc & ONENAND_ECC_2BIT_ALL

Quoted 8 lines

but onenand_read still marks the bufferRAM as valid i.e.

ret = this->wait(mtd, FL_READING);
/* First copy data and check return value for ECC handling */ onenand_update_bufferram(mtd, from, !ret);

This looks wrong to me. I think onenand_wait should return an error if there is an ecc failure.

Yes you're right.

Even though upper layer (JFFS2) receive the -EBADMSG or -EUCLEAN, OneNAND driver can think it is valid data.

Thank you,
Kyungmin Park

From 9235da2851242b96a938d43583bf88427ed14044 Mon Sep 17 00:00:00 2001
From: Kyungmin Park <[email protected]>
Date: Fri, 29 Dec 2006 11:51:40 +0900
Subject: [PATCH] [MTD] OneNAND: fix onenand_wait bug in read ecc error

Even though there is ECC error. OneNAND driver updates the bufferram as valid

---
 drivers/mtd/onenand/onenand_base.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/onenand/onenand_base.c +3 -2
index 0037cee..e80857b 100644
@@ -298,7 +298,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 	unsigned long timeout;
 	unsigned int flags = ONENAND_INT_MASTER;
 	unsigned int interrupt = 0;
-	unsigned int ctrl, ecc;
+	unsigned int ctrl;
 
 	/* The 20 msec is enough */
 	timeout = jiffies + msecs_to_jiffies(20);
@@ -324,7 +324,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 	}
 
 	if (interrupt & ONENAND_INT_READ) {
-		ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);
+		int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);
 		if (ecc) {
 			DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: ECC error = 0x%04x\n", ecc);
 			if (ecc & ONENAND_ECC_2BIT_ALL)
@@ -332,6 +332,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 			else if (ecc & ONENAND_ECC_1BIT_ALL)
 				mtd->ecc_stats.corrected++;
 		}
+		return ecc;
 	}
 
 	return 0;
Signature · 1 line
1.4.4.2