From cc3d5d375ce462167c8205c5bef3af915dae725d Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Wed, 8 Dec 2010 10:57:34 +0000 Subject: 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 It has been tested with a Option GTM501L 3G modem, to use DMA mode, DMA controller 2 of Moorestown has to be enabled Signed-off-by: Feng Tang [Typo fix and renames to match intel_mid_dma renaming] Signed-off-by: Vinod Koul [Clean up] Signed-off-by: Feng Tang [Fix timing delay, add cpu_relax] Signed-off-by: Arjan van de Ven Signed-off-by: Alan Cox --- include/linux/spi/dw_spi.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h index c91302f3a25..b2ecf9f1f97 100644 --- a/include/linux/spi/dw_spi.h +++ b/include/linux/spi/dw_spi.h @@ -1,5 +1,6 @@ #ifndef DW_SPI_HEADER_H #define DW_SPI_HEADER_H + #include /* Bit fields in CTRLR0 */ @@ -82,6 +83,13 @@ struct dw_spi_reg { though only low 16 bits matters */ } __packed; +struct dw_spi; +struct dw_spi_dma_ops { + int (*dma_init)(struct dw_spi *dws); + void (*dma_exit)(struct dw_spi *dws); + int (*dma_transfer)(struct dw_spi *dws, int cs_change); +}; + struct dw_spi { struct spi_master *master; struct spi_device *cur_dev; @@ -143,6 +151,9 @@ struct dw_spi { u64 rx_param; struct device *dma_dev; dma_addr_t dma_addr; + struct dw_spi_dma_ops *dma_ops; + void *dma_priv; /* platform relate info */ + struct pci_dev *dmac; /* Bus interface info */ void *priv; @@ -216,4 +227,8 @@ extern int dw_spi_add_host(struct dw_spi *dws); extern void dw_spi_remove_host(struct dw_spi *dws); extern int dw_spi_suspend_host(struct dw_spi *dws); extern int dw_spi_resume_host(struct dw_spi *dws); +extern void dw_spi_xfer_done(struct dw_spi *dws); + +/* platform related setup */ +extern int dw_spi_mid_init(struct dw_spi *dws); /* Intel MID platforms */ #endif /* DW_SPI_HEADER_H */ -- cgit v1.2.3