NAND: Change nand_wait_ready() to not call nand_wait()
[oweals/u-boot.git] / drivers / mtd / nand / nand_base.c
index aeb179731d662925b4a99b6d964bdec9f3f584db..f577ed6294c341b3f1dba90c0f6800bdcb3e4994 100644 (file)
@@ -489,7 +489,16 @@ EXPORT_SYMBOL_GPL(nand_wait_ready);
 void nand_wait_ready(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
-       nand_wait(mtd, chip);
+       u32 timeo = (CFG_HZ * 20) / 1000;
+
+       reset_timer();
+
+       /* wait until command is processed or timeout occures */
+       while (get_timer(0) < timeo) {
+               if (chip->dev_ready)
+                       if (chip->dev_ready(mtd))
+                               break;
+       }
 }
 #endif
 
@@ -2080,7 +2089,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 
        /* Calculate pages in each block */
        pages_per_block = 1 << (chip->phys_erase_shift - chip->page_shift);
-       
+
        /* Select the NAND device */
        chip->select_chip(mtd, chipnr);
 
@@ -2557,7 +2566,7 @@ int nand_scan_tail(struct mtd_info *mtd)
                default:
                        printk(KERN_WARNING "No oob scheme defined for "
                               "oobsize %d\n", mtd->oobsize);
-//                     BUG();
+/*                     BUG(); */
                }
        }
 
@@ -2748,7 +2757,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
                BUG();
        }
 #endif
-       
+
        ret = nand_scan_ident(mtd, maxchips);
        if (!ret)
                ret = nand_scan_tail(mtd);