1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

flashchips: Add Spansion (today Infineon) S25FL128L and S25FL256L

These chips seem to be rather regular, supporting 2.7V..3.6V, the
common erase block sizes 4KiB, 32KiB, 64KiB and the usual block-
protection bits.

Status/configuration register naming differs from other vendors,
though. These chips have 2 status registers plus 3 configuration
registers. Configuration registers 1 & 2 match status registers
2 & 3 of what we are used from other vendors. Read opcodes match
too, however writes are always done through the WRSR instruction
which can write up to 4 bytes (SR1, CR1, CR2, CR3).

S25FL256L supports native 4BA commands and entering a 4BA mode.
However, it uses an unusual opcode (0x53) for the 32KiB 4BA block
erase.

Signed-off-by: Nico Huber <nico.h@gmx.de>
Change-Id: I356df6649f29e50879a4da4183f1164a81cb0a09
Reviewed-on: https://review.coreboot.org/c/flashrom/+/64747
Reviewed-by: Thomas Heijligen <src@posteo.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2022-05-28 14:26:06 +02:00
parent f6d702e2d0
commit fe47c15b99
4 changed files with 135 additions and 0 deletions

View File

@ -16182,6 +16182,63 @@ const struct flashchip flashchips[] = {
.voltage = {2700, 3600}, .voltage = {2700, 3600},
}, },
{
.vendor = "Spansion",
.name = "S25FL128L",
.bustype = BUS_SPI,
.manufacture_id = SPANSION_ID,
.model_id = SPANSION_S25FL128L,
.total_size = 16384,
.page_size = 256,
/* 4 x 256B Security Region (OTP) */
.feature_bits = FEATURE_WRSR_WREN | FEATURE_WRSR_EXT3 | FEATURE_OTP,
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.block_erasers =
{
{
.eraseblocks = { {4 * 1024, 4096} },
.block_erase = spi_block_erase_20,
}, {
.eraseblocks = { {32 * 1024, 512} },
.block_erase = spi_block_erase_52,
}, {
.eraseblocks = { {64 * 1024, 256} },
.block_erase = spi_block_erase_d8,
}, {
.eraseblocks = { {16384 * 1024, 1} },
.block_erase = spi_block_erase_60,
}, {
.eraseblocks = { {16384 * 1024, 1} },
.block_erase = spi_block_erase_c7,
}
},
.printlock = spi_prettyprint_status_register_bp2_srwd,
.unlock = spi_disable_blockprotect_bp2_srwd,
.write = spi_chip_write_256,
.read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
.reg_bits =
{
/*
* Note: This chip has a read-only Status Register 2 that is not
* counted here. Registers are mapped as follows:
* STATUS1 ... Status Register 1
* STATUS2 ... Configuration Register 1
* STATUS3 ... Configuration Register 2
*/
.srp = {STATUS1, 7, RW},
.srl = {STATUS2, 0, RW},
.bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
.tb = {STATUS1, 5, RW},
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
},
{ {
.vendor = "Spansion", .vendor = "Spansion",
.name = "S25FL128P......0", /* uniform 64 kB sectors */ .name = "S25FL128P......0", /* uniform 64 kB sectors */
@ -16609,6 +16666,72 @@ const struct flashchip flashchips[] = {
.voltage = {2700, 3600}, .voltage = {2700, 3600},
}, },
{
.vendor = "Spansion",
.name = "S25FL256L",
.bustype = BUS_SPI,
.manufacture_id = SPANSION_ID,
.model_id = SPANSION_S25FL256L,
.total_size = 32768,
.page_size = 256,
/* 4 x 256B Security Region (OTP) */
.feature_bits = FEATURE_WRSR_WREN | FEATURE_WRSR_EXT3 | FEATURE_OTP |
FEATURE_4BA_ENTER | FEATURE_4BA_NATIVE,
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.block_erasers =
{
{
.eraseblocks = { {4 * 1024, 8192} },
.block_erase = spi_block_erase_21,
}, {
.eraseblocks = { {4 * 1024, 8192} },
.block_erase = spi_block_erase_20,
}, {
.eraseblocks = { {32 * 1024, 1024} },
.block_erase = spi_block_erase_53,
}, {
.eraseblocks = { {32 * 1024, 1024} },
.block_erase = spi_block_erase_52,
}, {
.eraseblocks = { {64 * 1024, 512} },
.block_erase = spi_block_erase_dc,
}, {
.eraseblocks = { {64 * 1024, 512} },
.block_erase = spi_block_erase_d8,
}, {
.eraseblocks = { {32768 * 1024, 1} },
.block_erase = spi_block_erase_60,
}, {
.eraseblocks = { {32768 * 1024, 1} },
.block_erase = spi_block_erase_c7,
}
},
.printlock = spi_prettyprint_status_register_bp3_srwd,
.unlock = spi_disable_blockprotect_bp3_srwd,
.write = spi_chip_write_256,
.read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
.reg_bits =
{
/*
* Note: This chip has a read-only Status Register 2 that is not
* counted here. Registers are mapped as follows:
* STATUS1 ... Status Register 1
* STATUS2 ... Configuration Register 1
* STATUS3 ... Configuration Register 2
*/
.srp = {STATUS1, 7, RW},
.srl = {STATUS2, 0, RW},
.bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}},
.tb = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
},
{ {
.vendor = "Spansion", .vendor = "Spansion",
.name = "S25FL256S Large Sectors", .name = "S25FL256S Large Sectors",

View File

@ -41,6 +41,7 @@ int spi_block_erase_20(struct flashctx *flash, unsigned int addr, unsigned int b
int spi_block_erase_21(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_21(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_50(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_50(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_52(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_52(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_53(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_5c(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_5c(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
int spi_block_erase_62(struct flashctx *flash, unsigned int addr, unsigned int blocklen); int spi_block_erase_62(struct flashctx *flash, unsigned int addr, unsigned int blocklen);

View File

@ -668,6 +668,8 @@
#define SPANSION_S25FL116K 0x4015 #define SPANSION_S25FL116K 0x4015
#define SPANSION_S25FL132K 0x4016 #define SPANSION_S25FL132K 0x4016
#define SPANSION_S25FL164K 0x4017 #define SPANSION_S25FL164K 0x4017
#define SPANSION_S25FL128L 0x6018
#define SPANSION_S25FL256L 0x6019
#define SPANSION_S25FS128S_L 0x20180081 /* Large sectors. */ #define SPANSION_S25FS128S_L 0x20180081 /* Large sectors. */
#define SPANSION_S25FS128S_S 0x20180181 /* Small sectors. */ #define SPANSION_S25FS128S_S 0x20180181 /* Small sectors. */
#define SPANSION_S25FS256S_L 0x02190081 /* Large sectors. */ #define SPANSION_S25FS256S_L 0x02190081 /* Large sectors. */

View File

@ -588,6 +588,13 @@ int spi_block_erase_21(struct flashctx *flash, unsigned int addr, unsigned int b
return spi_write_cmd(flash, 0x21, true, addr, NULL, 0, 10 * 1000); return spi_write_cmd(flash, 0x21, true, addr, NULL, 0, 10 * 1000);
} }
/* Erase 32 KB of flash with 4-bytes address from ANY mode (3-bytes or 4-bytes) */
int spi_block_erase_53(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
{
/* This usually takes 100-4000ms, so wait in 100ms steps. */
return spi_write_cmd(flash, 0x53, true, addr, NULL, 0, 100 * 1000);
}
/* Erase 32 KB of flash with 4-bytes address from ANY mode (3-bytes or 4-bytes) */ /* Erase 32 KB of flash with 4-bytes address from ANY mode (3-bytes or 4-bytes) */
int spi_block_erase_5c(struct flashctx *flash, unsigned int addr, unsigned int blocklen) int spi_block_erase_5c(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
{ {
@ -617,6 +624,8 @@ erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode)
return &spi_block_erase_50; return &spi_block_erase_50;
case 0x52: case 0x52:
return &spi_block_erase_52; return &spi_block_erase_52;
case 0x53:
return &spi_block_erase_53;
case 0x5c: case 0x5c:
return &spi_block_erase_5c; return &spi_block_erase_5c;
case 0x60: case 0x60: