public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Matthieu CASTET <matthieu.castet@parrot.fr>
To: linux-mtd@lists.infradead.org
Cc: Ben Dooks <ben-fbdev@fluff.org>
Subject: [PATCH] S3C2412 fix hw ecc
Date: Tue, 13 Feb 2007 12:30:38 +0100	[thread overview]
Message-ID: <45D1A15E.5030109@parrot.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hi,

S3C2412 use differents registers than s3c2440 for hw ecc handling.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.fr>




[-- Attachment #2: 2412_ecc --]
[-- Type: text/plain, Size: 1719 bytes --]

Index: linux-2.6.20/drivers/mtd/nand/s3c2410.c
===================================================================
--- linux-2.6.20.orig/drivers/mtd/nand/s3c2410.c	2007-02-13 10:17:54.000000000 +0100
+++ linux-2.6.20/drivers/mtd/nand/s3c2410.c	2007-02-13 12:07:10.000000000 +0100
@@ -419,6 +419,15 @@
 	writel(ctrl, info->regs + S3C2410_NFCONF);
 }
 
+static void s3c2412_nand_enable_hwecc(struct mtd_info *mtd, int mode)
+{
+	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
+	unsigned long ctrl;
+
+	ctrl = readl(info->regs + S3C2440_NFCONT);
+	writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC, info->regs + S3C2440_NFCONT);
+}
+
 static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
 	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
@@ -442,6 +451,20 @@
 	return 0;
 }
 
+static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
+{
+	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
+	unsigned long ecc = readl(info->regs + S3C2412_NFMECC0);
+
+	ecc_code[0] = ecc;
+	ecc_code[1] = ecc >> 8;
+	ecc_code[2] = ecc >> 16;
+
+	pr_debug("calculate_ecc: returning ecc %02x,%02x,%02x\n", ecc_code[0], ecc_code[1], ecc_code[2]);
+
+	return 0;
+}
+
 static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
 {
 	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
@@ -619,6 +642,10 @@
 			break;
 
 		case TYPE_S3C2412:
+  			chip->ecc.hwctl     = s3c2412_nand_enable_hwecc;
+  			chip->ecc.calculate = s3c2412_nand_calculate_ecc;
+			break;
+
 		case TYPE_S3C2440:
   			chip->ecc.hwctl     = s3c2440_nand_enable_hwecc;
   			chip->ecc.calculate = s3c2440_nand_calculate_ecc;


             reply	other threads:[~2007-02-13 11:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13 11:30 Matthieu CASTET [this message]
2007-02-13 11:45 ` [PATCH] S3C2412 fix hw ecc Ben Dooks

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=45D1A15E.5030109@parrot.fr \
    --to=matthieu.castet@parrot.fr \
    --cc=ben-fbdev@fluff.org \
    --cc=linux-mtd@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