[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170322221216.26539147@bbrezillon>
Date: Wed, 22 Mar 2017 22:12:16 +0100
From: Boris Brezillon <boris.brezillon@...e-electrons.com>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: linux-mtd@...ts.infradead.org, laurent.monat@...uantique.com,
thorsten.christiansson@...uantique.com,
Enrico Jorns <ejo@...gutronix.de>,
Jason Roberts <jason.e.roberts@...el.com>,
Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>,
Dinh Nguyen <dinguyen@...nel.org>,
Marek Vasut <marek.vasut@...il.com>,
Brian Norris <computersforpeace@...il.com>,
Graham Moore <grmoore@...nsource.altera.com>,
David Woodhouse <dwmw2@...radead.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Chuanxiao Dong <chuanxiao.dong@...el.com>,
Jassi Brar <jaswinder.singh@...aro.org>,
linux-kernel@...r.kernel.org, Richard Weinberger <richard@....at>,
Cyrille Pitchen <cyrille.pitchen@...el.com>
Subject: Re: [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@...ionext.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;
> +}
Powered by blists - more mailing lists