mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 07:02:34 +02:00
spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls
Make use of the JEDEC_CE_{60,62,C7} defined constants of the op-codes in each of the spi_simple_write_cmd() calls to assist in readability. V.2: Squash in JEDEC_BE_{52,C4,D7,D8,50,81} && JEDEC_SE. Both 'S'ector and 'B'lock 'E'rasers now use the consts in spi.h. BUG=none BRANCH=none TEST=builds same object. Change-Id: I1876781672fe03302af4a6ff8d365f2e6c3b6f13 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/47005 Reviewed-by: Shiyu Sun <sshiyu@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
53a99cdbc9
commit
8a9218bf56
20
spi25.c
20
spi25.c
@ -463,26 +463,26 @@ static int spi_write_cmd(struct flashctx *const flash, const uint8_t op,
|
||||
static int spi_chip_erase_60(struct flashctx *flash)
|
||||
{
|
||||
/* This usually takes 1-85s, so wait in 1s steps. */
|
||||
return spi_simple_write_cmd(flash, 0x60, 1000 * 1000);
|
||||
return spi_simple_write_cmd(flash, JEDEC_CE_60, 1000 * 1000);
|
||||
}
|
||||
|
||||
static int spi_chip_erase_62(struct flashctx *flash)
|
||||
{
|
||||
/* This usually takes 2-5s, so wait in 100ms steps. */
|
||||
return spi_simple_write_cmd(flash, 0x62, 100 * 1000);
|
||||
return spi_simple_write_cmd(flash, JEDEC_CE_62, 100 * 1000);
|
||||
}
|
||||
|
||||
static int spi_chip_erase_c7(struct flashctx *flash)
|
||||
{
|
||||
/* This usually takes 1-85s, so wait in 1s steps. */
|
||||
return spi_simple_write_cmd(flash, 0xc7, 1000 * 1000);
|
||||
return spi_simple_write_cmd(flash, JEDEC_CE_C7, 1000 * 1000);
|
||||
}
|
||||
|
||||
int spi_block_erase_52(struct flashctx *flash, unsigned int addr,
|
||||
unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 100-4000ms, so wait in 100ms steps. */
|
||||
return spi_write_cmd(flash, 0x52, false, addr, NULL, 0, 100 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_52, false, addr, NULL, 0, 100 * 1000);
|
||||
}
|
||||
|
||||
/* Block size is usually
|
||||
@ -491,7 +491,7 @@ int spi_block_erase_52(struct flashctx *flash, unsigned int addr,
|
||||
int spi_block_erase_c4(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 240-480s, so wait in 500ms steps. */
|
||||
return spi_write_cmd(flash, 0xc4, false, addr, NULL, 0, 500 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_C4, false, addr, NULL, 0, 500 * 1000);
|
||||
}
|
||||
|
||||
/* Block size is usually
|
||||
@ -503,7 +503,7 @@ int spi_block_erase_d8(struct flashctx *flash, unsigned int addr,
|
||||
unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 100-4000ms, so wait in 100ms steps. */
|
||||
return spi_write_cmd(flash, 0xd8, false, addr, NULL, 0, 100 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_D8, false, addr, NULL, 0, 100 * 1000);
|
||||
}
|
||||
|
||||
/* Block size is usually
|
||||
@ -513,7 +513,7 @@ int spi_block_erase_d7(struct flashctx *flash, unsigned int addr,
|
||||
unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 100-4000ms, so wait in 100ms steps. */
|
||||
return spi_write_cmd(flash, 0xd7, false, addr, NULL, 0, 100 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_D7, false, addr, NULL, 0, 100 * 1000);
|
||||
}
|
||||
|
||||
/* Page erase (usually 256B blocks) */
|
||||
@ -529,19 +529,19 @@ int spi_block_erase_20(struct flashctx *flash, unsigned int addr,
|
||||
unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 15-800ms, so wait in 10ms steps. */
|
||||
return spi_write_cmd(flash, 0x20, false, addr, NULL, 0, 10 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_SE, false, addr, NULL, 0, 10 * 1000);
|
||||
}
|
||||
|
||||
int spi_block_erase_50(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 10ms, so wait in 1ms steps. */
|
||||
return spi_write_cmd(flash, 0x50, false, addr, NULL, 0, 1 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_50, false, addr, NULL, 0, 1 * 1000);
|
||||
}
|
||||
|
||||
int spi_block_erase_81(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
|
||||
{
|
||||
/* This usually takes 8ms, so wait in 1ms steps. */
|
||||
return spi_write_cmd(flash, 0x81, false, addr, NULL, 0, 1 * 1000);
|
||||
return spi_write_cmd(flash, JEDEC_BE_81, false, addr, NULL, 0, 1 * 1000);
|
||||
}
|
||||
|
||||
int spi_block_erase_60(struct flashctx *flash, unsigned int addr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user