Lines Matching refs:dws
40 struct dw_spi *dws = param; in mid_spi_dma_chan_filter() local
42 return dws->dmac && (&dws->dmac->dev == chan->device->dev); in mid_spi_dma_chan_filter()
45 static int mid_spi_dma_init(struct dw_spi *dws) in mid_spi_dma_init() argument
47 struct mid_dma *dw_dma = dws->dma_priv; in mid_spi_dma_init()
55 dws->dmac = pci_get_device(PCI_VENDOR_ID_INTEL, 0x0813, NULL); in mid_spi_dma_init()
56 if (!dws->dmac) in mid_spi_dma_init()
57 dws->dmac = pci_get_device(PCI_VENDOR_ID_INTEL, 0x0827, NULL); in mid_spi_dma_init()
63 dws->rxchan = dma_request_channel(mask, mid_spi_dma_chan_filter, dws); in mid_spi_dma_init()
64 if (!dws->rxchan) in mid_spi_dma_init()
69 dws->rxchan->private = rxs; in mid_spi_dma_init()
72 dws->txchan = dma_request_channel(mask, mid_spi_dma_chan_filter, dws); in mid_spi_dma_init()
73 if (!dws->txchan) in mid_spi_dma_init()
78 dws->txchan->private = txs; in mid_spi_dma_init()
80 dws->dma_inited = 1; in mid_spi_dma_init()
84 dma_release_channel(dws->rxchan); in mid_spi_dma_init()
90 static void mid_spi_dma_exit(struct dw_spi *dws) in mid_spi_dma_exit() argument
92 dma_release_channel(dws->txchan); in mid_spi_dma_exit()
93 dma_release_channel(dws->rxchan); in mid_spi_dma_exit()
103 struct dw_spi *dws = arg; in dw_spi_dma_done() local
105 if (++dws->dma_chan_done != 2) in dw_spi_dma_done()
107 dw_spi_xfer_done(dws); in dw_spi_dma_done()
110 static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) in mid_spi_dma_transfer() argument
119 spi_enable_chip(dws, 0); in mid_spi_dma_transfer()
120 dw_writew(dws, DW_SPI_DMARDLR, 0xf); in mid_spi_dma_transfer()
121 dw_writew(dws, DW_SPI_DMATDLR, 0x10); in mid_spi_dma_transfer()
122 if (dws->tx_dma) in mid_spi_dma_transfer()
124 if (dws->rx_dma) in mid_spi_dma_transfer()
126 dw_writew(dws, DW_SPI_DMACR, dma_ctrl); in mid_spi_dma_transfer()
127 spi_enable_chip(dws, 1); in mid_spi_dma_transfer()
130 dws->dma_chan_done = 0; in mid_spi_dma_transfer()
131 txchan = dws->txchan; in mid_spi_dma_transfer()
132 rxchan = dws->rxchan; in mid_spi_dma_transfer()
136 txconf.dst_addr = dws->dma_addr; in mid_spi_dma_transfer()
145 memset(&dws->tx_sgl, 0, sizeof(dws->tx_sgl)); in mid_spi_dma_transfer()
146 dws->tx_sgl.dma_address = dws->tx_dma; in mid_spi_dma_transfer()
147 dws->tx_sgl.length = dws->len; in mid_spi_dma_transfer()
150 &dws->tx_sgl, in mid_spi_dma_transfer()
155 txdesc->callback_param = dws; in mid_spi_dma_transfer()
159 rxconf.src_addr = dws->dma_addr; in mid_spi_dma_transfer()
168 memset(&dws->rx_sgl, 0, sizeof(dws->rx_sgl)); in mid_spi_dma_transfer()
169 dws->rx_sgl.dma_address = dws->rx_dma; in mid_spi_dma_transfer()
170 dws->rx_sgl.length = dws->len; in mid_spi_dma_transfer()
173 &dws->rx_sgl, in mid_spi_dma_transfer()
178 rxdesc->callback_param = dws; in mid_spi_dma_transfer()
204 int dw_spi_mid_init(struct dw_spi *dws) in dw_spi_mid_init() argument
215 dws->max_freq = MRST_SPI_CLK_BASE / (clk_cdiv + 1); in dw_spi_mid_init()
218 dws->num_cs = 16; in dw_spi_mid_init()
219 dws->fifo_len = 40; /* FIFO has 40 words buffer */ in dw_spi_mid_init()
222 dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL); in dw_spi_mid_init()
223 if (!dws->dma_priv) in dw_spi_mid_init()
225 dws->dma_ops = &mid_dma_ops; in dw_spi_mid_init()