From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
linux-mtd@lists.infradead.org
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>
Subject: [PATCH 7/7] mtd: rawnand: micron: Make ECC activation stateful
Date: Wed, 18 Jul 2018 10:42:21 +0200 [thread overview]
Message-ID: <20180718084221.27821-7-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180718084221.27821-1-boris.brezillon@bootlin.com>
We currently don't store the on-die ECC state (enabled/disabled) which
might force us to re-disable the engine even if it's already been
disabled after we've read the page in raw mode to count the actual
number of bitflips.
Add an "enabled" field to struct micron_on_die_ecc to keep track of the
ECC state.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
drivers/mtd/nand/raw/nand_micron.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/nand_micron.c b/drivers/mtd/nand/raw/nand_micron.c
index 9d13b701e581..656947d91841 100644
--- a/drivers/mtd/nand/raw/nand_micron.c
+++ b/drivers/mtd/nand/raw/nand_micron.c
@@ -66,6 +66,7 @@ struct nand_onfi_vendor_micron {
struct micron_on_die_ecc {
bool forced;
+ bool enabled;
void *rawbuf;
};
@@ -174,14 +175,22 @@ static int micron_nand_on_die_ecc_setup(struct nand_chip *chip, bool enable)
{
struct micron_nand *micron = nand_get_manufacturer_data(chip);
u8 feature[ONFI_SUBFEATURE_PARAM_LEN] = { 0, };
+ int ret;
if (micron->ecc.forced)
return 0;
+ if (micron->ecc.enabled == enable)
+ return 0;
+
if (enable)
feature[0] |= ONFI_FEATURE_ON_DIE_ECC_EN;
- return nand_set_features(chip, ONFI_FEATURE_ON_DIE_ECC, feature);
+ ret = nand_set_features(chip, ONFI_FEATURE_ON_DIE_ECC, feature);
+ if (!ret)
+ micron->ecc.enabled = enable;
+
+ return ret;
}
static int micron_nand_on_die_ecc_status_4(struct nand_chip *chip, u8 status,
@@ -457,8 +466,10 @@ static int micron_nand_init(struct nand_chip *chip)
goto err_free_manuf_data;
}
- if (ondie == MICRON_ON_DIE_MANDATORY)
+ if (ondie == MICRON_ON_DIE_MANDATORY) {
micron->ecc.forced = true;
+ micron->ecc.enabled = true;
+ }
/*
* In case of 4bit on-die ECC, we need a buffer to store a
--
2.14.1
next prev parent reply other threads:[~2018-07-18 8:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 8:42 [PATCH 1/7] mtd: rawnand: micron: Fix on-die ECC detection logic Boris Brezillon
2018-07-18 8:42 ` [PATCH 2/7] mtd: rawnand: micron: support 8/512 on-die ECC Boris Brezillon
2018-07-18 18:32 ` Boris Brezillon
2018-07-18 8:42 ` [PATCH 3/7] mtd: rawnand: Expose _notsupp() helpers for raw page accessors Boris Brezillon
2018-07-19 9:22 ` Boris Brezillon
2018-07-19 21:15 ` Miquel Raynal
2018-07-18 8:42 ` [PATCH 4/7] mtd: rawnand: micron: allow forced on-die ECC Boris Brezillon
2018-07-18 18:32 ` Boris Brezillon
2018-07-18 8:42 ` [PATCH 5/7] mtd: rawnand: micron: Get the actual number of bitflips Boris Brezillon
2018-07-18 8:42 ` [PATCH 6/7] mtd: rawnand: micron: Avoid enabling/disabling ECC when it can't be disabled Boris Brezillon
2018-07-18 8:42 ` Boris Brezillon [this message]
2018-07-18 21:38 ` [PATCH 1/7] mtd: rawnand: micron: Fix on-die ECC detection logic Miquel Raynal
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=20180718084221.27821-7-boris.brezillon@bootlin.com \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.