aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng <[email protected]>2017-09-11 02:41:53 -0700
committerCyrille Pitchen <[email protected]>2017-10-11 09:41:48 +0200
commit9d63f17661e25fd28714dac94bdebc4ff5b75f09 (patch)
tree849f0357fe5499a72c5271d5e9aa40ddb4645cbe
parente58348b0e41b56660a349d63448826df11bb6163 (diff)
spi-nor: intel-spi: Fix broken software sequencing codes
There are two bugs in current intel_spi_sw_cycle(): - The 'data byte count' field should be the number of bytes transferred minus 1 - SSFSTS_CTL is the offset from ispi->sregs, not ispi->base Signed-off-by: Bin Meng <[email protected]> Cc: <[email protected]> # v4.11+ Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Cyrille Pitchen <[email protected]>
-rw-r--r--drivers/mtd/spi-nor/intel-spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c
index 07626caa7b32..263c6ab5849a 100644
--- a/drivers/mtd/spi-nor/intel-spi.c
+++ b/drivers/mtd/spi-nor/intel-spi.c
@@ -426,7 +426,7 @@ static int intel_spi_sw_cycle(struct intel_spi *ispi, u8 opcode, int len)
if (ret < 0)
return ret;
- val = (len << SSFSTS_CTL_DBC_SHIFT) | SSFSTS_CTL_DS;
+ val = ((len - 1) << SSFSTS_CTL_DBC_SHIFT) | SSFSTS_CTL_DS;
val |= ret << SSFSTS_CTL_COP_SHIFT;
val |= SSFSTS_CTL_FCERR | SSFSTS_CTL_FDONE;
val |= SSFSTS_CTL_SCGO;
@@ -436,7 +436,7 @@ static int intel_spi_sw_cycle(struct intel_spi *ispi, u8 opcode, int len)
if (ret)
return ret;
- status = readl(ispi->base + SSFSTS_CTL);
+ status = readl(ispi->sregs + SSFSTS_CTL);
if (status & SSFSTS_CTL_FCERR)
return -EIO;
else if (status & SSFSTS_CTL_AEL)