summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamal Dasu <kdasu.kdev@gmail.com>2022-03-28 10:24:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:15:05 +0200
commite4f970dabff6b39777be72818407892df0b84ce0 (patch)
tree11400385aed6cb498a465f5bcf22b9ca64c46b18
parent9648adb1b3ece55c657d3a4f52bfee663b710dfe (diff)
downloadlinux-stable-e4f970dabff6b39777be72818407892df0b84ce0.tar.gz
linux-stable-e4f970dabff6b39777be72818407892df0b84ce0.tar.bz2
linux-stable-e4f970dabff6b39777be72818407892df0b84ce0.zip
spi: bcm-qspi: fix MSPI only access with bcm_qspi_exec_mem_op()
[ Upstream commit 2c7d1b281286c46049cd22b43435cecba560edde ] This fixes case where MSPI controller is used to access spi-nor flash and BSPI block is not present. Fixes: 5f195ee7d830 ("spi: bcm-qspi: Implement the spi_mem interface") Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20220328142442.7553-1-kdasu.kdev@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/spi/spi-bcm-qspi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index 82c24c85f45b..3f291db7b39a 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -970,7 +970,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
addr = op->addr.val;
len = op->data.nbytes;
- if (bcm_qspi_bspi_ver_three(qspi) == true) {
+ if (has_bspi(qspi) && bcm_qspi_bspi_ver_three(qspi) == true) {
/*
* The address coming into this function is a raw flash offset.
* But for BSPI <= V3, we need to convert it to a remapped BSPI
@@ -989,7 +989,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
len < 4)
mspi_read = true;
- if (mspi_read)
+ if (!has_bspi(qspi) || mspi_read)
return bcm_qspi_mspi_exec_mem_op(spi, op);
ret = bcm_qspi_bspi_set_mode(qspi, op, 0);