[U-Boot] spi and block bits

Michael Walle michael at walle.cc
Mon Feb 9 00:27:08 CET 2015


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.

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"?

-michael


More information about the U-Boot mailing list