Author: hailfinger
Date: 2009-09-24 00:01:33 +0200 (Thu, 24 Sep 2009)
New Revision: 731

Modified:
   trunk/flash.h
   trunk/flashchips.c
   trunk/jedec.c
   trunk/sst_fwhub.c
Log:
Switch SST49LF004A/B to block erase, remove the hack which simulated
(unsupported) chip erase.
Annotate SST49LF004B quirks for TBL#.

Add TEST_OK_PRW which is useful when a PREW chip gets a new erase
routine.

Change a few erase function prototypes to use unsigned int instead of
int.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>
Acked-by: Luc Verhaegen <[email protected]>


Modified: trunk/flash.h
===================================================================
--- trunk/flash.h       2009-09-23 21:58:34 UTC (rev 730)
+++ trunk/flash.h       2009-09-23 22:01:33 UTC (rev 731)
@@ -225,6 +225,7 @@
 #define TEST_OK_WRITE  (1 << 3)
 #define TEST_OK_PR     (TEST_OK_PROBE | TEST_OK_READ)
 #define TEST_OK_PRE    (TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE)
+#define TEST_OK_PRW    (TEST_OK_PROBE | TEST_OK_READ | TEST_OK_WRITE)
 #define TEST_OK_PREW   (TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE | 
TEST_OK_WRITE)
 #define TEST_OK_MASK   0x0f
 
@@ -596,8 +597,8 @@
 int probe_jedec(struct flashchip *flash);
 int erase_chip_jedec(struct flashchip *flash);
 int write_jedec(struct flashchip *flash, uint8_t *buf);
-int erase_sector_jedec(struct flashchip *flash, unsigned int page, int 
pagesize);
-int erase_block_jedec(struct flashchip *flash, unsigned int page, int 
blocksize);
+int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned 
int pagesize);
+int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int 
blocksize);
 int write_sector_jedec(chipaddr bios, uint8_t *src,
                       chipaddr dst, unsigned int page_size);
 
@@ -657,6 +658,7 @@
 /* sst_fwhub.c */
 int probe_sst_fwhub(struct flashchip *flash);
 int erase_sst_fwhub(struct flashchip *flash);
+int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, 
unsigned int page_size);
 int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
 
 /* w39v040c.c */

Modified: trunk/flashchips.c
===================================================================
--- trunk/flashchips.c  2009-09-23 21:58:34 UTC (rev 730)
+++ trunk/flashchips.c  2009-09-23 22:01:33 UTC (rev 731)
@@ -2141,6 +2141,9 @@
        },
 
        {
+               /* Contrary to the data sheet, TBL# on the SST49LF004B affects 
the top 128kB (instead of 64kB)
+                * and is only honored for 64k block erase, but not 4k sector 
erase.
+                */
                .vendor         = "SST",
                .name           = "SST49LF004A/B",
                .bustype        = CHIP_BUSTYPE_FWH, /* A/A Mux */
@@ -2151,7 +2154,20 @@
                .tested         = TEST_OK_PREW,
                .probe          = probe_sst_fwhub,
                .probe_timing   = 1,            /* 150 ns | routine is wrapper 
to probe_jedec (sst_fwhub.c) */
-               .erase          = erase_sst_fwhub,
+               .erase          = NULL,
+               .block_erasers  =
+               {
+                       {
+                               .eraseblocks = { {4 * 1024, 128} },
+                               .block_erase = erase_sector_jedec, /* missing 
unlock */
+                       }, {
+                               .eraseblocks = { {64 * 1024, 8} },
+                               .block_erase = erase_sst_fwhub_block, /* same 
as erase_sector_block, but with unlock */
+                       }, {
+                               .eraseblocks = { {512 * 1024, 1} },
+                               .block_erase = NULL, /* AA 55 80 AA 55 10, only 
in PP mode */
+                       },
+               },
                .write          = write_sst_fwhub,
                .read           = read_memmapped,
        },

Modified: trunk/jedec.c
===================================================================
--- trunk/jedec.c       2009-09-23 21:58:34 UTC (rev 730)
+++ trunk/jedec.c       2009-09-23 22:01:33 UTC (rev 731)
@@ -175,7 +175,7 @@
        return 0;
 }
 
-int erase_sector_jedec(struct flashchip *flash, unsigned int page, int 
pagesize)
+int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned 
int pagesize)
 {
        chipaddr bios = flash->virtual_memory;
 
@@ -204,7 +204,7 @@
        return 0;
 }
 
-int erase_block_jedec(struct flashchip *flash, unsigned int block, int 
blocksize)
+int erase_block_jedec(struct flashchip *flash, unsigned int block, unsigned 
int blocksize)
 {
        chipaddr bios = flash->virtual_memory;
 

Modified: trunk/sst_fwhub.c
===================================================================
--- trunk/sst_fwhub.c   2009-09-23 21:58:34 UTC (rev 730)
+++ trunk/sst_fwhub.c   2009-09-23 22:01:33 UTC (rev 731)
@@ -94,7 +94,7 @@
        return 1;
 }
 
-int erase_sst_fwhub_block(struct flashchip *flash, int offset, int page_size)
+int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, 
unsigned int page_size)
 {
        uint8_t blockstatus = clear_sst_fwhub_block_lock(flash, offset);
 


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to