Skip to content

Commit

Permalink
jedec.c: Drop branching non-zero programmer_delay() operands
Browse files Browse the repository at this point in the history
The programmer_delay() function is already tolerant upon zero
delay values and will simply just return with a NOP. Therefore
there is no need to branch.

Change-Id: Ic547669bb16e6ace4fe283e07345fc2d7075d63e
Signed-off-by: Edward O'Callaghan <[email protected]>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/72692
Tested-by: build bot (Jenkins) <[email protected]>
Reviewed-by: Stefan Reinauer <[email protected]>
Reviewed-by: Thomas Heijligen <[email protected]>
  • Loading branch information
quasisec authored and heijligen committed Feb 27, 2023
1 parent 0facf12 commit 4ea3f6c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions jedec.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ static void toggle_ready_jedec_common(const struct flashctx *flash, chipaddr dst
tmp1 = chip_readb(flash, dst) & 0x40;

while (i++ < 0xFFFFFFF) {
if (delay)
programmer_delay(flash, delay);
programmer_delay(flash, delay);
tmp2 = chip_readb(flash, dst) & 0x40;
if (tmp1 == tmp2) {
break;
Expand Down Expand Up @@ -203,8 +202,7 @@ int probe_jedec(struct flashctx *flash)
* mode completely. Allow the chip to finish this before seeing a
* reset command.
*/
if (probe_timing_enter)
programmer_delay(flash, probe_timing_enter);
programmer_delay(flash, probe_timing_enter);
/* Reset chip to a clean slate */
if ((chip->feature_bits & FEATURE_RESET_MASK) == FEATURE_LONG_RESET) {
chip_writeb(flash, 0xAA, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
Expand All @@ -215,8 +213,7 @@ int probe_jedec(struct flashctx *flash)
programmer_delay(flash, 10);
}
chip_writeb(flash, 0xF0, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
if (probe_timing_exit)
programmer_delay(flash, probe_timing_exit);
programmer_delay(flash, probe_timing_exit);

/* Issue JEDEC Product ID Entry command */
chip_writeb(flash, 0xAA, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
Expand All @@ -226,8 +223,7 @@ int probe_jedec(struct flashctx *flash)
if (probe_timing_enter)
programmer_delay(flash, 10);
chip_writeb(flash, 0x90, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
if (probe_timing_enter)
programmer_delay(flash, probe_timing_enter);
programmer_delay(flash, probe_timing_enter);

/* Read product ID */
id1 = chip_readb(flash, bios + (0x00 << shifted));
Expand Down Expand Up @@ -257,8 +253,7 @@ int probe_jedec(struct flashctx *flash)
programmer_delay(flash, 10);
}
chip_writeb(flash, 0xF0, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
if (probe_timing_exit)
programmer_delay(flash, probe_timing_exit);
programmer_delay(flash, probe_timing_exit);

msg_cdbg("%s: id1 0x%02x, id2 0x%02x", __func__, largeid1, largeid2);
if (!oddparity(id1))
Expand Down

0 comments on commit 4ea3f6c

Please sign in to comment.