lkml.org 
[lkml]   [2017]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP capability
On Wed, 22 Mar 2017 23:07:19 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:

> +static int denali_hw_ecc_fixup(struct mtd_info *mtd,
> + struct denali_nand_info *denali)
> +{
> + int bank = denali->flash_bank;
> + uint32_t ecc_cor;
> + unsigned int max_bitflips;
> +
> + ecc_cor = ioread32(denali->flash_reg + ECC_COR_INFO(bank));
> + ecc_cor >>= ECC_COR_INFO__SHIFT(bank);
> +
> + if (ecc_cor & ECC_COR_INFO__UNCOR_ERR)
> + return -EBADMSG;

As previously mentioned, just increment ecc_stats.failed.

> +
> + max_bitflips = ecc_cor & ECC_COR_INFO__MAX_ERRORS;
> +
> + /*
> + * The register holds the maximum of the number of corrected bitflips
> + * per sector. This can be returned from ecc->read_page() as-is.
> + * Unfortunately, we can not know the total number of corrected bits
> + * in the page. mtd->ecc_stats.corrected is compromised here.
> + */
> + mtd->ecc_stats.corrected += max_bitflips;
> +
> + return max_bitflips;
> +}

\
 
 \ /
  Last update: 2017-03-22 22:12    [W:0.209 / U:0.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site