Subrata Banik has uploaded this change for review.
ichspi: Maximize usage of `ich_generation` global variable
This patch drop local variable `ich_gen` from
`ich_hwseq_wait_for_cycle_complete()` to maintain symmetry between
all hardware sequencing function in ichspi.c.
BUG=b:223630977
TEST=Able to perform flashrom read/write/erase operation on brya.
Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I7f37894b683196e741b6a95e290a68e83a550205
---
M ichspi.c
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/66/62866/1
diff --git a/ichspi.c b/ichspi.c
index 9f45ec2..08ca038 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1275,9 +1275,7 @@
Resets all error flags in HSFS.
Returns 0 if the cycle completes successfully without errors within
timeout us, 1 on errors. */
-static int ich_hwseq_wait_for_cycle_complete(unsigned int timeout,
- unsigned int len,
- enum ich_chipset ich_gen)
+static int ich_hwseq_wait_for_cycle_complete(unsigned int timeout, unsigned int len)
{
uint16_t hsfs;
uint32_t addr;
@@ -1289,13 +1287,14 @@
programmer_delay(8);
}
REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS));
+
if (!timeout) {
addr = REGREAD32(ICH9_REG_FADDR) & hwseq_data.addr_mask;
msg_perr("Timeout error between offset 0x%08x and "
"0x%08x (= 0x%08x + %d)!\n",
addr, addr + len - 1, addr, len - 1);
- prettyprint_ich9_reg_hsfs(hsfs, ich_gen);
- prettyprint_ich9_reg_hsfc(REGREAD16(ICH9_REG_HSFC), ich_gen);
+ prettyprint_ich9_reg_hsfs(hsfs, ich_generation);
+ prettyprint_ich9_reg_hsfc(REGREAD16(ICH9_REG_HSFC), ich_generation);
return 1;
}
@@ -1304,10 +1303,11 @@
msg_perr("Transaction error between offset 0x%08x and "
"0x%08x (= 0x%08x + %d)!\n",
addr, addr + len - 1, addr, len - 1);
- prettyprint_ich9_reg_hsfs(hsfs, ich_gen);
- prettyprint_ich9_reg_hsfc(REGREAD16(ICH9_REG_HSFC), ich_gen);
+ prettyprint_ich9_reg_hsfs(hsfs, ich_generation);
+ prettyprint_ich9_reg_hsfc(REGREAD16(ICH9_REG_HSFC), ich_generation);
return 1;
}
+
return 0;
}
@@ -1415,7 +1415,7 @@
prettyprint_ich9_reg_hsfc(hsfc, ich_generation);
REGWRITE16(ICH9_REG_HSFC, hsfc);
- if (ich_hwseq_wait_for_cycle_complete(timeout, len, ich_generation))
+ if (ich_hwseq_wait_for_cycle_complete(timeout, len))
return -1;
return 0;
}
@@ -1458,7 +1458,7 @@
hsfc |= HSFC_FGO; /* start */
REGWRITE16(ICH9_REG_HSFC, hsfc);
- if (ich_hwseq_wait_for_cycle_complete(timeout, block_len, ich_generation))
+ if (ich_hwseq_wait_for_cycle_complete(timeout, block_len))
return 1;
ich_read_data(buf, block_len, ICH9_REG_FDATA0);
addr += block_len;
@@ -1506,7 +1506,7 @@
hsfc |= HSFC_FGO; /* start */
REGWRITE16(ICH9_REG_HSFC, hsfc);
- if (ich_hwseq_wait_for_cycle_complete(timeout, block_len, ich_generation))
+ if (ich_hwseq_wait_for_cycle_complete(timeout, block_len))
return -1;
addr += block_len;
buf += block_len;
To view, visit change 62866. To unsubscribe, or for help writing mail filters, visit settings.