Lines Matching full:ecc
47 struct ingenic_ecc *ecc; member
79 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_ecc() local
81 if (section || !ecc->total) in qi_lb60_ooblayout_ecc()
84 oobregion->length = ecc->total; in qi_lb60_ooblayout_ecc()
94 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_free() local
99 oobregion->length = mtd->oobsize - ecc->total - 12; in qi_lb60_ooblayout_free()
100 oobregion->offset = 12 + ecc->total; in qi_lb60_ooblayout_free()
106 .ecc = qi_lb60_ooblayout_ecc,
114 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_ecc() local
116 if (section || !ecc->total) in jz4725b_ooblayout_ecc()
119 oobregion->length = ecc->total; in jz4725b_ooblayout_ecc()
129 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_free() local
134 oobregion->length = mtd->oobsize - ecc->total - 3; in jz4725b_ooblayout_free()
135 oobregion->offset = 3 + ecc->total; in jz4725b_ooblayout_free()
141 .ecc = jz4725b_ooblayout_ecc,
205 * Don't need to generate the ECC when reading, the ECC engine does it in ingenic_nand_ecc_calculate()
211 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_calculate()
212 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_calculate()
213 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_calculate()
215 return ingenic_ecc_calculate(nfc->ecc, ¶ms, dat, ecc_code); in ingenic_nand_ecc_calculate()
225 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_correct()
226 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_correct()
227 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_correct()
229 return ingenic_ecc_correct(nfc->ecc, ¶ms, dat, read_ecc); in ingenic_nand_ecc_correct()
238 if (chip->ecc.strength == 4) { in ingenic_nand_attach_chip()
239 /* JZ4740 uses 9 bytes of ECC to correct maximum 4 errors */ in ingenic_nand_attach_chip()
240 chip->ecc.bytes = 9; in ingenic_nand_attach_chip()
242 chip->ecc.bytes = fls((1 + 8) * chip->ecc.size) * in ingenic_nand_attach_chip()
243 (chip->ecc.strength / 8); in ingenic_nand_attach_chip()
246 switch (chip->ecc.mode) { in ingenic_nand_attach_chip()
248 if (!nfc->ecc) { in ingenic_nand_attach_chip()
249 dev_err(nfc->dev, "HW ECC selected, but ECC controller not found\n"); in ingenic_nand_attach_chip()
253 chip->ecc.hwctl = ingenic_nand_ecc_hwctl; in ingenic_nand_attach_chip()
254 chip->ecc.calculate = ingenic_nand_ecc_calculate; in ingenic_nand_attach_chip()
255 chip->ecc.correct = ingenic_nand_ecc_correct; in ingenic_nand_attach_chip()
259 (nfc->ecc) ? "hardware ECC" : "software ECC", in ingenic_nand_attach_chip()
260 chip->ecc.strength, chip->ecc.size, chip->ecc.bytes); in ingenic_nand_attach_chip()
263 dev_info(nfc->dev, "not using ECC\n"); in ingenic_nand_attach_chip()
266 dev_err(nfc->dev, "ECC mode %d not supported\n", in ingenic_nand_attach_chip()
267 chip->ecc.mode); in ingenic_nand_attach_chip()
271 /* The NAND core will generate the ECC layout for SW ECC */ in ingenic_nand_attach_chip()
272 if (chip->ecc.mode != NAND_ECC_HW) in ingenic_nand_attach_chip()
275 /* Generate ECC layout. ECC codes are right aligned in the OOB area. */ in ingenic_nand_attach_chip()
276 eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes; in ingenic_nand_attach_chip()
280 "invalid ECC config: required %d ECC bytes, but only %d are available", in ingenic_nand_attach_chip()
287 * ECC bytes in the OOB, so move the BBT markers outside the OOB area. in ingenic_nand_attach_chip()
368 chip->ecc.mode = NAND_ECC_HW; in ingenic_nand_init_chip()
451 * Check for ECC HW before we call nand_scan_ident, to prevent us from in ingenic_nand_probe()
452 * having to call it again if the ECC driver returns -EPROBE_DEFER. in ingenic_nand_probe()
454 nfc->ecc = of_ingenic_ecc_get(dev->of_node); in ingenic_nand_probe()
455 if (IS_ERR(nfc->ecc)) in ingenic_nand_probe()
456 return PTR_ERR(nfc->ecc); in ingenic_nand_probe()
466 if (nfc->ecc) in ingenic_nand_probe()
467 ingenic_ecc_release(nfc->ecc); in ingenic_nand_probe()
479 if (nfc->ecc) in ingenic_nand_remove()
480 ingenic_ecc_release(nfc->ecc); in ingenic_nand_remove()