Lines Matching full:ecc

44 	struct ingenic_ecc *ecc;  member
75 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_ecc() local
77 if (section || !ecc->total) in qi_lb60_ooblayout_ecc()
80 oobregion->length = ecc->total; in qi_lb60_ooblayout_ecc()
90 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_free() local
95 oobregion->length = mtd->oobsize - ecc->total - 12; in qi_lb60_ooblayout_free()
96 oobregion->offset = 12 + ecc->total; in qi_lb60_ooblayout_free()
102 .ecc = qi_lb60_ooblayout_ecc,
110 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_ecc() local
112 if (section || !ecc->total) in jz4725b_ooblayout_ecc()
115 oobregion->length = ecc->total; in jz4725b_ooblayout_ecc()
125 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_free() local
130 oobregion->length = mtd->oobsize - ecc->total - 3; in jz4725b_ooblayout_free()
131 oobregion->offset = 3 + ecc->total; in jz4725b_ooblayout_free()
137 .ecc = jz4725b_ooblayout_ecc,
156 * Don't need to generate the ECC when reading, the ECC engine does it in ingenic_nand_ecc_calculate()
162 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_calculate()
163 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_calculate()
164 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_calculate()
166 return ingenic_ecc_calculate(nfc->ecc, &params, dat, ecc_code); in ingenic_nand_ecc_calculate()
176 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_correct()
177 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_correct()
178 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_correct()
180 return ingenic_ecc_correct(nfc->ecc, &params, dat, read_ecc); in ingenic_nand_ecc_correct()
189 if (chip->ecc.strength == 4) { in ingenic_nand_attach_chip()
190 /* JZ4740 uses 9 bytes of ECC to correct maximum 4 errors */ in ingenic_nand_attach_chip()
191 chip->ecc.bytes = 9; in ingenic_nand_attach_chip()
193 chip->ecc.bytes = fls((1 + 8) * chip->ecc.size) * in ingenic_nand_attach_chip()
194 (chip->ecc.strength / 8); in ingenic_nand_attach_chip()
197 switch (chip->ecc.engine_type) { in ingenic_nand_attach_chip()
199 if (!nfc->ecc) { in ingenic_nand_attach_chip()
200 dev_err(nfc->dev, "HW ECC selected, but ECC controller not found\n"); in ingenic_nand_attach_chip()
204 chip->ecc.hwctl = ingenic_nand_ecc_hwctl; in ingenic_nand_attach_chip()
205 chip->ecc.calculate = ingenic_nand_ecc_calculate; in ingenic_nand_attach_chip()
206 chip->ecc.correct = ingenic_nand_ecc_correct; in ingenic_nand_attach_chip()
210 (nfc->ecc) ? "hardware ECC" : "software ECC", in ingenic_nand_attach_chip()
211 chip->ecc.strength, chip->ecc.size, chip->ecc.bytes); in ingenic_nand_attach_chip()
214 dev_info(nfc->dev, "not using ECC\n"); in ingenic_nand_attach_chip()
217 dev_err(nfc->dev, "ECC mode %d not supported\n", in ingenic_nand_attach_chip()
218 chip->ecc.engine_type); in ingenic_nand_attach_chip()
222 /* The NAND core will generate the ECC layout for SW ECC */ in ingenic_nand_attach_chip()
223 if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) in ingenic_nand_attach_chip()
226 /* Generate ECC layout. ECC codes are right aligned in the OOB area. */ in ingenic_nand_attach_chip()
227 eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes; in ingenic_nand_attach_chip()
231 "invalid ECC config: required %d ECC bytes, but only %d are available", in ingenic_nand_attach_chip()
238 * ECC bytes in the OOB, so move the BBT markers outside the OOB area. in ingenic_nand_attach_chip()
244 chip->ecc.read_page = nand_read_page_hwecc_oob_first; in ingenic_nand_attach_chip()
400 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; in ingenic_nand_init_chip()
488 * Check for ECC HW before we call nand_scan_ident, to prevent us from in ingenic_nand_probe()
489 * having to call it again if the ECC driver returns -EPROBE_DEFER. in ingenic_nand_probe()
491 nfc->ecc = of_ingenic_ecc_get(dev->of_node); in ingenic_nand_probe()
492 if (IS_ERR(nfc->ecc)) in ingenic_nand_probe()
493 return PTR_ERR(nfc->ecc); in ingenic_nand_probe()
503 if (nfc->ecc) in ingenic_nand_probe()
504 ingenic_ecc_release(nfc->ecc); in ingenic_nand_probe()
516 if (nfc->ecc) in ingenic_nand_remove()
517 ingenic_ecc_release(nfc->ecc); in ingenic_nand_remove()