aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:42:53 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:42:53 -0400
commit83544ae9f3991bfc7d5e0fe9a3008cd05a8d57b7 (patch)
treebc4b28c2e5bdae01a2c8a250176fcdac6ae7a8ce /drivers/dma
parent9308add6ea4fedeba37b0d7c4630a542bd34f214 (diff)
dmaengine, async_tx: support alignment checks
Some engines have transfer size and address alignment restrictions. Add a per-operation alignment property to struct dma_device that the async routines and dmatest can use to check alignment capabilities. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmatest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 58e49e41c7a3..a3722a7384b5 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -288,6 +288,7 @@ static int dmatest_func(void *data)
288 dma_addr_t dma_dsts[dst_cnt]; 288 dma_addr_t dma_dsts[dst_cnt];
289 struct completion cmp; 289 struct completion cmp;
290 unsigned long tmo = msecs_to_jiffies(3000); 290 unsigned long tmo = msecs_to_jiffies(3000);
291 u8 align = 0;
291 292
292 total_tests++; 293 total_tests++;
293 294
@@ -295,6 +296,18 @@ static int dmatest_func(void *data)
295 src_off = dmatest_random() % (test_buf_size - len + 1); 296 src_off = dmatest_random() % (test_buf_size - len + 1);
296 dst_off = dmatest_random() % (test_buf_size - len + 1); 297 dst_off = dmatest_random() % (test_buf_size - len + 1);
297 298
299 /* honor alignment restrictions */
300 if (thread->type == DMA_MEMCPY)
301 align = dev->copy_align;
302 else if (thread->type == DMA_XOR)
303 align = dev->xor_align;
304 else if (thread->type == DMA_PQ)
305 align = dev->pq_align;
306
307 len = (len >> align) << align;
308 src_off = (src_off >> align) << align;
309 dst_off = (dst_off >> align) << align;
310
298 dmatest_init_srcs(thread->srcs, src_off, len); 311 dmatest_init_srcs(thread->srcs, src_off, len);
299 dmatest_init_dsts(thread->dsts, dst_off, len); 312 dmatest_init_dsts(thread->dsts, dst_off, len);
300 313
@@ -311,6 +324,7 @@ static int dmatest_func(void *data)
311 DMA_BIDIRECTIONAL); 324 DMA_BIDIRECTIONAL);
312 } 325 }
313 326
327
314 if (thread->type == DMA_MEMCPY) 328 if (thread->type == DMA_MEMCPY)
315 tx = dev->device_prep_dma_memcpy(chan, 329 tx = dev->device_prep_dma_memcpy(chan,
316 dma_dsts[0] + dst_off, 330 dma_dsts[0] + dst_off,