Lines Matching full:ecc

57 #define SLCCTRL_ECC_CLEAR	(1 << 1) /* Reset ECC bit */
64 #define SLCCFG_DMA_ECC (1 << 4) /* Enable DMA ECC bit */
65 #define SLCCFG_ECC_EN (1 << 3) /* ECC enable bit */
109 /* ECC line party fetch macro */
114 * DMA requires storage space for the DMA local buffer and the hardware ECC
121 /* Number of bytes used for ECC stored in NAND per 256 bytes */
135 * NAND ECC Layout for small page NAND devices
168 .ecc = lpc32xx_ooblayout_ecc,
230 * DMA and CPU addresses of ECC work area and data buffer
326 * Prepares SLC for transfers with H/W ECC enabled
330 /* Hardware ECC is enabled automatically in hardware as needed */ in lpc32xx_nand_ecc_enable()
334 * Calculates the ECC for the data
341 * ECC is calculated automatically in hardware during syndrome read in lpc32xx_nand_ecc_calculate()
358 * Simple device read without ECC
364 /* Direct device read with no ECC */ in lpc32xx_nand_read_buf()
370 * Simple device write without ECC
377 /* Direct device write with no ECC */ in lpc32xx_nand_write_buf()
383 * Read the OOB data from the device without ECC using FIFO method
393 * Write the OOB data to the device without ECC using FIFO method
404 * Fills in the ECC fields in the OOB buffer with the hardware generated ECC
406 static void lpc32xx_slc_ecc_copy(uint8_t *spare, const uint32_t *ecc, int count) in lpc32xx_slc_ecc_copy() argument
411 uint32_t ce = ecc[i / 3]; in lpc32xx_slc_ecc_copy()
484 * DMA read/write transfers with ECC support
520 /* Clear initial ECC */ in lpc32xx_xfer()
530 for (i = 0; i < chip->ecc.steps; i++) { in lpc32xx_xfer()
533 dma_buf + i * chip->ecc.size, in lpc32xx_xfer()
534 mtd->writesize / chip->ecc.steps, dir); in lpc32xx_xfer()
538 /* Always _read_ ECC */ in lpc32xx_xfer()
539 if (i == chip->ecc.steps - 1) in lpc32xx_xfer()
541 if (!read) /* ECC availability delayed on write */ in lpc32xx_xfer()
568 /* Read last calculated ECC value */ in lpc32xx_xfer()
571 host->ecc_buf[chip->ecc.steps - 1] = in lpc32xx_xfer()
584 /* Stop DMA & HW ECC */ in lpc32xx_xfer()
598 * Read the data and OOB data from the device, use ECC correction with the
599 * data, disable ECC for the OOB data
613 /* Read data and oob, calculate ECC */ in lpc32xx_nand_read_page_syndrome()
614 status = lpc32xx_xfer(mtd, buf, chip->ecc.steps, 1); in lpc32xx_nand_read_page_syndrome()
619 /* Convert to stored ECC format */ in lpc32xx_nand_read_page_syndrome()
620 lpc32xx_slc_ecc_copy(tmpecc, (uint32_t *) host->ecc_buf, chip->ecc.steps); in lpc32xx_nand_read_page_syndrome()
622 /* Pointer to ECC data retrieved from NAND spare area */ in lpc32xx_nand_read_page_syndrome()
629 for (i = 0; i < chip->ecc.steps; i++) { in lpc32xx_nand_read_page_syndrome()
630 stat = chip->ecc.correct(chip, buf, oobecc, in lpc32xx_nand_read_page_syndrome()
631 &tmpecc[i * chip->ecc.bytes]); in lpc32xx_nand_read_page_syndrome()
637 buf += chip->ecc.size; in lpc32xx_nand_read_page_syndrome()
638 oobecc += chip->ecc.bytes; in lpc32xx_nand_read_page_syndrome()
645 * Read the data and OOB data from the device, no ECC correction with the
658 chip->legacy.read_buf(chip, buf, chip->ecc.size * chip->ecc.steps); in lpc32xx_nand_read_page_raw_syndrome()
665 * Write the data and OOB data to the device, use ECC with the data,
666 * disable ECC for the OOB data
680 /* Write data, calculate ECC on outbound data */ in lpc32xx_nand_write_page_syndrome()
681 error = lpc32xx_xfer(mtd, (uint8_t *)buf, chip->ecc.steps, 0); in lpc32xx_nand_write_page_syndrome()
686 * The calculated ECC needs some manual work done to it before in lpc32xx_nand_write_page_syndrome()
687 * committing it to NAND. Process the calculated ECC and place in lpc32xx_nand_write_page_syndrome()
694 lpc32xx_slc_ecc_copy(pb, (uint32_t *)host->ecc_buf, chip->ecc.steps); in lpc32xx_nand_write_page_syndrome()
696 /* Write ECC data to device */ in lpc32xx_nand_write_page_syndrome()
703 * Write the data and OOB data to the device, no ECC correction with the
714 chip->ecc.size * chip->ecc.steps); in lpc32xx_nand_write_page_raw_syndrome()
777 if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) in lpc32xx_nand_attach_chip()
780 /* OOB and ECC CPU and DMA work areas */ in lpc32xx_nand_attach_chip()
791 chip->ecc.placement = NAND_ECC_PLACEMENT_INTERLEAVED; in lpc32xx_nand_attach_chip()
793 chip->ecc.size = 256; in lpc32xx_nand_attach_chip()
794 chip->ecc.strength = 1; in lpc32xx_nand_attach_chip()
795 chip->ecc.bytes = LPC32XX_SLC_DEV_ECC_BYTES; in lpc32xx_nand_attach_chip()
796 chip->ecc.prepad = 0; in lpc32xx_nand_attach_chip()
797 chip->ecc.postpad = 0; in lpc32xx_nand_attach_chip()
798 chip->ecc.read_page_raw = lpc32xx_nand_read_page_raw_syndrome; in lpc32xx_nand_attach_chip()
799 chip->ecc.read_page = lpc32xx_nand_read_page_syndrome; in lpc32xx_nand_attach_chip()
800 chip->ecc.write_page_raw = lpc32xx_nand_write_page_raw_syndrome; in lpc32xx_nand_attach_chip()
801 chip->ecc.write_page = lpc32xx_nand_write_page_syndrome; in lpc32xx_nand_attach_chip()
802 chip->ecc.write_oob = lpc32xx_nand_write_oob_syndrome; in lpc32xx_nand_attach_chip()
803 chip->ecc.read_oob = lpc32xx_nand_read_oob_syndrome; in lpc32xx_nand_attach_chip()
804 chip->ecc.calculate = lpc32xx_nand_ecc_calculate; in lpc32xx_nand_attach_chip()
805 chip->ecc.correct = rawnand_sw_hamming_correct; in lpc32xx_nand_attach_chip()
806 chip->ecc.hwctl = lpc32xx_nand_ecc_enable; in lpc32xx_nand_attach_chip()
810 * won't interfere with the ECC layout. Large and huge page in lpc32xx_nand_attach_chip()
903 * extra space for the spare area and ECC storage area in lpc32xx_nand_probe()