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..82207ef 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, .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}, + }, + .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 */ { .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,843 @@ 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, + .tested = TEST_OK_PRW, .probe = probe_49fl00x, .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", + .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", + .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", + .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", + .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", + .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", + .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", + .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", + .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} }, .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 +2328,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, .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 */ - .tested = TEST_OK_PR|TEST_BAD_ERASE|TEST_BAD_WRITE, + .tested = TEST_OK_PR|TEST_BAD_WRITE, .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 +2638,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 +2702,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, + }, { + .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, + }, { + .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 +2924,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 */ + }, { + .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 #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