spi: cadence-quadspi: fix incorrect supports_op() return value
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Wed, 6 Apr 2022 13:28:32 +0000 (15:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Apr 2022 12:38:52 +0000 (14:38 +0200)
commit8920a03a3a152d00e5447669371f25368d3e35b5
tree33491c17c077e1b6658f8b49d6f619501907132d
parenta583f2f3c8788bffd7fd7baeb76bd6d80543d7ea
spi: cadence-quadspi: fix incorrect supports_op() return value

[ Upstream commit f1d388f216aeb41a5df518815ae559d14a6d438e ]

Since the conversion to spi-mem, the driver advertised support for
various operations that cqspi_set_protocol() was never expected to handle
correctly - in particuar all non-DTR operations with command or address
buswidth > 1. For DTR, all operations except for 8-8-8 would fail, as
cqspi_set_protocol() returns -EINVAL.

In non-DTR mode, this resulted in data corruption for SPI-NOR flashes that
support such operations. As a minimal fix that can be backported to stable
kernels, simply disallow the unsupported operations again to avoid this
issue.

Fixes: a314f6367787 ("mtd: spi-nor: Convert cadence-quadspi to use spi-mem framework")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/20220406132832.199777-1-matthias.schiffer@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-cadence-quadspi.c