[U-Boot] onenand: fix oob print out issue

Submitted by Lei Wen on Dec. 2, 2010, 2:53 p.m.

Details

Message ID 1291301610-5984-1-git-send-email-leiwen@marvell.com
State Accepted
Delegated to: Scott Wood
Headers show

Commit Message

Lei Wen Dec. 2, 2010, 2:53 p.m.
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.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 common/cmd_onenand.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Scott Wood Dec. 7, 2010, 12:23 a.m.
On Thu, Dec 02, 2010 at 04:53:30AM -0000, Lei Wen wrote:
> 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.
> 
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> 
> ---
> common/cmd_onenand.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
> index 33108f1..6d77495 100644
> --- a/common/cmd_onenand.c
> +++ b/common/cmd_onenand.c
> @@ -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
Lei Wen Dec. 7, 2010, 1:23 a.m.
Hi Scott,

On Tue, Dec 7, 2010 at 8:23 AM, Scott Wood <scottwood@freescale.com> wrote:
> On Thu, Dec 02, 2010 at 04:53:30AM -0000, Lei Wen wrote:
>> 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.
>>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>>
>> ---
>> common/cmd_onenand.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
>> index 33108f1..6d77495 100644
>> --- a/common/cmd_onenand.c
>> +++ b/common/cmd_onenand.c
>> @@ -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.
>

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

Patch hide | download patch | download mbox

diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 33108f1..6d77495 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -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]);