From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 1/3] spi: spi-gpio: actually delay in spidelay()
Date: Wed, 25 Sep 2024 16:06:32 +0200 [thread overview]
Message-ID: <20240925-spi-gpio-v1-1-47f6285b3bf1@pengutronix.de> (raw)
In-Reply-To: <20240925-spi-gpio-v1-0-47f6285b3bf1@pengutronix.de>
spidelay() currently only is a no-op dummy function. Actually delay in
this function to avoid spi-gpio being faster than specified.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/spi/gpio_spi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c
index e5664df3fe..a71b4eddab 100644
--- a/drivers/spi/gpio_spi.c
+++ b/drivers/spi/gpio_spi.c
@@ -48,7 +48,10 @@ static inline int getmiso(const struct spi_device *spi)
return !!gpio_get_value(priv->data->miso);
}
-#define spidelay(nsecs) do { } while (0)
+static inline void spidelay(unsigned int nsecs)
+{
+ udelay(max(1U, nsecs / 1000));
+}
#include "spi-bitbang-txrx.h"
--
2.39.5
next prev parent reply other threads:[~2024-09-25 14:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 14:06 [PATCH 0/3] spi-gpio updates Sascha Hauer
2024-09-25 14:06 ` Sascha Hauer [this message]
2024-09-26 5:55 ` [PATCH 1/3] spi: spi-gpio: actually delay in spidelay() Ahmad Fatoum
2024-09-26 7:05 ` Sascha Hauer
2024-09-25 14:06 ` [PATCH 2/3] spi: spi-gpio: support different word widths Sascha Hauer
2024-09-26 6:07 ` Ahmad Fatoum
2024-09-26 7:16 ` Sascha Hauer
2024-09-25 14:06 ` [PATCH 3/3] spi: spi-gpio: switch to new gpio binding Sascha Hauer
2024-09-26 6:09 ` Ahmad Fatoum
2024-09-26 8:19 ` 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=20240925-spi-gpio-v1-1-47f6285b3bf1@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