From patchwork Fri Feb 14 17:01:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pekon gupta X-Patchwork-Id: 320488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A25732C00AC for ; Sat, 15 Feb 2014 04:03:04 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E91C34B6BD; Fri, 14 Feb 2014 18:03:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AGdOCjtCZvRx; Fri, 14 Feb 2014 18:03:00 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6F87C4B6B1; Fri, 14 Feb 2014 18:02:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7245B4B6B1 for ; Fri, 14 Feb 2014 18:02:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hRh8MtSivtd0 for ; Fri, 14 Feb 2014 18:02:46 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by theia.denx.de (Postfix) with ESMTPS id 6A45A4B6AD for ; Fri, 14 Feb 2014 18:02:41 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s1EH2WMG028446; Fri, 14 Feb 2014 11:02:32 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1EH2WZp001847; Fri, 14 Feb 2014 11:02:32 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 14 Feb 2014 11:02:31 -0600 Received: from psplinux063.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1EH2Num003160; Fri, 14 Feb 2014 11:02:29 -0600 From: Pekon Gupta To: Brian Norris , Artem Bityutskiy Date: Fri, 14 Feb 2014 22:31:47 +0530 Message-ID: <1392397308-17630-3-git-send-email-pekon@ti.com> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1392397308-17630-1-git-send-email-pekon@ti.com> References: <1392397308-17630-1-git-send-email-pekon@ti.com> MIME-Version: 1.0 Cc: Felipe@theia.denx.de, Stefan@theia.denx.de, Balbi , u-boot@lists.denx.de, Enric Balletbo Serra , linux-mtd , Roese Subject: [U-Boot] [PATCH v2 2/3] mtd: nand: omap: fix ecclayout->oobfree->length X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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 */