From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekon Gupta Date: Fri, 14 Feb 2014 22:31:47 +0530 Subject: [U-Boot] [PATCH v2 2/3] mtd: nand: omap: fix ecclayout->oobfree->length In-Reply-To: <1392397308-17630-1-git-send-email-pekon@ti.com> References: <1392397308-17630-1-git-send-email-pekon@ti.com> Message-ID: <1392397308-17630-3-git-send-email-pekon@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de ECC layout of some ecc-schemes expect a 'reserve-marker' as specific byte-position in OOB. But current calculation of oobfree->length does not consider that for all ecc-schemes. But in general, for all ecc-schems, OOB bytes from oobfree->offset till end of OOB region are unused. So this patch fixes oobfree->length calculation. Signed-off-by: Pekon Gupta --- drivers/mtd/nand/omap2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 874fd9d..433e58a 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1977,9 +1977,8 @@ static int omap_nand_probe(struct platform_device *pdev) goto return_error; } - /* populate remaining ECC layout data */ - ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + - ecclayout->eccbytes); + /* all OOB bytes from oobfree->offset till end off OOB are free */ + ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; for (i = 1; i < ecclayout->eccbytes; i++) ecclayout->eccpos[i] = ecclayout->eccpos[0] + i; /* check if NAND device's OOB is enough to store ECC signatures */ -- 1.8.5.1.163.gd7aced9