mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 20:05:22 +02:00
spi: stm32: qspi: Fix dual flash mode sanity test in stm32_qspi_setup()
commitc2bd0791c5
upstream. Misplaced parenthesis make test of mode wrong in case mode is equal to SPI_TX_OCTAL or SPI_RX_OCTAL. Simplify this sanity test, if one of this bit is set, property cs-gpio must be present in DT. Fixes:a557fca630
("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-2-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
211deb3e31
commit
6e77a7c0bd
|
@ -653,9 +653,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mode = spi->mode & (SPI_TX_OCTAL | SPI_RX_OCTAL);
|
mode = spi->mode & (SPI_TX_OCTAL | SPI_RX_OCTAL);
|
||||||
if ((mode == SPI_TX_OCTAL || mode == SPI_RX_OCTAL) ||
|
if (mode && gpiod_count(qspi->dev, "cs") == -ENOENT) {
|
||||||
((mode == (SPI_TX_OCTAL | SPI_RX_OCTAL)) &&
|
|
||||||
gpiod_count(qspi->dev, "cs") == -ENOENT)) {
|
|
||||||
dev_err(qspi->dev, "spi-rx-bus-width\\/spi-tx-bus-width\\/cs-gpios\n");
|
dev_err(qspi->dev, "spi-rx-bus-width\\/spi-tx-bus-width\\/cs-gpios\n");
|
||||||
dev_err(qspi->dev, "configuration not supported\n");
|
dev_err(qspi->dev, "configuration not supported\n");
|
||||||
|
|
||||||
|
@ -676,10 +674,10 @@ static int stm32_qspi_setup(struct spi_device *spi)
|
||||||
qspi->cr_reg = CR_APMS | 3 << CR_FTHRES_SHIFT | CR_SSHIFT | CR_EN;
|
qspi->cr_reg = CR_APMS | 3 << CR_FTHRES_SHIFT | CR_SSHIFT | CR_EN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dual flash mode is only enable in case SPI_TX_OCTAL and SPI_TX_OCTAL
|
* Dual flash mode is only enable in case SPI_TX_OCTAL or SPI_RX_OCTAL
|
||||||
* are both set in spi->mode and "cs-gpios" properties is found in DT
|
* is set in spi->mode and "cs-gpios" properties is found in DT
|
||||||
*/
|
*/
|
||||||
if (mode == (SPI_TX_OCTAL | SPI_RX_OCTAL)) {
|
if (mode) {
|
||||||
qspi->cr_reg |= CR_DFM;
|
qspi->cr_reg |= CR_DFM;
|
||||||
dev_dbg(qspi->dev, "Dual flash mode enable");
|
dev_dbg(qspi->dev, "Dual flash mode enable");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user