Flashing NAND with latest u-boot fails

Hi,

I pulled u-boot from
http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;
OMAP3 beagleboard.org # nand erase 0 80000;
OMAP3 beagleboard.org # nand write.i 0x80200000 0 80000;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 flash-uboot.bin; nand unlock;
OMAP3 beagleboard.org # nand ecc sw;nand erase 80000 160000;
OMAP3 beagleboard.org # nand write.i 0x80200000 80000 160000;\0"

But nothing turns up on the screen after rebooting.

Any suggestions? Do we need to fix some stuff here.

I am working on getting production tests / validation as patches to
the latest version. I am then planning to add USB keyboard and DSS
based Console to u-boot.

Any suggestions are appreciated.

Regards,
Khasim

Op 26 nov 2008, om 16:36 heeft Khasim Syed Mohammed het volgende geschreven:

Hi,

I pulled u-boot from
http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;
OMAP3 beagleboard.org # nand erase 0 80000;
OMAP3 beagleboard.org # nand write.i 0x80200000 0 80000;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 flash-uboot.bin; nand unlock;
OMAP3 beagleboard.org # nand ecc sw;nand erase 80000 160000;
OMAP3 beagleboard.org # nand write.i 0x80200000 80000 160000;\0"

But nothing turns up on the screen after rebooting.

Any suggestions? Do we need to fix some stuff here.

I am working on getting production tests / validation as patches to
the latest version. I am then planning to add USB keyboard and DSS
based Console to u-boot.

Any suggestions are appreciated.

The name was changed to get it accepted upstream, see

http://groups.google.com/group/beagleboard/browse_thread/thread/ff1d79ab64bdce1/1be6fadb9be55d80?lnk=gst&q=nandecc#1be6fadb9be55d80

regards,

Koen

Khasim Syed Mohammed wrote:

Hi,

I pulled u-boot from
http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;

Hmm, this shouldn't work. Don't you get any error message?

As Koen already mentioned, we had to switch to

nandecc hw/sw

instead (without space between nand and ecc). Does this work for you?

OMAP3 beagleboard.org # nand erase 0 80000;
OMAP3 beagleboard.org # nand write.i 0x80200000 0 80000;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 flash-uboot.bin; nand unlock;
OMAP3 beagleboard.org # nand ecc sw;nand erase 80000 160000;
OMAP3 beagleboard.org # nand write.i 0x80200000 80000 160000;\0"

But nothing turns up on the screen after rebooting.

Any suggestions? Do we need to fix some stuff here.

I am working on getting production tests / validation as patches to
the latest version. I am then planning to add USB keyboard and DSS
based Console to u-boot.

Before adding new code, I'm still looking for somebody who likes to help to make existing code mainline ready

http://lists.denx.de/pipermail/u-boot/2008-November/043775.html

Best regards

Dirk

Khasim Syed Mohammed wrote:

Hi,

I pulled u-boot from

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;

Hmm, this shouldn't work. Don't you get any error message?

As Koen already mentioned, we had to switch to

nandecc hw/sw

Now I am able to flash x-loader and it comesup as well. But for some
reason the u-boot doesn't flash at all. It returns with lots of Skip
bad block messages.

Skip bad block 0x24fe0000
Skip bad block 0x25000000
Skip bad block 0x25020000
Skip bad block 0x25040000
Skip bad block 0x25060000
Skip bad block 0x25080000
Skip bad block 0x250a0000
Skip bad block 0x250c0000
...

However, if I use older u-boot its able to flash. I think I am missing
some thing...

instead (without space between nand and ecc). Does this work for you?

It was giving error, I was very lazy to look the message - sorry about that.

I am working on getting production tests / validation as patches to
the latest version. I am then planning to add USB keyboard and DSS
based Console to u-boot.

Before adding new code, I'm still looking for somebody who likes to help to
make existing code mainline ready

I have to attend couple of tech symposiums next week. After that I am
pretty much free. I will dedicate my self to u-boot activity for a
while. Sorry for loading lots of stuff on you alone.

Regards,
Khasim

Khasim Syed Mohammed wrote:

Khasim Syed Mohammed wrote:

Hi,

I pulled u-boot from

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;

Hmm, this shouldn't work. Don't you get any error message?

As Koen already mentioned, we had to switch to

nandecc hw/sw

Now I am able to flash x-loader and it comesup as well. But for some
reason the u-boot doesn't flash at all. It returns with lots of Skip
bad block messages.

Skip bad block 0x24fe0000
Skip bad block 0x25000000
Skip bad block 0x25020000
Skip bad block 0x25040000
Skip bad block 0x25060000
Skip bad block 0x25080000
Skip bad block 0x250a0000
Skip bad block 0x250c0000
...

However, if I use older u-boot its able to flash. I think I am missing
some thing...

Had a short discussion with Scott Wood, U-Boot's NAND custodian, about this. Assuming that "older U-Boot" is u-boot_beagle_revb.tar.gz which is version 1.3.3. we have different ECC layout:

Old layout: U-Boot 1.3.3:

static struct nand_oobinfo sw_nand_oob_64 = {
  .useecc = MTD_NANDECC_AUTOPLACE,
  .eccbytes = 24,
  .eccpos = {
       40, 41, 42, 43, 44, 45, 46, 47,
       48, 49, 50, 51, 52, 53, 54, 55,
       56, 57, 58, 59, 60, 61, 62, 63},
  .oobfree = {{2, 38}}
};

New layout: git head:

#define GPMC_NAND_HW_ECC_LAYOUT {\
  .eccbytes = 12,\
  .eccpos = {2, 3, 4, 5, 6, 7, 8, 9,\
    10, 11, 12, 13},\
  .oobfree = {\
    {.offset = 14,\
     .length = 50 } } \
}

One idea was that old layout might have overwritten bad block markers, but this doesn't seem to be the case, as bytes 0 & 1 are reserved in both layouts.

The proposal from Scott is to dump on the bad blocks to see what's there.

Regards

Dirk

Khasim Syed Mohammed wrote:

Khasim Syed Mohammed wrote:

Hi,

I pulled u-boot from

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=tree;h=refs/heads/omap3;hb=refs/heads/omap3

It boots fine on board, I am trying to flash the same with x-loader. I
used the instructions as I was using before,

OMAP3 beagleboard.org # mmcinit;
OMAP3 beagleboard.org # fatload mmc 0 0x80200000 x-load.bin.ift;
OMAP3 beagleboard.org # nand unlock;
OMAP3 beagleboard.org # nand ecc hw;

Hmm, this shouldn't work. Don't you get any error message?

As Koen already mentioned, we had to switch to

nandecc hw/sw

Now I am able to flash x-loader and it comesup as well. But for some
reason the u-boot doesn't flash at all. It returns with lots of Skip
bad block messages.

Skip bad block 0x24fe0000
Skip bad block 0x25000000
Skip bad block 0x25020000
Skip bad block 0x25040000
Skip bad block 0x25060000
Skip bad block 0x25080000
Skip bad block 0x250a0000
Skip bad block 0x250c0000
...

However, if I use older u-boot its able to flash. I think I am missing
some thing...

Can you try (NAND) relative addresses instead of absolute addresses? Absolute adresses were used for onenand, and we decided to change that to match NAND's relative addresses.

http://elinux.org/BeagleBoardNAND#Software

can give you a hint about the addresses.

Best regards

Dirk

Dirk,

Thanks for the mails, don't know for some reason they were marked as
READ and I missed reading the same :frowning:

I will work on this today and update you my findings.

Regards,
Khasim

I also noticed this issue with new u-boot. We had some discussion
about this in IRC a few days ago:
http://www.beagleboard.org/irclogs/index.php?date=2008-12-03#T19:34:10

This is what happens if I try to erase kernel area in NAND using u-
boot:
http://pastebin.com/ma9e3b29
Command "nand bad" returns only one bad block which is not even near
the kernel area. Seems that the kernel memory area won't get erased
because after this the Linux still boots ok...

Flashing kernel works OK with older u-boot. And by older I mean u-boot
downloaded from Beagle Board Google Project page.

- Antti

>> Now I am able to flash x-loader and it comesup as well. But for some
>> reason the u-boot doesn't flash at all. It returns with lots of Skip
>> bad block messages.

>> Skip bad block 0x24fe0000
>> Skip bad block 0x25000000
>> Skip bad block 0x25020000
>> Skip bad block 0x25040000
>> Skip bad block 0x25060000
>> Skip bad block 0x25080000
>> Skip bad block 0x250a0000
>> Skip bad block 0x250c0000
>> ...

>> However, if I use older u-boot its able to flash. I think I am missing
>> some thing...

ok, if I try nandecc sw first and flash u-boot then switch to nandecc
hw and flash x-loader - IT WORKS...!!!

I will dig more to find the root cause.

Regards,
Khasim

I still don't have the complete solution but the problem is clear, we
are releasing the allocated/initialized buffers,
in drivers/mtd/nand/omap_gpmc.c

omap_nand_switch_ecc
{

        /* clean up allocated buffers */
        nand_release(mtd);

This will erase the bbt created for swecc, this table is never populated again.

When we try a write again (after hwecc followed by swecc), the
nand_isbad_bbt (drivers/mtd/nand/nand_bbt.c ) function is called and
this->bbt[block >> 3] returns a junk value and the block is skipped.

I am finding the correct place to rescan/populate the table after
every ecc change.

Any suggestions are appreciated.

Regards,

Khasim