mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/5] nand omap: fix hamming romcode ecc code
Date: Mon, 11 Apr 2011 16:10:32 +0200	[thread overview]
Message-ID: <1302531036-27906-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1302531036-27906-1-git-send-email-s.hauer@pengutronix.de>

This got broken in commit:

6943635 mtd nand omap: make ecc mode runtime configurable

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index 1599603..74ef1ac 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -470,7 +470,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
 	struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand->priv);
 	unsigned int bch_mod = 0, bch_wrapmode = 0, eccsize1 = 0, eccsize0 = 0;
 	unsigned int ecc_conf_val = 0, ecc_size_conf_val = 0;
-	int dev_width = 0;
+	int dev_width = nand->options & NAND_BUSWIDTH_16 ? 0 : 1;
 	int ecc_size = nand->ecc.size;
 	int cs = 0;
 
@@ -508,7 +508,11 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
 	/* clear ecc and enable bits */
 	if (oinfo->ecc_mode == OMAP_ECC_HAMMING_CODE_HW_ROMCODE) {
 		writel(0x00000101, oinfo->gpmc_base + GPMC_ECC_CONTROL);
-		ecc_size_conf_val = (eccsize1 << 22) | 0x0000000F;
+		/* Size 0 = 0xFF, Size1 is 0xFF - both are 512 bytes
+		 * tell all regs to generate size0 sized regs
+		 * we just have a single ECC engine for all CS
+		 */
+		ecc_size_conf_val = 0x3FCFF000;
 		ecc_conf_val = (dev_width << 7) | (cs << 1) | (0x1);
 	} else {
 		writel(0x1, oinfo->gpmc_base + GPMC_ECC_CONTROL);
@@ -557,6 +561,14 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
 	case OMAP_ECC_HAMMING_CODE_HW_ROMCODE:
 		oinfo->nand.ecc.bytes    = 3;
 		oinfo->nand.ecc.size     = 512;
+		oinfo->ecc_parity_pairs  = 12;
+		if (oinfo->nand.options & NAND_BUSWIDTH_16) {
+			offset = 2;
+		} else {
+			offset = 1;
+			oinfo->nand.badblock_pattern = &bb_descrip_flashbased;
+		}
+		omap_oobinfo.eccbytes = 3 * (minfo->oobsize / 16);
 		for (i = 0; i < omap_oobinfo.eccbytes; i++)
 			omap_oobinfo.eccpos[i] = i + offset;
 		omap_oobinfo.oobfree->offset = offset + omap_oobinfo.eccbytes;
@@ -613,8 +625,6 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
 		return -EINVAL;
 	}
 
-	omap_oobinfo.eccbytes = oinfo->nand.ecc.bytes;
-
 	oinfo->ecc_mode = mode;
 
 	if (nand->buffers)
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-04-11 14:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 14:10 omap nand patches Sascha Hauer
2011-04-11 14:10 ` Sascha Hauer [this message]
2011-04-11 14:10 ` [PATCH 2/5] nand omap: turn debug messages into dev_dbg Sascha Hauer
2011-04-11 14:10 ` [PATCH 3/5] nand omap: use standard debug functions Sascha Hauer
2011-04-11 14:10 ` [PATCH 4/5] nand omap: use xzalloc instead of calloc Sascha Hauer
2011-04-11 14:10 ` [PATCH 5/5] nand omap: handle erased pages correctly in hamming ecc mode Sascha Hauer

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=1302531036-27906-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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