On 08.01.2010 23:33, Sean Nelson wrote:
> This patch should have all chips from A to M converted to struct block
> erasers.
>
> Converted chips to block_erasers:
> ASD AE49F2008
> AMIC A25L40P(T/U)
> AMIC A49LF040A
> EMST F49B002UA
> Eon EN25B05
> Eon EN25B10
> Eon EN25B20
> Eon EN25B40
> Eon EN25B80
> Eon EN25B16
> Eon EN25B32
> Eon EN25B64
> Eon EN25D16
> Eon EN25F05
> Eon EN25F10
> Eon EN25F20
> Eon EN25F40
> Eon EN25F80
> Eon EN25F16
> Eon EN25F32
> Intel 28F001BX-B
> Intel 28F001BX-T
> Intel 82802AB
> Intel 82802AC
> Macronix MX25L1635D
> Macronix MX25L3235D
> Macronix MX25L6405
> Macronix MX25L12805
> Macronix MX29F001B
> Macronix MX29F001T
> Macronix MX29LV040
>
> Added new chips (according to datasheets):
> Eon EN25B05T
> Eon EN25B10T
> Eon EN25B20T
> Eon EN25B40T
> Eon EN25B80T
> Eon EN25B16T
> Eon EN25B32T
> Eon EN25B64T
>
> Implement fixes for jedec probe by Carl-Daniel.

These jedec fixes are logically separate. I'd like to commit them
separately to make tracking easier.


> Added minor Device IDs for Eon EN25Bxx{T,B} chips.
>
> Signed-off-by: Sean Nelson <[email protected]>

Please don't get me wrong, a lot of stuff in the review below isn't
actually affecting any of the code you wrote, it is just me reviewing
the code in the general vincinity. Feel free to ignore that stuff. I
just thought I'd write it down in case someone motivated comes along and
wants to fix that up.


> diff --git a/82802ab.c b/82802ab.c
> index 58d3467..0e71975 100644
> --- a/82802ab.c
> +++ b/82802ab.c
> @@ -82,44 +82,44 @@ uint8_t wait_82802ab(chipaddr bios)
>               while ((chip_readb(bios) & 0x80) == 0) ;
>       }
>  
>       status = chip_readb(bios);
>  
>       /* Reset to get a clean state */
>       chip_writeb(0xFF, bios);
>  
>       return status;
>  }
>  
> -int erase_82802ab_block(struct flashchip *flash, int offset)
> +int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned 
> int pagesize)
>  {
> -     chipaddr bios = flash->virtual_memory + offset;
> -     chipaddr wrprotect = flash->virtual_registers + offset + 2;
> +     chipaddr bios = flash->virtual_memory;
> +     chipaddr wrprotect = flash->virtual_registers + page + 2;
>       uint8_t status;
>  
>       // clear status register
> -     chip_writeb(0x50, bios);
> +     chip_writeb(0x50, bios + page);
>  
>       // clear write protect
>       chip_writeb(0, wrprotect);
>  
>       // now start it
> -     chip_writeb(0x20, bios);
> -     chip_writeb(0xd0, bios);
> +     chip_writeb(0x20, bios + page);
> +     chip_writeb(0xd0, bios + page);
>       programmer_delay(10);
>  
>       // now let's see what the register is
> -     status = wait_82802ab(flash->virtual_memory);
> +     status = wait_82802ab(bios);
>       print_82802ab_status(status);
>  
> -     if (check_erased_range(flash, offset, flash->page_size)) {
> +     if (check_erased_range(flash, page, pagesize)) {
>               fprintf(stderr, "ERASE FAILED!\n");
>               return -1;
>       }
>       printf("DONE BLOCK 0x%x\n", offset);
>  
>       return 0;
>  }
>  
>  int erase_82802ab(struct flashchip *flash)
>  {
>       int i;
> diff --git a/flashchips.c b/flashchips.c
> index e6c4b86..0500be4 100644
> --- a/flashchips.c
> +++ b/flashchips.c
> @@ -275,23 +275,38 @@ struct flashchip flashchips[] = {
>       {
>               .vendor         = "ASD",
>               .name           = "AE49F2008",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = ASD_ID,
>               .model_id       = ASD_AE49F2008,
>   

Do you have a datasheet for that chip? I was unable to find one. To be
honest, I do not think this ID is even valid. IMHO someone mistook a LHA
header for an ID and back then my code to check for such mistakes didn't
exist yet. I'm tempted to kill this chip altogether. Not something you
have to fix, I just wanted to record this for posterity.


>               .total_size     = 256,
>               .page_size      = 128,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_jedec,
>               .probe_timing   = TIMING_FIXME, 
> -             .erase          = erase_chip_jedec,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 2},
> +                                     {96 * 1024, 1},
> +                                     {128 * 1024, 1},
>   

The eraseblocks suggest a bottom boot block which is highly unusual in
the x86 market.


> +                             },
> +                             .block_erase = erase_sector_jedec,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_erase = erase_chip_block_jedec,
> +                     }
> +             },
>               .write          = write_jedec,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Atmel",
>               .name           = "AT25DF021",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = ATMEL_ID,
>               .model_id       = AT_25DF021,
>               .total_size     = 256,
> @@ -1132,34 +1147,84 @@ struct flashchip flashchips[] = {
>                               },
>                               .block_erase = erase_sector_jedec,
>                       }, {
>                               .eraseblocks = { {256 * 1024, 1} },
>                               .block_erase = erase_chip_block_jedec,
>                       }
>               },
>               .write          = write_49f002,
>               .read           = read_memmapped,
>       },
>  
> +     /* The next two chip definitions have top/bottom boot blocks, but has no
> +     device differenciation between the two */
>   

We might want to add FEATURE_HAS_EVIL_TWIN or somesuch to .feature_bits
to mark these chips. Not sure. If anything, it is material for later
patches.


>       {
>               .vendor         = "AMIC",
> -             .name           = "A25L40P",
> +             .name           = "A25L40PT",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = AMIC_ID,
>               .model_id       = AMIC_A25L40P,
>               .total_size     = 512,
>               .page_size      = 256,
> -             .tested         = TEST_OK_PREW,
> +             .tested         = TEST_OK_PRW,
>               .probe          = probe_spi_rdid4,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 7},
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "AMIC",
> +             .name           = "A25L40PU",
> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = AMIC_ID,
> +             .model_id       = AMIC_A25L40P,
> +             .total_size     = 512,
> +             .page_size      = 256,
> +             .tested         = TEST_OK_PRW,
> +             .probe          = probe_spi_rdid4,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 7},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "AMIC",
>               .name           = "A29002B",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = AMIC_ID_NOPREFIX,
>               .model_id       = AMIC_A29002B,
>               .total_size     = 256,
> @@ -1244,314 +1309,844 @@ struct flashchip flashchips[] = {
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "AMIC",
>               .name           = "A49LF040A",
>               .bustype        = CHIP_BUSTYPE_LPC,
>               .manufacture_id = AMIC_ID_NOPREFIX,
>               .model_id       = AMIC_A49LF040A,
>               .total_size     = 512,
>               .page_size      = 64 * 1024,
> -             .tested         = TEST_OK_PREW,
> -             .probe          = probe_49fl00x,
> +             .feature_bits   = FEATURE_REGISTERMAP,
> +             .tested         = TEST_OK_PRW,
> +             .probe          = probe_jedec,
>               .probe_timing   = TIMING_ZERO,  /* routine is wrapper to 
> probe_jedec (pm49fl00x.c) */
> -             .erase          = erase_49fl00x,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {64 * 1024, 8} },
> +                             .block_eraser = erase_block_jedec,
> +                     }, {
> +                             .eraseblocks = { {512 * 1024, 1} },
> +                             .block_eraser = erase_chip_block_jedec,
> +                     }
> +             },
>               .write          = write_49fl00x,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "EMST",
>               .name           = "F49B002UA",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = EMST_ID,
>               .model_id       = EMST_F49B002UA,
>               .total_size     = 256,
>               .page_size      = 4096,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_jedec,
>               .probe_timing   = TIMING_ZERO,  /* Datasheet has no timing info 
> specified */
> -             .erase          = erase_chip_jedec,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { 
> +                                     {128 * 1024, 1},
> +                                     {96 * 1024, 1},
> +                                     {8 * 1024, 2},
> +                                     {16 * 1024, 1},
> +                             },
> +                             .block_eraser = erase_sector_jedec,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_eraser = erase_chip_block_jedec,
> +                     }
> +             },
>               .write          = write_49f002,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B05",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B05,
>               .total_size     = 64,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B05T",
>   

EN20B05 and EN25B05T are actually not 100% evil twins. If you run
probe_spi_rems in addition to probe_spi_rdid, you can differentiate the
two. Maybe add that info as comment. I can do that myself, tough. No
reason to hold back your patch.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B05,
> +             .total_size     = 64,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B10",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B10,
>               .total_size     = 128,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 3},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B10T",
>   

Same comment as for EN25B05.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B10,
> +             .total_size     = 128,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {32 * 1024, 3},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B20",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B20,
>               .total_size     = 256,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 3}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B20T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B20,
> +             .total_size     = 256,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 3},
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B40",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B40,
>               .total_size     = 512,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 7}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {512 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B40T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B40,
> +             .total_size     = 512,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 7}
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {512 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B80",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B80,
>               .total_size     = 1024,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 15}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B80T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B80,
> +             .total_size     = 1024,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 15}
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B16",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B16,
>               .total_size     = 2048,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 31}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B16T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B16,
> +             .total_size     = 2048,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 31}
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B32",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B32,
>               .total_size     = 4096,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 63}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B32T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B32,
> +             .total_size     = 4096,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 63}
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25B64",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25B64,
>               .total_size     = 8192,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 127}
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {8 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
> +             .write          = spi_chip_write_256,
> +             .read           = spi_chip_read,
> +     },
> +
> +     {
> +             .vendor         = "Eon",
> +             .name           = "EN25B64T",
>   

Ditto.


> +             .bustype        = CHIP_BUSTYPE_SPI,
> +             .manufacture_id = EON_ID_NOPREFIX,
> +             .model_id       = EN_25B64,
> +             .total_size     = 8192,
> +             .page_size      = 256,
> +             .tested         = TEST_UNTESTED,
> +             .probe          = probe_spi_rdid,
> +             .probe_timing   = TIMING_ZERO,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = {
> +                                     {64 * 1024, 127}
> +                                     {32 * 1024, 1},
> +                                     {16 * 1024, 1},
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                             },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {8 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25D16",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25D16,
>               .total_size     = 2048,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 512} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 32} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 32} },
> +                             .block_eraser = spi_block_eraser_52,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F05",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F05,
>               .total_size     = 64,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 16} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {32 * 1024, 2} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {32 * 1024, 2} },
> +                             .block_eraser = spi_block_eraser_52,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F10",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F10,
>               .total_size     = 128,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 32} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {32 * 1024, 4} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {32 * 1024, 4} },
> +                             .block_eraser = spi_block_eraser_52,
> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F20",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F20,
>               .total_size     = 256,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 64} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 4} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 4} },
> +                             .block_eraser = spi_block_eraser_52,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {256 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F40",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F40,
>               .total_size     = 512,
>               .page_size      = 256,
>               .tested         = TEST_OK_PROBE,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
>               .erase          = NULL,
>               .block_erasers  =
>               {
>                       {
> -                             .eraseblocks = { {4 * 1024, 2048} },
> +                             .eraseblocks = { {4 * 1024, 128} },
>                               .block_erase = spi_block_erase_20,
>                       }, {
> -                             .eraseblocks = { {4 * 1024, 2048} },
> +                             .eraseblocks = { {64 * 1024, 8} },
>                               .block_erase = spi_block_erase_d8,
>                       }, {
> -                             .eraseblocks = { {8 * 1024 * 1024, 1} },
> +                             .eraseblocks = { {512 * 1024, 1} },
>                               .block_erase = spi_block_erase_60,
>                       }, {
> -                             .eraseblocks = { {8 * 1024 * 1024, 1} },
> +                             .eraseblocks = { {512 * 1024, 1} },
>   

Oops.


>                               .block_erase = spi_block_erase_c7,
>                       },
>               },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F80",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F80,
>               .total_size     = 1024,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 256} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 16} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F16",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F16,
>               .total_size     = 2048,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 512} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 32} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Eon",
>               .name           = "EN25F32",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = EON_ID_NOPREFIX,
>               .model_id       = EN_25F32,
>               .total_size     = 4096,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 1024} },
> +                             .block_eraser = spi_block_eraser_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 64} },
> +                             .block_eraser = spi_block_eraser_d8,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_60,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_eraser = spi_block_eraser_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "EON",
>               .name           = "EN29F002(A)(N)B",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = EON_ID,
>               .model_id       = EN_29F002B,
>               .total_size     = 256,
> @@ -1734,74 +2329,110 @@ struct flashchip flashchips[] = {
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Intel",
>               .name           = "28F001BX-B",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = INTEL_ID,
>               .model_id       = P28F001BXB,
>               .total_size     = 128,
>               .page_size      = 128 * 1024, /* 8k + 2x4k + 112k */
> -             .tested         = TEST_BAD_ERASE|TEST_BAD_WRITE,
> +             .tested         = TEST_BAD_WRITE,
>   

Yay!


>               .probe          = probe_jedec,
>               .probe_timing   = TIMING_ZERO,  /* Datasheet has no timing info 
> specified */
>               .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { 
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                                     {112 * 1024, 1},
> +                             },
> +                             .block_erase = erase_82802ab,
> +                     },
> +             },
>               .write          = NULL,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Intel",
>               .name           = "28F001BX-T",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = INTEL_ID,
>               .model_id       = P28F001BXT,
>               .total_size     = 128,
>               .page_size      = 128 * 1024, /* 112k + 2x4k + 8k */
>   

Ugh. Not your comment, but WTF?!? page_size must DIE!


> -             .tested         = TEST_OK_PR|TEST_BAD_ERASE|TEST_BAD_WRITE,
> +             .tested         = TEST_OK_PR|TEST_BAD_WRITE,
>   

Heh. Indeed. We should dig up who tested this and have him/her retest
the chips.


>               .probe          = probe_jedec,
>               .probe_timing   = TIMING_ZERO,  /* Datasheet has no timing info 
> specified */
>               .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { 
> +                                     {112 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                             },
> +                             .block_erase = erase_82802ab,
> +                     },
> +             },
>               .write          = NULL,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Intel",
>               .name           = "82802AB",
>               .bustype        = CHIP_BUSTYPE_FWH,
>               .manufacture_id = INTEL_ID,
>               .model_id       = I_82802AB,
>               .total_size     = 512,
>               .page_size      = 64 * 1024,
> -             .tested         = TEST_OK_PREW,
> +             .tested         = TEST_OK_PRW,
>               .probe          = probe_82802ab,
>               .probe_timing   = TIMING_IGNORED, /* routine does not use 
> probe_timing (82802ab.c) */
> -             .erase          = erase_82802ab,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {64 * 1024, 8} },
> +                             .block_erase = erase_82802ab,
> +                     },
> +             },
>               .write          = write_82802ab,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Intel",
>               .name           = "82802AC",
>               .bustype        = CHIP_BUSTYPE_FWH,
>               .manufacture_id = INTEL_ID,
>               .model_id       = I_82802AC,
>               .total_size     = 1024,
>               .page_size      = 64 * 1024,
> -             .tested         = TEST_OK_PREW,
> +             .tested         = TEST_OK_PRW,
>               .probe          = probe_82802ab,
>               .probe_timing   = TIMING_IGNORED, /* routine does not use 
> probe_timing (82802ab.c) */
> -             .erase          = erase_82802ab,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {64 * 1024, 16} },
> +                             .block_erase = erase_82802ab,
> +                     },
> +             },
>               .write          = write_82802ab,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L512",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L512,
>               .total_size     = 64,
> @@ -2008,23 +2639,39 @@ struct flashchip flashchips[] = {
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L1635D",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L1635D,
>               .total_size     = 2048,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 512} },
> +                             .block_erase = spi_block_erase_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 32} },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_60,
> +                     }, {
> +                             .eraseblocks = { {2 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L3205",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L3205,
>               .total_size     = 4096,
> @@ -2056,87 +2703,167 @@ struct flashchip flashchips[] = {
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L3235D",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L3235D,
>               .total_size     = 4096,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 1024} },
> +                             .block_erase = spi_block_erase_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 64} },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_60,
> +                     }, {
> +                             .eraseblocks = { {4 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L6405",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L6405,
>               .total_size     = 8192,
>               .page_size      = 256,
>               .tested         = TEST_OK_PROBE,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {64 * 1024, 128} },
> +                             .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_60,
> +                     }, {
> +                             .eraseblocks = { {8 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX25L12805",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_25L12805,
>               .total_size     = 16384,
>               .page_size      = 256,
>               .tested         = TEST_UNTESTED,
>               .probe          = probe_spi_rdid,
>               .probe_timing   = TIMING_ZERO,
> -             .erase          = spi_chip_erase_60_c7,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {4 * 1024, 4096} },
> +                             .block_erase = spi_block_erase_20,
> +                     }, {
> +                             .eraseblocks = { {64 * 1024, 256} },
> +                             .block_erase = spi_block_erase_d8,
> +                     }, {
> +                             .eraseblocks = { {16 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_60,
> +                     }, {
> +                             .eraseblocks = { {16 * 1024 * 1024, 1} },
> +                             .block_erase = spi_block_erase_c7,
> +                     }
> +             },
>               .write          = spi_chip_write_256,
>               .read           = spi_chip_read,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX29F001B",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_29F001B,
>               .total_size     = 128,
>               .page_size      = 32 * 1024,
> -             .tested         = TEST_OK_PRE,
> +             .tested         = TEST_OK_PR,
>               .probe          = probe_29f002,
>               .probe_timing   = TIMING_IGNORED, /* routine don't use 
> probe_timing (mx29f002.c) */
> -             .erase          = erase_29f002,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { 
> +                                     {8 * 1024, 1},
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 2},
> +                                     {32 * 1024, 1},
> +                                     {64 * 1024, 1},
> +                             },
> +                             .block_erase = eraser_sector_29f002,
>   

Typo? eraseR looks strange.


> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_erase = erase_chip_29f002,
> +                     }
> +             },
>               .write          = write_jedec_1,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX29F001T",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_29F001T,
>               .total_size     = 128,
>               .page_size      = 32 * 1024,
> -             .tested         = TEST_OK_PRE,
> +             .tested         = TEST_OK_PR,
>               .probe          = probe_29f002,
>               .probe_timing   = TIMING_IGNORED, /* routine don't use 
> probe_timing (mx29f002.c) */
> -             .erase          = erase_29f002,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { 
> +                                     {64 * 1024, 1},
> +                                     {32 * 1024, 1},
> +                                     {8 * 1024, 2},
> +                                     {4 * 1024, 2},
> +                                     {8 * 1024, 1},
> +                             },
> +                             .block_erase = eraser_sector_29f002,
>   

Typo? eraseR looks strange.


> +                     }, {
> +                             .eraseblocks = { {128 * 1024, 1} },
> +                             .block_erase = erase_chip_29f002,
> +                     }
> +             },
>               .write          = write_jedec_1,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Macronix",
>               .name           = "MX29F002B",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_29F002B,
>               .total_size     = 256,
> @@ -2198,23 +2925,33 @@ struct flashchip flashchips[] = {
>       {
>               .vendor         = "Macronix",
>               .name           = "MX29LV040",
>               .bustype        = CHIP_BUSTYPE_PARALLEL,
>               .manufacture_id = MX_ID,
>               .model_id       = MX_29LV040,
>               .total_size     = 512,
>               .page_size      = 64 * 1024,
>               .tested         = TEST_OK_PR,
>               .probe          = probe_29f002,
>               .probe_timing   = TIMING_IGNORED, /* routine don't use 
> probe_timing (mx29f002.c) */
> -             .erase          = erase_29f002,
> +             .erase          = NULL,
> +             .block_erasers  =
> +             {
> +                     {
> +                             .eraseblocks = { {64 * 1024, 8}, },
> +                             .block_erase = erase_sector_29f002,     /* This 
> erase function has 64k blocksize for eLiteFlash */
>   

Does that thing really also exist as eLiteFlash?


> +                     }, {
> +                             .eraseblocks = { {512 * 1024, 1} },
> +                             .block_erase = erase_chip_29f002,
> +                     },
> +             },
>               .write          = write_jedec_1,
>               .read           = read_memmapped,
>       },
>  
>       {
>               .vendor         = "Numonyx",
>               .name           = "M25PE10",
>               .bustype        = CHIP_BUSTYPE_SPI,
>               .manufacture_id = ST_ID,
>               .model_id       = ST_M25PE10,
>               .total_size     = 128,
> diff --git a/flashchips.h b/flashchips.h
> index 684b8b9..19ff745 100644
> --- a/flashchips.h
> +++ b/flashchips.h
> @@ -156,29 +156,45 @@
>   * EN25 chips are SPI, first byte of device ID is memory type,
>   * second byte of device ID is log(bitsize)-9.
>   * Vendor and device ID of EN29 series are both prefixed with 0x7F, which
>   * is the continuation code for IDs in bank 2.
>   * Vendor ID of EN25 series is NOT prefixed with 0x7F, this results in
>   * a collision with Mitsubishi. Mitsubishi once manufactured flash chips.
>   * Let's hope they are not manufacturing SPI flash chips as well.
>   */
>  #define EON_ID                       0x7F1C  /* EON Silicon Devices */
>  #define EON_ID_NOPREFIX              0x1C    /* EON, missing 0x7F prefix */
>  #define EN_25B05             0x2010  /* Same as P05, 2^19 kbit or 2^16 kByte 
> */
> +#define EN_25B05T            0x25
> +#define EN_25B05B            0x95
>  #define EN_25B10             0x2011  /* Same as P10 */
> +#define EN_25B10T            0x40
> +#define EN_25B10B            0x30
>  #define EN_25B20             0x2012  /* Same as P20 */
> +#define EN_25B20T            0x41
> +#define EN_25B20B            0x31
>  #define EN_25B40             0x2013  /* Same as P40 */
> +#define EN_25B40T            0x42
> +#define EN_25B40B            0x32
>  #define EN_25B80             0x2014  /* Same as P80 */
> +#define EN_25B80T            0x43
> +#define EN_25B80B            0x33
>  #define EN_25B16             0x2015  /* Same as P16 */
> +#define EN_25B16T            0x44
> +#define EN_25B16B            0x34
>  #define EN_25B32             0x2016  /* Same as P32 */
> +#define EN_25B32T            0x45
> +#define EN_25B32B            0x35
>  #define EN_25B64             0x2017  /* Same as P64 */
> +#define EN_25B64T            0x46
> +#define EN_25B64B            0x36
>   

Very nice. I'll create a probe function which can use the amended IDs.


>  #define EN_25D16             0x3015
>  #define EN_25F05             0x3110
>  #define EN_25F10             0x3111
>  #define EN_25F20             0x3112
>  #define EN_25F40             0x3113
>  #define EN_25F80             0x3114
>  #define EN_25F16             0x3115
>  #define EN_25F32             0x3116
>  #define EN_29F512            0x7F21
>  #define EN_29F010            0x7F20
>  #define EN_29F040A           0x7F04
> diff --git a/jedec.c b/jedec.c
> index e1bd12f..3a21539 100644
> --- a/jedec.c
> +++ b/jedec.c
> @@ -181,29 +181,29 @@ int probe_jedec_common(struct flashchip *flash,
>       if (flashcontent2 == 0x7F) {
>               flashcontent2 <<= 8;
>               flashcontent2 |= chip_readb(bios + 0x101);
>       }
>  
>       if (largeid1 == flashcontent1)
>               printf_debug(", id1 is normal flash content");
>       if (largeid2 == flashcontent2)
>               printf_debug(", id2 is normal flash content");
>  
>       printf_debug("\n");
> -     if (largeid1 == flash->manufacture_id && largeid2 == flash->model_id)
> -             return 1;
> +     if (largeid1 != flash->manufacture_id || largeid2 != flash->model_id)
> +             return 0;
>  
>       if (flash->feature_bits & FEATURE_REGISTERMAP)
>               map_flash_registers(flash);
>  
> -     return 0;
> +     return 1;
>  }
>  
>  int erase_sector_jedec_common(struct flashchip *flash, unsigned int page,
>                             unsigned int pagesize, unsigned int mask)
>  {
>       chipaddr bios = flash->virtual_memory;
>  
>       /*  Issue the Sector Erase command   */
>       chip_writeb(0xAA, bios + (0x5555 & mask));
>       programmer_delay(10);
>       chip_writeb(0x55, bios + (0x2AAA & mask));
>   

I noticed the possible eraseR_block_foo typo in a few places.

I'll commit my patch, and it would be great if you could regenerate
yours on top (and please test compilation).

Regards,
Carl-Daniel

-- 
Developer quote of the year:
"We are juggling too many chainsaws and flaming arrows and tigers."


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

Reply via email to