[brcm63xx] base-files: brcm63xx.sh: Added comtrend (96348GW-11) to routers with butto...
[openwrt.git] / target / linux / generic / patches-2.6.34 / 920-04-spi-gpio-implement-spi-delay.patch
1 Implement the SPI-GPIO delay function for busses that need speed limitation.
2
3 --mb
4
5
6
7 --- a/drivers/spi/spi_gpio.c
8 +++ b/drivers/spi/spi_gpio.c
9 @@ -21,6 +21,7 @@
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/gpio.h>
13 +#include <linux/delay.h>
14
15 #include <linux/spi/spi.h>
16 #include <linux/spi/spi_bitbang.h>
17 @@ -69,6 +70,7 @@ struct spi_gpio {
18 * #define SPI_MOSI_GPIO 120
19 * #define SPI_SCK_GPIO 121
20 * #define SPI_N_CHIPSEL 4
21 + * #undef NEED_SPIDELAY
22 * #include "spi_gpio.c"
23 */
24
25 @@ -76,6 +78,7 @@ struct spi_gpio {
26 #define DRIVER_NAME "spi_gpio"
27
28 #define GENERIC_BITBANG /* vs tight inlines */
29 +#define NEED_SPIDELAY 1
30
31 /* all functions referencing these symbols must define pdata */
32 #define SPI_MISO_GPIO ((pdata)->miso)
33 @@ -120,12 +123,20 @@ static inline int getmiso(const struct s
34 #undef pdata
35
36 /*
37 - * NOTE: this clocks "as fast as we can". It "should" be a function of the
38 - * requested device clock. Software overhead means we usually have trouble
39 - * reaching even one Mbit/sec (except when we can inline bitops), so for now
40 - * we'll just assume we never need additional per-bit slowdowns.
41 + * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz
42 + * and spi_transfer.speed_hz to 0.
43 + * Otherwise this is a function of the requested device clock.
44 + * Software overhead means we usually have trouble
45 + * reaching even one Mbit/sec (except when we can inline bitops). So on small
46 + * embedded devices with fast SPI slaves you usually don't need a delay.
47 */
48 -#define spidelay(nsecs) do {} while (0)
49 +static inline void spidelay(unsigned nsecs)
50 +{
51 +#ifdef NEED_SPIDELAY
52 + if (unlikely(nsecs))
53 + ndelay(nsecs);
54 +#endif /* NEED_SPIDELAY */
55 +}
56
57 #define EXPAND_BITBANG_TXRX
58 #include <linux/spi/spi_bitbang.h>
This page took 0.045215 seconds and 5 git commands to generate.