diff options
author | Han Xu <han.xu@nxp.com> | 2016-03-28 10:35:59 -0500 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | f1dc96f94666099af968e1139cfb0a4db3beb717 (patch) | |
tree | f0c1d9e1534fe8d39ac538b60b17f76287dfa56d | |
parent | ea7af3ea356cbd77f0cc920fa5c4b23392845d6f (diff) |
MLK-12601: mtd: gpmi: provide the option to use legacy bch geometry
Provide an option in DT to use legacy bch geometry, which compatible
with the 3.10 kernel bch setting. To enable the feature, adding
"fsl,legacy-bch-geometry" under gpmi-nand node.
NOTICE: The feature must be enabled/disabled in both u-boot and kernel.
Conflicts:
drivers/mtd/nand/gpmi-nand/gpmi-nand.h
Signed-off-by: Han Xu <han.xu@nxp.com>
(cherry picked from commit 4d28b1693905526558892d40525763e6bc4469e4)
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 9 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 27e44913767c..f10c482e2309 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -584,8 +584,9 @@ int common_nfc_set_geometry(struct gpmi_nand_data *this) return -EINVAL; } - if (!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0) && - !(mtd->oobsize > 1024)) + if ((!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0) && + (mtd->oobsize < 1024)) || this->legacy_bch_geometry) + dev_warn(this->dev, "use legacy bch geometry\n"); return legacy_set_geometry(this); if (mtd->oobsize > 1024 || chip->ecc_step_ds < mtd->oobsize) @@ -2317,6 +2318,10 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) if (of_property_read_bool(this->dev->of_node, "fsl,no-blockmark-swap")) this->swap_block_mark = false; + + if (of_property_read_bool(this->dev->of_node, + "fsl,legacy-bch-geometry")) + this->legacy_bch_geometry = true; } dev_dbg(this->dev, "Blockmark swapping %sabled\n", this->swap_block_mark ? "en" : "dis"); diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h index dd9b6fa625d0..816097aa77f3 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h @@ -196,6 +196,8 @@ struct gpmi_nand_data { dma_addr_t auxiliary_phys; void *raw_buffer; + /* legacy bch geometry flag */ + bool legacy_bch_geometry; /* DMA channels */ #define DMA_CHANS 8 |