summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2024-06-18 16:29:50 +0300
committerMark Brown <broonie@kernel.org>2024-06-18 16:48:26 +0300
commit63deee52811b2f84ed2da55ad47252f0e8145d62 (patch)
treead206e2a8586942e928917ecaeedf0a9e92fc49c /drivers/spi
parentc2bd0791c5f02e964402624dfff45ca8995f5397 (diff)
downloadlinux-63deee52811b2f84ed2da55ad47252f0e8145d62.tar.xz
spi: stm32: qspi: Clamp stm32_qspi_get_mode() output to CCR_BUSWIDTH_4
In case usage of OCTAL mode, buswidth parameter can take the value 8. As return value of stm32_qspi_get_mode() is used to configure fields of CCR registers that are 2 bits only (fields IMODE, ADMODE, ADSIZE, DMODE), clamp return value of stm32_qspi_get_mode() to 4. Fixes: a557fca630cc ("spi: stm32_qspi: Add transfer_one_message() spi callback") Cc: stable@vger.kernel.org Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://msgid.link/r/20240618132951.2743935-3-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-stm32-qspi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 6944e85d8367..955c920c4b63 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -349,7 +349,7 @@ static int stm32_qspi_wait_poll_status(struct stm32_qspi *qspi)
static int stm32_qspi_get_mode(u8 buswidth)
{
- if (buswidth == 4)
+ if (buswidth >= 4)
return CCR_BUSWIDTH_4;
return buswidth;