Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/62892 )
Change subject: ichspi: Introduce HSFC FDBC(n) macro ......................................................................
ichspi: Introduce HSFC FDBC(n) macro
This patch introduces useful HSFC_FDBC(n) macros to use in SPI read and write operations.
Also, renamed HSFC_FDBC -> HSFC_FDBC_MASK.
BUG=b:223630977 TEST=Able to perform read/write/erase operation on brya.
Signed-off-by: Subrata Banik subratabanik@google.com Change-Id: Ie2512c85de9fc21286234b97f5842ecef1729787 --- M ichspi.c 1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/92/62892/1
diff --git a/ichspi.c b/ichspi.c index 3f7083c..080eb10 100644 --- a/ichspi.c +++ b/ichspi.c @@ -144,7 +144,8 @@ #define HSFC_WET (0x1 << HSFC_WET_OFF) /* 3-7: reserved */ #define HSFC_FDBC_OFF 8 /* 8-13: Flash Data Byte Count */ -#define HSFC_FDBC (0x3f << HSFC_FDBC_OFF) +#define HSFC_FDBC_MASK (0x3f << HSFC_FDBC_OFF) +#define HSFC_FDBC(n) (((n) << HSFC_FDBC_OFF) & HSFC_FDBC_MASK) /* 14: reserved */ #define HSFC_SME_OFF 15 /* 15: SPI SMI# Enable */ #define HSFC_SME (0x1 << HSFC_SME_OFF) @@ -505,7 +506,7 @@ reg_val, ", "); break; } - pprint_reg(HSFC, FDBC, reg_val, ", "); + _pprint_reg(HSFC, HSFC_FDBC_MASK, HSFC_FDBC_OFF, reg_val, ", "); pprint_reg(HSFC, SME, reg_val, "\n"); }
@@ -1484,9 +1485,9 @@
hsfc = REGREAD16(ICH9_REG_HSFC); hsfc &= ~hwseq_data.hsfc_fcycle; /* set read operation */ - hsfc &= ~HSFC_FDBC; /* clear byte count */ + hsfc &= ~HSFC_FDBC_MASK; /* clear byte count */ /* set byte count */ - hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); + hsfc |= HSFC_FDBC(block_len - 1); hsfc |= HSFC_FGO; /* start */ REGWRITE16(ICH9_REG_HSFC, hsfc);
@@ -1531,9 +1532,9 @@ hsfc = REGREAD16(ICH9_REG_HSFC); hsfc &= ~hwseq_data.hsfc_fcycle; /* clear operation */ hsfc |= (0x2 << HSFC_FCYCLE_OFF); /* set write operation */ - hsfc &= ~HSFC_FDBC; /* clear byte count */ + hsfc &= ~HSFC_FDBC_MASK; /* clear byte count */ /* set byte count */ - hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); + hsfc |= HSFC_FDBC(block_len - 1); hsfc |= HSFC_FGO; /* start */ REGWRITE16(ICH9_REG_HSFC, hsfc);