mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: David Jander <david@protonic.nl>,
	Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1] spi: stm32: avoid enabling SPI in setup to allow register configuration
Date: Wed, 29 May 2024 12:08:38 +0200	[thread overview]
Message-ID: <20240529100838.551840-1-o.rempel@pengutronix.de> (raw)

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




             reply	other threads:[~2024-05-29 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 10:08 Oleksij Rempel [this message]
2024-05-30 13:24 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240529100838.551840-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=david@protonic.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox