diff options
author | snelson <snelson@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-01-19 03:23:07 +0000 |
---|---|---|
committer | snelson <snelson@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-01-19 03:23:07 +0000 |
commit | 816429b047f8eee2cecf7b58793c005a6e0831f4 (patch) | |
tree | 339d115b6865e7c0c3b3330df5f81072fb12803a /spi.c | |
parent | 4784cb51db8fbc5d580fb3a7e526e57057ff000b (diff) | |
download | flashrom-816429b047f8eee2cecf7b58793c005a6e0831f4.tar.gz |
Convert chips to block_erasers:
ST_M25PE10
ST_M25PE20
ST_M25PE40
ST_M25PE80
ST_M25PE16
PMC_25LV010
PMC_25LV016B
PMC_25LV020
PMC_25LV040
PMC_25LV080B
PMC_25LV512
PMC_39F010
PMC_49FL002
PMC_49FL004
SANYO_LE25FW203A
SPANSION_S25FL016A
Added spi_block_erase_d7 for PMC chips.
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@867 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'spi.c')
-rw-r--r-- | spi.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -701,6 +701,48 @@ int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int return 0; } +/* Block size is usually + * 4k for PMC + */ +int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +{ + int result; + struct spi_command cmds[] = { + { + .writecnt = JEDEC_WREN_OUTSIZE, + .writearr = (const unsigned char[]){ JEDEC_WREN }, + .readcnt = 0, + .readarr = NULL, + }, { + .writecnt = JEDEC_BE_D7_OUTSIZE, + .writearr = (const unsigned char[]){ JEDEC_BE_D7, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (addr & 0xff) }, + .readcnt = 0, + .readarr = NULL, + }, { + .writecnt = 0, + .writearr = NULL, + .readcnt = 0, + .readarr = NULL, + }}; + + result = spi_send_multicommand(cmds); + if (result) { + fprintf(stderr, "%s failed during command execution at address 0x%x\n", + __func__, addr); + return result; + } + /* Wait until the Write-In-Progress bit is cleared. + * This usually takes 100-4000 ms, so wait in 100 ms steps. + */ + while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) + programmer_delay(100 * 1000); + if (check_erased_range(flash, addr, blocklen)) { + fprintf(stderr, "ERASE FAILED!\n"); + return -1; + } + return 0; +} + int spi_chip_erase_d8(struct flashchip *flash) { int i, rc = 0; |