[flashrom] Test report for multiple SPI flash chips on serprog with UNTESTED status

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sat Apr 20 11:36:53 CEST 2013

On Fri, 19 Apr 2013 10:44:29 +0800
Chi Zhang <zhangchi866 at gmail.com> wrote:

> 在 2013年4月19日 星期五 02:28:02,Stefan Tauner 写道:
> > On Wed, 03 Apr 2013 12:40:07 +0800
> > 
> > Chi Zhang <zhangchi866 at gmail.com> wrote:
> > > Applied patch: http://patchwork.coreboot.org/patch/3927/
> > > And now AT26DF161A is NOT working any more.
> > > 
> > > http://paste.flashrom.org/view.php?id=1578
> > 
> > I have to admit that I don't understand the problem yet at all. It
> > should have worked IMHO.
> > If you have some time please retry with -VV again after applying the
> > following patch on top of the previous patch (3927). This should print
> > what we actually try to write to the status register to disable the
> > alleged write protection. Maybe I am misreading the datasheet, and if
> > so the debug output should make it easier to understand what's going on.
> > 
> Done with latest SVN version (r1671) and patch 3927 and the patch in your 
> mail.
> http://paste.flashrom.org/view.php?id=1618

Thanks for testing. This is quite odd: we do the right thing IMHO.
The relevant code is in spi25_statusreg.c
spi_disable_blockprotect_at25df() calls
spi_disable_blockprotect_generic(flash, 0x0C, 1 << 7, 1 << 4)
In the beginning the status register is 0x1C, i.e. the status register
is not locked, the hardware protection pin is not asserted, only the
write protection bits are set.
spi_disable_blockprotect_generic() correctly detects that and tries to
set the protection bits to 0 by trying to write 0x10 (not touching the
r/o WP pin bit), but that apparently has no effect.

> Unpatched r1671 still works:
> http://paste.flashrom.org/view.php?id=1619

Interestingly here the initial contents of the status register are what
we would expect them to be after unlocking(!).
Maybe the chip reacts too slow? Do you have another explanation for
that behavior?

The patch below adds a delay of five seconds after trying to write to
the status register for unlocking.

diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index b325a2e..b692851 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -163,6 +163,7 @@ static int spi_disable_blockprotect_generic(struct flashctx *flash, uint8_t bp_m
                msg_cerr("spi_write_status_register failed.\n");
                return result;
+       programmer_delay(5*1000*1000);
        status = spi_read_status_register(flash);
        if ((status & bp_mask) != 0) {
                msg_cerr("Block protection could not be disabled!\n");

Kind regards/Mit freundlichen Grüßen, Stefan Tauner

More information about the flashrom mailing list