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()
206 * The internal ECC doesn't tell us the number of bitflips that have in micron_nand_on_die_ecc_status_4()
242 ret = nand_read_page_op(chip, page, 0, micron->ecc.rawbuf, in micron_nand_on_die_ecc_status_4()
247 for (step = 0; step < chip->ecc.steps; step++) { in micron_nand_on_die_ecc_status_4()
251 offs = step * chip->ecc.size; in micron_nand_on_die_ecc_status_4()
252 rawbuf = micron->ecc.rawbuf + offs; in micron_nand_on_die_ecc_status_4()
255 for (i = 0; i < chip->ecc.size; i++) in micron_nand_on_die_ecc_status_4()
259 rawbuf = micron->ecc.rawbuf + mtd->writesize + offs; in micron_nand_on_die_ecc_status_4()
262 for (i = 0; i < chip->ecc.bytes + 4; i++) in micron_nand_on_die_ecc_status_4()
265 if (WARN_ON(nbitflips > chip->ecc.strength)) in micron_nand_on_die_ecc_status_4()
355 if (chip->ecc.strength == 4) in micron_nand_read_page_on_die_ecc()
385 /* The NAND flash doesn't support on-die ECC */
389 * The NAND flash supports on-die ECC and it can be
395 * The NAND flash supports on-die ECC, and it cannot be
405 * Try to detect if the NAND support on-die ECC. To do this, we enable
408 * allow disabling the on-die ECC and we don't support such NANDs for
411 * This function also has the side effect of disabling on-die ECC if
428 * We only support on-die ECC of 4/512 or 8/512 in micron_supports_on_die_ecc()
433 /* 0x2 means on-die ECC is available. */ in micron_supports_on_die_ecc()
439 * It seems that there are devices which do not support ECC officially. in micron_supports_on_die_ecc()
441 * enabling the ECC feature but don't reflect that to the READ_ID table. in micron_supports_on_die_ecc()
442 * So we have to guarantee that we disable the ECC feature directly in micron_supports_on_die_ecc()
469 * We only support on-die ECC of 4/512 or 8/512 in micron_supports_on_die_ecc()
505 chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_DIE) { in micron_nand_init()
506 pr_err("On-die ECC forcefully enabled, not supported\n"); in micron_nand_init()
511 if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE) { in micron_nand_init()
513 pr_err("On-die ECC selected but not supported\n"); in micron_nand_init()
519 micron->ecc.forced = true; in micron_nand_init()
520 micron->ecc.enabled = true; in micron_nand_init()
524 * In case of 4bit on-die ECC, we need a buffer to store a in micron_nand_init()
526 * to the same page after ECC correction happened and extract in micron_nand_init()
528 * That's not needed for 8-bit ECC, because the status expose in micron_nand_init()
532 micron->ecc.rawbuf = kmalloc(mtd->writesize + in micron_nand_init()
535 if (!micron->ecc.rawbuf) { in micron_nand_init()
548 chip->ecc.bytes = requirements->strength * 2; in micron_nand_init()
549 chip->ecc.size = 512; in micron_nand_init()
550 chip->ecc.strength = requirements->strength; in micron_nand_init()
551 chip->ecc.algo = NAND_ECC_ALGO_BCH; in micron_nand_init()
552 chip->ecc.read_page = micron_nand_read_page_on_die_ecc; in micron_nand_init()
553 chip->ecc.write_page = micron_nand_write_page_on_die_ecc; in micron_nand_init()
556 chip->ecc.read_page_raw = nand_read_page_raw_notsupp; in micron_nand_init()
557 chip->ecc.write_page_raw = nand_write_page_raw_notsupp; in micron_nand_init()
559 if (!chip->ecc.read_page_raw) in micron_nand_init()
560 chip->ecc.read_page_raw = nand_read_page_raw; in micron_nand_init()
561 if (!chip->ecc.write_page_raw) in micron_nand_init()
562 chip->ecc.write_page_raw = nand_write_page_raw; in micron_nand_init()
569 kfree(micron->ecc.rawbuf); in micron_nand_init()
579 kfree(micron->ecc.rawbuf); in micron_nand_cleanup()