aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorSandeep Paulraj <s-paulraj@ti.com>2009-09-20 13:47:03 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:26 -0500
commitcc93fc3f34552e791e480ac21a17eceb9c0e26f2 (patch)
tree26382d737a5c986bd06fc340c85829b162723d09 /arch/arm/mach-davinci
parentdc4c05a5131d691ccbc06c2e670385127871bdbe (diff)
DaVinci: EDMA: Fix Bug while obtaining contiguous params
The reserve_contiguous_params function is used to reserve a set of contiguous PARAMs. If we do not find a complete set of contiguous PARAMs, the functions still has to free every PARAM that it found to be free in the process of finding a complete set and thus marked as "in use". This patch mainly deals with correctly handling the freeing of PARAMs. Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/dma.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 8eda4c3be940..b097592a862e 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -515,17 +515,30 @@ static int reserve_contiguous_params(int ctlr, unsigned int id,
515{ 515{
516 int i, j; 516 int i, j;
517 unsigned int count = num_params; 517 unsigned int count = num_params;
518 int stop_param = start_param;
519 DECLARE_BITMAP(tmp_inuse, EDMA_MAX_PARAMENTRY);
518 520
519 for (i = start_param; i < edma_info[ctlr]->num_slots; ++i) { 521 for (i = start_param; i < edma_info[ctlr]->num_slots; ++i) {
520 j = EDMA_CHAN_SLOT(i); 522 j = EDMA_CHAN_SLOT(i);
521 if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse)) 523 if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse)) {
524 /* Record our current beginning slot */
525 if (count == num_params)
526 stop_param = i;
527
522 count--; 528 count--;
529 set_bit(j, tmp_inuse);
530
523 if (count == 0) 531 if (count == 0)
524 break; 532 break;
525 else if (id == EDMA_CONT_PARAMS_FIXED_EXACT) 533 } else {
526 break; 534 clear_bit(j, tmp_inuse);
527 else 535
528 count = num_params; 536 if (id == EDMA_CONT_PARAMS_FIXED_EXACT) {
537 stop_param = i;
538 break;
539 } else
540 count = num_params;
541 }
529 } 542 }
530 543
531 /* 544 /*
@@ -534,12 +547,15 @@ static int reserve_contiguous_params(int ctlr, unsigned int id,
534 * of contiguous parameter RAMs but do not find the exact number 547 * of contiguous parameter RAMs but do not find the exact number
535 * requested as we may reach the total number of parameter RAMs 548 * requested as we may reach the total number of parameter RAMs
536 */ 549 */
537 if (count) { 550 if (i == edma_info[ctlr]->num_slots)
538 for (j = i - num_params + count + 1; j <= i ; ++j) 551 stop_param = i;
552
553 for (j = start_param; j < stop_param; j++)
554 if (test_bit(j, tmp_inuse))
539 clear_bit(j, edma_info[ctlr]->edma_inuse); 555 clear_bit(j, edma_info[ctlr]->edma_inuse);
540 556
557 if (count)
541 return -EBUSY; 558 return -EBUSY;
542 }
543 559
544 for (j = i - num_params + 1; j <= i; ++j) 560 for (j = i - num_params + 1; j <= i; ++j)
545 memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(j), 561 memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(j),