diff options
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; |