Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pekon Gupta <pekon@ti.com>
To: Brian Norris <computersforpeace@gmail.com>,
	Artem Bityutskiy <dedekind1@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>,
	u-boot@lists.denx.de,
	Enric Balletbo Serra <eballetbo@iseebcn.com>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Pekon Gupta <pekon@ti.com>, Stefan Roese <sr@denx.de>
Subject: [PATCH v2 2/3] mtd: nand: omap: fix ecclayout->oobfree->length
Date: Fri, 14 Feb 2014 22:31:47 +0530	[thread overview]
Message-ID: <1392397308-17630-3-git-send-email-pekon@ti.com> (raw)
In-Reply-To: <1392397308-17630-1-git-send-email-pekon@ti.com>

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 <pekon@ti.com>
---
 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

  parent reply	other threads:[~2014-02-14 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 17:01 [PATCH v2 0/3] mtd: nand: omap: fix ecc-layout Pekon Gupta
2014-02-14 17:01 ` [PATCH v2 1/3] mtd: nand: omap: fix ecclayout->oobfree->offset Pekon Gupta
2014-02-14 18:59   ` Brian Norris
2014-02-14 17:01 ` Pekon Gupta [this message]
2014-02-14 17:01 ` [PATCH v2 3/3] mtd: nand: omap: fix ecclayout to be in sync with u-boot NAND driver Pekon Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392397308-17630-3-git-send-email-pekon@ti.com \
    --to=pekon@ti.com \
    --cc=balbi@ti.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=eballetbo@iseebcn.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox