aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-06-22 12:27:59 +0000
committerJonas Gorski <jogo@openwrt.org>2015-06-22 12:27:59 +0000
commitdc18617098592901d24daa1fce6734e9c62cbef1 (patch)
treece824259896e9866aa6d76e388ce9272a7ba24a1 /target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch
parent148eac2b3134cc8e1eeaeea95c385a130b953335 (diff)
downloadmaster-187ad058-dc18617098592901d24daa1fce6734e9c62cbef1.tar.gz
master-187ad058-dc18617098592901d24daa1fce6734e9c62cbef1.tar.bz2
master-187ad058-dc18617098592901d24daa1fce6734e9c62cbef1.zip
generic: add linux 4.1 support
Boot tested: http://pastebin.com/L6aAb9xj Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> [jogo: update to 4.1 final add patches added since submission delete patches applied in later rcs restore commit messages in 220-gc-sections and 304-mips_disable_fpu fix 050-backport_netfilter_rtcache to match new API update inlined dma ops with upstream changes add missing config symbols enabled CONFIG_MULTIUSER update kmod defintions for 4.1 ] Signed-off-by: Jonas Gorski <jogo@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46112 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch')
-rw-r--r--target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch
new file mode 100644
index 0000000000..fc1b40c035
--- /dev/null
+++ b/target/linux/generic/patches-4.1/861-04_spi_gpio_implement_spi_delay.patch
@@ -0,0 +1,58 @@
+Implement the SPI-GPIO delay function for busses that need speed limitation.
+
+--mb
+
+
+
+--- a/drivers/spi/spi-gpio.c
++++ b/drivers/spi/spi-gpio.c
+@@ -17,6 +17,7 @@
+ #include <linux/module.h>
+ #include <linux/platform_device.h>
+ #include <linux/gpio.h>
++#include <linux/delay.h>
+ #include <linux/of.h>
+ #include <linux/of_device.h>
+ #include <linux/of_gpio.h>
+@@ -69,6 +70,7 @@ struct spi_gpio {
+ * #define SPI_MOSI_GPIO 120
+ * #define SPI_SCK_GPIO 121
+ * #define SPI_N_CHIPSEL 4
++ * #undef NEED_SPIDELAY
+ * #include "spi-gpio.c"
+ */
+
+@@ -76,6 +78,7 @@ struct spi_gpio {
+ #define DRIVER_NAME "spi_gpio"
+
+ #define GENERIC_BITBANG /* vs tight inlines */
++#define NEED_SPIDELAY 1
+
+ /* all functions referencing these symbols must define pdata */
+ #define SPI_MISO_GPIO ((pdata)->miso)
+@@ -126,12 +129,20 @@ static inline int getmiso(const struct s
+ #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.
++ * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz
++ * and spi_transfer.speed_hz to 0.
++ * Otherwise this is 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 on small
++ * embedded devices with fast SPI slaves you usually don't need a delay.
+ */
+-#define spidelay(nsecs) do {} while (0)
++static inline void spidelay(unsigned nsecs)
++{
++#ifdef NEED_SPIDELAY
++ if (unlikely(nsecs))
++ ndelay(nsecs);
++#endif /* NEED_SPIDELAY */
++}
+
+ #include "spi-bitbang-txrx.h"
+