Patchwork [U-Boot] am35xx, twister: could not write nand flash

login
register
mail settings
Submitter Heiko Schocher
Date June 15, 2012, 12:01 p.m.
Message ID <4FDB2416.2060809@denx.de>
Download mbox | patch
Permalink /patch/165098/
State Not Applicable
Headers show

Comments

Heiko Schocher - June 15, 2012, 12:01 p.m.
Hello Scott,

I currently tried current U-Boot HEAD

commit fedab338f3459315cb69627fcf46032ec8df1753
Merge: 74b5b5d f6b690e
Author: Wolfgang Denk <wd@denx.de>
Date:   Thu Jun 7 23:42:17 2012 +0200

     Merge branch 'master' of git://git.denx.de/u-boot-video

on the twister board, and detected that a "run update" fails with:

twister => run update
SW ECC selected

NAND erase: device 0 offset 0x80000, size 0x100000
Erasing at 0x160000 -- 100% complete.
OK

NAND write:
(board hangs ...)

Environment var:
update=nandecc sw;nand erase ${uboot_addr} 100000;nand write ${loadaddr} ${uboot_addr} 80000

So I started "git bisection":

[hs@pollux u-boot]$ git bisect start
[hs@pollux u-boot]$ git bisect bad
[hs@pollux u-boot]$ git bisect good 415d386877df49eb051b85ef74fa59a16dc17c7d
Bisecting: 211 revisions left to test after this (roughly 8 steps)
[...]
[hs@pollux u-boot]$ git bisect bad
418396e212b59bf907dbccad997ff50f7eb61b16 is the first bad commit
commit 418396e212b59bf907dbccad997ff50f7eb61b16
Author: Scott Wood <scottwood@freescale.com>
Date:   Fri Mar 2 14:01:57 2012 -0600

     nand: extend .raw accesses to work on multiple pages

     A use for this is to read, modify, erase, and write an entire block as a
     single unit, as a replacement for the biterr command.  This way gives
     more flexibility in that you can also test multiple bit errors, errors
     in the ECC, etc.

     Signed-off-by: Scott Wood <scottwood@freescale.com>

:040000 040000 ad5ce55a0fdf3a40e1aaae0546aae68bf7a0b480 f57e87a8630715e37170b5bb3a109a58b6b89333 M      common
:040000 040000 83834ae80a73f20357132875078f643b4064f9dd ed0004e44b4da8b2734168a3950733afba0a0b64 M      doc
[hs@pollux u-boot]$

following patch helps:


What do you think? Is this a correct fix, and I should sent this as
a real patch, or did I overlook something?

bye,
Heiko
Scott Wood - June 15, 2012, 4:28 p.m.
On 06/15/2012 07:01 AM, Heiko Schocher wrote:
> Hello Scott,
> 
> I currently tried current U-Boot HEAD
> 
> commit fedab338f3459315cb69627fcf46032ec8df1753
> Merge: 74b5b5d f6b690e
> Author: Wolfgang Denk <wd@denx.de>
> Date:   Thu Jun 7 23:42:17 2012 +0200
> 
>     Merge branch 'master' of git://git.denx.de/u-boot-video
> 
> on the twister board, and detected that a "run update" fails with:
> 
> twister => run update
> SW ECC selected
> 
> NAND erase: device 0 offset 0x80000, size 0x100000
> Erasing at 0x160000 -- 100% complete.
> OK
> 
> NAND write:
> (board hangs ...)
> 
> Environment var:
> update=nandecc sw;nand erase ${uboot_addr} 100000;nand write ${loadaddr}
> ${uboot_addr} 80000
> 
> So I started "git bisection":
> 
> [hs@pollux u-boot]$ git bisect start
> [hs@pollux u-boot]$ git bisect bad
> [hs@pollux u-boot]$ git bisect good
> 415d386877df49eb051b85ef74fa59a16dc17c7d
> Bisecting: 211 revisions left to test after this (roughly 8 steps)
> [...]
> [hs@pollux u-boot]$ git bisect bad
> 418396e212b59bf907dbccad997ff50f7eb61b16 is the first bad commit
> commit 418396e212b59bf907dbccad997ff50f7eb61b16
> Author: Scott Wood <scottwood@freescale.com>
> Date:   Fri Mar 2 14:01:57 2012 -0600
> 
>     nand: extend .raw accesses to work on multiple pages
> 
>     A use for this is to read, modify, erase, and write an entire block
> as a
>     single unit, as a replacement for the biterr command.  This way gives
>     more flexibility in that you can also test multiple bit errors, errors
>     in the ECC, etc.
> 
>     Signed-off-by: Scott Wood <scottwood@freescale.com>
> 
> :040000 040000 ad5ce55a0fdf3a40e1aaae0546aae68bf7a0b480
> f57e87a8630715e37170b5bb3a109a58b6b89333 M      common
> :040000 040000 83834ae80a73f20357132875078f643b4064f9dd
> ed0004e44b4da8b2734168a3950733afba0a0b64 M      doc
> [hs@pollux u-boot]$
> 
> following patch helps:
> 
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index fa44295..edeb093 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -617,7 +617,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc,
> char * const argv[])
> 
>                 s = strchr(cmd, '.');
> 
> -               if (!strcmp(s, ".raw")) {
> +               if ((s != NULL) && (!strcmp(s, ".raw"))) {
>                         raw = 1;
> 
>                         if (arg_off(argv[3], &dev, &off, &size))
> 
> What do you think? Is this a correct fix, and I should sent this as
> a real patch, or did I overlook something?

This is the correct fix, and I have a pull request pending that contains
it. :-)

-Scott

Patch

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index fa44295..edeb093 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -617,7 +617,7 @@  int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])

                 s = strchr(cmd, '.');

-               if (!strcmp(s, ".raw")) {
+               if ((s != NULL) && (!strcmp(s, ".raw"))) {
                         raw = 1;

                         if (arg_off(argv[3], &dev, &off, &size))