Skip to contentSkip to conversation

onenand: fix oob print out issue

PATCH Superseded Lei Wen 3 participants 5 messages Dec 2, 2010 – Dec 7, 2010

lore
Share & tools
lore

Lei Wen

author
#0 lore raw

PATCH 1/1 onenand: fix oob print out issue

Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set.

---
 common/cmd_onenand.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
common/cmd_onenand.c +2 -0
index 33108f1..6d77495 100644
@@ -319,6 +319,8 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob)
 	}
 	puts("OOB:\n");
 	i = mtd->oobsize >> 3;
+	p = oobbuf;
+
 	while (i--) {
 		printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
 		       p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 15 lines · Lei Wen

Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set.

---
common/cmd_onenand.c | 2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
common/cmd_onenand.c +0 -0
index 33108f1..6d77495 100644

common/cmd_onenand.c static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob) · line 326

Quoted 8 lines
common/cmd_onenand.c +2 -0
@@ -319,6 +319,8 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob)
 	}
 	puts("OOB:\n");
 	i = mtd->oobsize >> 3;
+	p = oobbuf;
+
 	while (i--) {
 		printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
 		       p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);

Earlier in the function there's a comment saying:

	ops.oobbuf = oobbuf;
	/* must exist, but oob data will be appended to ops.databuf */

Is this no longer accurate (I hope so, since that's awful)? If so, let's remove the comment.

-Scott

#2 lore raw

Hi Scott,

Quoted 29 lines · Scott Wood
Quoted 15 lines · Lei Wen

Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set.

---
common/cmd_onenand.c | ? ?2 ++
?1 files changed, 2 insertions(+), 0 deletions(-)

common/cmd_onenand.c +0 -0
index 33108f1..6d77495 100644

common/cmd_onenand.c static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob) · line 326

Quoted 8 lines
common/cmd_onenand.c +2 -0
@@ -319,6 +319,8 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob)
 ? ? ? }
 ? ? ? puts("OOB:\n");
 ? ? ? i = mtd->oobsize >> 3;
+ ? ? p = oobbuf;
+
 ? ? ? while (i--) {
 ? ? ? ? ? ? ? printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
 ? ? ? ? ? ? ? ? ? ? ?p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);

Earlier in the function there's a comment saying:
? ? ? ?ops.oobbuf = oobbuf;
? ? ? ?/* must exist, but oob data will be appended to ops.databuf */

Quoted 3 lines

Is this no longer accurate (I hope so, since that's awful)? ?If so, let's remove the comment.

Seem this comment should be removed...
For in onenand_read_ops_nolock, we transfer the oob data to the oobbuf pass from the onenand dump function call in cmd_onenand.

I would send the updated patch later.

Best regards,
Lei

author
#3 lore raw

PATCH v2 1/1 onenand: fix oob print out issue

Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set.

---
Changelog:
V1: Initial patch
V2: remove the comment of oob data appended to datbuf

 common/cmd_onenand.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
common/cmd_onenand.c +3 -1
index a59ab79..0434e19 100644
@@ -294,7 +294,7 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob)
 	addr = (loff_t) off;
 	memset(&ops, 0, sizeof(ops));
 	ops.datbuf = datbuf;
-	ops.oobbuf = oobbuf; /* must exist, but oob data will be appended to ops.datbuf */
+	ops.oobbuf = oobbuf;
 	ops.len = mtd->writesize;
 	ops.ooblen = mtd->oobsize;
 	ops.retlen = 0;
@@ -320,6 +320,8 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob)
 	}
 	puts("OOB:\n");
 	i = mtd->oobsize >> 3;
+	p = oobbuf;
+
 	while (i--) {
 		printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
 		       p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v2 1/1 onenand: fix oob print out issue

Quoted 9 lines · Lei Wen

Seems original implementation forget to set the pointer to point to the oobbuf, so when we want to see oob buf, we see nothing... Fix it by get pointer as the oobbuf set.

---
Changelog:
V1: Initial patch
V2: remove the comment of oob data appended to datbuf

Applied to u-boot-nand-flash

-Scott