
hi folks,
I've come across a case on one of our PXA250 boards where the flash was getting corrupted when using the 1.3.2 version of cfi_flash.c, while the 1.2.0 version worked just fine.
Here's what happens:
1. Reprogram uboot. 2. Compare uboot in flash against uboot in DRAM. 3. Either run "reset" or press the reset button. 4. Compare the flash and DRAM, as well as a new copy of uboot re-read from CF for good measure.
At this point the low byte in the word at offset 0x554 has switched from a 0x30 to a 0x10. This is the only change in the flash. The new value is always the same.
I narrowed down the source of the problem to the loss of the volatile qualifier on the addr pointer in flash_write_cmd(). Adding the qualifier gets rid of the corruption. In the older 1.2.0 sources, addr was declared as "volatile cfiptr_t addr;".
Has anyone else seen this? It seems like the safe thing to do is to restore the qualifier in general.
Below is a diff, of the change for the 1.3.2. sources:
diff -u -r1.1.1.2.2.2 cfi_flash.c --- cfi_flash.c 23 Apr 2008 17:02:47 -0000 1.1.1.2.2.2 +++ cfi_flash.c 29 Apr 2008 18:55:47 -0000 @@ -464,7 +464,7 @@ uint offset, uchar cmd) {
- void *addr; + void *volatile addr; cfiword_t cword;
addr = flash_map (info, sect, offset);
Adrian -- Linux Software Engineer | EuroTech, Inc. | www.eurotech-inc.com