23 #include <linux/slab.h>
25 #include <linux/types.h>
29 #ifdef CONFIG_SPI_DW_MID_DMA
31 #include <linux/pci.h>
45 static int mid_spi_dma_init(
struct dw_spi *dws)
66 rxs = &dw_dma->dmas_rx;
69 dws->
rxchan->private = rxs;
75 txs = &dw_dma->dmas_tx;
78 dws->
txchan->private = txs;
90 static void mid_spi_dma_exit(
struct dw_spi *dws)
101 static void dw_spi_dma_done(
void *
arg)
119 spi_enable_chip(dws, 0);
127 spi_enable_chip(dws, 1);
140 txconf.device_fc =
false;
143 (
unsigned long) &txconf);
149 txdesc = dmaengine_prep_slave_sg(txchan,
163 rxconf.device_fc =
false;
166 (
unsigned long) &rxconf);
172 rxdesc = dmaengine_prep_slave_sg(rxchan,
177 rxdesc->callback = dw_spi_dma_done;
178 rxdesc->callback_param = dws;
181 rxdesc->tx_submit(rxdesc);
188 .dma_exit = mid_spi_dma_exit,
189 .dma_transfer = mid_spi_dma_transfer,
196 #define MRST_SPI_CLK_BASE 100000000
197 #define MRST_CLK_SPI0_REG 0xff11d86c
198 #define CLK_SPI_BDIV_OFFSET 0
199 #define CLK_SPI_BDIV_MASK 0x00000007
200 #define CLK_SPI_CDIV_OFFSET 9
201 #define CLK_SPI_CDIV_MASK 0x00000e00
202 #define CLK_SPI_DISABLE_OFFSET 8
221 #ifdef CONFIG_SPI_DW_MID_DMA