mtd: nand: omap: fix ecclayout->oobfree->offset
authorPekon Gupta <pekon@ti.com>
Mon, 17 Feb 2014 07:41:24 +0000 (13:11 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 06:06:25 +0000 (22:06 -0800)
commitd98b58586fe428e08c43fa33081974a5961ddbf1
treef95f1121ed70d47d9fe2f0ffea276c9a0cb9e4fb
parentaae6284e65491176f0e3de397162b8167fa0b4b6
mtd: nand: omap: fix ecclayout->oobfree->offset

commit aa6092f9835893290e77c3e24649def49dac1583 upstream.

1) In current implementation, ecclayout->oobfree->offset is calculated with
 respect to ecclayout->eccpos[0] which is incorrect because ECC bytes may not
 be stored contiguously in OOB.
 So, this patch calculates ecclayout->oobfree->offset with respect to last
 ECC byte-position 'eccpos[ecclayout->eccbytes-1]'.

2) ECC layout of some ecc-schemes expects reserved-markers at specific eccpos[]
 which should not be over-written by any file-system metadata.
 So this patch aligns oobfree->offset taking into account of such markers.

Tested-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/omap2.c