struct micron_on_die_ecc {
bool forced;
+ bool enabled;
void *rawbuf;
};
{
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,
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