mtd: OneNAND: Fix page offset handling at 2KiB pagesize

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Dec 3 11:59:02 EST 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=08b3af3092bb2c284796e4e823c5309c2d0a9bca
Commit:     08b3af3092bb2c284796e4e823c5309c2d0a9bca
Parent:     daf05ec00c6e60a2c705820e7f93cbd31c804fe3
Author:     Kyungmin Park <kyungmin.park at samsung.com>
AuthorDate: Tue Nov 2 10:28:46 2010 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Dec 3 16:27:18 2010 +0000

    mtd: OneNAND: Fix page offset handling at 2KiB pagesize
    
    When use the 2KiB pagesize, it should be set the correct page offset.
    
    Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/onenand/samsung.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 0de7a05..a4c74a9 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -651,7 +651,7 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
 	void __iomem *p;
 	void *buf = (void *) buffer;
 	dma_addr_t dma_src, dma_dst;
-	int err, page_dma = 0;
+	int err, ofs, page_dma = 0;
 	struct device *dev = &onenand->pdev->dev;
 
 	p = this->base + area;
@@ -677,10 +677,13 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
 		if (!page)
 			goto normal;
 
+		/* Page offset */
+		ofs = ((size_t) buf & ~PAGE_MASK);
 		page_dma = 1;
+
 		/* DMA routine */
 		dma_src = onenand->phys_base + (p - this->base);
-		dma_dst = dma_map_page(dev, page, 0, count, DMA_FROM_DEVICE);
+		dma_dst = dma_map_page(dev, page, ofs, count, DMA_FROM_DEVICE);
 	} else {
 		/* DMA routine */
 		dma_src = onenand->phys_base + (p - this->base);



More information about the linux-mtd-cvs mailing list