Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b28af78e authored by Pradeep P V K's avatar Pradeep P V K
Browse files

mtd: msm_qpic_nand: Use flash device ECC capability for erase page



Page codeword's ECC data is used to determine if the page is actually
erased or not. On an erased page, this data is all 0xFF. The acceptable
bitflips on this ECC data is flash device dependent. So, always check
against flash device ECC capability value for erase page determination.

Change-Id: Ib3889f91c871b5f131fe8bc960ffa68ac11e0633
Signed-off-by: default avatarPradeep P V K <ppvk@codeaurora.org>
parent 9499b3ff
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1995,7 +1995,7 @@ static int msm_nand_is_erased_page_ps(struct mtd_info *mtd, loff_t from,
			if (last_pos < ecc_bytes_percw_in_bits)
				num_zero_bits++;

			if (num_zero_bits > MAX_ECC_BIT_FLIPS) {
			if (num_zero_bits > info->flash_dev.ecc_capability) {
				*erased_page = false;
				goto free_mem;
			}
@@ -2007,7 +2007,8 @@ static int msm_nand_is_erased_page_ps(struct mtd_info *mtd, loff_t from,
		ecc_temp += chip->ecc_parity_bytes;
	}

	if ((n == cwperpage) && (num_zero_bits <= MAX_ECC_BIT_FLIPS))
	if ((n == cwperpage) &&
			(num_zero_bits <= info->flash_dev.ecc_capability))
		*erased_page = true;
free_mem:
	kfree(ecc);
@@ -2662,7 +2663,7 @@ static int msm_nand_is_erased_page(struct mtd_info *mtd, loff_t from,
			if (last_pos < ecc_bytes_percw_in_bits)
				num_zero_bits++;

			if (num_zero_bits > MAX_ECC_BIT_FLIPS) {
			if (num_zero_bits > info->flash_dev.ecc_capability) {
				*erased_page = false;
				goto free_mem;
			}
@@ -2674,7 +2675,8 @@ static int msm_nand_is_erased_page(struct mtd_info *mtd, loff_t from,
		ecc_temp += chip->ecc_parity_bytes;
	}

	if ((n == cwperpage) && (num_zero_bits <= MAX_ECC_BIT_FLIPS))
	if ((n == cwperpage) &&
			(num_zero_bits <= info->flash_dev.ecc_capability))
		*erased_page = true;
free_mem:
	kfree(ecc);