]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/nand_base.c
mtd: Introduce mtd_block_isreserved()
[karo-tx-uboot.git] / drivers / mtd / nand / nand_base.c
index 57df8bc4f7d0de47ce04ec87ebe1376c511ae76d..ab6946aea1ef772112b3635642d716486e8106c2 100644 (file)
@@ -524,6 +524,23 @@ static int nand_check_wp(struct mtd_info *mtd)
        return (chip->read_byte(mtd) & NAND_STATUS_WP) ? 0 : 1;
 }
 
+/**
+ * nand_block_checkbad - [GENERIC] Check if a block is marked bad
+ * @mtd: MTD device structure
+ * @ofs: offset from device start
+ *
+ * Check if the block is mark as reserved.
+ */
+static int nand_block_isreserved(struct mtd_info *mtd, loff_t ofs)
+{
+       struct nand_chip *chip = mtd->priv;
+
+       if (!chip->bbt)
+               return 0;
+       /* Return info from the table */
+       return nand_isreserved_bbt(mtd, ofs);
+}
+
 /**
  * nand_block_checkbad - [GENERIC] Check if a block is marked bad
  * @mtd: MTD device structure
@@ -3885,6 +3902,7 @@ int nand_scan_tail(struct mtd_info *mtd)
        mtd->_sync = nand_sync;
        mtd->_lock = NULL;
        mtd->_unlock = NULL;
+       mtd->_block_isreserved = nand_block_isreserved;
        mtd->_block_isbad = nand_block_isbad;
        mtd->_block_markbad = nand_block_markbad;
        mtd->writebufsize = mtd->writesize;