[U-Boot] dfu, nand: writing on not empty nand partition

Heiko Schocher hs at denx.de
Thu Jun 13 14:15:18 CEST 2013


Hello,

I just tried to write with "dfu" and dfu-util on the host
to a not empty partiton on a nand flash. After the dfu
returned without error, I wanted to read the nand partiton
with "nand read" and I get ECC errors. This is on an am335x
based board (mainline patches coming soon) with ECC BCH8
enabled...

Here is a log:

U-Boot# dfu nand 0
using id 'nand0,0'
using id 'nand0,1'
using id 'nand0,2'
using id 'nand0,3'
using id 'nand0,4'
using id 'nand0,6'
using id 'nand0,7'
using id 'nand0,9'
GADGET DRIVER: usb_dnl_dfu
#
DFU complete CRC32: 0x4b157e97
DOWNLOAD ... OK
Ctrl+C to exit ...
U-Boot#
U-Boot# nand read 80100000 780000 2000

NAND read: device 0 offset 0x780000, size 0x2000
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
NAND read from offset 780000 failed -74
 0 bytes read: ERROR
U-Boot# nand erase.part kernel_b

NAND erase.part: device 0 offset 0x780000, size 0x500000
Erasing at 0xc60000 -- 100% complete.
OK
U-Boot# dfu nand 0
using id 'nand0,0'
using id 'nand0,1'
using id 'nand0,2'
using id 'nand0,3'
using id 'nand0,4'
using id 'nand0,6'
using id 'nand0,7'
using id 'nand0,9'
GADGET DRIVER: usb_dnl_dfu
#
DFU complete CRC32: 0x4b157e97
DOWNLOAD ... OK
Ctrl+C to exit ...
U-Boot# nand read 80100000 780000 2000

NAND read: device 0 offset 0x780000, size 0x2000
 8192 bytes read: OK
U-Boot# md 80100000
80100000: 56190527 5657499d 00379251 101f2f00    '..V.IWVQ.7../..
80100010: 00800080 00800080 f3f41c20 00020205    ........ .......
80100020: 756e694c 2e332d78 2d302e32 00303172    Linux-3.2.0-r10.
80100030: 00000000 00000000 00000000 00000000    ................
80100040: e1a00000 e1a00000 e1a00000 e1a00000    ................
80100050: e1a00000 e1a00000 e1a00000 e1a00000    ................
80100060: ea000002 016f2818 00000000 002f1f10    .....(o......./.
80100070: e1a07001 e1a08002 e10f2000 e3120003    .p....... ......
80100080: 1a000001 e3a00017 ef123456 e10f2000    ........V4... ..
80100090: e38220c0 e121f002 00000000 00000000    . ....!.........
801000a0: e59f4784 eb000055 e28f0f4a e8901c4e    .G..U...J...N...
801000b0: e590d01c e0400001 e0866000 e08aa000    ...... at ..`......
801000c0: e5da9000 e5dae001 e189940e e5dae002    ................
801000d0: e5daa003 e189980e e1899c0a e08dd000    ................
801000e0: e28da801 e3a05000 e28aa901 e154000a    .....P........T.
801000f0: 2a000016 e084a009 e28f9050 e15a0009    ...*....P.....Z.
U-Boot#

Is this a bug or a feature?

If it is a bug, I fixed it as I added in my tree in
drivers/mtd/nand/nand_util.c a nand_erase_write_skip_bad()
function, which erases before writes to "off, length" ...
and call this function in drivers/dfu/dfu_nand.c nand_block_op()
instead nand_write_skip_bad() ... Is this a possible solution?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list