diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-01-25 05:18:26 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-31 01:27:19 -0500 |
commit | 5ed04b8575cb22920b1333aeb55121339449048f (patch) | |
tree | 4931e3f65f92da16a1967263b4c0f3623cce144d /drivers/dma/ste_dma40_ll.c | |
parent | e24b36bdf873b4a64545fd66da13877214d235cf (diff) |
dma40: unify d40_log_sg_to_lli funcs for mem and slave
Acked-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ste_dma40_ll.c')
-rw-r--r-- | drivers/dma/ste_dma40_ll.c | 63 |
1 files changed, 12 insertions, 51 deletions
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c index fa6c3ab93fae..9935c6dbcfe0 100644 --- a/drivers/dma/ste_dma40_ll.c +++ b/drivers/dma/ste_dma40_ll.c | |||
@@ -369,53 +369,6 @@ static void d40_log_fill_lli(struct d40_log_lli *lli, | |||
369 | 369 | ||
370 | } | 370 | } |
371 | 371 | ||
372 | int d40_log_sg_to_dev(struct scatterlist *sg, | ||
373 | int sg_len, | ||
374 | struct d40_log_lli_bidir *lli, | ||
375 | struct d40_def_lcsp *lcsp, | ||
376 | u32 src_data_width, | ||
377 | u32 dst_data_width, | ||
378 | enum dma_data_direction direction, | ||
379 | dma_addr_t dev_addr) | ||
380 | { | ||
381 | int total_size = 0; | ||
382 | struct scatterlist *current_sg = sg; | ||
383 | int i; | ||
384 | struct d40_log_lli *lli_src = lli->src; | ||
385 | struct d40_log_lli *lli_dst = lli->dst; | ||
386 | |||
387 | for_each_sg(sg, current_sg, sg_len, i) { | ||
388 | dma_addr_t sg_addr = sg_dma_address(current_sg); | ||
389 | unsigned int len = sg_dma_len(current_sg); | ||
390 | dma_addr_t src; | ||
391 | dma_addr_t dst; | ||
392 | |||
393 | total_size += len; | ||
394 | |||
395 | if (direction == DMA_TO_DEVICE) { | ||
396 | src = sg_addr; | ||
397 | dst = dev_addr; | ||
398 | } else { | ||
399 | src = dev_addr; | ||
400 | dst = sg_addr; | ||
401 | } | ||
402 | |||
403 | lli_src = d40_log_buf_to_lli(lli_src, src, len, | ||
404 | lcsp->lcsp1, | ||
405 | src_data_width, | ||
406 | dst_data_width, | ||
407 | src == sg_addr); | ||
408 | |||
409 | lli_dst = d40_log_buf_to_lli(lli_dst, dst, len, | ||
410 | lcsp->lcsp3, | ||
411 | dst_data_width, | ||
412 | src_data_width, | ||
413 | dst == sg_addr); | ||
414 | } | ||
415 | |||
416 | return total_size; | ||
417 | } | ||
418 | |||
419 | struct d40_log_lli *d40_log_buf_to_lli(struct d40_log_lli *lli_sg, | 372 | struct d40_log_lli *d40_log_buf_to_lli(struct d40_log_lli *lli_sg, |
420 | dma_addr_t addr, | 373 | dma_addr_t addr, |
421 | int size, | 374 | int size, |
@@ -447,6 +400,7 @@ struct d40_log_lli *d40_log_buf_to_lli(struct d40_log_lli *lli_sg, | |||
447 | 400 | ||
448 | int d40_log_sg_to_lli(struct scatterlist *sg, | 401 | int d40_log_sg_to_lli(struct scatterlist *sg, |
449 | int sg_len, | 402 | int sg_len, |
403 | dma_addr_t dev_addr, | ||
450 | struct d40_log_lli *lli_sg, | 404 | struct d40_log_lli *lli_sg, |
451 | u32 lcsp13, /* src or dst*/ | 405 | u32 lcsp13, /* src or dst*/ |
452 | u32 data_width1, u32 data_width2) | 406 | u32 data_width1, u32 data_width2) |
@@ -455,14 +409,21 @@ int d40_log_sg_to_lli(struct scatterlist *sg, | |||
455 | struct scatterlist *current_sg = sg; | 409 | struct scatterlist *current_sg = sg; |
456 | int i; | 410 | int i; |
457 | struct d40_log_lli *lli = lli_sg; | 411 | struct d40_log_lli *lli = lli_sg; |
412 | bool autoinc = !dev_addr; | ||
458 | 413 | ||
459 | for_each_sg(sg, current_sg, sg_len, i) { | 414 | for_each_sg(sg, current_sg, sg_len, i) { |
415 | dma_addr_t sg_addr = sg_dma_address(current_sg); | ||
416 | unsigned int len = sg_dma_len(current_sg); | ||
417 | dma_addr_t addr = dev_addr ?: sg_addr; | ||
418 | |||
460 | total_size += sg_dma_len(current_sg); | 419 | total_size += sg_dma_len(current_sg); |
461 | lli = d40_log_buf_to_lli(lli, | 420 | |
462 | sg_dma_address(current_sg), | 421 | lli = d40_log_buf_to_lli(lli, addr, len, |
463 | sg_dma_len(current_sg), | ||
464 | lcsp13, | 422 | lcsp13, |
465 | data_width1, data_width2, true); | 423 | data_width1, |
424 | data_width2, | ||
425 | autoinc); | ||
466 | } | 426 | } |
427 | |||
467 | return total_size; | 428 | return total_size; |
468 | } | 429 | } |