diff options
author | Pratyush Yadav <p.yadav@ti.com> | 2020-12-23 00:14:20 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 11:37:54 +0100 |
commit | d8d37cdde2a5a5a5a85748b7610dcdebdd72edb4 (patch) | |
tree | 9f83cc56f2061c314033ca3e3a897a31c41ecd3c | |
parent | a8594ec0bb3780b40baf8722880373d8c439ed3e (diff) | |
download | kernel_replicant_linux-d8d37cdde2a5a5a5a85748b7610dcdebdd72edb4.tar.gz kernel_replicant_linux-d8d37cdde2a5a5a5a85748b7610dcdebdd72edb4.tar.bz2 kernel_replicant_linux-d8d37cdde2a5a5a5a85748b7610dcdebdd72edb4.zip |
spi: cadence-quadspi: Abort read if dummy cycles required are too many
[ Upstream commit ceeda328edeeeeac7579e9dbf0610785a3b83d39 ]
The controller can only support up to 31 dummy cycles. If the command
requires more it falls back to using 31. This command is likely to fail
because the correct number of cycles are not waited upon. Rather than
silently issuing an incorrect command, fail loudly so the caller can get
a chance to find out the command can't be supported by the controller.
Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Link: https://lore.kernel.org/r/20201222184425.7028-3-p.yadav@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/spi/spi-cadence-quadspi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index ba7d40c2922f..826b01f34624 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -461,7 +461,7 @@ static int cqspi_read_setup(struct cqspi_flash_pdata *f_pdata, /* Setup dummy clock cycles */ dummy_clk = op->dummy.nbytes * 8; if (dummy_clk > CQSPI_DUMMY_CLKS_MAX) - dummy_clk = CQSPI_DUMMY_CLKS_MAX; + return -EOPNOTSUPP; if (dummy_clk) reg |= (dummy_clk & CQSPI_REG_RD_INSTR_DUMMY_MASK) |