diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-29 15:04:20 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-29 15:04:20 +0000 |
commit | 57794ac1580fc5efee3ba01a0c3e4539bb58d088 (patch) | |
tree | 4212a02023a6a8c6dd0b03d234e66471ddb5d634 /spi25.c | |
parent | 54aaa4ae2bb4026ae7acbf3e0aafe8542aaff2a4 (diff) | |
download | ast2050-flashrom-57794ac1580fc5efee3ba01a0c3e4539bb58d088.zip ast2050-flashrom-57794ac1580fc5efee3ba01a0c3e4539bb58d088.tar.gz |
Add support for Atmel's AT25F series of SPI flash chips
This adds support for the following chips:
- AT25F512, AT25F512A, AT25F512B
- AT25F1024, AT25F1024A
- AT25F2048
- AT25F4096
Besides the definitions of the the chips in flashchips.c this includes
- a dedicated probing method (probe_spi_at25f)
- pretty printing methods (spi_prettyprint_status_register_at25f*), and
- unlocking methods (spi_disable_blockprotect_at25f*)
Corresponding to flashrom svn r1637.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'spi25.c')
-rw-r--r-- | spi25.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -279,6 +279,28 @@ int probe_spi_res2(struct flashctx *flash) return 1; } +/* Only used for some Atmel chips. */ +int probe_spi_at25f(struct flashctx *flash) +{ + static const unsigned char cmd[AT25F_RDID_OUTSIZE] = { AT25F_RDID }; + unsigned char readarr[AT25F_RDID_INSIZE]; + uint32_t id1; + uint32_t id2; + + if (spi_send_command(flash, sizeof(cmd), sizeof(readarr), cmd, readarr)) + return 0; + + id1 = readarr[0]; + id2 = readarr[1]; + + msg_cdbg("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2); + + if (id1 == flash->chip->manufacture_id && id2 == flash->chip->model_id) + return 1; + + return 0; +} + int spi_chip_erase_60(struct flashctx *flash) { int result; |