Patchwork flashrom support for SST26VF064B

login
register
about
Submitter Wei Hu
Date 2014-02-26 22:57:32
Message ID <CANwcMEYauCeZpsocmWyeN_7FHvdQdbE__Zy2RpXqJTL_YQZFng@mail.gmail.com>
Download mbox | patch
Permalink /patch/4111/
State Superseded
Headers show

Comments

Wei Hu - 2014-02-26 22:57:32
Hi flashrom folks,

I'm trying to add support for SST26VF064B after I got a patch from Elias. I
made some changes to it after reading the datasheet, but none of the block
erasing commands worked, and I don't know why...

Erasing and writing flash chip... *Trying erase function 0...
0x000000-0x000fff*:E
program_opcodes: preop=5006 optype=463b opmenu=05200302c79f0190
on-the-fly *OPCODE (0x20)* re-programmed, op-pos=2
FAILED at 0x00000010! Expected=0xff, Found=0x5a, failed byte count from
0x00000000-0x00000fff: 0x83
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase
function.
*Trying erase function 1... 0x000000-0x00ffff*:E
program_opcodes: preop=5006 optype=463b opmenu=05d80302c79f0190
on-the-fly *OPCODE (0xD8)* re-programmed, op-pos=2
FAILED at 0x00000010! Expected=0xff, Found=0x5a, failed byte count from
0x00000000-0x0000ffff: 0xdf16
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase
function.
*Trying erase function 2... 0x000000-0x7fffff*:EFAILED at 0x00000010!
Expected=0xff, Found=0x5a, failed byte count from 0x00000000-0x007fffff:
0x702b2a
ERASE FAILED!
Looking for another erase function.
No usable erase functions left.
FAILED!

It tried the commands for erasing 4KB, 64KB, 8MB, and all failed...

This is basically what I had in the block_erasers[] array. Full diff is
attached. Thanks for your help!

                {
                        {
                                .eraseblocks = { {4 * 1024, 2048} },
                                .block_erase = spi_block_erase_20,
                        }, {
                                .eraseblocks = { {64 * 1024, 128} },
                                .block_erase = spi_block_erase_d8,
                        }, {
                                .eraseblocks = { {8 * 1024 * 1024, 1} },
                                .block_erase = spi_block_erase_c7,
                        },
                },
Stefan Tauner - 2014-02-27 07:11:43
On Wed, 26 Feb 2014 14:57:32 -0800
Wei Hu <wei@aristanetworks.com> wrote:

> Hi flashrom folks,
> 
> I'm trying to add support for SST26VF064B after I got a patch from Elias. I
> made some changes to it after reading the datasheet, but none of the block
> erasing commands worked, and I don't know why...

I don't see obvious problems either, but I did not read the datasheet.

Two things I would check:
 - is there a write protection pin or register bits that might silently
   block any modification requests?
 - is the opcode sequence including wren? (this is probably done
   automatically by the ichspi driver, but i cant remember the details)

And you could test if hardware sequencing (or SFDP) works as a
workaround (but I doubt SFDP would behave differently for the lower
block sizes and some of them are obviously wrong in the SFDP table
anyway (or you have found a bug)). A full verbose log could shed some
more light on it too, but I doubt it.

If we get this to work we would probably like to commit this patch. For
this either of you must sign it off according to
http://www.coreboot.org/Development_Guidelines#Sign-off_Procedure

Patch

Index: flashrom-0.9.8/flashchips.c
===================================================================
--- flashrom-0.9.8.orig/flashchips.c
+++ flashrom-0.9.8/flashchips.c
@@ -9881,6 +9881,38 @@  const struct flashchip flashchips[] = {
 
 	{
 		.vendor		= "SST",
+		.name		= "SST26VF064B",
+		.bustype	= BUS_SPI,
+		.manufacture_id	= SST_ID,
+		.model_id	= SST_SST26VF064B,
+		.total_size	= 8192,
+		.page_size	= 256,
+		.feature_bits	= FEATURE_WRSR_EWSR,
+		.tested		= TEST_OK_PREW,
+		.probe		= probe_spi_rdid,
+		.probe_timing	= TIMING_ZERO,
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = { {4 * 1024, 2048} },
+				.block_erase = spi_block_erase_20,
+			}, {
+				.eraseblocks = { {64 * 1024, 128} },
+				.block_erase = spi_block_erase_d8,
+			}, {
+				.eraseblocks = { {8 * 1024 * 1024, 1} },
+				.block_erase = spi_block_erase_c7,
+			},
+		},
+		.printlock	= spi_prettyprint_status_register_sst25, /* TODO: check */
+		.unlock		= spi_disable_blockprotect,
+		.write		= spi_chip_write_256,
+		.read		= spi_chip_read,
+		.voltage	= {2700, 3600},
+	},
+
+	{
+		.vendor		= "SST",
 		.name		= "SST25WF512",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= SST_ID,
Index: flashrom-0.9.8/flashchips.h
===================================================================
--- flashrom-0.9.8.orig/flashchips.h
+++ flashrom-0.9.8/flashchips.h
@@ -590,6 +590,7 @@ 
 #define SST_SST25VF064C		0x254B
 #define SST_SST26VF016		0x2601
 #define SST_SST26VF032		0x2602
+#define SST_SST26VF064B		0x2643
 #define SST_SST27SF512		0xA4
 #define SST_SST27SF010		0xA5
 #define SST_SST27SF020		0xA6