Author: hailfinger
Date: 2009-12-23 13:02:55 +0100 (Wed, 23 Dec 2009)
New Revision: 817
Modified:
trunk/flashchips.c
Log:
Convert the following chips to use struct eraseblock:
AT25DF021, AT25DF041A, AT25DF081, AT25DF161, AT25DF321, AT25DF321A,
AT25DF641, AT25F512B, AT25FS010, AT25FS040, AT26DF041, AT26DF081A,
AT26DF161, AT26DF161A, AT26F004, AT29C512, AT29C010A, AT29C020,
AT29C040A, AT49BV512, AT49F002(N), AT49F002(N)T
A possible future patch would to add spi_block_erase_d7 to spi.c as an
alternate to spi_block_erase_20. Only some SPI chips support d7.
Signed-off-by: Sean Nelson <audiohacked(a)gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Modified: trunk/flashchips.c
===================================================================
--- trunk/flashchips.c 2009-12-23 03:01:36 UTC (rev 816)
+++ trunk/flashchips.c 2009-12-23 12:02:55 UTC (rev 817)
@@ -298,7 +298,26 @@
.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_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 8} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 4} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {256 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {256 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -314,7 +333,26 @@
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
- .erase = spi_chip_erase_60_c7,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 16} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -330,7 +368,26 @@
.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_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 32} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 16} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -346,7 +403,26 @@
.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 = { {32 * 1024, 64} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -359,10 +435,29 @@
.model_id = AT_25DF321,
.total_size = 4096,
.page_size = 256,
- .tested = TEST_OK_PREW,
+ .tested = TEST_OK_PRW,
.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 = { {32 * 1024, 128} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -378,7 +473,26 @@
.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 = { {32 * 1024, 128} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -394,7 +508,26 @@
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
- .erase = spi_chip_erase_60_c7,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 2048} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 256} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -410,7 +543,26 @@
.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_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 2} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {32 * 1024, 2} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -426,7 +578,26 @@
.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_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 4} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {32 * 1024, 4} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {128 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {128 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -442,7 +613,26 @@
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
- .erase = spi_chip_erase_60_c7,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -459,6 +649,13 @@
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = spi_block_erase_20,
+ }
+ },
.write = NULL /* Incompatible Page write */,
.read = spi_chip_read,
},
@@ -474,7 +671,26 @@
.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_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 32} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 16} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = spi_chip_write_256,
.read = spi_chip_read,
},
@@ -490,7 +706,26 @@
.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 = { {32 * 1024, 64} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -506,7 +741,26 @@
.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 = { {32 * 1024, 64} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .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,
},
@@ -539,7 +793,26 @@
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
- .erase = spi_chip_erase_60_c7,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 16} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
.write = NULL /* Incompatible Page write */,
.read = spi_chip_read,
},
@@ -552,10 +825,17 @@
.model_id = AT_29C512,
.total_size = 64,
.page_size = 128,
- .tested = TEST_OK_PREW,
+ .tested = TEST_OK_PRW,
.probe = probe_jedec,
.probe_timing = 10000, /* 10mS, Enter=Exec */
- .erase = erase_chip_jedec,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_jedec,
.read = read_memmapped,
@@ -569,10 +849,17 @@
.model_id = AT_29C010A,
.total_size = 128,
.page_size = 128,
- .tested = TEST_OK_PRE,
+ .tested = TEST_OK_PR,
.probe = probe_jedec,
.probe_timing = 10000, /* 10mS, Enter=Exec */
- .erase = erase_chip_jedec,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {128 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_jedec, /* FIXME */
.read = read_memmapped,
},
@@ -585,10 +872,17 @@
.model_id = AT_29C020,
.total_size = 256,
.page_size = 256,
- .tested = TEST_OK_PREW,
+ .tested = TEST_OK_PRW,
.probe = probe_jedec,
.probe_timing = 10000, /* 10ms */
- .erase = erase_chip_jedec,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {256 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_jedec,
.read = read_memmapped,
},
@@ -604,7 +898,14 @@
.tested = TEST_UNTESTED,
.probe = probe_jedec,
.probe_timing = 10000, /* 10 ms */
- .erase = erase_chip_jedec,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_jedec,
.read = read_memmapped,
},
@@ -761,10 +1062,17 @@
.model_id = AT_49BV512,
.total_size = 64,
.page_size = 64,
- .tested = TEST_OK_PREW,
+ .tested = TEST_OK_PRW,
.probe = probe_jedec,
.probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */
- .erase = erase_chip_jedec,
+ .erase = NULL,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_49f002,
.read = read_memmapped,
},
@@ -780,7 +1088,22 @@
.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 = {
+ {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_49f002,
.read = read_memmapped,
},
@@ -793,10 +1116,25 @@
.model_id = AT_49F002NT,
.total_size = 256,
.page_size = 256,
- .tested = TEST_OK_PREW,
+ .tested = TEST_OK_PRW,
.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_erase = erase_sector_jedec,
+ }, {
+ .eraseblocks = { {256 * 1024, 1} },
+ .block_erase = erase_chip_block_jedec,
+ }
+ },
.write = write_49f002,
.read = read_memmapped,
},