summaryrefslogtreecommitdiffstats
path: root/ichspi.c
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2022-06-28 11:49:10 +0530
committerEdward O'Callaghan <quasisec@chromium.org>2022-07-13 00:37:16 +0000
commit7b82b516302e766540f9a3831ee914c7a31e34bf (patch)
tree8e555f8eba3ff530d05bfc3d547c255b98688063 /ichspi.c
parentedcea80d68e0f029b79bc273ba622dc4a3e6cb2b (diff)
downloadflashrom-7b82b516302e766540f9a3831ee914c7a31e34bf.tar.gz
flashrom-7b82b516302e766540f9a3831ee914c7a31e34bf.tar.bz2
flashrom-7b82b516302e766540f9a3831ee914c7a31e34bf.zip
ichspi: Call `Set Flash Address` API from `Read/Write Status` functions
This patch calls into `ich_hwseq_set_addr` function by passing flash address `0` while performing Read and Write status operation as Intel SPI BWG recommends that "SW should program the FADDR every time before any transaction as FADDR is used to determine which Chip Select, CS0 if FADDR <= device 0 size, else CS1". The reason behind setting the flash address in this patch is to adhere to the Intel recommended reference implementation that programs FADDR. Additionally, the followup patch will factor out `hwseq_xfer` logic to create a helper function that ensures all SPI related operational APIs could leverage the common `hwseq_xfer` logic. BUG=b:223630977 TEST=Able to perform read-status/write-status operation on PCH 600 series chipset (board name: google/kano). Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: Ib1d85ebdde99a31728f404d66a1eb4e3599b9054 Reviewed-on: https://review.coreboot.org/c/flashrom/+/65468 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'ichspi.c')
-rw-r--r--ichspi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ichspi.c b/ichspi.c
index f295ffe41..80bf09a99 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1348,6 +1348,7 @@ static int ich_hwseq_read_status(const struct flashctx *flash, enum flash_reg re
return -1;
}
msg_pdbg("Reading Status register\n");
+ ich_hwseq_set_addr(0);
/* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */
REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS));
@@ -1383,6 +1384,7 @@ static int ich_hwseq_write_status(const struct flashctx *flash, enum flash_reg r
return -1;
}
msg_pdbg("Writing status register\n");
+ ich_hwseq_set_addr(0);
/* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */
REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS));