Lines Matching full:ecc
15 * corrected by on-die ECC and should be rewritten.
20 * On chips with 8-bit ECC and additional bit can be used to distinguish
66 struct micron_on_die_ecc ecc; member
127 .ecc = micron_nand_on_die_4_ooblayout_ecc,
140 oobregion->offset = mtd->oobsize - chip->ecc.total; in micron_nand_on_die_8_ooblayout_ecc()
141 oobregion->length = chip->ecc.total; in micron_nand_on_die_8_ooblayout_ecc()
156 oobregion->length = mtd->oobsize - chip->ecc.total - 2; in micron_nand_on_die_8_ooblayout_free()
162 .ecc = micron_nand_on_die_8_ooblayout_ecc,
172 if (micron->ecc.forced) in micron_nand_on_die_ecc_setup()
175 if (micron->ecc.enabled == enable) in micron_nand_on_die_ecc_setup()
183 micron->ecc.enabled = enable; in micron_nand_on_die_ecc_setup()
205 * The internal ECC doesn't tell us the number of bitflips that have in micron_nand_on_die_ecc_status_4()
222 ret = nand_read_page_op(chip, page, 0, micron->ecc.rawbuf, in micron_nand_on_die_ecc_status_4()
227 for (step = 0; step < chip->ecc.steps; step++) { in micron_nand_on_die_ecc_status_4()
231 offs = step * chip->ecc.size; in micron_nand_on_die_ecc_status_4()
232 rawbuf = micron->ecc.rawbuf + offs; in micron_nand_on_die_ecc_status_4()
235 for (i = 0; i < chip->ecc.size; i++) in micron_nand_on_die_ecc_status_4()
239 rawbuf = micron->ecc.rawbuf + mtd->writesize + offs; in micron_nand_on_die_ecc_status_4()
242 for (i = 0; i < chip->ecc.bytes + 4; i++) in micron_nand_on_die_ecc_status_4()
245 if (WARN_ON(nbitflips > chip->ecc.strength)) in micron_nand_on_die_ecc_status_4()
312 if (chip->ecc.strength == 4) in micron_nand_read_page_on_die_ecc()
342 /* The NAND flash doesn't support on-die ECC */
346 * The NAND flash supports on-die ECC and it can be
352 * The NAND flash supports on-die ECC, and it cannot be
362 * Try to detect if the NAND support on-die ECC. To do this, we enable
365 * allow disabling the on-die ECC and we don't support such NANDs for
368 * This function also has the side effect of disabling on-die ECC if
383 * We only support on-die ECC of 4/512 or 8/512 in micron_supports_on_die_ecc()
388 /* 0x2 means on-die ECC is available. */ in micron_supports_on_die_ecc()
394 * It seems that there are devices which do not support ECC officially. in micron_supports_on_die_ecc()
396 * enabling the ECC feature but don't reflect that to the READ_ID table. in micron_supports_on_die_ecc()
397 * So we have to guarantee that we disable the ECC feature directly in micron_supports_on_die_ecc()
424 * We only support on-die ECC of 4/512 or 8/512 in micron_supports_on_die_ecc()
455 chip->ecc.mode != NAND_ECC_ON_DIE) { in micron_nand_init()
456 pr_err("On-die ECC forcefully enabled, not supported\n"); in micron_nand_init()
461 if (chip->ecc.mode == NAND_ECC_ON_DIE) { in micron_nand_init()
463 pr_err("On-die ECC selected but not supported\n"); in micron_nand_init()
469 micron->ecc.forced = true; in micron_nand_init()
470 micron->ecc.enabled = true; in micron_nand_init()
474 * In case of 4bit on-die ECC, we need a buffer to store a in micron_nand_init()
476 * to the same page after ECC correction happened and extract in micron_nand_init()
478 * That's not needed for 8-bit ECC, because the status expose in micron_nand_init()
482 micron->ecc.rawbuf = kmalloc(mtd->writesize + in micron_nand_init()
485 if (!micron->ecc.rawbuf) { in micron_nand_init()
498 chip->ecc.bytes = chip->base.eccreq.strength * 2; in micron_nand_init()
499 chip->ecc.size = 512; in micron_nand_init()
500 chip->ecc.strength = chip->base.eccreq.strength; in micron_nand_init()
501 chip->ecc.algo = NAND_ECC_BCH; in micron_nand_init()
502 chip->ecc.read_page = micron_nand_read_page_on_die_ecc; in micron_nand_init()
503 chip->ecc.write_page = micron_nand_write_page_on_die_ecc; in micron_nand_init()
506 chip->ecc.read_page_raw = nand_read_page_raw_notsupp; in micron_nand_init()
507 chip->ecc.write_page_raw = nand_write_page_raw_notsupp; in micron_nand_init()
509 chip->ecc.read_page_raw = nand_read_page_raw; in micron_nand_init()
510 chip->ecc.write_page_raw = nand_write_page_raw; in micron_nand_init()
517 kfree(micron->ecc.rawbuf); in micron_nand_init()
527 kfree(micron->ecc.rawbuf); in micron_nand_cleanup()