AT91SAM9260EK: Handle 8 or 16 bit NAND
authorStelian Pop <stelian@popies.net>
Thu, 8 May 2008 18:52:18 +0000 (20:52 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sat, 10 May 2008 09:32:07 +0000 (11:32 +0200)
The Atmel boards can handle 8 or 16 bit NAND memories. This patch
makes the support configurable in the board config header file
(CFG_NAND_DBW_8 or CFG_NAND_DBW_16).

Signed-off-by: Stelian Pop <stelian@popies.net>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
board/atmel/at91sam9260ek/at91sam9260ek.c
board/atmel/at91sam9260ek/nand.c
include/configs/at91sam9260ek.h

index 21479acab4babbd660335b149aaa58a85391e2cd..4635f0fb7c442ff418e6d6ec3ba8b3059e17b91e 100644 (file)
@@ -90,7 +90,12 @@ static void at91sam9260ek_nand_hw_init(void)
        at91_sys_write(AT91_SMC_MODE(3),
                       AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
                       AT91_SMC_EXNWMODE_DISABLE |
-                      AT91_SMC_DBW_8 | AT91_SMC_TDF_(2));
+#ifdef CFG_NAND_DBW_16
+                      AT91_SMC_DBW_16 |
+#else /* CFG_NAND_DBW_8 */
+                      AT91_SMC_DBW_8 |
+#endif
+                      AT91_SMC_TDF_(2));
 
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
 
index 7c1e6abd9a3c70eb60aee8958cf632ed351207ec..9738f0fd48a8576b5e0b06db212fc59ab29c5a2e 100644 (file)
@@ -68,6 +68,9 @@ static int at91sam9260ek_nand_ready(struct mtd_info *mtd)
 int board_nand_init(struct nand_chip *nand)
 {
        nand->eccmode = NAND_ECC_SOFT;
+#ifdef CFG_NAND_DBW_16
+       nand->options = NAND_BUSWIDTH_16;
+#endif
        nand->hwcontrol = at91sam9260ek_nand_hwcontrol;
        nand->dev_ready = at91sam9260ek_nand_ready;
        nand->chip_delay = 20;
index 41c418f9aba331413c0a9e7314351ac5ca561917..784b9e5e634709f9d2fa86e0887904f7775a146b 100644 (file)
 #define NAND_MAX_CHIPS                 1
 #define CFG_MAX_NAND_DEVICE            1
 #define CFG_NAND_BASE                  0x40000000
+#define CFG_NAND_DBW_8                 1
 
 /* NOR flash - no real flash on this board */
 #define CFG_NO_FLASH                   1