aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2011-02-08 07:03:12 -0500
committerGrant Likely <grant.likely@secretlab.ca>2011-02-15 17:09:00 -0500
commitecd442fd9e388a31d382a62fb43e851048c282e1 (patch)
treeb0b872742d1a4c30e46a35ebe89d96548021ec91 /drivers/spi
parentea3065df7ddffe4669136619ad712783ccee22c6 (diff)
spi/pl022: use dmaengine helper macros
This simplifies the DMA code a bit by using the dmaengine helpers. The cookie from descriptor submission can be ignored in this case as has been established in review of the MMCI/PL180 driver. Cc: Dan Williams <dan.j.williams@intel.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/amba-pl022.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 71a1219a995d..4220aad42840 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -917,7 +917,6 @@ static int configure_dma(struct pl022 *pl022)
917 struct dma_chan *txchan = pl022->dma_tx_channel; 917 struct dma_chan *txchan = pl022->dma_tx_channel;
918 struct dma_async_tx_descriptor *rxdesc; 918 struct dma_async_tx_descriptor *rxdesc;
919 struct dma_async_tx_descriptor *txdesc; 919 struct dma_async_tx_descriptor *txdesc;
920 dma_cookie_t cookie;
921 920
922 /* Check that the channels are available */ 921 /* Check that the channels are available */
923 if (!rxchan || !txchan) 922 if (!rxchan || !txchan)
@@ -962,10 +961,8 @@ static int configure_dma(struct pl022 *pl022)
962 tx_conf.dst_addr_width = rx_conf.src_addr_width; 961 tx_conf.dst_addr_width = rx_conf.src_addr_width;
963 BUG_ON(rx_conf.src_addr_width != tx_conf.dst_addr_width); 962 BUG_ON(rx_conf.src_addr_width != tx_conf.dst_addr_width);
964 963
965 rxchan->device->device_control(rxchan, DMA_SLAVE_CONFIG, 964 dmaengine_slave_config(rxchan, &rx_conf);
966 (unsigned long) &rx_conf); 965 dmaengine_slave_config(txchan, &tx_conf);
967 txchan->device->device_control(txchan, DMA_SLAVE_CONFIG,
968 (unsigned long) &tx_conf);
969 966
970 /* Create sglists for the transfers */ 967 /* Create sglists for the transfers */
971 pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1; 968 pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1;
@@ -1018,23 +1015,19 @@ static int configure_dma(struct pl022 *pl022)
1018 rxdesc->callback_param = pl022; 1015 rxdesc->callback_param = pl022;
1019 1016
1020 /* Submit and fire RX and TX with TX last so we're ready to read! */ 1017 /* Submit and fire RX and TX with TX last so we're ready to read! */
1021 cookie = rxdesc->tx_submit(rxdesc); 1018 dmaengine_submit(rxdesc);
1022 if (dma_submit_error(cookie)) 1019 dmaengine_submit(txdesc);
1023 goto err_submit_rx; 1020 dma_async_issue_pending(rxchan);
1024 cookie = txdesc->tx_submit(txdesc); 1021 dma_async_issue_pending(txchan);
1025 if (dma_submit_error(cookie))
1026 goto err_submit_tx;
1027 rxchan->device->device_issue_pending(rxchan);
1028 txchan->device->device_issue_pending(txchan);
1029 1022
1030 return 0; 1023 return 0;
1031 1024
1032err_submit_tx: 1025err_submit_tx:
1033err_submit_rx: 1026err_submit_rx:
1034err_txdesc: 1027err_txdesc:
1035 txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0); 1028 dmaengine_terminate_all(txchan);
1036err_rxdesc: 1029err_rxdesc:
1037 rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0); 1030 dmaengine_terminate_all(rxchan);
1038 dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl, 1031 dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
1039 pl022->sgt_tx.nents, DMA_TO_DEVICE); 1032 pl022->sgt_tx.nents, DMA_TO_DEVICE);
1040err_tx_sgmap: 1033err_tx_sgmap:
@@ -1101,8 +1094,8 @@ static void terminate_dma(struct pl022 *pl022)
1101 struct dma_chan *rxchan = pl022->dma_rx_channel; 1094 struct dma_chan *rxchan = pl022->dma_rx_channel;
1102 struct dma_chan *txchan = pl022->dma_tx_channel; 1095 struct dma_chan *txchan = pl022->dma_tx_channel;
1103 1096
1104 rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0); 1097 dmaengine_terminate_all(rxchan);
1105 txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0); 1098 dmaengine_terminate_all(txchan);
1106 unmap_free_dma_scatter(pl022); 1099 unmap_free_dma_scatter(pl022);
1107} 1100}
1108 1101