summaryrefslogtreecommitdiffstats
path: root/spi25.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-02-17 14:51:04 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-02-17 14:51:04 +0000
commitac1b4c8bd707c07e9636bedbd823ed5cb46f89ad (patch)
tree5553eec8f0f86f363220a979342d59e3c55eae58 /spi25.c
parentac427b22c4fa45936fe94af31a5e0422dd95c152 (diff)
downloadast2050-flashrom-ac1b4c8bd707c07e9636bedbd823ed5cb46f89ad.zip
ast2050-flashrom-ac1b4c8bd707c07e9636bedbd823ed5cb46f89ad.tar.gz
Add support for SFDP (JESD216)
Similar to modules using the opaque programmer framework (e.g. ICH Hardware Sequencing) this uses a template struct flashchip element in flashchips.c with a special probe function that fills the obtained values into that struct. This allows yet unknown SPI chips to be supported (read, erase, write) almost as if it was already added to flashchips.c. Documentation used: http://www.jedec.org/standards-documents/docs/jesd216 (2011-04) W25Q32BV data sheet Revision F (2011-04-01) EN25QH16 data sheet Revision F (2011-06-01) MX25L6436E data sheet Revision 1.8 (2011-12-26) Tested-by: David Hendricks <dhendrix@google.com> on W25Q64CV + dediprog Tested-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> on a 2010 MX25L6436E with preliminary (i.e. incorrect) SFDP implementation + serprog Thanks also to Michael Karcher for his comments and preliminary review! Corresponding to flashrom svn r1500. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'spi25.c')
-rw-r--r--spi25.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/spi25.c b/spi25.c
index 3ce7f08..b7e8189 100644
--- a/spi25.c
+++ b/spi25.c
@@ -720,6 +720,32 @@ int spi_block_erase_c7(struct flashctx *flash, unsigned int addr,
return spi_chip_erase_c7(flash);
}
+erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode)
+{
+ switch(opcode){
+ case 0xff:
+ case 0x00:
+ /* Not specified, assuming "not supported". */
+ return NULL;
+ case 0x20:
+ return &spi_block_erase_20;
+ case 0x52:
+ return &spi_block_erase_52;
+ case 0x60:
+ return &spi_block_erase_60;
+ case 0xc7:
+ return &spi_block_erase_c7;
+ case 0xd7:
+ return &spi_block_erase_d7;
+ case 0xd8:
+ return &spi_block_erase_d8;
+ default:
+ msg_cinfo("%s: unknown erase opcode (0x%02x). Please report "
+ "this at flashrom@flashrom.org\n", __func__, opcode);
+ return NULL;
+ }
+}
+
int spi_write_status_enable(struct flashctx *flash)
{
static const unsigned char cmd[JEDEC_EWSR_OUTSIZE] = { JEDEC_EWSR };
OpenPOWER on IntegriCloud