Hello flashrom developers!
I am currently hacking flashrom support for a National
Instrments USB-8451 USB-SPI converter. I have found an
AT25DF081A in the drawer to be used as a medical rabbit for my
Probing, reading works fine, but the
chip is sector protected. The flashrom tries to disable the
protection with clearing the 7th bit (SPRL) in the status
register, but as the datasheet states:
As a safeguard
against accidental or erroneous locking or unlocking of
sectors, the Sector Protection Registers can themselves be
locked from updates by using the SPRL (Sector Protection
Registers Locked) bit of the Status Register (refer to
“Status Register Commands” on page 16 for more details). If
the Sector Protection Registers are locked, then any
attempts to issue the Unprotect Sector command will be
ignored, and the device will reset the WEL bit in the Status
Register back to a logical “0” and return to the idle
state once the CS pin has been deasserted.
So to unlock my flash I would have to walk through the sectors
and issue an Unprotect sector command with the sector's
My problem is that the erase blocks addresses and the sector
addresses are different things. In my case it has 64Kbyte
block feature and the sectors are 64Kbyte, but it also has
4KByte block feature too.
What would you recommend how to implement the sector unlocking
My proposal is the following:
- Add a sector describing structure to the flashchip
structure. It would contain the sector count and sector size.
- Create a new unlock method:
spi_disable_blockprotect_at2x_sector_unprotect for e.g. which
clears the SPRL, then (if SWP is not 0) loops through the
sectors and unlock them.
- If we want to be nice after the write we can reprotect the
Please let me know your opinion on this topic!