
On 9 February 2015 at 04:57, Michael Walle michael@walle.cc wrote:
Hi there,
I stumbled across a situation where the SPI flash on my board was write protected and i could not unlock it in the bootloader. This is especially unfortunate because the recovery mechanism relies on the bootloader to be able to erase the environment.
Which flash vendor it is? seems like there is a hardware write protected mechanism in ST MICRON flashes.
Please refer that, may be this looks similar to that W#/Vpp CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
So any ideas how to fix this? I didn't see any code which unlocks the sectors yet.
We could add a lock/unlock function to the spi system, then call unlock in the beginning of saveenv() and lock at the end of saveenv(). Eg.
lockbits = read_status() & LOCK_BITS spi_unlock_all() saveenv() spi_lock(lockbits)
Also this should be exposed to the CLI somehow. "sf lock/unlock"?
thanks!