[flashrom] Sector unprotect at AT25DF081A

Márton Miklós martonmiklosqdev at gmail.com
Sat Apr 12 19:19:20 CEST 2014

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 experiments.
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 
So to unlock my flash I would have to walk through the sectors and issue 
an Unprotect sector command with the sector's address.
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 mode?
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 device.

Please let me know your opinion on this topic!

Márton Miklós

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20140412/852eb1b6/attachment.html>

More information about the flashrom mailing list