[PATCH 2/2] mtd: nand: mxs-nand: Add on flash bbt support

Sascha Hauer s.hauer at pengutronix.de
Mon Jul 22 06:28:05 EDT 2013


For DT only at the moment.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/nand/nand_mxs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 68eb040..8e5c83c 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -1214,6 +1214,17 @@ err1:
 	return -ENOMEM;
 }
 
+static void mxs_nand_probe_dt(struct device_d *dev, struct mxs_nand_info *nand_info)
+{
+	struct nand_chip *nand = &nand_info->nand_chip;
+
+	if (!IS_ENABLED(CONFIG_OFTREE))
+		return;
+
+	if (of_get_nand_on_flash_bbt(dev->device_node))
+		nand->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
+}
+
 static int mxs_nand_probe(struct device_d *dev)
 {
 	struct mxs_nand_info *nand_info;
@@ -1232,6 +1243,8 @@ static int mxs_nand_probe(struct device_d *dev)
 		return -ENOMEM;
 	}
 
+	mxs_nand_probe_dt(dev, nand_info);
+
 	nand_info->type = type;
 	nand_info->io_base = dev_request_mem_region(dev, 0);
 	nand_info->bch_base = dev_request_mem_region(dev, 1);
-- 
1.8.3.2




More information about the barebox mailing list