aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-12-24 00:59:11 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-12-24 03:23:25 -0500
commit7063c0d942a1af2993531fbe52b4c74c1db818c4 (patch)
treefe91b01bd61449849736c47e0a05840fc47a5eb3 /include
parent79290a2aa2fd1c179a285218472092475630dc0e (diff)
spi/dw_spi: add DMA support
dw_spi driver in upstream only supports PIO mode, and this patch will support it to cowork with the Designware dma controller used on Intel Moorestown platform, at the same time it provides a general framework to support dw_spi core to cowork with dma controllers on other platforms It has been tested with a Option GTM501L 3G modem and Infenion 60x60 modem. To use DMA mode, DMA controller 2 of Moorestown has to be enabled Also change the dma interface suggested by Linus Walleij. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Feng Tang <feng.tang@intel.com> [Typo fix and renames to match intel_mid_dma renaming] Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
-rw-r--r--include/linux/spi/dw_spi.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
index c91302f3a257..6cd10f6ad472 100644
--- a/include/linux/spi/dw_spi.h
+++ b/include/linux/spi/dw_spi.h
@@ -1,5 +1,6 @@
1#ifndef DW_SPI_HEADER_H 1#ifndef DW_SPI_HEADER_H
2#define DW_SPI_HEADER_H 2#define DW_SPI_HEADER_H
3
3#include <linux/io.h> 4#include <linux/io.h>
4 5
5/* Bit fields in CTRLR0 */ 6/* Bit fields in CTRLR0 */
@@ -82,6 +83,13 @@ struct dw_spi_reg {
82 though only low 16 bits matters */ 83 though only low 16 bits matters */
83} __packed; 84} __packed;
84 85
86struct dw_spi;
87struct dw_spi_dma_ops {
88 int (*dma_init)(struct dw_spi *dws);
89 void (*dma_exit)(struct dw_spi *dws);
90 int (*dma_transfer)(struct dw_spi *dws, int cs_change);
91};
92
85struct dw_spi { 93struct dw_spi {
86 struct spi_master *master; 94 struct spi_master *master;
87 struct spi_device *cur_dev; 95 struct spi_device *cur_dev;
@@ -136,13 +144,15 @@ struct dw_spi {
136 /* Dma info */ 144 /* Dma info */
137 int dma_inited; 145 int dma_inited;
138 struct dma_chan *txchan; 146 struct dma_chan *txchan;
147 struct scatterlist tx_sgl;
139 struct dma_chan *rxchan; 148 struct dma_chan *rxchan;
140 int txdma_done; 149 struct scatterlist rx_sgl;
141 int rxdma_done; 150 int dma_chan_done;
142 u64 tx_param;
143 u64 rx_param;
144 struct device *dma_dev; 151 struct device *dma_dev;
145 dma_addr_t dma_addr; 152 dma_addr_t dma_addr; /* phy address of the Data register */
153 struct dw_spi_dma_ops *dma_ops;
154 void *dma_priv; /* platform relate info */
155 struct pci_dev *dmac;
146 156
147 /* Bus interface info */ 157 /* Bus interface info */
148 void *priv; 158 void *priv;
@@ -216,4 +226,8 @@ extern int dw_spi_add_host(struct dw_spi *dws);
216extern void dw_spi_remove_host(struct dw_spi *dws); 226extern void dw_spi_remove_host(struct dw_spi *dws);
217extern int dw_spi_suspend_host(struct dw_spi *dws); 227extern int dw_spi_suspend_host(struct dw_spi *dws);
218extern int dw_spi_resume_host(struct dw_spi *dws); 228extern int dw_spi_resume_host(struct dw_spi *dws);
229extern void dw_spi_xfer_done(struct dw_spi *dws);
230
231/* platform related setup */
232extern int dw_spi_mid_init(struct dw_spi *dws); /* Intel MID platforms */
219#endif /* DW_SPI_HEADER_H */ 233#endif /* DW_SPI_HEADER_H */