Lines Matching full:ecc

45 	struct ingenic_ecc *ecc;  member
76 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_ecc() local
78 if (section || !ecc->total) in qi_lb60_ooblayout_ecc()
81 oobregion->length = ecc->total; in qi_lb60_ooblayout_ecc()
91 struct nand_ecc_ctrl *ecc = &chip->ecc; in qi_lb60_ooblayout_free() local
96 oobregion->length = mtd->oobsize - ecc->total - 12; in qi_lb60_ooblayout_free()
97 oobregion->offset = 12 + ecc->total; in qi_lb60_ooblayout_free()
103 .ecc = qi_lb60_ooblayout_ecc,
111 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_ecc() local
113 if (section || !ecc->total) in jz4725b_ooblayout_ecc()
116 oobregion->length = ecc->total; in jz4725b_ooblayout_ecc()
126 struct nand_ecc_ctrl *ecc = &chip->ecc; in jz4725b_ooblayout_free() local
131 oobregion->length = mtd->oobsize - ecc->total - 3; in jz4725b_ooblayout_free()
132 oobregion->offset = 3 + ecc->total; in jz4725b_ooblayout_free()
138 .ecc = jz4725b_ooblayout_ecc,
157 * Don't need to generate the ECC when reading, the ECC engine does it in ingenic_nand_ecc_calculate()
163 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_calculate()
164 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_calculate()
165 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_calculate()
167 return ingenic_ecc_calculate(nfc->ecc, &params, dat, ecc_code); in ingenic_nand_ecc_calculate()
177 params.size = nand->chip.ecc.size; in ingenic_nand_ecc_correct()
178 params.bytes = nand->chip.ecc.bytes; in ingenic_nand_ecc_correct()
179 params.strength = nand->chip.ecc.strength; in ingenic_nand_ecc_correct()
181 return ingenic_ecc_correct(nfc->ecc, &params, dat, read_ecc); in ingenic_nand_ecc_correct()
190 if (chip->ecc.strength == 4) { in ingenic_nand_attach_chip()
191 /* JZ4740 uses 9 bytes of ECC to correct maximum 4 errors */ in ingenic_nand_attach_chip()
192 chip->ecc.bytes = 9; in ingenic_nand_attach_chip()
194 chip->ecc.bytes = fls((1 + 8) * chip->ecc.size) * in ingenic_nand_attach_chip()
195 (chip->ecc.strength / 8); in ingenic_nand_attach_chip()
198 switch (chip->ecc.engine_type) { in ingenic_nand_attach_chip()
200 if (!nfc->ecc) { in ingenic_nand_attach_chip()
201 dev_err(nfc->dev, "HW ECC selected, but ECC controller not found\n"); in ingenic_nand_attach_chip()
205 chip->ecc.hwctl = ingenic_nand_ecc_hwctl; in ingenic_nand_attach_chip()
206 chip->ecc.calculate = ingenic_nand_ecc_calculate; in ingenic_nand_attach_chip()
207 chip->ecc.correct = ingenic_nand_ecc_correct; in ingenic_nand_attach_chip()
211 (nfc->ecc) ? "hardware ECC" : "software ECC", in ingenic_nand_attach_chip()
212 chip->ecc.strength, chip->ecc.size, chip->ecc.bytes); in ingenic_nand_attach_chip()
215 dev_info(nfc->dev, "not using ECC\n"); in ingenic_nand_attach_chip()
218 dev_err(nfc->dev, "ECC mode %d not supported\n", in ingenic_nand_attach_chip()
219 chip->ecc.engine_type); in ingenic_nand_attach_chip()
223 /* The NAND core will generate the ECC layout for SW ECC */ in ingenic_nand_attach_chip()
224 if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) in ingenic_nand_attach_chip()
227 /* Generate ECC layout. ECC codes are right aligned in the OOB area. */ in ingenic_nand_attach_chip()
228 eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes; in ingenic_nand_attach_chip()
232 "invalid ECC config: required %d ECC bytes, but only %d are available", in ingenic_nand_attach_chip()
239 * ECC bytes in the OOB, so move the BBT markers outside the OOB area. in ingenic_nand_attach_chip()
245 chip->ecc.read_page = nand_read_page_hwecc_oob_first; in ingenic_nand_attach_chip()
413 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; in ingenic_nand_init_chip()
501 * Check for ECC HW before we call nand_scan_ident, to prevent us from in ingenic_nand_probe()
502 * having to call it again if the ECC driver returns -EPROBE_DEFER. in ingenic_nand_probe()
504 nfc->ecc = of_ingenic_ecc_get(dev->of_node); in ingenic_nand_probe()
505 if (IS_ERR(nfc->ecc)) in ingenic_nand_probe()
506 return PTR_ERR(nfc->ecc); in ingenic_nand_probe()
516 if (nfc->ecc) in ingenic_nand_probe()
517 ingenic_ecc_release(nfc->ecc); in ingenic_nand_probe()
529 if (nfc->ecc) in ingenic_nand_remove()
530 ingenic_ecc_release(nfc->ecc); in ingenic_nand_remove()