Lines Matching refs:ecc
185 struct mtd_oob_region ecc; member
207 int bytes_per_step = DIV_ROUND_UP(BITS_PER_STEP_RS * chip->ecc.strength, in tegra_nand_ooblayout_rs_ecc()
214 oobregion->length = round_up(bytes_per_step * chip->ecc.steps, 4); in tegra_nand_ooblayout_rs_ecc()
226 .ecc = tegra_nand_ooblayout_rs_ecc,
234 int bytes_per_step = DIV_ROUND_UP(BITS_PER_STEP_BCH * chip->ecc.strength, in tegra_nand_ooblayout_bch_ecc()
241 oobregion->length = round_up(bytes_per_step * chip->ecc.steps, 4); in tegra_nand_ooblayout_bch_ecc()
247 .ecc = tegra_nand_ooblayout_bch_ecc,
485 if (chip->ecc.algo == NAND_ECC_ALGO_BCH && enable) in tegra_nand_hw_ecc()
710 if (fail_sec_flag ^ GENMASK(chip->ecc.steps - 1, 0)) { in tegra_nand_read_page_hwecc()
726 for_each_set_bit(bit, &fail_sec_flag, chip->ecc.steps) { in tegra_nand_read_page_hwecc()
727 u8 *data = buf + (chip->ecc.size * bit); in tegra_nand_read_page_hwecc()
728 u8 *oob = chip->oob_poi + nand->ecc.offset + in tegra_nand_read_page_hwecc()
729 (chip->ecc.bytes * bit); in tegra_nand_read_page_hwecc()
731 ret = nand_check_erased_ecc_chunk(data, chip->ecc.size, in tegra_nand_read_page_hwecc()
732 oob, chip->ecc.bytes, in tegra_nand_read_page_hwecc()
734 chip->ecc.strength); in tegra_nand_read_page_hwecc()
849 bool maximize = base->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH; in tegra_nand_get_strength()
870 bytes_per_page = round_up(bytes_per_step * chip->ecc.steps, 4); in tegra_nand_get_strength()
885 switch (chip->ecc.algo) { in tegra_nand_select_strength()
927 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; in tegra_nand_attach_chip()
928 chip->ecc.size = 512; in tegra_nand_attach_chip()
929 chip->ecc.steps = mtd->writesize / chip->ecc.size; in tegra_nand_attach_chip()
936 chip->ecc.read_page = tegra_nand_read_page_hwecc; in tegra_nand_attach_chip()
937 chip->ecc.write_page = tegra_nand_write_page_hwecc; in tegra_nand_attach_chip()
938 chip->ecc.read_page_raw = tegra_nand_read_page_raw; in tegra_nand_attach_chip()
939 chip->ecc.write_page_raw = tegra_nand_write_page_raw; in tegra_nand_attach_chip()
940 chip->ecc.read_oob = tegra_nand_read_oob; in tegra_nand_attach_chip()
941 chip->ecc.write_oob = tegra_nand_write_oob; in tegra_nand_attach_chip()
946 if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN) { in tegra_nand_attach_chip()
948 chip->ecc.algo = NAND_ECC_ALGO_RS; in tegra_nand_attach_chip()
950 chip->ecc.algo = NAND_ECC_ALGO_BCH; in tegra_nand_attach_chip()
953 if (chip->ecc.algo == NAND_ECC_ALGO_BCH && mtd->writesize < 2048) { in tegra_nand_attach_chip()
958 if (!chip->ecc.strength) { in tegra_nand_attach_chip()
967 chip->ecc.strength = ret; in tegra_nand_attach_chip()
973 switch (chip->ecc.algo) { in tegra_nand_attach_chip()
975 bits_per_step = BITS_PER_STEP_RS * chip->ecc.strength; in tegra_nand_attach_chip()
979 switch (chip->ecc.strength) { in tegra_nand_attach_chip()
991 chip->ecc.strength); in tegra_nand_attach_chip()
996 bits_per_step = BITS_PER_STEP_BCH * chip->ecc.strength; in tegra_nand_attach_chip()
999 switch (chip->ecc.strength) { in tegra_nand_attach_chip()
1014 chip->ecc.strength); in tegra_nand_attach_chip()
1024 chip->ecc.algo == NAND_ECC_ALGO_BCH ? "BCH" : "RS", in tegra_nand_attach_chip()
1025 chip->ecc.strength); in tegra_nand_attach_chip()
1027 chip->ecc.bytes = DIV_ROUND_UP(bits_per_step, BITS_PER_BYTE); in tegra_nand_attach_chip()
1132 mtd_ooblayout_ecc(mtd, 0, &nand->ecc); in tegra_nand_chips_init()