Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC_CE consts in spi_simple_write_cmd() calls ......................................................................
spi25.c: Use JEDEC_CE 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.
BUG=none BRANCH=none TEST=builds same object.
Change-Id: I1876781672fe03302af4a6ff8d365f2e6c3b6f13 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M spi25.c 1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/05/47005/1
diff --git a/spi25.c b/spi25.c index 1e797c8..15cca39 100644 --- a/spi25.c +++ b/spi25.c @@ -463,19 +463,19 @@ 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,
Hello build bot (Jenkins), Shiyu Sun, Angel Pons, Nikolai Artemiev,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/47005
to look at the new patch set (#2).
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
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 --- M spi25.c 1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/05/47005/2
Shiyu Sun has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
Patch Set 2: Code-Review+1
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
Patch Set 2: Code-Review+2
(2 comments)
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c File spi25.c:
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@524 PS2, Line 524: 0xdb this one isn't standard, I guess?
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@634 PS2, Line 634: return &spi_block_erase_dc; I guess this could also be updated
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c File spi25.c:
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@524 PS2, Line 524: 0xdb
this one isn't standard, I guess?
I looked for it and it didn't grep in spi.h so I left it for now.
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@634 PS2, Line 634: return &spi_block_erase_dc;
I guess this could also be updated
I thought about it but figured its sort of easier to read with the magics but I wasn't sure so I left it out of this change for now.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c File spi25.c:
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@524 PS2, Line 524: 0xdb
I looked for it and it didn't grep in spi.h so I left it for now.
Ack
https://review.coreboot.org/c/flashrom/+/47005/2/spi25.c@634 PS2, Line 634: return &spi_block_erase_dc;
I thought about it but figured its sort of easier to read with the magics but I wasn't sure so I lef […]
I think this would look much better if using an array of structs with function pointers. I'll take a look later.
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/47005 )
Change subject: spi25.c: Use JEDEC consts in spi_simple_write_cmd() calls ......................................................................
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 --- M spi25.c 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Shiyu Sun: Looks good to me, but someone else must approve
diff --git a/spi25.c b/spi25.c index 1e797c8..213273f 100644 --- a/spi25.c +++ b/spi25.c @@ -463,26 +463,26 @@ 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_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 @@ 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 @@ 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 @@ 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,