mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration
@ 2024-05-29 10:08 Oleksij Rempel
  2024-05-30 13:24 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2024-05-29 10:08 UTC (permalink / raw)
  To: barebox; +Cc: David Jander, Oleksij Rempel

From: David Jander <david@protonic.nl>

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@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration
  2024-05-29 10:08 [PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration Oleksij Rempel
@ 2024-05-30 13:24 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-05-30 13:24 UTC (permalink / raw)
  To: barebox, Oleksij Rempel; +Cc: David Jander


On Wed, 29 May 2024 12:08:38 +0200, Oleksij Rempel wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] spi: stm32: avoid enabling SPI in setup to allow register configuration
      https://git.pengutronix.de/cgit/barebox/commit/?id=e548c6f567f2 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-30 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 10:08 [PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration Oleksij Rempel
2024-05-30 13:24 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox