summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/nand_micron.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-07-18 10:42:20 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-07-19 23:15:04 +0200
commitef422e1ecd272d077efce64432907632758cf2e2 (patch)
treecccfe0f885d56d56252d442f5216004333c23318 /drivers/mtd/nand/raw/nand_micron.c
parent2301780711efc514a8bb183e853bda8decce746a (diff)
downloadlinux-ef422e1ecd272d077efce64432907632758cf2e2.tar.bz2
mtd: rawnand: micron: Avoid enabling/disabling ECC when it can't be disabled
Some chips have their on-die ECC forcibly enabled, there's no point in trying to enable/disable the ECC engine in that case. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/nand_micron.c')
-rw-r--r--drivers/mtd/nand/raw/nand_micron.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nand_micron.c b/drivers/mtd/nand/raw/nand_micron.c
index 2cff25f7b48b..9d13b701e581 100644
--- a/drivers/mtd/nand/raw/nand_micron.c
+++ b/drivers/mtd/nand/raw/nand_micron.c
@@ -65,6 +65,7 @@ struct nand_onfi_vendor_micron {
} __packed;
struct micron_on_die_ecc {
+ bool forced;
void *rawbuf;
};
@@ -171,8 +172,12 @@ static const struct mtd_ooblayout_ops micron_nand_on_die_8_ooblayout_ops = {
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, };
+ if (micron->ecc.forced)
+ return 0;
+
if (enable)
feature[0] |= ONFI_FEATURE_ON_DIE_ECC_EN;
@@ -452,6 +457,9 @@ static int micron_nand_init(struct nand_chip *chip)
goto err_free_manuf_data;
}
+ if (ondie == MICRON_ON_DIE_MANDATORY)
+ micron->ecc.forced = true;
+
/*
* In case of 4bit on-die ECC, we need a buffer to store a
* page dumped in raw mode so that we can compare its content