mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alifer Moraes <alifer.m@variscite.com>
To: linux-kernel@vger.kernel.org
Cc: eran.m@variscite.com, han.xu@nxp.com,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
	pierluigi.p@variscite.com, richard@nod.at, vigneshr@ti.com,
	Alifer Moraes <alifer.m@variscite.com>
Subject: [PATCH] mtd: rawnand: gpmi: add support for legacy-bch-geometry
Date: Mon,  7 Mar 2022 11:32:02 -0300	[thread overview]
Message-ID: <20220307143202.28474-1-alifer.m@variscite.com> (raw)

From: Pierluigi Passaro <pierluigi.p@variscite.com>

For backward compatibility, allow supporting legacy-bch-geometry as in
original NXP releases.

Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com>
Signed-off-by: Alifer Moraes <alifer.m@variscite.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


                 reply	other threads:[~2022-03-07 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307143202.28474-1-alifer.m@variscite.com \
    --to=alifer.m@variscite.com \
    --cc=eran.m@variscite.com \
    --cc=han.xu@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pierluigi.p@variscite.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®