]> git.sur5r.net Git - u-boot/blobdiff - drivers/mtd/nand/nand_base.c
Merge branch 'fixes'
[u-boot] / drivers / mtd / nand / nand_base.c
index 4069ab1278d4428928715fbb0b3bfbac498c4f40..94a65d4e72b02fa5bc7e981a66a96e72b048c3fe 100644 (file)
@@ -460,8 +460,8 @@ 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;
+               chip->scan_bbt(mtd);
        }
 
        if (!chip->bbt)
@@ -2450,6 +2450,12 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
        /* Select the device */
        chip->select_chip(mtd, 0);
 
+       /*
+        * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
+        * after power-up
+        */
+       chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
+
        /* Send the command for reading device ID */
        chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
 
@@ -2620,6 +2626,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
        /* Check for a chip array */
        for (i = 1; i < maxchips; i++) {
                chip->select_chip(mtd, i);
+               /* See comment in nand_get_flash_type for reset */
+               chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
                /* Send the command for reading device ID */
                chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
                /* Read manufacturer and device IDs */