protection on cfi-flash

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Thu Aug 5 04:01:35 EDT 2010


Hi,

I have a board with Spansion nor flash, type S29GL01GP. This uses the
cfi-flash driver
In order to avoid accidential erasure of sectors, and hence wanted to
use flash_lock and flash_unlock.
However apparently the mtd driver for this chip does not support lock
and unlock.

U-boot does support protecting the flash (using the protect command)
so it is feasible.
The chip uses cfi_cmdset_0002.c to do its work.

I guess adding lock/unlock to this is technically not too difficult,
but I lack some info on the internals of mtd and how best to do this.
Anyone a suggestion (or maybe some code or a pointer to some code)?

Thanks alot, Frans

PS: I noticed that if I protect the flash in u-boot that flash_erase
will still report success when I invoke it (although of course the
actual data is not erased).
I would expect flash_erase to get some error code in that case and
report it back (or if that is not possible do a readback of the data
to see if the erase was successful).



More information about the linux-mtd mailing list