mtd: gpmi: add on-flash BBT support for gpmi nand
authorHuang Shijie <b32955@freescale.com>
Tue, 3 Jul 2012 08:24:32 +0000 (16:24 +0800)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 16 Jul 2012 20:46:46 +0000 (21:46 +0100)
add the on flash bbt support for gpmi nand driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Documentation/devicetree/bindings/mtd/gpmi-nand.txt
drivers/mtd/nand/gpmi-nand/gpmi-nand.c

index 1a5bbd346d223a4d3d0429b7abd57595b025763b..3fb3f9015365d0c15d1b4219838d6d16bef9cc53 100644 (file)
@@ -12,6 +12,10 @@ Required properties:
   - interrupt-names : The interrupt names "gpmi-dma", "bch";
   - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
 
+Optional properties:
+  - nand-on-flash-bbt: boolean to enable on flash bbt option if not
+                       present false
+
 The device tree may optionally contain sub-nodes describing partitions of the
 address space. See partition.txt for more detail.
 
index d6fa8f4779ce62148ce5224fa36f9533d9c064ef..5d9796acc49a280ca80787e4b45bd809db13b52a 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_mtd.h>
 #include "gpmi-nand.h"
 
 /* add our owner bbt descriptor */
@@ -1502,6 +1503,8 @@ static int __devinit gpmi_nfc_init(struct gpmi_nand_data *this)
        chip->ecc.size          = 1;
        chip->ecc.strength      = 8;
        chip->ecc.layout        = &gpmi_hw_ecclayout;
+       if (of_get_nand_on_flash_bbt(this->dev->of_node))
+               chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
 
        /* Allocate a temporary DMA buffer for reading ID in the nand_scan() */
        this->bch_geometry.payload_size = 1024;