mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH v2 4/5] spi: spi-gpio: deassert CS during setup
Date: Thu, 26 Sep 2024 13:21:40 +0200	[thread overview]
Message-ID: <20240926-spi-gpio-v2-4-3bf7b511c8c0@pengutronix.de> (raw)
In-Reply-To: <20240926-spi-gpio-v2-0-3bf7b511c8c0@pengutronix.de>

The initial CS gpio state is unknown. When it's asserted the first
transfer might fail. Deassert the CS during setup to make sure the
slave gets a fresh start.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/spi/gpio_spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c
index 417e8db30e..36e6204283 100644
--- a/drivers/spi/gpio_spi.c
+++ b/drivers/spi/gpio_spi.c
@@ -165,6 +165,7 @@ static int gpio_spi_transfer(struct spi_device *spi, struct spi_message *msg)
 
 static int gpio_spi_setup(struct spi_device *spi)
 {
+	gpio_spi_set_cs(spi, 0);
 	return 0;
 }
 

-- 
2.39.5




  parent reply	other threads:[~2024-09-26 11:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 11:21 [PATCH v2 0/5] spi-gpio updates Sascha Hauer
2024-09-26 11:21 ` [PATCH v2 1/5] spi: spi-gpio: actually delay in spidelay() Sascha Hauer
2024-09-26 11:21 ` [PATCH v2 2/5] spi: spi-gpio: support different word widths Sascha Hauer
2024-09-26 11:21 ` [PATCH v2 3/5] spi: spi-gpio: switch to new gpio binding Sascha Hauer
2024-09-26 11:21 ` Sascha Hauer [this message]
2024-09-26 11:21 ` [PATCH v2 5/5] spi: spi-gpio: switch to gpiod api Sascha Hauer
2024-09-27 10:40 ` [PATCH v2 0/5] spi-gpio updates 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=20240926-spi-gpio-v2-4-3bf7b511c8c0@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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