]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/nand_base.c
Merge branch 'sandbox' of git://git.denx.de/u-boot-x86
[karo-tx-uboot.git] / drivers / mtd / nand / nand_base.c
index 085b1541cda9c6f721663a01e520bd3e959f5acd..70e780c3113a6049cfd5fac686bbfdd140b4050a 100644 (file)
@@ -29,7 +29,6 @@
  *
  */
 
-#define __UBOOT__
 #ifndef __UBOOT__
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -309,8 +308,7 @@ static void ioread16_rep(void *addr, void *buf, int len)
 {
        int i;
        u16 *p = (u16 *) buf;
-       len >>= 1;
+
        for (i = 0; i < len; i++)
                p[i] = readw(addr);
 }
@@ -319,7 +317,6 @@ static void iowrite16_rep(void *addr, void *buf, int len)
 {
        int i;
         u16 *p = (u16 *) buf;
-        len >>= 1;
 
         for (i = 0; i < len; i++)
                 writew(p[i], addr);
@@ -637,6 +634,11 @@ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip,
 {
        struct nand_chip *chip = mtd->priv;
 
+       if (!(chip->options & NAND_BBT_SCANNED)) {
+               chip->scan_bbt(mtd);
+               chip->options |= NAND_BBT_SCANNED;
+       }
+
        if (!chip->bbt)
                return chip->block_bad(mtd, ofs, getchip);
 
@@ -4325,10 +4327,9 @@ int nand_scan_tail(struct mtd_info *mtd)
 
        /* Check, if we should skip the bad block table scan */
        if (chip->options & NAND_SKIP_BBTSCAN)
-               return 0;
+               chip->options |= NAND_BBT_SCANNED;
 
-       /* Build bad block table */
-       return chip->scan_bbt(mtd);
+       return 0;
 }
 EXPORT_SYMBOL(nand_scan_tail);