Lines Matching full:ecc

23  *	1024 bytes data + 4Bytes sys data + 28Bytes~124Bytes ECC data +
24 * 1024 bytes data + 4Bytes sys data + 28Bytes~124Bytes ECC data +
31 * 4Bytes sys data + .... + 4Bytes sys data + ECC data.
93 * struct rk_ecc_cnt_status: represent a ecc status data.
95 * @low: ECC count low bit index at register.
97 * @low_bn: ECC count low bit number.
98 * @high: ECC count high bit index at register.
113 * @ecc_strengths: ECC strengths
114 * @ecc_cfgs: ECC config values
197 return (u8 *)p + i * chip->ecc.size; in rk_nfc_buf_to_data_ptr()
214 poi = chip->oob_poi + rknand->metadata_size + chip->ecc.bytes * i; in rk_nfc_buf_to_oob_ecc_ptr()
221 return chip->ecc.size + chip->ecc.bytes + NFC_SYS_DATA_SIZE; in rk_nfc_data_len()
235 return nfc->page_buf + i * rk_nfc_data_len(chip) + chip->ecc.size; in rk_nfc_oob_ptr()
255 /* Save chip ECC setting */ in rk_nfc_hw_ecc_setup()
265 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_select_chip() local
296 * Compare current chip ECC setting with selected chip ECC setting and in rk_nfc_select_chip()
299 if (nfc->cur_ecc != ecc->strength) in rk_nfc_select_chip()
300 rk_nfc_hw_ecc_setup(chip, ecc->strength); in rk_nfc_select_chip()
512 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_write_page_raw() local
518 rknand->boot_ecc != ecc->strength) { in rk_nfc_write_page_raw()
521 * a different ECC strength is in use for the boot blocks. in rk_nfc_write_page_raw()
529 for (i = 0; i < ecc->steps; i++) { in rk_nfc_write_page_raw()
534 ecc->size); in rk_nfc_write_page_raw()
571 rk_nfc_buf_to_oob_ptr(chip, ecc->steps - 1), in rk_nfc_write_page_raw()
577 /* Copy ECC data to the NFC buffer. */ in rk_nfc_write_page_raw()
580 ecc->bytes); in rk_nfc_write_page_raw()
594 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_write_page_hwecc() local
595 int oob_step = (ecc->bytes > 60) ? NFC_MAX_OOB_PER_STEP : in rk_nfc_write_page_hwecc()
634 * Configure the ECC algorithm supported by the boot ROM. in rk_nfc_write_page_hwecc()
639 if (rknand->boot_ecc != ecc->strength) in rk_nfc_write_page_hwecc()
643 for (i = 0; i < ecc->steps; i++) { in rk_nfc_write_page_hwecc()
645 oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; in rk_nfc_write_page_hwecc()
660 ecc->steps * oob_step, in rk_nfc_write_page_hwecc()
666 rk_nfc_xfer_start(nfc, NFC_WRITE, ecc->steps, dma_data, in rk_nfc_write_page_hwecc()
681 dma_unmap_single(nfc->dev, dma_oob, ecc->steps * oob_step, in rk_nfc_write_page_hwecc()
684 if (boot_rom_mode && rknand->boot_ecc != ecc->strength) in rk_nfc_write_page_hwecc()
685 rk_nfc_hw_ecc_setup(chip, ecc->strength); in rk_nfc_write_page_hwecc()
706 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_read_page_raw() local
712 rknand->boot_ecc != ecc->strength) { in rk_nfc_read_page_raw()
715 * a different ECC strength is in use for the boot blocks. in rk_nfc_read_page_raw()
722 for (i = 0; i < ecc->steps; i++) { in rk_nfc_read_page_raw()
731 memcpy(rk_nfc_buf_to_oob_ptr(chip, ecc->steps - 1), in rk_nfc_read_page_raw()
739 /* Copy ECC data from the NFC buffer. */ in rk_nfc_read_page_raw()
742 ecc->bytes); in rk_nfc_read_page_raw()
748 ecc->size); in rk_nfc_read_page_raw()
760 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_read_page_hwecc() local
761 int oob_step = (ecc->bytes > 60) ? NFC_MAX_OOB_PER_STEP : in rk_nfc_read_page_hwecc()
776 ecc->steps * oob_step, in rk_nfc_read_page_hwecc()
782 * Configure the ECC algorithm supported by the boot ROM. in rk_nfc_read_page_hwecc()
787 if (rknand->boot_ecc != ecc->strength) in rk_nfc_read_page_hwecc()
793 rk_nfc_xfer_start(nfc, NFC_READ, ecc->steps, dma_data, in rk_nfc_read_page_hwecc()
808 dma_unmap_single(nfc->dev, dma_oob, ecc->steps * oob_step, in rk_nfc_read_page_hwecc()
817 for (i = 0; i < ecc->steps; i++) { in rk_nfc_read_page_hwecc()
819 oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; in rk_nfc_read_page_hwecc()
834 for (i = 0; i < (ecc->steps / 2); i++) { in rk_nfc_read_page_hwecc()
856 if (boot_rom_mode && rknand->boot_ecc != ecc->strength) in rk_nfc_read_page_hwecc()
857 rk_nfc_hw_ecc_setup(chip, ecc->strength); in rk_nfc_read_page_hwecc()
863 dev_err(nfc->dev, "read page: %x ecc error!\n", page); in rk_nfc_read_page_hwecc()
967 .ecc = rk_nfc_ooblayout_ecc,
974 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_ecc_init() local
981 if (!ecc->size || !ecc->strength || in rk_nfc_ecc_init()
982 ecc->strength > nfc_max_strength) { in rk_nfc_ecc_init()
983 chip->ecc.size = 1024; in rk_nfc_ecc_init()
984 ecc->steps = mtd->writesize / ecc->size; in rk_nfc_ecc_init()
987 * HW ECC always requests the number of ECC bytes per 1024 byte in rk_nfc_ecc_init()
990 max_strength = ((mtd->oobsize / ecc->steps) - 4) * 8 / in rk_nfc_ecc_init()
1001 dev_err(nfc->dev, "unsupported ECC strength\n"); in rk_nfc_ecc_init()
1005 ecc->strength = strengths[i]; in rk_nfc_ecc_init()
1007 ecc->steps = mtd->writesize / ecc->size; in rk_nfc_ecc_init()
1008 ecc->bytes = DIV_ROUND_UP(ecc->strength * fls(8 * chip->ecc.size), 8); in rk_nfc_ecc_init()
1019 struct nand_ecc_ctrl *ecc = &chip->ecc; in rk_nfc_attach_chip() local
1029 if (ecc->engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) in rk_nfc_attach_chip()
1036 rknand->metadata_size = NFC_SYS_DATA_SIZE * ecc->steps; in rk_nfc_attach_chip()
1056 new_oob_len = ecc->steps * NFC_MAX_OOB_PER_STEP; in rk_nfc_attach_chip()
1086 chip->ecc.write_page_raw = rk_nfc_write_page_raw; in rk_nfc_attach_chip()
1087 chip->ecc.write_page = rk_nfc_write_page_hwecc; in rk_nfc_attach_chip()
1088 chip->ecc.write_oob = rk_nfc_write_oob; in rk_nfc_attach_chip()
1090 chip->ecc.read_page_raw = rk_nfc_read_page_raw; in rk_nfc_attach_chip()
1091 chip->ecc.read_page = rk_nfc_read_page_hwecc; in rk_nfc_attach_chip()
1092 chip->ecc.read_oob = rk_nfc_read_oob; in rk_nfc_attach_chip()
1159 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; in rk_nfc_nand_chip_init()
1180 ret = of_property_read_u32(np, "rockchip,boot-ecc-strength", in rk_nfc_nand_chip_init()
1182 rknand->boot_ecc = ret ? chip->ecc.strength : tmp; in rk_nfc_nand_chip_init()