diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2022-10-25 08:46:22 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-25 20:34:05 +0100 |
commit | 43f173e7e508ede3d6f5411b9ffbb33d6d284211 (patch) | |
tree | f69f550f060b5e8004208423bb46518b1de7908b /drivers/spi/spi-intel.c | |
parent | spi: intel: Implement adjust_op_size() (diff) | |
download | linux-43f173e7e508ede3d6f5411b9ffbb33d6d284211.tar.xz linux-43f173e7e508ede3d6f5411b9ffbb33d6d284211.zip |
spi: intel: Take possible chip address into account in intel_spi_read/write_reg()
The SPI-NOR operation can have non-zero chip address as well so take
this into account in intel_spi_read/write_reg().
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20221025064623.22808-4-mika.westerberg@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-intel.c')
-rw-r--r-- | drivers/spi/spi-intel.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 431a6f97daf2..4d8fda991e7b 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -457,11 +457,12 @@ static int intel_spi_read_reg(struct intel_spi *ispi, const struct spi_mem *mem, const struct intel_spi_mem_op *iop, const struct spi_mem_op *op) { + u32 addr = intel_spi_chip_addr(ispi, mem) + op->addr.val; size_t nbytes = op->data.nbytes; u8 opcode = op->cmd.opcode; int ret; - writel(intel_spi_chip_addr(ispi, mem), ispi->base + FADDR); + writel(addr, ispi->base + FADDR); if (ispi->swseq_reg) ret = intel_spi_sw_cycle(ispi, opcode, nbytes, @@ -479,6 +480,7 @@ static int intel_spi_write_reg(struct intel_spi *ispi, const struct spi_mem *mem const struct intel_spi_mem_op *iop, const struct spi_mem_op *op) { + u32 addr = intel_spi_chip_addr(ispi, mem) + op->addr.val; size_t nbytes = op->data.nbytes; u8 opcode = op->cmd.opcode; int ret; @@ -522,7 +524,7 @@ static int intel_spi_write_reg(struct intel_spi *ispi, const struct spi_mem *mem if (opcode == SPINOR_OP_WRDI) return 0; - writel(intel_spi_chip_addr(ispi, mem), ispi->base + FADDR); + writel(addr, ispi->base + FADDR); /* Write the value beforehand */ ret = intel_spi_write_block(ispi, op->data.buf.out, nbytes); |