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 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -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) @@ -120,12 +123,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 */ +} #define EXPAND_BITBANG_TXRX #include .cgi/openwrt/upstream/about/?h=v17.01.7'>aboutsummaryrefslogtreecommitdiffstats
blob: 65a02bc12024a3d5bf21051cbed731693a0036be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- a/drivers/net/ag71xx/ag71xx_main.c
+++ b/drivers/net/ag71xx/ag71xx_main.c
@@ -575,7 +575,7 @@ static void ag71xx_oom_timer_handler(uns
 	struct net_device *dev = (struct net_device *) data;
 	struct ag71xx *ag = netdev_priv(dev);
 
-	netif_rx_schedule(&ag->napi);
+	napi_schedule(&ag->napi);
 }
 
 static void ag71xx_tx_timeout(struct net_device *dev)
@@ -731,7 +731,7 @@ static int ag71xx_poll(struct napi_struc
 		DBG("%s: disable polling mode, done=%d, limit=%d\n",
 			dev->name, done, limit);
 
-		netif_rx_complete(napi);
+		napi_complete(napi);
 
 		/* enable interrupts */
 		spin_lock_irqsave(&ag->lock, flags);
@@ -750,7 +750,7 @@ static int ag71xx_poll(struct napi_struc
 		printk(KERN_DEBUG "%s: out of memory\n", dev->name);
 
 	mod_timer(&ag->oom_timer, jiffies + AG71XX_OOM_REFILL);
-	netif_rx_complete(napi);
+	napi_complete(napi);
 	return 0;
 }
 
@@ -780,7 +780,7 @@ static irqreturn_t ag71xx_interrupt(int 
 	if (likely(status & AG71XX_INT_POLL)) {
 		ag71xx_int_disable(ag, AG71XX_INT_POLL);
 		DBG("%s: enable polling mode\n", dev->name);
-		netif_rx_schedule(&ag->napi);
+		napi_schedule(&ag->napi);
 	}
 
 	return IRQ_HANDLED;