Lines Matching defs:ecc

18 #include <linux/mtd/nand-ecc-sw-bch.h>
122 /* GPMC ecc engine settings for read */
129 /* GPMC ecc engine settings for write */
624 * @ecc_buf: buffer to store ecc code
644 * @ecc_data1: ecc code from nand spare area
645 * @ecc_data2: ecc code from hardware register obtained from hardware ecc
774 * @read_ecc: ecc read from nand flash
775 * @calc_ecc: ecc read from HW ECC registers
777 * Compares the ecc read from nand spare area with ECC registers values
792 if (info->nand.ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST &&
793 info->nand.ecc.size == 2048)
816 * @dat: The pointer to data on which ecc is computed
835 /* read ecc result */
846 * omap_enable_hwecc - This function enables the hardware ecc functionality
856 /* clear ecc and enable bits */
860 /* program ecc and result sizes */
861 val = ((((info->nand.ecc.size >> 1) - 1) << ECCSIZE1_SHIFT) |
916 nsectors = chip->ecc.steps;
936 nsectors = chip->ecc.steps;
949 nsectors = chip->ecc.steps;
966 /* Configure ecc size for BCH */
983 /* Clear ecc and enable bits */
994 * @dat: The pointer to data on which ecc is computed
1005 int eccbytes = info->nand.ecc.bytes;
1122 * @dat: The pointer to data on which ecc is computed
1138 * @dat: The pointer to data on which ecc is computed
1141 * Support calculating of BCH4/8/16 ecc vectors for the entire page in one go.
1147 int eccbytes = info->nand.ecc.bytes;
1178 for (i = 0; i < info->nand.ecc.size; i++) {
1180 if (flip_bits > info->nand.ecc.strength)
1184 for (i = 0; i < info->nand.ecc.bytes - 1; i++) {
1186 if (flip_bits > info->nand.ecc.strength)
1195 memset(data, 0xFF, info->nand.ecc.size);
1196 memset(oob, 0xFF, info->nand.ecc.bytes);
1206 * @read_ecc: ecc read from nand flash
1207 * @calc_ecc: ecc read from HW ECC registers
1209 * Calculated ecc vector reported as zero in case of non-error pages.
1210 * In case of non-zero ecc vector, first filter out erased-pages, and
1217 struct nand_ecc_ctrl *ecc = &info->nand.ecc;
1234 actual_eccbytes = ecc->bytes - 1;
1239 actual_eccbytes = ecc->bytes - 1;
1243 actual_eccbytes = ecc->bytes;
1259 * In case of error, non zero ecc reported.
1263 eccflag = 1; /* non zero ecc, error present */
1276 buf = &data[info->nand.ecc.size * i];
1303 /* Update the ecc vector */
1304 calc_ecc += ecc->bytes;
1305 read_ecc += ecc->bytes;
1336 error_max = (ecc->size + actual_eccbytes) * 8;
1368 data += ecc->size;
1369 spare_ecc += ecc->bytes;
1376 * omap_write_page_bch - BCH ecc based write page function for entire page
1389 uint8_t *ecc_calc = chip->ecc.calc_buf;
1398 /* Enable GPMC ecc engine */
1399 chip->ecc.hwctl(chip, NAND_ECC_WRITE);
1405 /* Update ecc vector from GPMC result registers */
1420 /* Write ecc vector to OOB area */
1443 u8 *ecc_calc = chip->ecc.calc_buf;
1444 int ecc_size = chip->ecc.size;
1445 int ecc_bytes = chip->ecc.bytes;
1463 chip->ecc.hwctl(chip, NAND_ECC_WRITE);
1506 * omap_read_page_bch - BCH ecc based page read function for entire page
1512 * For BCH ecc scheme, GPMC used for syndrome calculation and ELM module
1516 * ecc engine enabled. ecc vector updated after read of OOB data.
1517 * For non error pages ecc vector reported as zero.
1524 uint8_t *ecc_calc = chip->ecc.calc_buf;
1525 uint8_t *ecc_code = chip->ecc.code_buf;
1534 /* Enable GPMC ecc engine */
1535 chip->ecc.hwctl(chip, NAND_ECC_READ);
1554 /* Calculate ecc bytes */
1568 stat = chip->ecc.correct(chip,
1680 /* select ecc-scheme for NAND */
1681 if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
1682 dev_err(dev, "ti,nand-ecc-opt not found\n");
1704 dev_err(dev, "unrecognized value for ti,nand-ecc-opt\n");
1739 oobregion->length = chip->ecc.total;
1758 off += chip->ecc.total;
1769 .ecc = omap_ooblayout_ecc,
1820 .ecc = omap_sw_ooblayout_ecc,
1926 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
1927 chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
1935 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1936 chip->ecc.bytes = 3;
1937 chip->ecc.size = 512;
1938 chip->ecc.strength = 1;
1939 chip->ecc.calculate = omap_calculate_ecc;
1940 chip->ecc.hwctl = omap_enable_hwecc;
1941 chip->ecc.correct = omap_correct_data;
1943 oobbytes_per_step = chip->ecc.bytes;
1952 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1953 chip->ecc.size = 512;
1954 chip->ecc.bytes = 7;
1955 chip->ecc.strength = 4;
1956 chip->ecc.hwctl = omap_enable_hwecc_bch;
1957 chip->ecc.correct = rawnand_sw_bch_correct;
1958 chip->ecc.calculate = omap_calculate_ecc_bch_sw;
1961 oobbytes_per_step = chip->ecc.bytes + 1;
1972 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1973 chip->ecc.size = 512;
1975 chip->ecc.bytes = 7 + 1;
1976 chip->ecc.strength = 4;
1977 chip->ecc.hwctl = omap_enable_hwecc_bch;
1978 chip->ecc.correct = omap_elm_correct_data;
1979 chip->ecc.read_page = omap_read_page_bch;
1980 chip->ecc.write_page = omap_write_page_bch;
1981 chip->ecc.write_subpage = omap_write_subpage_bch;
1983 oobbytes_per_step = chip->ecc.bytes;
1989 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1990 chip->ecc.size = 512;
1991 chip->ecc.bytes = 13;
1992 chip->ecc.strength = 8;
1993 chip->ecc.hwctl = omap_enable_hwecc_bch;
1994 chip->ecc.correct = rawnand_sw_bch_correct;
1995 chip->ecc.calculate = omap_calculate_ecc_bch_sw;
1998 oobbytes_per_step = chip->ecc.bytes + 1;
2009 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
2010 chip->ecc.size = 512;
2012 chip->ecc.bytes = 13 + 1;
2013 chip->ecc.strength = 8;
2014 chip->ecc.hwctl = omap_enable_hwecc_bch;
2015 chip->ecc.correct = omap_elm_correct_data;
2016 chip->ecc.read_page = omap_read_page_bch;
2017 chip->ecc.write_page = omap_write_page_bch;
2018 chip->ecc.write_subpage = omap_write_subpage_bch;
2020 oobbytes_per_step = chip->ecc.bytes;
2026 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
2027 chip->ecc.size = 512;
2028 chip->ecc.bytes = 26;
2029 chip->ecc.strength = 16;
2030 chip->ecc.hwctl = omap_enable_hwecc_bch;
2031 chip->ecc.correct = omap_elm_correct_data;
2032 chip->ecc.read_page = omap_read_page_bch;
2033 chip->ecc.write_page = omap_write_page_bch;
2034 chip->ecc.write_subpage = omap_write_subpage_bch;
2036 oobbytes_per_step = chip->ecc.bytes;
2045 chip->ecc.steps = mtd->writesize / chip->ecc.size;
2046 info->neccpg = chip->ecc.steps / ERROR_VECTOR_MAX;
2051 info->nsteps_per_eccpg = chip->ecc.steps;
2053 info->eccpg_size = info->nsteps_per_eccpg * chip->ecc.size;
2054 info->eccpg_bytes = info->nsteps_per_eccpg * chip->ecc.bytes;
2057 info->nsteps_per_eccpg, chip->ecc.size,
2058 chip->ecc.bytes);
2065 (mtd->writesize / chip->ecc.size));