diff options
Diffstat (limited to 'drivers/spi/spi-dw.h')
-rw-r--r-- | drivers/spi/spi-dw.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 587643dae11e..6d2acad34f64 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/io.h> | 4 | #include <linux/io.h> |
5 | #include <linux/scatterlist.h> | 5 | #include <linux/scatterlist.h> |
6 | #include <linux/gpio.h> | ||
6 | 7 | ||
7 | /* Register offsets */ | 8 | /* Register offsets */ |
8 | #define DW_SPI_CTRL0 0x00 | 9 | #define DW_SPI_CTRL0 0x00 |
@@ -104,14 +105,6 @@ struct dw_spi { | |||
104 | u16 bus_num; | 105 | u16 bus_num; |
105 | u16 num_cs; /* supported slave numbers */ | 106 | u16 num_cs; /* supported slave numbers */ |
106 | 107 | ||
107 | /* Driver message queue */ | ||
108 | struct workqueue_struct *workqueue; | ||
109 | struct work_struct pump_messages; | ||
110 | spinlock_t lock; | ||
111 | struct list_head queue; | ||
112 | int busy; | ||
113 | int run; | ||
114 | |||
115 | /* Message Transfer pump */ | 108 | /* Message Transfer pump */ |
116 | struct tasklet_struct pump_transfers; | 109 | struct tasklet_struct pump_transfers; |
117 | 110 | ||
@@ -186,15 +179,20 @@ static inline void spi_set_clk(struct dw_spi *dws, u16 div) | |||
186 | dw_writel(dws, DW_SPI_BAUDR, div); | 179 | dw_writel(dws, DW_SPI_BAUDR, div); |
187 | } | 180 | } |
188 | 181 | ||
189 | static inline void spi_chip_sel(struct dw_spi *dws, u16 cs) | 182 | static inline void spi_chip_sel(struct dw_spi *dws, struct spi_device *spi, |
183 | int active) | ||
190 | { | 184 | { |
191 | if (cs > dws->num_cs) | 185 | u16 cs = spi->chip_select; |
192 | return; | 186 | int gpio_val = active ? (spi->mode & SPI_CS_HIGH) : |
187 | !(spi->mode & SPI_CS_HIGH); | ||
193 | 188 | ||
194 | if (dws->cs_control) | 189 | if (dws->cs_control) |
195 | dws->cs_control(1); | 190 | dws->cs_control(active); |
191 | if (gpio_is_valid(spi->cs_gpio)) | ||
192 | gpio_set_value(spi->cs_gpio, gpio_val); | ||
196 | 193 | ||
197 | dw_writel(dws, DW_SPI_SER, 1 << cs); | 194 | if (active) |
195 | dw_writel(dws, DW_SPI_SER, 1 << cs); | ||
198 | } | 196 | } |
199 | 197 | ||
200 | /* Disable IRQ bits */ | 198 | /* Disable IRQ bits */ |