<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-2">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="linestyle1 colourline"><tt><span>Hello flashrom developers!</span></tt></div>
    <div class="linestyle1 colourline"><tt><span><br>
          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.</span></tt></div>
    <div class="linestyle1 colourline"><tt>Probing,</tt> <tt><span
          class="timestamp"></span></tt><tt><span><span
            class="hyperlink-channel"></span>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:<br>
          <i><br>
          </i></span></tt></div>
    <div class="linestyle1 colourline"><tt><span><i>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</i><i>
          </i><i>Register back to a logical “0” and return to the idle
            state once the CS pin has been deasserted.</i><i><br>
          </i><br>
          So to unlock my flash I would have to walk through the sectors
          and issue an Unprotect sector command with the sector's
          address.<br>
          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.<br>
          <br>
          What would you recommend how to implement the sector unlocking
          mode?<br>
          My proposal is the following:<br>
          - Add a sector describing structure to the flashchip
          structure. It would contain the sector count and sector size.<br>
          - 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. <br>
          - If we want to be nice after the write we can reprotect the
          device.<br>
          <br>
          Please let me know your opinion on this topic!<br>
          Thanks!<br>
        </span></tt></div>
    <pre class="moz-signature" cols="72">-- 
Üdvözlettel,
Márton Miklós</pre>
  </body>
</html>