Merge branch 'master' of rsync://rsync.denx.de/git/u-boot
[platform/kernel/u-boot.git] / drivers / nand / nand_base.c
index a5792cf..b7a5d32 100644 (file)
@@ -71,9 +71,8 @@
 #endif
 
 #include <common.h>
-#ifdef CONFIG_NEW_NAND_CODE
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
 
 #include <malloc.h>
 #include <watchdog.h>
@@ -489,7 +488,6 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
        return nand_write_oob (mtd, ofs , 2, &retlen, buf);
 }
 
-#if READ_STATUS_BUG
 /**
  * nand_check_wp - [GENERIC] check if the chip is write protected
  * @mtd:       MTD device structure
@@ -504,12 +502,7 @@ static int nand_check_wp (struct mtd_info *mtd)
        this->cmdfunc (mtd, NAND_CMD_STATUS, -1, -1);
        return (this->read_byte(mtd) & 0x80) ? 0 : 1;
 }
-#else
-static int nand_check_wp (struct mtd_info *mtd)
-{
-       return 0;
-}
-#endif
+
 /**
  * nand_block_checkbad - [GENERIC] Check if a block is marked bad
  * @mtd:       MTD device structure
@@ -870,10 +863,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
                                break;
                }
        }
-
-       /* XXX nand device 1 on dave (PPChameleonEVB) needs more time */
+#ifdef PPCHAMELON_NAND_TIMER_HACK
        reset_timer();
        while (get_timer(0) < 10);
+#endif /*  PPCHAMELON_NAND_TIMER_HACK */
 
        return this->read_byte(mtd);
 }
@@ -900,7 +893,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
        int     i, status;
        u_char  ecc_code[32];
        int     eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;
-       int     *oob_config = oobsel->eccpos;
+       uint    *oob_config = oobsel->eccpos;
        int     datidx = 0, eccidx = 0, eccsteps = this->eccsteps;
        int     eccbytes = 0;
 
@@ -1122,7 +1115,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
        u_char ecc_calc[32];
        u_char ecc_code[32];
        int eccmode, eccsteps;
-       int     *oob_config, datidx;
+       unsigned *oob_config;
+       int     datidx;
        int     blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
        int     eccbytes;
        int     compareecc = 1;
@@ -2669,5 +2663,3 @@ void nand_release (struct mtd_info *mtd)
 }
 
 #endif
-#endif /* CONFIG_NEW_NAND_CODE */
-