Lines Matching defs:ecc
185 * @ecc: ECC controller structure
195 struct sunxi_nand_hw_ecc ecc;
603 bool ecc)
612 if (ecc) {
623 bool ecc)
633 state = sunxi_nfc_randomizer_state(nand, page, ecc);
670 bool ecc, int page)
672 sunxi_nfc_randomizer_config(nand, page, ecc);
679 int len, bool ecc, int page)
681 sunxi_nfc_randomizer_config(nand, page, ecc);
692 writel(sunxi_nand->ecc.ecc_ctl, nfc->regs + NFC_REG_ECC_CTL);
763 struct nand_ecc_ctrl *ecc = &nand->ecc;
782 memset(data, pattern, ecc->size);
785 memset(oob, pattern, ecc->bytes + 4);
803 struct nand_ecc_ctrl *ecc = &nand->ecc;
811 sunxi_nfc_randomizer_read_buf(nand, NULL, ecc->size, false, page);
813 if (data_off + ecc->size != oob_off)
829 *cur_off = oob_off + ecc->bytes + 4;
844 ecc->size, false);
847 ecc->size);
849 nand_change_read_column_op(nand, oob_off, oob, ecc->bytes + 4,
852 ret = nand_check_erased_ecc_chunk(data, ecc->size,
853 oob, ecc->bytes + 4,
854 NULL, 0, ecc->strength);
858 memcpy_fromio(data, nfc->regs + NFC_RAM0_BASE, ecc->size);
863 sunxi_nfc_randomizer_read_buf(nand, oob, ecc->bytes + 4,
881 struct nand_ecc_ctrl *ecc = &nand->ecc;
882 int offset = ((ecc->bytes + 4) * ecc->steps);
909 struct nand_ecc_ctrl *ecc = &nand->ecc;
919 ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, nchunks,
956 int data_off = i * ecc->size;
957 int oob_off = i * (ecc->bytes + 4);
974 oob, ecc->bytes + 4, false);
988 int data_off = i * ecc->size;
989 int oob_off = i * (ecc->bytes + 4);
1003 data, ecc->size,
1009 oob, ecc->bytes + 4, false);
1011 ret = nand_check_erased_ecc_chunk(data, ecc->size,
1012 oob, ecc->bytes + 4,
1014 ecc->strength);
1037 struct nand_ecc_ctrl *ecc = &nand->ecc;
1043 sunxi_nfc_randomizer_write_buf(nand, data, ecc->size, false, page);
1045 if (data_off + ecc->size != oob_off)
1064 *cur_off = oob_off + ecc->bytes + 4;
1074 struct nand_ecc_ctrl *ecc = &nand->ecc;
1075 int offset = ((ecc->bytes + 4) * ecc->steps);
1095 struct nand_ecc_ctrl *ecc = &nand->ecc;
1106 for (i = 0; i < ecc->steps; i++) {
1107 int data_off = i * ecc->size;
1108 int oob_off = i * (ecc->bytes + 4);
1141 nand->ecc.steps);
1154 struct nand_ecc_ctrl *ecc = &nand->ecc;
1164 for (i = data_offs / ecc->size;
1165 i < DIV_ROUND_UP(data_offs + readlen, ecc->size); i++) {
1166 int data_off = i * ecc->size;
1167 int oob_off = i * (ecc->bytes + 4);
1189 int nchunks = DIV_ROUND_UP(data_offs + readlen, nand->ecc.size);
1210 struct nand_ecc_ctrl *ecc = &nand->ecc;
1219 for (i = 0; i < ecc->steps; i++) {
1220 int data_off = i * ecc->size;
1221 int oob_off = i * (ecc->bytes + 4);
1247 struct nand_ecc_ctrl *ecc = &nand->ecc;
1256 for (i = data_offs / ecc->size;
1257 i < DIV_ROUND_UP(data_offs + data_len, ecc->size); i++) {
1258 int data_off = i * ecc->size;
1259 int oob_off = i * (ecc->bytes + 4);
1281 struct nand_ecc_ctrl *ecc = &nand->ecc;
1292 ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, ecc->steps,
1297 for (i = 0; i < ecc->steps; i++) {
1298 const u8 *oob = nand->oob_poi + (i * (ecc->bytes + 4));
1350 return nand->ecc.read_page(nand, buf, 1, page);
1360 ret = nand->ecc.write_page(nand, buf, 1, page);
1563 struct nand_ecc_ctrl *ecc = &nand->ecc;
1565 if (section >= ecc->steps)
1568 oobregion->offset = section * (ecc->bytes + 4) + 4;
1569 oobregion->length = ecc->bytes;
1578 struct nand_ecc_ctrl *ecc = &nand->ecc;
1580 if (section > ecc->steps)
1588 if (!section && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
1599 if (section == ecc->steps && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
1602 oobregion->offset = section * (ecc->bytes + 4);
1604 if (section < ecc->steps)
1613 .ecc = sunxi_nand_ooblayout_ecc,
1618 struct nand_ecc_ctrl *ecc,
1629 if (nanddev->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) {
1632 ecc->size = 1024;
1633 nsectors = mtd->writesize / ecc->size;
1645 ecc->strength = bytes * 8 / fls(8 * ecc->size);
1648 if (strengths[i] > ecc->strength)
1653 ecc->strength = 0;
1655 ecc->strength = strengths[i - 1];
1658 if (ecc->size != 512 && ecc->size != 1024)
1662 if (ecc->size == 512 && mtd->writesize > 512) {
1663 ecc->size = 1024;
1664 ecc->strength *= 2;
1669 if (ecc->strength <= strengths[i]) {
1671 * Update ecc->strength value with the actual strength
1674 ecc->strength = strengths[i];
1685 ecc->bytes = DIV_ROUND_UP(ecc->strength * fls(8 * 1024), 8);
1688 ecc->bytes = ALIGN(ecc->bytes, 2);
1690 nsectors = mtd->writesize / ecc->size;
1692 if (mtd->oobsize < ((ecc->bytes + 4) * nsectors))
1695 ecc->read_oob = sunxi_nfc_hw_ecc_read_oob;
1696 ecc->write_oob = sunxi_nfc_hw_ecc_write_oob;
1700 ecc->read_page = sunxi_nfc_hw_ecc_read_page_dma;
1701 ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage_dma;
1702 ecc->write_page = sunxi_nfc_hw_ecc_write_page_dma;
1705 ecc->read_page = sunxi_nfc_hw_ecc_read_page;
1706 ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage;
1707 ecc->write_page = sunxi_nfc_hw_ecc_write_page;
1711 ecc->write_subpage = sunxi_nfc_hw_ecc_write_subpage;
1712 ecc->read_oob_raw = nand_read_oob_std;
1713 ecc->write_oob_raw = nand_write_oob_std;
1715 sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(i) | NFC_ECC_EXCEPTION |
1718 if (ecc->size == 512)
1719 sunxi_nand->ecc.ecc_ctl |= NFC_ECC_BLOCK_512;
1728 struct nand_ecc_ctrl *ecc = &nand->ecc;
1740 if (!ecc->size) {
1741 ecc->size = requirements->step_size;
1742 ecc->strength = requirements->strength;
1745 if (!ecc->size || !ecc->strength)
1748 switch (ecc->engine_type) {
1750 ret = sunxi_nand_hw_ecc_ctrl_init(nand, ecc, np);
2003 nand->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;