From: Rohit Hassan Sathyanarayan Date: Fri, 23 Jul 2010 06:59:25 +0000 (+0530) Subject: mtd: onenand:fix for page addr calculation based on device type X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=42b0aab1cc30b2fa7e0a99b832bd1b5c9b59757d;p=linux-beck.git mtd: onenand:fix for page addr calculation based on device type 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 Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 26caf2590dae..f749935f3cb5 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;