Lines Matching defs:ecc

593 				      bool ecc)
602 if (ecc) {
613 bool ecc)
623 state = sunxi_nfc_randomizer_state(nand, page, ecc);
660 bool ecc, int page)
662 sunxi_nfc_randomizer_config(nand, page, ecc);
669 int len, bool ecc, int page)
671 sunxi_nfc_randomizer_config(nand, page, ecc);
680 struct sunxi_nand_hw_ecc *data = nand->ecc.priv;
689 if (nand->ecc.size == 512)
764 struct nand_ecc_ctrl *ecc = &nand->ecc;
783 memset(data, pattern, ecc->size);
786 memset(oob, pattern, ecc->bytes + 4);
804 struct nand_ecc_ctrl *ecc = &nand->ecc;
812 sunxi_nfc_randomizer_read_buf(nand, NULL, ecc->size, false, page);
814 if (data_off + ecc->size != oob_off)
830 *cur_off = oob_off + ecc->bytes + 4;
845 ecc->size, false);
848 ecc->size);
850 nand_change_read_column_op(nand, oob_off, oob, ecc->bytes + 4,
853 ret = nand_check_erased_ecc_chunk(data, ecc->size,
854 oob, ecc->bytes + 4,
855 NULL, 0, ecc->strength);
859 memcpy_fromio(data, nfc->regs + NFC_RAM0_BASE, ecc->size);
864 sunxi_nfc_randomizer_read_buf(nand, oob, ecc->bytes + 4,
882 struct nand_ecc_ctrl *ecc = &nand->ecc;
883 int offset = ((ecc->bytes + 4) * ecc->steps);
910 struct nand_ecc_ctrl *ecc = &nand->ecc;
920 ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, nchunks,
952 int data_off = i * ecc->size;
953 int oob_off = i * (ecc->bytes + 4);
970 oob, ecc->bytes + 4, false);
984 int data_off = i * ecc->size;
985 int oob_off = i * (ecc->bytes + 4);
999 data, ecc->size,
1005 oob, ecc->bytes + 4, false);
1007 ret = nand_check_erased_ecc_chunk(data, ecc->size,
1008 oob, ecc->bytes + 4,
1010 ecc->strength);
1033 struct nand_ecc_ctrl *ecc = &nand->ecc;
1039 sunxi_nfc_randomizer_write_buf(nand, data, ecc->size, false, page);
1041 if (data_off + ecc->size != oob_off)
1060 *cur_off = oob_off + ecc->bytes + 4;
1070 struct nand_ecc_ctrl *ecc = &nand->ecc;
1071 int offset = ((ecc->bytes + 4) * ecc->steps);
1091 struct nand_ecc_ctrl *ecc = &nand->ecc;
1102 for (i = 0; i < ecc->steps; i++) {
1103 int data_off = i * ecc->size;
1104 int oob_off = i * (ecc->bytes + 4);
1137 nand->ecc.steps);
1150 struct nand_ecc_ctrl *ecc = &nand->ecc;
1160 for (i = data_offs / ecc->size;
1161 i < DIV_ROUND_UP(data_offs + readlen, ecc->size); i++) {
1162 int data_off = i * ecc->size;
1163 int oob_off = i * (ecc->bytes + 4);
1185 int nchunks = DIV_ROUND_UP(data_offs + readlen, nand->ecc.size);
1206 struct nand_ecc_ctrl *ecc = &nand->ecc;
1215 for (i = 0; i < ecc->steps; i++) {
1216 int data_off = i * ecc->size;
1217 int oob_off = i * (ecc->bytes + 4);
1243 struct nand_ecc_ctrl *ecc = &nand->ecc;
1252 for (i = data_offs / ecc->size;
1253 i < DIV_ROUND_UP(data_offs + data_len, ecc->size); i++) {
1254 int data_off = i * ecc->size;
1255 int oob_off = i * (ecc->bytes + 4);
1277 struct nand_ecc_ctrl *ecc = &nand->ecc;
1287 ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, ecc->steps,
1292 for (i = 0; i < ecc->steps; i++) {
1293 const u8 *oob = nand->oob_poi + (i * (ecc->bytes + 4));
1340 return nand->ecc.read_page(nand, buf, 1, page);
1350 ret = nand->ecc.write_page(nand, buf, 1, page);
1553 struct nand_ecc_ctrl *ecc = &nand->ecc;
1555 if (section >= ecc->steps)
1558 oobregion->offset = section * (ecc->bytes + 4) + 4;
1559 oobregion->length = ecc->bytes;
1568 struct nand_ecc_ctrl *ecc = &nand->ecc;
1570 if (section > ecc->steps)
1578 if (!section && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
1585 oobregion->offset = section * (ecc->bytes + 4);
1587 if (section < ecc->steps)
1596 .ecc = sunxi_nand_ooblayout_ecc,
1600 static void sunxi_nand_hw_ecc_ctrl_cleanup(struct nand_ecc_ctrl *ecc)
1602 kfree(ecc->priv);
1606 struct nand_ecc_ctrl *ecc,
1618 if (nanddev->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) {
1621 ecc->size = 1024;
1622 nsectors = mtd->writesize / ecc->size;
1634 ecc->strength = bytes * 8 / fls(8 * ecc->size);
1637 if (strengths[i] > ecc->strength)
1642 ecc->strength = 0;
1644 ecc->strength = strengths[i - 1];
1647 if (ecc->size != 512 && ecc->size != 1024)
1655 if (ecc->size == 512 && mtd->writesize > 512) {
1656 ecc->size = 1024;
1657 ecc->strength *= 2;
1662 if (ecc->strength <= strengths[i]) {
1664 * Update ecc->strength value with the actual strength
1667 ecc->strength = strengths[i];
1681 ecc->bytes = DIV_ROUND_UP(ecc->strength * fls(8 * 1024), 8);
1684 ecc->bytes = ALIGN(ecc->bytes, 2);
1686 nsectors = mtd->writesize / ecc->size;
1688 if (mtd->oobsize < ((ecc->bytes + 4) * nsectors)) {
1693 ecc->read_oob = sunxi_nfc_hw_ecc_read_oob;
1694 ecc->write_oob = sunxi_nfc_hw_ecc_write_oob;
1696 ecc->priv = data;
1699 ecc->read_page = sunxi_nfc_hw_ecc_read_page_dma;
1700 ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage_dma;
1701 ecc->write_page = sunxi_nfc_hw_ecc_write_page_dma;
1704 ecc->read_page = sunxi_nfc_hw_ecc_read_page;
1705 ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage;
1706 ecc->write_page = sunxi_nfc_hw_ecc_write_page;
1710 ecc->write_subpage = sunxi_nfc_hw_ecc_write_subpage;
1711 ecc->read_oob_raw = nand_read_oob_std;
1712 ecc->write_oob_raw = nand_write_oob_std;
1722 static void sunxi_nand_ecc_cleanup(struct nand_ecc_ctrl *ecc)
1724 switch (ecc->engine_type) {
1726 sunxi_nand_hw_ecc_ctrl_cleanup(ecc);
1738 struct nand_ecc_ctrl *ecc = &nand->ecc;
1750 if (!ecc->size) {
1751 ecc->size = requirements->step_size;
1752 ecc->strength = requirements->strength;
1755 if (!ecc->size || !ecc->strength)
1758 switch (ecc->engine_type) {
1760 ret = sunxi_nand_hw_ecc_ctrl_init(nand, ecc, np);
1997 nand->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
2056 sunxi_nand_ecc_cleanup(&chip->ecc);