Lines Matching refs:ecc

1088 	int eccsize = chip->ecc.size;  in nand_read_page_raw_syndrome()
1089 int eccbytes = chip->ecc.bytes; in nand_read_page_raw_syndrome()
1093 for (steps = chip->ecc.steps; steps > 0; steps--) { in nand_read_page_raw_syndrome()
1097 if (chip->ecc.prepad) { in nand_read_page_raw_syndrome()
1098 chip->read_buf(mtd, oob, chip->ecc.prepad); in nand_read_page_raw_syndrome()
1099 oob += chip->ecc.prepad; in nand_read_page_raw_syndrome()
1105 if (chip->ecc.postpad) { in nand_read_page_raw_syndrome()
1106 chip->read_buf(mtd, oob, chip->ecc.postpad); in nand_read_page_raw_syndrome()
1107 oob += chip->ecc.postpad; in nand_read_page_raw_syndrome()
1128 int i, eccsize = chip->ecc.size; in nand_read_page_swecc()
1129 int eccbytes = chip->ecc.bytes; in nand_read_page_swecc()
1130 int eccsteps = chip->ecc.steps; in nand_read_page_swecc()
1134 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_read_page_swecc()
1136 chip->ecc.read_page_raw(mtd, chip, buf, page); in nand_read_page_swecc()
1139 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in nand_read_page_swecc()
1141 for (i = 0; i < chip->ecc.total; i++) in nand_read_page_swecc()
1144 eccsteps = chip->ecc.steps; in nand_read_page_swecc()
1150 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); in nand_read_page_swecc()
1171 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_read_subpage()
1179 start_step = data_offs / chip->ecc.size; in nand_read_subpage()
1180 end_step = (data_offs + readlen - 1) / chip->ecc.size; in nand_read_subpage()
1184 datafrag_len = num_steps * chip->ecc.size; in nand_read_subpage()
1185 eccfrag_len = num_steps * chip->ecc.bytes; in nand_read_subpage()
1187 data_col_addr = start_step * chip->ecc.size; in nand_read_subpage()
1196 for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) in nand_read_subpage()
1197 chip->ecc.calculate(mtd, p, &chip->buffers->ecccalc[i]); in nand_read_subpage()
1203 if (eccpos[i + start_step * chip->ecc.bytes] + 1 != in nand_read_subpage()
1204 eccpos[i + start_step * chip->ecc.bytes + 1]) { in nand_read_subpage()
1215 index = start_step * chip->ecc.bytes; in nand_read_subpage()
1221 if (eccpos[index + (num_steps * chip->ecc.bytes)] & (busw - 1)) in nand_read_subpage()
1233 for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) { in nand_read_subpage()
1236 stat = chip->ecc.correct(mtd, p, in nand_read_subpage()
1258 int i, eccsize = chip->ecc.size; in nand_read_page_hwecc()
1259 int eccbytes = chip->ecc.bytes; in nand_read_page_hwecc()
1260 int eccsteps = chip->ecc.steps; in nand_read_page_hwecc()
1264 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_read_page_hwecc()
1267 chip->ecc.hwctl(mtd, NAND_ECC_READ); in nand_read_page_hwecc()
1269 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in nand_read_page_hwecc()
1273 for (i = 0; i < chip->ecc.total; i++) in nand_read_page_hwecc()
1276 eccsteps = chip->ecc.steps; in nand_read_page_hwecc()
1282 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); in nand_read_page_hwecc()
1308 int i, eccsize = chip->ecc.size; in nand_read_page_hwecc_oob_first()
1309 int eccbytes = chip->ecc.bytes; in nand_read_page_hwecc_oob_first()
1310 int eccsteps = chip->ecc.steps; in nand_read_page_hwecc_oob_first()
1313 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_read_page_hwecc_oob_first()
1321 for (i = 0; i < chip->ecc.total; i++) in nand_read_page_hwecc_oob_first()
1327 chip->ecc.hwctl(mtd, NAND_ECC_READ); in nand_read_page_hwecc_oob_first()
1329 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in nand_read_page_hwecc_oob_first()
1331 stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); in nand_read_page_hwecc_oob_first()
1353 int i, eccsize = chip->ecc.size; in nand_read_page_syndrome()
1354 int eccbytes = chip->ecc.bytes; in nand_read_page_syndrome()
1355 int eccsteps = chip->ecc.steps; in nand_read_page_syndrome()
1362 chip->ecc.hwctl(mtd, NAND_ECC_READ); in nand_read_page_syndrome()
1365 if (chip->ecc.prepad) { in nand_read_page_syndrome()
1366 chip->read_buf(mtd, oob, chip->ecc.prepad); in nand_read_page_syndrome()
1367 oob += chip->ecc.prepad; in nand_read_page_syndrome()
1370 chip->ecc.hwctl(mtd, NAND_ECC_READSYN); in nand_read_page_syndrome()
1372 stat = chip->ecc.correct(mtd, p, oob, NULL); in nand_read_page_syndrome()
1381 if (chip->ecc.postpad) { in nand_read_page_syndrome()
1382 chip->read_buf(mtd, oob, chip->ecc.postpad); in nand_read_page_syndrome()
1383 oob += chip->ecc.postpad; in nand_read_page_syndrome()
1413 struct nand_oobfree *free = chip->ecc.layout->oobfree; in nand_transfer_oob()
1496 ret = chip->ecc.read_page_raw(mtd, chip, in nand_do_read_ops()
1499 ret = chip->ecc.read_subpage(mtd, chip, in nand_do_read_ops()
1502 ret = chip->ecc.read_page(mtd, chip, bufpoi, in nand_do_read_ops()
1652 int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad; in nand_read_oob_syndrome()
1653 int eccsize = chip->ecc.size; in nand_read_oob_syndrome()
1657 chip->cmdfunc(mtd, NAND_CMD_READ0, chip->ecc.size, page); in nand_read_oob_syndrome()
1658 for (i = 0; i < chip->ecc.steps; i++) { in nand_read_oob_syndrome()
1711 int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad; in nand_write_oob_syndrome()
1712 int eccsize = chip->ecc.size, length = mtd->oobsize; in nand_write_oob_syndrome()
1713 int i, len, pos, status = 0, sndcmd = 0, steps = chip->ecc.steps; in nand_write_oob_syndrome()
1721 if (!chip->ecc.prepad && !chip->ecc.postpad) { in nand_write_oob_syndrome()
1782 len = chip->ecc.layout->oobavail; in nand_do_read_oob()
1809 sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd); in nand_do_read_oob()
1926 int eccsize = chip->ecc.size; in nand_write_page_raw_syndrome()
1927 int eccbytes = chip->ecc.bytes; in nand_write_page_raw_syndrome()
1931 for (steps = chip->ecc.steps; steps > 0; steps--) { in nand_write_page_raw_syndrome()
1935 if (chip->ecc.prepad) { in nand_write_page_raw_syndrome()
1936 chip->write_buf(mtd, oob, chip->ecc.prepad); in nand_write_page_raw_syndrome()
1937 oob += chip->ecc.prepad; in nand_write_page_raw_syndrome()
1943 if (chip->ecc.postpad) { in nand_write_page_raw_syndrome()
1944 chip->write_buf(mtd, oob, chip->ecc.postpad); in nand_write_page_raw_syndrome()
1945 oob += chip->ecc.postpad; in nand_write_page_raw_syndrome()
1962 int i, eccsize = chip->ecc.size; in nand_write_page_swecc()
1963 int eccbytes = chip->ecc.bytes; in nand_write_page_swecc()
1964 int eccsteps = chip->ecc.steps; in nand_write_page_swecc()
1967 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_write_page_swecc()
1971 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in nand_write_page_swecc()
1973 for (i = 0; i < chip->ecc.total; i++) in nand_write_page_swecc()
1976 chip->ecc.write_page_raw(mtd, chip, buf); in nand_write_page_swecc()
1988 int i, eccsize = chip->ecc.size; in nand_write_page_hwecc()
1989 int eccbytes = chip->ecc.bytes; in nand_write_page_hwecc()
1990 int eccsteps = chip->ecc.steps; in nand_write_page_hwecc()
1993 uint32_t *eccpos = chip->ecc.layout->eccpos; in nand_write_page_hwecc()
1996 chip->ecc.hwctl(mtd, NAND_ECC_WRITE); in nand_write_page_hwecc()
1998 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in nand_write_page_hwecc()
2001 for (i = 0; i < chip->ecc.total; i++) in nand_write_page_hwecc()
2019 int i, eccsize = chip->ecc.size; in nand_write_page_syndrome()
2020 int eccbytes = chip->ecc.bytes; in nand_write_page_syndrome()
2021 int eccsteps = chip->ecc.steps; in nand_write_page_syndrome()
2027 chip->ecc.hwctl(mtd, NAND_ECC_WRITE); in nand_write_page_syndrome()
2030 if (chip->ecc.prepad) { in nand_write_page_syndrome()
2031 chip->write_buf(mtd, oob, chip->ecc.prepad); in nand_write_page_syndrome()
2032 oob += chip->ecc.prepad; in nand_write_page_syndrome()
2035 chip->ecc.calculate(mtd, p, oob); in nand_write_page_syndrome()
2039 if (chip->ecc.postpad) { in nand_write_page_syndrome()
2040 chip->write_buf(mtd, oob, chip->ecc.postpad); in nand_write_page_syndrome()
2041 oob += chip->ecc.postpad; in nand_write_page_syndrome()
2068 chip->ecc.write_page_raw(mtd, chip, buf); in nand_write_page()
2070 chip->ecc.write_page(mtd, chip, buf); in nand_write_page()
2125 struct nand_oobfree *free = chip->ecc.layout->oobfree; in nand_fill_oob()
2364 len = chip->ecc.layout->oobavail; in nand_do_write_oob()
2415 status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask); in nand_do_write_oob()
3252 if (!chip->ecc.layout && (chip->ecc.mode != NAND_ECC_SOFT_BCH)) { in nand_scan_tail()
3255 chip->ecc.layout = &nand_oob_8; in nand_scan_tail()
3258 chip->ecc.layout = &nand_oob_16; in nand_scan_tail()
3261 chip->ecc.layout = &nand_oob_64; in nand_scan_tail()
3264 chip->ecc.layout = &nand_oob_128; in nand_scan_tail()
3281 switch (chip->ecc.mode) { in nand_scan_tail()
3284 if (!chip->ecc.calculate || !chip->ecc.correct || in nand_scan_tail()
3285 !chip->ecc.hwctl) { in nand_scan_tail()
3290 if (!chip->ecc.read_page) in nand_scan_tail()
3291 chip->ecc.read_page = nand_read_page_hwecc_oob_first; in nand_scan_tail()
3295 if (!chip->ecc.read_page) in nand_scan_tail()
3296 chip->ecc.read_page = nand_read_page_hwecc; in nand_scan_tail()
3297 if (!chip->ecc.write_page) in nand_scan_tail()
3298 chip->ecc.write_page = nand_write_page_hwecc; in nand_scan_tail()
3299 if (!chip->ecc.read_page_raw) in nand_scan_tail()
3300 chip->ecc.read_page_raw = nand_read_page_raw; in nand_scan_tail()
3301 if (!chip->ecc.write_page_raw) in nand_scan_tail()
3302 chip->ecc.write_page_raw = nand_write_page_raw; in nand_scan_tail()
3303 if (!chip->ecc.read_oob) in nand_scan_tail()
3304 chip->ecc.read_oob = nand_read_oob_std; in nand_scan_tail()
3305 if (!chip->ecc.write_oob) in nand_scan_tail()
3306 chip->ecc.write_oob = nand_write_oob_std; in nand_scan_tail()
3309 if ((!chip->ecc.calculate || !chip->ecc.correct || in nand_scan_tail()
3310 !chip->ecc.hwctl) && in nand_scan_tail()
3311 (!chip->ecc.read_page || in nand_scan_tail()
3312 chip->ecc.read_page == nand_read_page_hwecc || in nand_scan_tail()
3313 !chip->ecc.write_page || in nand_scan_tail()
3314 chip->ecc.write_page == nand_write_page_hwecc)) { in nand_scan_tail()
3320 if (!chip->ecc.read_page) in nand_scan_tail()
3321 chip->ecc.read_page = nand_read_page_syndrome; in nand_scan_tail()
3322 if (!chip->ecc.write_page) in nand_scan_tail()
3323 chip->ecc.write_page = nand_write_page_syndrome; in nand_scan_tail()
3324 if (!chip->ecc.read_page_raw) in nand_scan_tail()
3325 chip->ecc.read_page_raw = nand_read_page_raw_syndrome; in nand_scan_tail()
3326 if (!chip->ecc.write_page_raw) in nand_scan_tail()
3327 chip->ecc.write_page_raw = nand_write_page_raw_syndrome; in nand_scan_tail()
3328 if (!chip->ecc.read_oob) in nand_scan_tail()
3329 chip->ecc.read_oob = nand_read_oob_syndrome; in nand_scan_tail()
3330 if (!chip->ecc.write_oob) in nand_scan_tail()
3331 chip->ecc.write_oob = nand_write_oob_syndrome; in nand_scan_tail()
3333 if (mtd->writesize >= chip->ecc.size) in nand_scan_tail()
3337 chip->ecc.size, mtd->writesize); in nand_scan_tail()
3338 chip->ecc.mode = NAND_ECC_SOFT; in nand_scan_tail()
3341 chip->ecc.calculate = nand_calculate_ecc; in nand_scan_tail()
3342 chip->ecc.correct = nand_correct_data; in nand_scan_tail()
3343 chip->ecc.read_page = nand_read_page_swecc; in nand_scan_tail()
3344 chip->ecc.read_subpage = nand_read_subpage; in nand_scan_tail()
3345 chip->ecc.write_page = nand_write_page_swecc; in nand_scan_tail()
3346 chip->ecc.read_page_raw = nand_read_page_raw; in nand_scan_tail()
3347 chip->ecc.write_page_raw = nand_write_page_raw; in nand_scan_tail()
3348 chip->ecc.read_oob = nand_read_oob_std; in nand_scan_tail()
3349 chip->ecc.write_oob = nand_write_oob_std; in nand_scan_tail()
3350 if (!chip->ecc.size) in nand_scan_tail()
3351 chip->ecc.size = 256; in nand_scan_tail()
3352 chip->ecc.bytes = 3; in nand_scan_tail()
3360 chip->ecc.calculate = nand_bch_calculate_ecc; in nand_scan_tail()
3361 chip->ecc.correct = nand_bch_correct_data; in nand_scan_tail()
3362 chip->ecc.read_page = nand_read_page_swecc; in nand_scan_tail()
3363 chip->ecc.read_subpage = nand_read_subpage; in nand_scan_tail()
3364 chip->ecc.write_page = nand_write_page_swecc; in nand_scan_tail()
3365 chip->ecc.read_page_raw = nand_read_page_raw; in nand_scan_tail()
3366 chip->ecc.write_page_raw = nand_write_page_raw; in nand_scan_tail()
3367 chip->ecc.read_oob = nand_read_oob_std; in nand_scan_tail()
3368 chip->ecc.write_oob = nand_write_oob_std; in nand_scan_tail()
3375 if (!chip->ecc.size && (mtd->oobsize >= 64)) { in nand_scan_tail()
3376 chip->ecc.size = 512; in nand_scan_tail()
3377 chip->ecc.bytes = 7; in nand_scan_tail()
3379 chip->ecc.priv = nand_bch_init(mtd, in nand_scan_tail()
3380 chip->ecc.size, in nand_scan_tail()
3381 chip->ecc.bytes, in nand_scan_tail()
3382 &chip->ecc.layout); in nand_scan_tail()
3383 if (!chip->ecc.priv) { in nand_scan_tail()
3392 chip->ecc.read_page = nand_read_page_raw; in nand_scan_tail()
3393 chip->ecc.write_page = nand_write_page_raw; in nand_scan_tail()
3394 chip->ecc.read_oob = nand_read_oob_std; in nand_scan_tail()
3395 chip->ecc.read_page_raw = nand_read_page_raw; in nand_scan_tail()
3396 chip->ecc.write_page_raw = nand_write_page_raw; in nand_scan_tail()
3397 chip->ecc.write_oob = nand_write_oob_std; in nand_scan_tail()
3398 chip->ecc.size = mtd->writesize; in nand_scan_tail()
3399 chip->ecc.bytes = 0; in nand_scan_tail()
3404 chip->ecc.mode); in nand_scan_tail()
3412 chip->ecc.layout->oobavail = 0; in nand_scan_tail()
3413 for (i = 0; chip->ecc.layout->oobfree[i].length in nand_scan_tail()
3414 && i < ARRAY_SIZE(chip->ecc.layout->oobfree); i++) in nand_scan_tail()
3415 chip->ecc.layout->oobavail += in nand_scan_tail()
3416 chip->ecc.layout->oobfree[i].length; in nand_scan_tail()
3417 mtd->oobavail = chip->ecc.layout->oobavail; in nand_scan_tail()
3423 chip->ecc.steps = mtd->writesize / chip->ecc.size; in nand_scan_tail()
3424 if (chip->ecc.steps * chip->ecc.size != mtd->writesize) { in nand_scan_tail()
3428 chip->ecc.total = chip->ecc.steps * chip->ecc.bytes; in nand_scan_tail()
3436 switch (chip->ecc.steps) { in nand_scan_tail()
3480 mtd->ecclayout = chip->ecc.layout; in nand_scan_tail()
3539 if (chip->ecc.mode == NAND_ECC_SOFT_BCH) in nand_release()
3540 nand_bch_free((struct nand_bch_control *)chip->ecc.priv); in nand_release()