@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
cfg->blk_adr_bytes = get_blk_adr_bytes(mtd->size, mtd->writesize);
if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) {
- dev_err(ctrl->dev, "only HW ECC supported; selected: %d\n",
- chip->ecc.engine_type);
- return -EINVAL;
+ if (chip->ecc.strength) {
+ dev_err(ctrl->dev, "ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n",
+ chip->ecc.strength);
+ return -EINVAL;
+ }
}
if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN) {
@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
if (ret)
return ret;
- brcmnand_set_ecc_enabled(host, 1);
+ if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE) {
+ dev_dbg(ctrl->dev, "Disable HW ECC for on-die ECC\n");
+ brcmnand_set_ecc_enabled(host, 0);
+ } else
+ brcmnand_set_ecc_enabled(host, 1);
brcmnand_print_cfg(host, msg, cfg);
dev_info(ctrl->dev, "detected %s\n", msg);