[PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: David Jander <david@xxxxxxxxxxx>

The stm32_spi_setup function configures the STM32 SPI engine by setting
the SPI mode and speed. However, enabling the SPI peripheral during this
process blocks all changes to configuration registers, causing the
configuration writes to be ignored.

Remove stm32_spi_enable calls from stm32_spi_setup to ensure proper
configuration of the SPI registers before enabling the peripheral.

This fix addresses the following error on some platforms with an SJA1105
switch attached over SPI to an STM32MP151 SoC:
ERROR: sja1105 switch@00: Device tree specifies chip 2919236366/39557
       but found 3607101831/0, please fix it!
ERROR: sja1105 switch@00: Device ID check failed: -19

Signed-off-by: David Jander <david@xxxxxxxxxxx>
Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 drivers/spi/stm32_spi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c
index 9ef405a788..df48264d24 100644
--- a/drivers/spi/stm32_spi.c
+++ b/drivers/spi/stm32_spi.c
@@ -330,7 +330,6 @@ static int stm32_spi_setup(struct spi_device *spi)
 	int ret;
 
 	stm32_spi_set_cs(spi, false);
-	stm32_spi_enable(priv);
 
 	stm32_spi_set_mode(priv, spi->mode);
 
@@ -346,7 +345,6 @@ static int stm32_spi_setup(struct spi_device *spi)
 		__func__, spi->mode, spi->bits_per_word,
 		spi->max_speed_hz);
 out:
-	stm32_spi_disable(priv);
 	return ret;
 }
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux