diff options
author | Edward O'Callaghan <quasisec@google.com> | 2023-02-01 12:37:43 +1100 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2023-02-21 06:13:30 +0000 |
commit | 61cf7e53b23624c5ec2560ddd59ed88dc797303c (patch) | |
tree | 92737fc64ce1a32911fb14054f27223a67dee353 | |
parent | 248fa24490df1942c83823483f75b762406c6bb7 (diff) | |
download | flashrom-61cf7e53b23624c5ec2560ddd59ed88dc797303c.tar.gz flashrom-61cf7e53b23624c5ec2560ddd59ed88dc797303c.tar.bz2 flashrom-61cf7e53b23624c5ec2560ddd59ed88dc797303c.zip |
jedec.c: Fold up dst into toggle_ready_jedec()
Change-Id: Ib7a3fdbc6e0a888093dc8da6f5567a7301ec5040
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/72691
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
-rw-r--r-- | jedec.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -67,8 +67,9 @@ void toggle_ready_jedec(const struct flashctx *flash, chipaddr dst) * Given that erase is slow on all chips, it is recommended to use * toggle_ready_jedec_slow in erase functions. */ -static void toggle_ready_jedec_slow(const struct flashctx *flash, chipaddr dst) +static void toggle_ready_jedec_slow(const struct flashctx *flash) { + const chipaddr dst = flash->virtual_memory; toggle_ready_jedec_common(flash, dst, 8 * 1000); } @@ -300,14 +301,12 @@ static void issuecmd(const struct flashctx *flash, uint8_t op, unsigned int oper int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int size) { - const chipaddr bios = flash->virtual_memory; - /* Issue the Sector Erase command */ issuecmd(flash, 0x80, 0); issuecmd(flash, 0x30, page); /* wait for Toggle bit ready */ - toggle_ready_jedec_slow(flash, bios); + toggle_ready_jedec_slow(flash); /* FIXME: Check the status register for errors. */ return 0; @@ -315,14 +314,12 @@ int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int s int erase_block_jedec(struct flashctx *flash, unsigned int block, unsigned int size) { - const chipaddr bios = flash->virtual_memory; - /* Issue the Sector Erase command */ issuecmd(flash, 0x80, 0); issuecmd(flash, 0x50, block); /* wait for Toggle bit ready */ - toggle_ready_jedec_slow(flash, bios); + toggle_ready_jedec_slow(flash); /* FIXME: Check the status register for errors. */ return 0; @@ -331,8 +328,6 @@ int erase_block_jedec(struct flashctx *flash, unsigned int block, unsigned int s /* erase chip with block_erase() prototype */ int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr, unsigned int blocksize) { - const chipaddr bios = flash->virtual_memory; - if ((addr != 0) || (blocksize != flash->chip->total_size * 1024)) { msg_cerr("%s called with incorrect arguments\n", __func__); @@ -343,7 +338,7 @@ int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr, unsigned i issuecmd(flash, 0x80, 0); issuecmd(flash, 0x10, 0); - toggle_ready_jedec_slow(flash, bios); + toggle_ready_jedec_slow(flash); /* FIXME: Check the status register for errors. */ return 0; |