[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220307143202.28474-1-alifer.m@variscite.com>
Date: Mon, 7 Mar 2022 11:32:02 -0300
From: Alifer Moraes <alifer.m@...iscite.com>
To: linux-kernel@...r.kernel.org
Cc: eran.m@...iscite.com, han.xu@....com,
linux-mtd@...ts.infradead.org, miquel.raynal@...tlin.com,
pierluigi.p@...iscite.com, richard@....at, vigneshr@...com,
Alifer Moraes <alifer.m@...iscite.com>
Subject: [PATCH] mtd: rawnand: gpmi: add support for legacy-bch-geometry
From: Pierluigi Passaro <pierluigi.p@...iscite.com>
For backward compatibility, allow supporting legacy-bch-geometry as in
original NXP releases.
Signed-off-by: Pierluigi Passaro <pierluigi.p@...iscite.com>
Signed-off-by: Alifer Moraes <alifer.m@...iscite.com>
---
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 9 +++++++++
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 1b64c5a5140d..ae375115ef0a 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -517,6 +517,11 @@ static int common_nfc_set_geometry(struct gpmi_nand_data *this)
const struct nand_ecc_props *requirements =
nanddev_get_ecc_requirements(&chip->base);
+ if (this->legacy_bch_geometry) {
+ dev_warn(this->dev, "use legacy bch geometry\n");
+ return legacy_set_geometry(this);
+ }
+
if (chip->ecc.strength > 0 && chip->ecc.size > 0)
return set_geometry_by_ecc_info(this, chip->ecc.strength,
chip->ecc.size);
@@ -2072,6 +2077,10 @@ static int gpmi_nand_attach_chip(struct nand_chip *chip)
dev_dbg(this->dev, "Blockmark swapping %sabled\n",
this->swap_block_mark ? "en" : "dis");
+ if (of_property_read_bool(this->dev->of_node,
+ "fsl,legacy-bch-geometry"))
+ this->legacy_bch_geometry = true;
+
ret = gpmi_init_last(this);
if (ret)
return ret;
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h
index 5e1c3ddae5f8..d9926cf3d5e0 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h
@@ -151,6 +151,9 @@ struct gpmi_nand_data {
void *raw_buffer;
+ /* legacy bch geometry flag */
+ bool legacy_bch_geometry;
+
/* DMA channels */
#define DMA_CHANS 8
struct dma_chan *dma_chans[DMA_CHANS];
--
2.25.1
Powered by blists - more mailing lists