mtd: onenand:fix for page addr calculation based on device type
authorRohit Hassan Sathyanarayan <rohit.hs@samsung.com>
Fri, 23 Jul 2010 06:59:25 +0000 (12:29 +0530)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 2 Aug 2010 08:10:09 +0000 (09:10 +0100)
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>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/onenand/onenand_base.c

index 26caf2590dae1c55ee161f64854c467934164f95..f749935f3cb53d7ff910a24b521eb02656f845b7 100644 (file)
@@ -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;