Commit 1617942a authored by Miquel Raynal's avatar Miquel Raynal
Browse files

mtd: rawnand: marvell: Rename the ->correct() function



There is no correction involved at this point, it is just a matter of
reading registers and checking whether bitflips have occurred or
not. Rename the function to clarify it.

Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200424164501.26719-7-miquel.raynal@bootlin.com
parent 82c6c04e
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -932,13 +932,13 @@ static void marvell_nfc_check_empty_chunk(struct nand_chip *chip,
}

/*
 * Check a chunk is correct or not according to hardware ECC engine.
 * Check if a chunk is correct or not according to the hardware ECC engine.
 * mtd->ecc_stats.corrected is updated, as well as max_bitflips, however
 * mtd->ecc_stats.failure is not, the function will instead return a non-zero
 * value indicating that a check on the emptyness of the subpage must be
 * performed before declaring the subpage corrupted.
 * performed before actually declaring the subpage as "corrupted".
 */
static int marvell_nfc_hw_ecc_correct(struct nand_chip *chip,
static int marvell_nfc_hw_ecc_check_bitflips(struct nand_chip *chip,
					     unsigned int *max_bitflips)
{
	struct mtd_info *mtd = nand_to_mtd(chip);
@@ -1053,7 +1053,7 @@ static int marvell_nfc_hw_ecc_hmg_read_page(struct nand_chip *chip, u8 *buf,
	marvell_nfc_enable_hw_ecc(chip);
	marvell_nfc_hw_ecc_hmg_do_read_page(chip, buf, chip->oob_poi, false,
					    page);
	ret = marvell_nfc_hw_ecc_correct(chip, &max_bitflips);
	ret = marvell_nfc_hw_ecc_check_bitflips(chip, &max_bitflips);
	marvell_nfc_disable_hw_ecc(chip);

	if (!ret)
@@ -1336,7 +1336,7 @@ static int marvell_nfc_hw_ecc_bch_read_page(struct nand_chip *chip,
		/* Read the chunk and detect number of bitflips */
		marvell_nfc_hw_ecc_bch_read_chunk(chip, chunk, data, data_len,
						  spare, spare_len, page);
		ret = marvell_nfc_hw_ecc_correct(chip, &max_bitflips);
		ret = marvell_nfc_hw_ecc_check_bitflips(chip, &max_bitflips);
		if (ret)
			failure_mask |= BIT(chunk);

@@ -1358,10 +1358,9 @@ static int marvell_nfc_hw_ecc_bch_read_page(struct nand_chip *chip,
	 */

	/*
	 * In case there is any subpage read error reported by ->correct(), we
	 * usually re-read only ECC bytes in raw mode and check if the whole
	 * page is empty. In this case, it is normal that the ECC check failed
	 * and we just ignore the error.
	 * In case there is any subpage read error, we usually re-read only ECC
	 * bytes in raw mode and check if the whole page is empty. In this case,
	 * it is normal that the ECC check failed and we just ignore the error.
	 *
	 * However, it has been empirically observed that for some layouts (e.g
	 * 2k page, 8b strength per 512B chunk), the controller tries to correct