Skip to content

Instantly share code, notes, and snippets.

@c-mauderer
Created September 6, 2020 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c-mauderer/5c3ed1c9305e5318c659577f4e3628d2 to your computer and use it in GitHub Desktop.
Save c-mauderer/5c3ed1c9305e5318c659577f4e3628d2 to your computer and use it in GitHub Desktop.
From 71ce28abeb30a849fde20ccb78aaf83df06c2f16 Mon Sep 17 00:00:00 2001
From: Christian Mauderer <oss@c-mauderer.de>
Date: Sat, 8 Jun 2019 17:30:00 +0200
Subject: [PATCH] spi: spi-gpio: Add spidelay.
There are only few devices that can't handle >1MBit/s on SPI but there
are some. This allows to handle them using spi-gpio driver.
Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
---
drivers/spi/spi-gpio.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 1c34c9314c8a..551a196c3bd4 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
+#include <linux/delay.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
@@ -125,13 +126,7 @@ static inline int getmiso(const struct spi_device *spi)
#undef pdata
-/*
- * NOTE: this clocks "as fast as we can". It "should" be a function of the
- * requested device clock. Software overhead means we usually have trouble
- * reaching even one Mbit/sec (except when we can inline bitops), so for now
- * we'll just assume we never need additional per-bit slowdowns.
- */
-#define spidelay(nsecs) do {} while (0)
+#define spidelay(x) ndelay(x)
#include "spi-bitbang-txrx.h"
--
2.21.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment