mtd: nand: gpmi: get correct free oob space
authorHan Xu <han.xu@nxp.com>
Tue, 12 Apr 2016 22:06:33 +0000 (17:06 -0500)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 23 Sep 2016 07:35:16 +0000 (09:35 +0200)
change the way to calculate pagesize to get correct free oob space for
legacy_set_geometry function.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/gpmi-nand/gpmi-nand.c

index 6e461560c6a8eff68f7b0698c73e332c8f6bf28a..6c062b8251d238ac8155c2a7590eaa2c9ffd2c42 100644 (file)
@@ -318,7 +318,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
                return -EINVAL;
        }
 
-       geo->page_size = mtd->writesize + mtd->oobsize;
+       geo->page_size = mtd->writesize + geo->metadata_size +
+               (geo->gf_len * geo->ecc_strength * geo->ecc_chunk_count) / 8;
        geo->payload_size = mtd->writesize;
 
        /*