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

login
register
mail settings
Submitter Kyungmin Park
Date Nov. 2, 2010, 1:28 a.m.
Message ID <20101102012846.GA2470@july>
Download mbox | patch
Permalink /patch/69857/
State New
Headers show

Comments

Kyungmin Park - Nov. 2, 2010, 1:28 a.m.
From: Kyungmin Park <kyungmin.park@samsung.com>

When use the 2KiB pagesize, it should be set the correct page offset.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Artem Bityutskiy - Nov. 13, 2010, 10:51 a.m.
On Tue, 2010-11-02 at 10:28 +0900, Kyungmin Park wrote:
> From: Kyungmin Park <kyungmin.park@samsung.com>
> 
> When use the 2KiB pagesize, it should be set the correct page offset.
> 
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Pushed to l2-mtd-2.6.git, thank you.

Patch

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);