]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/m5329evb/nand.c
Merge remote-tracking branch 'u-boot-imx/master'
[u-boot] / board / freescale / m5329evb / nand.c
index cf27dda2ffef8272c17f570c9f818df9658c91e0..c70c98c8a14c0c99a0092674cc0194a71983ca72 100644 (file)
@@ -2,7 +2,7 @@
  * (C) Copyright 2000-2003
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  *
  * See file CREDITS for list of people who contributed to this
@@ -47,10 +47,12 @@ static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int ctrl)
                ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
 
                IO_ADDR_W &= ~(SET_ALE | SET_CLE);
-               *nCE &= 0xFFFB;
 
                if (ctrl & NAND_NCE)
+                       *nCE &= 0xFFFB;
+               else
                        *nCE |= 0x0004;
+
                if (ctrl & NAND_CLE)
                        IO_ADDR_W |= SET_CLE;
                if (ctrl & NAND_ALE)
@@ -65,20 +67,20 @@ static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int ctrl)
 
 int board_nand_init(struct nand_chip *nand)
 {
-       volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+       gpio_t *gpio = (gpio_t *) MMAP_GPIO;
 
        /*
         * set up pin configuration - enabled 2nd output buffer's signals
         * (nand_ngpio - nCE USB1/2_PWR_EN, LATCH_GPIOs, LCD_VEEEN, etc)
         * to use nCE signal
         */
-       gpio->par_timer &= ~GPIO_PAR_TIN3_TIN3;
-       gpio->pddr_timer |= 0x08;
-       gpio->ppd_timer |= 0x08;
-       gpio->pclrr_timer = 0;
-       gpio->podr_timer = 0;
+       clrbits_8(&gpio->par_timer, GPIO_PAR_TIN3_TIN3);
+       setbits_8(&gpio->pddr_timer, 0x08);
+       setbits_8(&gpio->ppd_timer, 0x08);
+       out_8(&gpio->pclrr_timer, 0);
+       out_8(&gpio->podr_timer, 0);
 
-       nand->chip_delay = 50;
+       nand->chip_delay = 60;
        nand->ecc.mode = NAND_ECC_SOFT;
        nand->cmd_ctrl = nand_hwcontrol;