Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: bcm-qspi: fix MSPI only access with bcm_qspi_exec_mem_op()

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>

authored by

Kamal Dasu and committed by
Mark Brown
2c7d1b28 97e4827d

+2 -2
+2 -2
drivers/spi/spi-bcm-qspi.c
··· 1205 1205 addr = op->addr.val; 1206 1206 len = op->data.nbytes; 1207 1207 1208 - if (bcm_qspi_bspi_ver_three(qspi) == true) { 1208 + if (has_bspi(qspi) && bcm_qspi_bspi_ver_three(qspi) == true) { 1209 1209 /* 1210 1210 * The address coming into this function is a raw flash offset. 1211 1211 * But for BSPI <= V3, we need to convert it to a remapped BSPI ··· 1224 1224 len < 4) 1225 1225 mspi_read = true; 1226 1226 1227 - if (mspi_read) 1227 + if (!has_bspi(qspi) || mspi_read) 1228 1228 return bcm_qspi_mspi_exec_mem_op(spi, op); 1229 1229 1230 1230 ret = bcm_qspi_bspi_set_mode(qspi, op, 0);