From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Juergen Beisert <juergen@kreuzholzen.de>
Subject: [PATCH 05/20] MACH-S3C2440: Fix NAND controller for this CPU
Date: Wed, 16 Feb 2011 19:13:30 +0100 [thread overview]
Message-ID: <1297880025-7184-6-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1297880025-7184-1-git-send-email-jbe@pengutronix.de>
From: Juergen Beisert <juergen@kreuzholzen.de>
There are a few but important differences in S3C2410 and S3C2440. This patch
fixes them for the S3C2440 CPU.
Signed-off-by: Juergen Beisert <juergen@kreuzholzen.de>
---
drivers/mtd/nand/nand_s3c2410.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/nand_s3c2410.c b/drivers/mtd/nand/nand_s3c2410.c
index 8a47dc6..76ea9db 100644
--- a/drivers/mtd/nand/nand_s3c2410.c
+++ b/drivers/mtd/nand/nand_s3c2410.c
@@ -77,14 +77,13 @@
#define NFCMD 0x08
#define NFADDR 0x0C
#define NFDATA 0x10
-
-#define NFECC 0x1C
#define NFSTAT 0x20
+#define NFECC 0x2C
/* S3C2440 specific bits */
#define NFSTAT_BUSY (1)
#define NFCONT_nFCE (1 << 1)
-#define NFCONF_INITECC (1 << 12)
+#define NFCONT_INITECC (1 << 4)
#define NFCONT_EN (1)
#endif /* CONFIG_CPU_S3C2440 */
@@ -272,7 +271,12 @@ static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
struct nand_chip *nand_chip = mtd->priv;
struct s3c24x0_nand_host *host = nand_chip->priv;
+#ifdef CONFIG_CPU_S3C2410
writel(readl(host->base + NFCONF) | NFCONF_INITECC , host->base + NFCONF);
+#endif
+#ifdef CONFIG_CPU_S3C2440
+ writel(readl(host->base + NFCONT) | NFCONT_INITECC , host->base + NFCONT);
+#endif
}
static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code)
@@ -280,10 +284,18 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
struct nand_chip *nand_chip = mtd->priv;
struct s3c24x0_nand_host *host = nand_chip->priv;
+#ifdef CONFIG_CPU_S3C2410
ecc_code[0] = readb(host->base + NFECC);
ecc_code[1] = readb(host->base + NFECC + 1);
ecc_code[2] = readb(host->base + NFECC + 2);
+#endif
+#ifdef CONFIG_CPU_S3C2440
+ unsigned long ecc = readl(host->base + NFECC);
+ ecc_code[0] = ecc;
+ ecc_code[1] = ecc >> 8;
+ ecc_code[2] = ecc >> 16;
+#endif
return 0;
}
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-02-16 18:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-16 18:13 [PATCH v2] Booting from NAND for the mini2440 platform Juergen Beisert
2011-02-16 18:13 ` [PATCH 01/20] S3C24xx: Just remove a trailing whitespace Juergen Beisert
2011-02-16 18:13 ` [PATCH 02/20] MACH-S3C24XX: Fix typo in UART2_SIZE macro Juergen Beisert
2011-02-16 18:13 ` [PATCH 03/20] MACH-S3C24XX: Change detection method of the second SDRAM bank Juergen Beisert
2011-02-16 18:13 ` [PATCH 04/20] MACH-S3C24XX: Add support for flash based BBT Juergen Beisert
2011-02-16 18:13 ` Juergen Beisert [this message]
2011-02-16 18:13 ` [PATCH 06/20] MACH-S3C2440: Speed up NAND controller for this CPU Juergen Beisert
2011-02-16 18:13 ` [PATCH 07/20] mini2440: Be a little be pedantic with the include file order Juergen Beisert
2011-02-16 18:13 ` [PATCH 08/20] mini2440: Fix a runtime warning when '.id=0' is used Juergen Beisert
2011-02-16 18:13 ` [PATCH 09/20] mini2440: Add some useful documentation Juergen Beisert
2011-02-16 18:13 ` [PATCH 10/20] mini2440: Add PLL settings Juergen Beisert
2011-02-16 18:13 ` [PATCH 11/20] mini2440: Add SDRAM config settings Juergen Beisert
2011-02-16 18:13 ` [PATCH 12/20] mini2440: Configure debug UART pins very early Juergen Beisert
2011-02-16 18:13 ` [PATCH 13/20] mini2440: Add SDRAM size autodetection Juergen Beisert
2011-02-16 18:13 ` [PATCH 14/20] mini2440: Add GPIO settings Juergen Beisert
2011-02-16 18:13 ` [PATCH 15/20] mini2440: Add MCI support Juergen Beisert
2011-02-16 18:13 ` [PATCH 16/20] mini2440: Make it able to save a runtime environment Juergen Beisert
2011-02-16 18:13 ` [PATCH 17/20] mini2440: Use a flash based BBT as the kernel also does Juergen Beisert
2011-02-16 18:13 ` [PATCH 18/20] mini2440: Add booting from NAND support Juergen Beisert
2011-02-16 18:13 ` [PATCH 19/20] mini2440: Remove some A9M2440 platform leftovers Juergen Beisert
2011-02-16 18:13 ` [PATCH 20/20] mini2440: Use generic environment Juergen Beisert
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=1297880025-7184-6-git-send-email-jbe@pengutronix.de \
--to=jbe@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=juergen@kreuzholzen.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