diff options
author | Mika Westerberg <ext-mika.1.westerberg@nokia.com> | 2010-03-24 06:10:48 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-10 09:17:05 -0400 |
commit | 4a70b7d3953c279738a094d2e5ffe7c66b15a5d0 (patch) | |
tree | d791145ce49044b85b0e782f22b8046b8ba76422 /drivers/mtd/onenand | |
parent | ac39ee304ac33f15107e42adb5ee5b0d0ce2dc4a (diff) |
mtd: OneNAND: OMAP2/3: unmap correct DMA buffer
Functions omap2_onenand_write_bufferram() and omap3_onenand_write_bufferram()
map the write buffer and store the returned handle in variable dma_src. However,
when DMA unmap is done, variable dma_dst is used instead of the correct dma_src.
This patch fixes them to use the correct DMA buffer.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Acked-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index dfbab6c72b74..f52934c7eb05 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -402,7 +402,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area, | |||
402 | 402 | ||
403 | dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE); | 403 | dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE); |
404 | dma_dst = c->phys_base + bram_offset; | 404 | dma_dst = c->phys_base + bram_offset; |
405 | if (dma_mapping_error(&c->pdev->dev, dma_dst)) { | 405 | if (dma_mapping_error(&c->pdev->dev, dma_src)) { |
406 | dev_err(&c->pdev->dev, | 406 | dev_err(&c->pdev->dev, |
407 | "Couldn't DMA map a %d byte buffer\n", | 407 | "Couldn't DMA map a %d byte buffer\n", |
408 | count); | 408 | count); |
@@ -425,7 +425,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area, | |||
425 | if (*done) | 425 | if (*done) |
426 | break; | 426 | break; |
427 | 427 | ||
428 | dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE); | 428 | dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE); |
429 | 429 | ||
430 | if (!*done) { | 430 | if (!*done) { |
431 | dev_err(&c->pdev->dev, "timeout waiting for DMA\n"); | 431 | dev_err(&c->pdev->dev, "timeout waiting for DMA\n"); |
@@ -520,7 +520,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, | |||
520 | dma_src = dma_map_single(&c->pdev->dev, (void *) buffer, count, | 520 | dma_src = dma_map_single(&c->pdev->dev, (void *) buffer, count, |
521 | DMA_TO_DEVICE); | 521 | DMA_TO_DEVICE); |
522 | dma_dst = c->phys_base + bram_offset; | 522 | dma_dst = c->phys_base + bram_offset; |
523 | if (dma_mapping_error(&c->pdev->dev, dma_dst)) { | 523 | if (dma_mapping_error(&c->pdev->dev, dma_src)) { |
524 | dev_err(&c->pdev->dev, | 524 | dev_err(&c->pdev->dev, |
525 | "Couldn't DMA map a %d byte buffer\n", | 525 | "Couldn't DMA map a %d byte buffer\n", |
526 | count); | 526 | count); |
@@ -538,7 +538,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, | |||
538 | omap_start_dma(c->dma_channel); | 538 | omap_start_dma(c->dma_channel); |
539 | wait_for_completion(&c->dma_done); | 539 | wait_for_completion(&c->dma_done); |
540 | 540 | ||
541 | dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE); | 541 | dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE); |
542 | 542 | ||
543 | return 0; | 543 | return 0; |
544 | } | 544 | } |