Lines Matching refs:ecc
147 struct mtk_ecc *ecc; member
186 return (u8 *)p + i * chip->ecc.size; in data_ptr()
212 return chip->ecc.size + mtk_nand->spare_per_sector; in mtk_data_len()
226 return nfc->buffer + i * mtk_data_len(chip) + chip->ecc.size; in mtk_oob_ptr()
336 if (chip->ecc.size == 512) in mtk_nfc_hw_runtime_config()
342 if (chip->ecc.size == 512) in mtk_nfc_hw_runtime_config()
348 if (chip->ecc.size == 512) in mtk_nfc_hw_runtime_config()
365 if (chip->ecc.size == 1024) in mtk_nfc_hw_runtime_config()
384 nfc->ecc_cfg.strength = chip->ecc.strength; in mtk_nfc_hw_runtime_config()
385 nfc->ecc_cfg.len = chip->ecc.size + mtk_nand->fdm.ecc_size; in mtk_nfc_hw_runtime_config()
646 int size = chip->ecc.size + mtk_nand->fdm.reg_size; in mtk_nfc_sector_encode()
651 return mtk_ecc_encode(nfc->ecc, &nfc->ecc_cfg, data, size); in mtk_nfc_sector_encode()
668 bad_pos += nand->bad_mark.sec * chip->ecc.size; in mtk_nfc_bad_mark_swap()
683 start = offset / chip->ecc.size; in mtk_nfc_format_subpage()
684 end = DIV_ROUND_UP(offset + len, chip->ecc.size); in mtk_nfc_format_subpage()
687 for (i = 0; i < chip->ecc.steps; i++) { in mtk_nfc_format_subpage()
689 chip->ecc.size); in mtk_nfc_format_subpage()
717 for (i = 0; i < chip->ecc.steps; i++) { in mtk_nfc_format_page()
720 chip->ecc.size); in mtk_nfc_format_page()
758 for (i = 0; i < chip->ecc.steps; i++) { in mtk_nfc_write_fdm()
794 nfi_writel(nfc, chip->ecc.steps << CON_SEC_SHIFT, NFI_CON); in mtk_nfc_do_write_page()
813 ADDRCNTR_SEC(reg) >= chip->ecc.steps, in mtk_nfc_do_write_page()
846 ret = mtk_ecc_enable(nfc->ecc, &nfc->ecc_cfg); in mtk_nfc_write_page()
870 mtk_ecc_disable(nfc->ecc); in mtk_nfc_write_page()
927 memset(buf, 0xff, sectors * chip->ecc.size); in mtk_nfc_update_ecc_stats()
933 mtk_ecc_get_stats(nfc->ecc, &stats, sectors); in mtk_nfc_update_ecc_stats()
955 start = data_offs / chip->ecc.size; in mtk_nfc_read_subpage()
956 end = DIV_ROUND_UP(data_offs + readlen, chip->ecc.size); in mtk_nfc_read_subpage()
959 column = start * (chip->ecc.size + spare); in mtk_nfc_read_subpage()
961 len = sectors * chip->ecc.size + (raw ? sectors * spare : 0); in mtk_nfc_read_subpage()
962 buf = bufpoi + start * chip->ecc.size; in mtk_nfc_read_subpage()
983 rc = mtk_ecc_enable(nfc->ecc, &nfc->ecc_cfg); in mtk_nfc_read_subpage()
1018 rc = mtk_ecc_wait_done(nfc->ecc, ECC_DECODE); in mtk_nfc_read_subpage()
1029 mtk_ecc_disable(nfc->ecc); in mtk_nfc_read_subpage()
1069 for (i = 0; i < chip->ecc.steps; i++) { in mtk_nfc_read_page_raw()
1077 chip->ecc.size); in mtk_nfc_read_page_raw()
1156 eccsteps = mtd->writesize / chip->ecc.size; in mtk_nfc_ooblayout_free()
1177 eccsteps = mtd->writesize / chip->ecc.size; in mtk_nfc_ooblayout_ecc()
1186 .ecc = mtk_nfc_ooblayout_ecc,
1196 ecc_bytes = DIV_ROUND_UP(nand->ecc.strength * in mtk_nfc_set_fdm()
1197 mtk_ecc_get_parity_bits(nfc->ecc), 8); in mtk_nfc_set_fdm()
1228 eccsteps = mtd->writesize / nand->ecc.size; in mtk_nfc_set_spare_per_sector()
1231 if (nand->ecc.size == 1024) in mtk_nfc_set_spare_per_sector()
1247 if (nand->ecc.size == 1024) in mtk_nfc_set_spare_per_sector()
1263 if (nand->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) { in mtk_nfc_ecc_init()
1269 if (!nand->ecc.size || !nand->ecc.strength) { in mtk_nfc_ecc_init()
1271 nand->ecc.strength = requirements->strength; in mtk_nfc_ecc_init()
1272 nand->ecc.size = requirements->step_size; in mtk_nfc_ecc_init()
1278 if (nand->ecc.size < 1024) { in mtk_nfc_ecc_init()
1281 nand->ecc.size = 1024; in mtk_nfc_ecc_init()
1282 nand->ecc.strength <<= 1; in mtk_nfc_ecc_init()
1284 nand->ecc.size = 512; in mtk_nfc_ecc_init()
1287 nand->ecc.size = 1024; in mtk_nfc_ecc_init()
1295 free = (nand->ecc.strength * mtk_ecc_get_parity_bits(nfc->ecc) in mtk_nfc_ecc_init()
1306 nand->ecc.strength = (spare << 3) / in mtk_nfc_ecc_init()
1307 mtk_ecc_get_parity_bits(nfc->ecc); in mtk_nfc_ecc_init()
1310 nand->ecc.strength = (spare << 3) / in mtk_nfc_ecc_init()
1311 mtk_ecc_get_parity_bits(nfc->ecc); in mtk_nfc_ecc_init()
1315 mtk_ecc_adjust_strength(nfc->ecc, &nand->ecc.strength); in mtk_nfc_ecc_init()
1318 nand->ecc.size, nand->ecc.strength); in mtk_nfc_ecc_init()
1421 nand->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; in mtk_nfc_nand_chip_init()
1423 nand->ecc.write_subpage = mtk_nfc_write_subpage_hwecc; in mtk_nfc_nand_chip_init()
1424 nand->ecc.write_page_raw = mtk_nfc_write_page_raw; in mtk_nfc_nand_chip_init()
1425 nand->ecc.write_page = mtk_nfc_write_page_hwecc; in mtk_nfc_nand_chip_init()
1426 nand->ecc.write_oob_raw = mtk_nfc_write_oob_std; in mtk_nfc_nand_chip_init()
1427 nand->ecc.write_oob = mtk_nfc_write_oob_std; in mtk_nfc_nand_chip_init()
1429 nand->ecc.read_subpage = mtk_nfc_read_subpage_hwecc; in mtk_nfc_nand_chip_init()
1430 nand->ecc.read_page_raw = mtk_nfc_read_page_raw; in mtk_nfc_nand_chip_init()
1431 nand->ecc.read_page = mtk_nfc_read_page_hwecc; in mtk_nfc_nand_chip_init()
1432 nand->ecc.read_oob_raw = mtk_nfc_read_oob_std; in mtk_nfc_nand_chip_init()
1433 nand->ecc.read_oob = mtk_nfc_read_oob_std; in mtk_nfc_nand_chip_init()
1535 nfc->ecc = of_mtk_ecc_get(np); in mtk_nfc_probe()
1536 if (IS_ERR(nfc->ecc)) in mtk_nfc_probe()
1537 return PTR_ERR(nfc->ecc); in mtk_nfc_probe()
1538 else if (!nfc->ecc) in mtk_nfc_probe()
1601 mtk_ecc_release(nfc->ecc); in mtk_nfc_probe()
1623 mtk_ecc_release(nfc->ecc); in mtk_nfc_remove()