forked from Minki/linux
mtd: rawnand: micron: Make ECC activation stateful
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> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
ef422e1ecd
commit
317c6d9b69
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user