Patchwork [MTD] onenand/onenand_base.c:Fix for page addr calculation based on device type

login
register
mail settings
Submitter Rohit Hassan Sathyanarayan
Date July 23, 2010, 6:59 a.m.
Message ID <000401cb2a34$974af890$c5e0e9b0$%hs@samsung.com>
Download mbox | patch
Permalink /patch/59738/
State New
Headers show

Comments

Rohit Hassan Sathyanarayan - July 23, 2010, 6:59 a.m.
Hi all

Sending the patch for page address calculation based on device type. This resolves the 
OneNAND DDP device read problem as pointed by Enric.
http://lists.infradead.org/pipermail/linux-mtd/2010-July/030920.html


Signed-off-by: Rohit HS <rohit.hs@samsung.com>
---
drivers/mtd/onenand/onenand_base.c |    7 +++++--
1 file changed, 3 insertions(+)

---
Artem Bityutskiy - July 26, 2010, 5:31 a.m.
On Fri, 2010-07-23 at 12:29 +0530, Rohit Hassan Sathyanarayan wrote:
> Hi all
> 
> Sending the patch for page address calculation based on device type. This resolves the 
> OneNAND DDP device read problem as pointed by Enric.
> http://lists.infradead.org/pipermail/linux-mtd/2010-July/030920.html
> 
> 
> Signed-off-by: Rohit HS <rohit.hs@samsung.com>

Pushed to l2-mtd-2.6.git / master, thanks!

Patch

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 26caf25..f749935 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -377,8 +377,11 @@  static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le
 
 	default:
 		block = onenand_block(this, addr);
-		page = (int) (addr - onenand_addr(this, block)) >> this->page_shift;
-
+		if (FLEXONENAND(this))
+			page = (int) (addr - onenand_addr(this, block))>>\
+				this->page_shift;
+		else
+			page = (int) (addr >> this->page_shift);
 		if (ONENAND_IS_2PLANE(this)) {
 			/* Make the even block number */
 			block &= ~1;