aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/async_tx/async_memcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/async_tx/async_memcpy.c')
-rw-r--r--crypto/async_tx/async_memcpy.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/crypto/async_tx/async_memcpy.c b/crypto/async_tx/async_memcpy.c
index 047e533fcc5b..0f6282207b32 100644
--- a/crypto/async_tx/async_memcpy.c
+++ b/crypto/async_tx/async_memcpy.c
@@ -35,7 +35,7 @@
35 * @src: src page 35 * @src: src page
36 * @offset: offset in pages to start transaction 36 * @offset: offset in pages to start transaction
37 * @len: length in bytes 37 * @len: length in bytes
38 * @flags: ASYNC_TX_ASSUME_COHERENT, ASYNC_TX_ACK, ASYNC_TX_DEP_ACK, 38 * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK,
39 * @depend_tx: memcpy depends on the result of this transaction 39 * @depend_tx: memcpy depends on the result of this transaction
40 * @cb_fn: function to call when the memcpy completes 40 * @cb_fn: function to call when the memcpy completes
41 * @cb_param: parameter to pass to the callback routine 41 * @cb_param: parameter to pass to the callback routine
@@ -46,33 +46,29 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
46 struct dma_async_tx_descriptor *depend_tx, 46 struct dma_async_tx_descriptor *depend_tx,
47 dma_async_tx_callback cb_fn, void *cb_param) 47 dma_async_tx_callback cb_fn, void *cb_param)
48{ 48{
49 struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMCPY); 49 struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMCPY,
50 &dest, 1, &src, 1, len);
50 struct dma_device *device = chan ? chan->device : NULL; 51 struct dma_device *device = chan ? chan->device : NULL;
51 int int_en = cb_fn ? 1 : 0; 52 struct dma_async_tx_descriptor *tx = NULL;
52 struct dma_async_tx_descriptor *tx = device ?
53 device->device_prep_dma_memcpy(chan, len,
54 int_en) : NULL;
55 53
56 if (tx) { /* run the memcpy asynchronously */ 54 if (device) {
57 dma_addr_t addr; 55 dma_addr_t dma_dest, dma_src;
58 enum dma_data_direction dir; 56 unsigned long dma_prep_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;
59 57
60 pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len); 58 dma_dest = dma_map_page(device->dev, dest, dest_offset, len,
61 59 DMA_FROM_DEVICE);
62 dir = (flags & ASYNC_TX_ASSUME_COHERENT) ?
63 DMA_NONE : DMA_FROM_DEVICE;
64
65 addr = dma_map_page(device->dev, dest, dest_offset, len, dir);
66 tx->tx_set_dest(addr, tx, 0);
67 60
68 dir = (flags & ASYNC_TX_ASSUME_COHERENT) ? 61 dma_src = dma_map_page(device->dev, src, src_offset, len,
69 DMA_NONE : DMA_TO_DEVICE; 62 DMA_TO_DEVICE);
70 63
71 addr = dma_map_page(device->dev, src, src_offset, len, dir); 64 tx = device->device_prep_dma_memcpy(chan, dma_dest, dma_src,
72 tx->tx_set_src(addr, tx, 0); 65 len, dma_prep_flags);
66 }
73 67
68 if (tx) {
69 pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
74 async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param); 70 async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
75 } else { /* run the memcpy synchronously */ 71 } else {
76 void *dest_buf, *src_buf; 72 void *dest_buf, *src_buf;
77 pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len); 73 pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len);
78 74