Signed-off-by: Alessandro Rubini <rub...@gnudd.com>
Cc: Gregory Hermant <gregory.herm...@calao-systems.com>
---
 drivers/mtd/nand/nomadik.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nomadik.c b/drivers/mtd/nand/nomadik.c
index b76f4cb..149f68b 100644
--- a/drivers/mtd/nand/nomadik.c
+++ b/drivers/mtd/nand/nomadik.c
@@ -196,13 +196,20 @@ static void nomadik_nand_read_buf(struct mtd_info *mtd, 
uint8_t *buf, int len)
 
 int board_nand_init(struct nand_chip *chip)
 {
-       /* Set up the FSMC_PCR0 for nand access*/
-       writel(0x0000004a, REG_FSMC_PCR0);
-       /* Set up FSMC_PMEM0, FSMC_PATT0 with timing data for access */
+       u32 pcr0_val;
+
+       chip->options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING;
+       pcr0_val = 0x0000004a; /* Enabled, nand, enable ecc hw */
+
+#ifdef CONFIG_NAND_NOMADIK_16BIT
+       chip->options |= NAND_BUSWIDTH_16;
+       pcr0_val |= 0x00000010; /* 16-bit access */
+#endif
+       /* Set up FSMC control0, PMEM0, PATT0 with timing data for access */
+       writel(pcr0_val, REG_FSMC_PCR0);
        writel(0x00020401, REG_FSMC_PMEM0);
        writel(0x00020404, REG_FSMC_PATT0);
 
-       chip->options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING;
        chip->cmd_ctrl = nomadik_nand_hwcontrol;
        chip->dev_ready = nomadik_nand_ready;
        /* The chip allows 32bit reads, so avoid the default 8bit copy */
-- 
1.6.0.2
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to