Lines Matching refs:ecc

407 	struct nand_ecc_ctrl *ecc = &chip->ecc;  in nand_ooblayout_ecc_lp()  local
409 if (section || !ecc->total) in nand_ooblayout_ecc_lp()
412 oobregion->length = ecc->total; in nand_ooblayout_ecc_lp()
425 struct nand_ecc_ctrl *ecc = &chip->ecc; in nand_ooblayout_free_lp() local
430 oobregion->length = mtd->oobsize - ecc->total - 2; in nand_ooblayout_free_lp()
437 .ecc = nand_ooblayout_ecc_lp,
453 struct nand_ecclayout *layout = nand->ecc.layout; in octeontx_nand_calc_ecc_layout()
464 nand->ecc.layout = layout; in octeontx_nand_calc_ecc_layout()
467 layout->eccbytes = nand->ecc.steps * nand->ecc.bytes; in octeontx_nand_calc_ecc_layout()
479 nand->ecc.layout = layout; in octeontx_nand_calc_ecc_layout()
1455 if (!ecc_buffer || ecc_size < nand->ecc.size) { in octeontx_nand_bch_calculate_ecc_internal()
1456 ecc_size = nand->ecc.size; in octeontx_nand_bch_calculate_ecc_internal()
1461 memset(ecc_buffer, 0, nand->ecc.bytes); in octeontx_nand_bch_calculate_ecc_internal()
1466 rc = octeontx_bch_encode(bch_vf, ihandle, nand->ecc.size, in octeontx_nand_bch_calculate_ecc_internal()
1467 nand->ecc.strength, in octeontx_nand_bch_calculate_ecc_internal()
1486 memcpy(code, ecc_buffer, nand->ecc.bytes); in octeontx_nand_bch_calculate_ecc_internal()
1488 for (i = 0; i < nand->ecc.bytes; i++) in octeontx_nand_bch_calculate_ecc_internal()
1506 nand->ecc.size, DMA_TO_DEVICE); in octeontx_nand_bch_calculate()
1530 int i = nand->ecc.size + nand->ecc.bytes; in octeontx_nand_bch_correct()
1552 memcpy(data_buffer, dat, nand->ecc.size); in octeontx_nand_bch_correct()
1553 memcpy(data_buffer + nand->ecc.size, read_ecc, nand->ecc.bytes); in octeontx_nand_bch_correct()
1555 for (i = 0; i < nand->ecc.bytes; i++) in octeontx_nand_bch_correct()
1556 data_buffer[nand->ecc.size + i] ^= tn->eccmask[i]; in octeontx_nand_bch_correct()
1561 ohandle = dma_map_single(dat, nand->ecc.size, DMA_FROM_DEVICE); in octeontx_nand_bch_correct()
1562 rc = octeontx_bch_decode(bch_vf, ihandle, nand->ecc.size, in octeontx_nand_bch_correct()
1563 nand->ecc.strength, ohandle, tn->bch_rhandle); in octeontx_nand_bch_correct()
1608 int i, eccsize = chip->ecc.size, ret; in octeontx_nand_hw_bch_read_page()
1609 int eccbytes = chip->ecc.bytes; in octeontx_nand_hw_bch_read_page()
1610 int eccsteps = chip->ecc.steps; in octeontx_nand_hw_bch_read_page()
1622 chip->ecc.total); in octeontx_nand_hw_bch_read_page()
1631 stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); in octeontx_nand_hw_bch_read_page()
1654 int i, eccsize = chip->ecc.size, ret; in octeontx_nand_hw_bch_write_page()
1655 int eccbytes = chip->ecc.bytes; in octeontx_nand_hw_bch_write_page()
1656 int eccsteps = chip->ecc.steps; in octeontx_nand_hw_bch_write_page()
1662 for (i = 0; i < chip->ecc.total; i++) in octeontx_nand_hw_bch_write_page()
1674 ret = chip->ecc.calculate(mtd, p, &ecc_calc[i]); in octeontx_nand_hw_bch_write_page()
1684 chip->ecc.total); in octeontx_nand_hw_bch_write_page()
1774 struct nand_ecc_ctrl *ecc = &nand->ecc; in octeontx_nand_calc_bch_ecc_strength() local
1776 int nsteps = mtd->writesize / ecc->size; in octeontx_nand_calc_bch_ecc_strength()
1785 while (index > 0 && !(ecc->options & NAND_ECC_MAXIMIZE) && in octeontx_nand_calc_bch_ecc_strength()
1786 strengths[index - 1] >= ecc->strength) in octeontx_nand_calc_bch_ecc_strength()
1797 ecc->strength = strengths[index]; in octeontx_nand_calc_bch_ecc_strength()
1798 ecc->bytes = need; in octeontx_nand_calc_bch_ecc_strength()
1799 debug("%s: strength: %d, bytes: %d\n", __func__, ecc->strength, in octeontx_nand_calc_bch_ecc_strength()
1800 ecc->bytes); in octeontx_nand_calc_bch_ecc_strength()
1803 tn->eccmask = devm_kzalloc(tn->dev, ecc->bytes, GFP_KERNEL); in octeontx_nand_calc_bch_ecc_strength()
1817 unsigned int eccsize = nand->ecc.size; in octeontx_bch_save_empty_eccmask()
1818 unsigned int eccbytes = nand->ecc.bytes; in octeontx_bch_save_empty_eccmask()
1848 struct nand_ecc_ctrl *ecc = &nand->ecc; in octeontx_nfc_chip_sizing() local
1853 __func__, nand, chip->row_bytes, chip->col_bytes, ecc->mode); in octeontx_nfc_chip_sizing()
1864 __func__, ecc->steps, ecc->size, ecc->bytes); in octeontx_nfc_chip_sizing()
1868 if (ecc->mode != NAND_ECC_NONE) { in octeontx_nfc_chip_sizing()
1869 int nsteps = ecc->steps ? ecc->steps : 1; in octeontx_nfc_chip_sizing()
1871 if (ecc->size && ecc->size != mtd->writesize) in octeontx_nfc_chip_sizing()
1872 nsteps = mtd->writesize / ecc->size; in octeontx_nfc_chip_sizing()
1876 ecc->steps = nsteps; in octeontx_nfc_chip_sizing()
1877 ecc->size = mtd->writesize / nsteps; in octeontx_nfc_chip_sizing()
1878 ecc->bytes = mtd->oobsize / nsteps; in octeontx_nfc_chip_sizing()
1881 ecc->strength = nand->ecc_strength_ds; in octeontx_nfc_chip_sizing()
1883 ecc->size = nand->ecc_step_ds; in octeontx_nfc_chip_sizing()
1888 if (!mtd->subpage_sft && !(ecc->steps & (ecc->steps - 1))) in octeontx_nfc_chip_sizing()
1889 mtd->subpage_sft = fls(ecc->steps) - 1; in octeontx_nfc_chip_sizing()
1892 debug("%s: ecc mode: %d\n", __func__, ecc->mode); in octeontx_nfc_chip_sizing()
1893 if (ecc->mode != NAND_ECC_SOFT && in octeontx_nfc_chip_sizing()
1899 ecc->mode = NAND_ECC_HW_SYNDROME; in octeontx_nfc_chip_sizing()
1900 ecc->read_page = octeontx_nand_hw_bch_read_page; in octeontx_nfc_chip_sizing()
1901 ecc->write_page = in octeontx_nfc_chip_sizing()
1903 ecc->read_page_raw = in octeontx_nfc_chip_sizing()
1905 ecc->write_page_raw = in octeontx_nfc_chip_sizing()
1907 ecc->read_oob = octeontx_nand_read_oob_std; in octeontx_nfc_chip_sizing()
1908 ecc->write_oob = octeontx_nand_write_oob_std; in octeontx_nfc_chip_sizing()
1910 ecc->calculate = octeontx_nand_bch_calculate; in octeontx_nfc_chip_sizing()
1911 ecc->correct = octeontx_nand_bch_correct; in octeontx_nfc_chip_sizing()
1912 ecc->hwctl = octeontx_nand_bch_hwctl; in octeontx_nfc_chip_sizing()
1917 ecc->bytes, ecc->size); in octeontx_nfc_chip_sizing()
1919 ecc->strength); in octeontx_nfc_chip_sizing()