[U-Boot-Users] cfi driver - wrong sector protection detection with AMD flashes

Hi all,
I tried the cfi flash driver on our custom MPC5200 board (TQM5200). It works fine with different flash chips soldered. The only problem is with an AMD (Spansion) AM29L160M Flash. There u-boot comes up with _all_ sectors protected:
=> flinfo
Bank # 1: CFI conformant FLASH (32 x 16) Size: 4 MB in 35 Sectors Erase timeout 16384 ms, write timeout 0 ms, buffer write timeout 1 ms, buffer s ize 1 Sector Start Addresses: FC000000 RO FC008000 RO FC00C000 RO FC010000 RO FC020000 RO FC040000 RO FC060000 ERO FC080000 ERO FC0A0000 ERO FC0C0000 ERO FC0E0000 ERO FC100000 ERO FC120000 ERO FC140000 ERO FC160000 ERO FC180000 ERO FC1A0000 ERO FC1C0000 ERO FC1E0000 ERO FC200000 ERO FC220000 ERO FC240000 ERO FC260000 ERO FC280000 ERO FC2A0000 ERO FC2C0000 ERO FC2E0000 ERO FC300000 ERO FC320000 ERO FC340000 ERO FC360000 ERO FC380000 ERO FC3A0000 ERO FC3C0000 ERO FC3E0000 ERO =>
I tracked down the problem to the function flash_get_size() in cfi_flash.c. There a special mechanism is used to query the flash for the protection status of each sector. As far as I know, the used mechanism is not part of the CFI Spec. And worse the mechanism is different for Intel and AMD (Spansion).
For Intel flashes the sector protection status could be read when the flash is in the CFI query state (at offset 02h on each sector address). For AMD flashes this works only in the "autoselect" mode and in the actual driver the "autoselect" mode is not used. And I could not say, if autoselect and CFI Query mode would work at the same time.
I wonder if anyone else encountered similar problems with AMD flahes and sector protection detection?
As solution for flashes with AMD command set I disabled the sector protection detection in the cfi driver (see patch). Comments are welcome.
Is there anybody out there who uses the cfi driver and _really_ protected flash sectors (not the software based protection used by u-boot)? If not, we could perhaps disable the protection detection mechanism completely. Also because the used mechanism is not part of the cfi specification.
Regards, Martin
------------------------------------------------------------------ Martin Krause TQ-Systems GmbH Gut Delling, Mühlstr. 2, 82229 Seefeld, Germany Fax: +49 8153 4223 Phone: +49 8153 9308 157 Personal Fax: +49 8153 9308 7157 Email: martin.krause@tqs.de http://www.tq-group.com ------------------------------------------------------------------
participants (1)
-
Martin Krause