aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorKyungmin Park <kyungmin.park@samsung.com>2010-09-28 06:27:10 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 19:51:33 -0400
commitdcf08227e964a53a2cb39130b74842c7dcb6adde (patch)
tree76afbe6cec8de927c0f120beaa0b32eb0675ce2d /drivers/mtd
parentaa6d1c0e15948894978b342da45d91f5a2af9933 (diff)
mtd: OneNAND: S5PC110: Fix wrong DMA handling when HIGHMEM
When use HIGHMEM, dma_map_single doesn't get the proper DMA address. So use the dma_map_page in this case. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/onenand/samsung.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 285085a93c31..afdb4c544132 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -582,7 +582,8 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
582 void __iomem *p; 582 void __iomem *p;
583 void *buf = (void *) buffer; 583 void *buf = (void *) buffer;
584 dma_addr_t dma_src, dma_dst; 584 dma_addr_t dma_src, dma_dst;
585 int err; 585 int err, page_dma = 0;
586 struct device *dev = &onenand->pdev->dev;
586 587
587 p = this->base + area; 588 p = this->base + area;
588 if (ONENAND_CURRENT_BUFFERRAM(this)) { 589 if (ONENAND_CURRENT_BUFFERRAM(this)) {
@@ -606,21 +607,27 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
606 page = vmalloc_to_page(buf); 607 page = vmalloc_to_page(buf);
607 if (!page) 608 if (!page)
608 goto normal; 609 goto normal;
609 buf = page_address(page) + ((size_t) buf & ~PAGE_MASK);
610 }
611 610
612 /* DMA routine */ 611 page_dma = 1;
613 dma_src = onenand->phys_base + (p - this->base); 612 /* DMA routine */
614 dma_dst = dma_map_single(&onenand->pdev->dev, 613 dma_src = onenand->phys_base + (p - this->base);
615 buf, count, DMA_FROM_DEVICE); 614 dma_dst = dma_map_page(dev, page, 0, count, DMA_FROM_DEVICE);
616 if (dma_mapping_error(&onenand->pdev->dev, dma_dst)) { 615 } else {
617 dev_err(&onenand->pdev->dev, 616 /* DMA routine */
618 "Couldn't map a %d byte buffer for DMA\n", count); 617 dma_src = onenand->phys_base + (p - this->base);
618 dma_dst = dma_map_single(dev, buf, count, DMA_FROM_DEVICE);
619 }
620 if (dma_mapping_error(dev, dma_dst)) {
621 dev_err(dev, "Couldn't map a %d byte buffer for DMA\n", count);
619 goto normal; 622 goto normal;
620 } 623 }
621 err = s5pc110_dma_ops((void *) dma_dst, (void *) dma_src, 624 err = s5pc110_dma_ops((void *) dma_dst, (void *) dma_src,
622 count, S5PC110_DMA_DIR_READ); 625 count, S5PC110_DMA_DIR_READ);
623 dma_unmap_single(&onenand->pdev->dev, dma_dst, count, DMA_FROM_DEVICE); 626
627 if (page_dma)
628 dma_unmap_page(dev, dma_dst, count, DMA_FROM_DEVICE);
629 else
630 dma_unmap_single(dev, dma_dst, count, DMA_FROM_DEVICE);
624 631
625 if (!err) 632 if (!err)
626 return 0; 633 return 0;