]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/nand_base.c
karo: merge with Ka-Ro specific tree for secure boot support
[karo-tx-uboot.git] / drivers / mtd / nand / nand_base.c
index d04c7ea0ae7c66afca1167cc5f9aac78cfa21197..fa8dace7e9dd5b8f6c2fd93586d1a40219ea05b4 100644 (file)
@@ -634,9 +634,10 @@ 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);
+       if (!(chip->options & NAND_SKIP_BBTSCAN) &&
+           !(chip->options & NAND_BBT_SCANNED)) {
                chip->options |= NAND_BBT_SCANNED;
+               chip->scan_bbt(mtd);
        }
 
        if (!chip->bbt)
@@ -2512,7 +2513,7 @@ static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
        return NULL;
 }
 
-#define NOTALIGNED(x)  ((x & (chip->subpagesize - 1)) != 0)
+#define NOTALIGNED(x)  (((x) & (chip->subpagesize - 1)) != 0)
 
 /**
  * nand_do_write_ops - [INTERN] NAND write with ECC
@@ -4259,6 +4260,8 @@ int nand_scan_tail(struct mtd_info *mtd)
        ecc->steps = mtd->writesize / ecc->size;
        if (ecc->steps * ecc->size != mtd->writesize) {
                pr_warn("Invalid ECC parameters\n");
+               pr_warn("steps=%d size=%d writesize=%d\n",
+                       chip->ecc.steps, chip->ecc.size, mtd->writesize);
                BUG();
        }
        ecc->total = ecc->steps * ecc->bytes;
@@ -4325,10 +4328,6 @@ int nand_scan_tail(struct mtd_info *mtd)
        if (!mtd->bitflip_threshold)
                mtd->bitflip_threshold = mtd->ecc_strength;
 
-       /* Check, if we should skip the bad block table scan */
-       if (chip->options & NAND_SKIP_BBTSCAN)
-               chip->options |= NAND_BBT_SCANNED;
-
        return 0;
 }
 EXPORT_SYMBOL(nand_scan_tail);