aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/Kconfig17
-rw-r--r--drivers/mtd/nand/Makefile2
-rw-r--r--drivers/mtd/nand/atmel_nand.c (renamed from drivers/mtd/nand/at91_nand.c)10
-rw-r--r--drivers/mtd/nand/atmel_nand_ecc.h36
4 files changed, 50 insertions, 15 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 7dea6c3a6603..cdd2952c1533 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -271,7 +271,7 @@ config MTD_NAND_CS553X
271 271
272 If you say "m", the module will be called "cs553x_nand.ko". 272 If you say "m", the module will be called "cs553x_nand.ko".
273 273
274config MTD_NAND_AT91 274config MTD_NAND_ATMEL
275 bool "Support for NAND Flash / SmartMedia on AT91" 275 bool "Support for NAND Flash / SmartMedia on AT91"
276 depends on ARCH_AT91 276 depends on ARCH_AT91
277 help 277 help
@@ -279,14 +279,15 @@ config MTD_NAND_AT91
279 on Atmel AT91 processors. 279 on Atmel AT91 processors.
280choice 280choice
281 prompt "ECC management for NAND Flash / SmartMedia on AT91" 281 prompt "ECC management for NAND Flash / SmartMedia on AT91"
282 depends on MTD_NAND_AT91 282 depends on MTD_NAND_ATMEL
283 283
284config MTD_NAND_AT91_ECC_HW 284config MTD_NAND_ATMEL_ECC_HW
285 bool "Hardware ECC" 285 bool "Hardware ECC"
286 depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260 286 depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260
287 help 287 help
288 Uses hardware ECC provided by the at91sam9260/at91sam9263 chip 288 Use hardware ECC instead of software ECC when the chip
289 instead of software ECC. 289 supports it.
290
290 The hardware ECC controller is capable of single bit error 291 The hardware ECC controller is capable of single bit error
291 correction and 2-bit random detection per page. 292 correction and 2-bit random detection per page.
292 293
@@ -296,16 +297,16 @@ config MTD_NAND_AT91_ECC_HW
296 297
297 If unsure, say Y 298 If unsure, say Y
298 299
299config MTD_NAND_AT91_ECC_SOFT 300config MTD_NAND_ATMEL_ECC_SOFT
300 bool "Software ECC" 301 bool "Software ECC"
301 help 302 help
302 Uses software ECC. 303 Use software ECC.
303 304
304 NB : hardware and software ECC schemes are incompatible. 305 NB : hardware and software ECC schemes are incompatible.
305 If you switch from one to another, you'll have to erase your 306 If you switch from one to another, you'll have to erase your
306 mtd partition. 307 mtd partition.
307 308
308config MTD_NAND_AT91_ECC_NONE 309config MTD_NAND_ATMEL_ECC_NONE
309 bool "No ECC (testing only, DANGEROUS)" 310 bool "No ECC (testing only, DANGEROUS)"
310 depends on DEBUG_KERNEL 311 depends on DEBUG_KERNEL
311 help 312 help
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index d95a10c51866..d772581de573 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -23,7 +23,7 @@ obj-$(CONFIG_MTD_NAND_TS7250) += ts7250.o
23obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o 23obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o
24obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o 24obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o
25obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o 25obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o
26obj-$(CONFIG_MTD_NAND_AT91) += at91_nand.o 26obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o
27obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o 27obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o
28obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o 28obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o
29obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o 29obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o
diff --git a/drivers/mtd/nand/at91_nand.c b/drivers/mtd/nand/atmel_nand.c
index 2dcaeeae2068..51b703155db6 100644
--- a/drivers/mtd/nand/at91_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * drivers/mtd/nand/at91_nand.c
3 *
4 * Copyright (C) 2003 Rick Bronson 2 * Copyright (C) 2003 Rick Bronson
5 * 3 *
6 * Derived from drivers/mtd/nand/autcpu12.c 4 * Derived from drivers/mtd/nand/autcpu12.c
@@ -36,13 +34,13 @@
36 34
37#include <asm/arch/board.h> 35#include <asm/arch/board.h>
38 36
39#ifdef CONFIG_MTD_NAND_AT91_ECC_HW 37#ifdef CONFIG_MTD_NAND_ATMEL_ECC_HW
40#define hard_ecc 1 38#define hard_ecc 1
41#else 39#else
42#define hard_ecc 0 40#define hard_ecc 0
43#endif 41#endif
44 42
45#ifdef CONFIG_MTD_NAND_AT91_ECC_NONE 43#ifdef CONFIG_MTD_NAND_ATMEL_ECC_NONE
46#define no_ecc 1 44#define no_ecc 1
47#else 45#else
48#define no_ecc 0 46#define no_ecc 0
@@ -54,7 +52,7 @@
54#define ecc_writel(add, reg, value) \ 52#define ecc_writel(add, reg, value) \
55 __raw_writel((value), add + AT91_ECC_##reg) 53 __raw_writel((value), add + AT91_ECC_##reg)
56 54
57#include <asm/arch/at91_ecc.h> /* AT91SAM9260/3 ECC registers */ 55#include "atmel_nand_ecc.h" /* Hardware ECC registers */
58 56
59/* oob layout for large page size 57/* oob layout for large page size
60 * bad block info is on bytes 0 and 1 58 * bad block info is on bytes 0 and 1
@@ -588,5 +586,5 @@ module_exit(at91_nand_exit);
588 586
589MODULE_LICENSE("GPL"); 587MODULE_LICENSE("GPL");
590MODULE_AUTHOR("Rick Bronson"); 588MODULE_AUTHOR("Rick Bronson");
591MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91RM9200 / AT91SAM9"); 589MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91 / AVR32");
592MODULE_ALIAS("platform:at91_nand"); 590MODULE_ALIAS("platform:at91_nand");
diff --git a/drivers/mtd/nand/atmel_nand_ecc.h b/drivers/mtd/nand/atmel_nand_ecc.h
new file mode 100644
index 000000000000..170db869aacf
--- /dev/null
+++ b/drivers/mtd/nand/atmel_nand_ecc.h
@@ -0,0 +1,36 @@
1/*
2 * Error Corrected Code Controller (ECC) - System peripherals regsters.
3 * Based on AT91SAM9260 datasheet revision B.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef ATMEL_NAND_ECC_H
12#define ATMEL_NAND_ECC_H
13
14#define AT91_ECC_CR 0x00 /* Control register */
15#define AT91_ECC_RST (1 << 0) /* Reset parity */
16
17#define AT91_ECC_MR 0x04 /* Mode register */
18#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */
19#define AT91_ECC_PAGESIZE_528 (0)
20#define AT91_ECC_PAGESIZE_1056 (1)
21#define AT91_ECC_PAGESIZE_2112 (2)
22#define AT91_ECC_PAGESIZE_4224 (3)
23
24#define AT91_ECC_SR 0x08 /* Status register */
25#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */
26#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
27#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */
28
29#define AT91_ECC_PR 0x0c /* Parity register */
30#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */
31#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
32
33#define AT91_ECC_NPR 0x10 /* NParity register */
34#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */
35
36#endif