This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ECC/NAND problem with 2.6.37 writing uImage to NAND from kernel

Other Parts Discussed in Thread: DM3730

Hi OMAP/DM friends,

I am using a DM3730 board. NAND boot works fine when I flash mlo,u-boot,kern,ubifs from u-boot. I am using rowboat gingerbread 2.3.4 devkit 2.1's (for everything, ie: mlo, u-boot, kernel, rootfs). My goal is to get userspace firmware upgrades working. This is when I started hitting a problem. From userspace, I did:

/# flash_erase /dev/mtd/mtd3 0 0 ; nandwrite -b1 -p /dev/mtd/mtd3 /fwupgrade/uImage 
Erasing 128 Kibyte @ 4e0000 -- 100 % complete
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
Writing data to block 5 at offset 0xa0000
Writing data to block 6 at offset 0xc0000
Writing data to block 7 at offset 0xe0000
Writing data to block 8 at offset 0x100000
Writing data to block 9 at offset 0x120000
Writing data to block 10 at offset 0x140000
Writing data to block 11 at offset 0x160000
Writing data to block 12 at offset 0x180000
Writing data to block 13 at offset 0x1a0000
Writing data to block 14 at offset 0x1c0000
Writing data to block 15 at offset 0x1e0000
Writing data to block 16 at offset 0x200000
Writing data to block 17 at offset 0x220000
Writing data to block 18 at offset 0x240000
Writing data to block 19 at offset 0x260000
Writing data to block 20 at offset 0x280000
Writing data to block 21 at offset 0x2a0000
Writing data to block 22 at offset 0x2c0000
Writing data to block 23 at offset 0x2e0000
Writing data to block 24 at offset 0x300000
Writing data to block 25 at offset 0x320000
Writing data to block 26 at offset 0x340000
Writing data to block 27 at offset 0x360000
Writing data to block 28 at offset 0x380000

Then poweroff/on and check if u-boot can boot this uImage and I get:
OMAP3 beagleboard.org # nandecc hw 1
HW ECC [Kernel/FS layout] selected
OMAP3 beagleboard.org # nand read 0x82000000 280000 400000

NAND read: device 0 offset 0x280000, size 0x400000
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed

After googling, I saw 's comment here:http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/t/116753.aspx

So I made that change to my kernel (I am using 2.6.37 from rowboat-android devkit 2.1 gingerbread 2.3.4):
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 1ed2648..d8d771d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -858,7 +858,7 @@ int gpmc_enable_hwecc(int ecc_type, int cs, int mode,
bch_mod = 1;
bch_wrapmode = 0x04;
} else
- eccsize1 = ((ecc_size >> 1) - 1) << 22;
+ eccsize1 = ((ecc_size >> 1) - 1);
break;

case GPMC_ECC_READSYN:
@@ -874,7 +874,7 @@ int gpmc_enable_hwecc(int ecc_type, int cs, int mode,
bch_mod = 1;
bch_wrapmode = 0x06;
} else
- eccsize1 = ((ecc_size >> 1) - 1) << 22;
+ eccsize1 = ((ecc_size >> 1) - 1);
break;

default:

I then did nand erase all, booted from SD using the updated kernel with Abhilash's changes. Then again did the command:

/# flash_erase /dev/mtd/mtd3 0 0 ; nandwrite -b1 -p /dev/mtd/mtd3 /fwupgrade/uImage2

but upon rebooting into u-boot, I still get:

OMAP3 beagleboard.org # nandecc hw 1
HW ECC [Kernel/FS layout] selected
OMAP3 beagleboard.org # nand read 0x82000000 280000 400000

NAND read: device 0 offset 0x280000, size 0x400000
Error: Bad compare! failed
Error: Bad compare! failed
...

I am using 2.6.37 from rowboat-android. I would appreciate any advice/suggestions on how to resolve this issue.

Thanks,
jaya
  • Basically it looks like ECC mismatch only. Could you please try to see whether different options for nandecc command and change the algorithms and try?

    If you are still stuck I'll suggest you to try these steps. Create a small file of 2KB(depending on your page size) and flash the same from kernel to a particular offset. Go to u-boot and do a "nand dump 0xoffset" and see the spare area values. Then flash the same file from u-boot and do a "nand dump 0xoffset" again. Compare the spare area of the page with the previous spare area values. You can try flashing the same file from u-boot with different algorithms selected using nandecc command and figure out the right algorithm to choose.