* [PATCH] mtd: nand: sunxi: Fix ECC strength choice
@ 2018-01-24 22:49 Miquel Raynal
2018-01-24 22:59 ` Miquel Raynal
0 siblings, 1 reply; 3+ messages in thread
From: Miquel Raynal @ 2018-01-24 22:49 UTC (permalink / raw)
To: linux-arm-kernel
When the requested ECC strength does not exactly match the strengths
supported by the ECC engine, the driver is selecting the closest
strength meeting the 'selected_strength > requested_strength'
constraint. Fix the fact that, in this particular case, ecc->strength
value was not updated to match the 'selected_strength'.
For instance, one can encounter this issue when no ECC requirement is
filled in the device tree while the NAND chip minimum requirement is not
a strength/step_size combo natively supported by the ECC engine.
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
---
drivers/mtd/nand/sunxi_nand.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 82244be3e766..958974821582 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -1853,8 +1853,14 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,
/* Add ECC info retrieval from DT */
for (i = 0; i < ARRAY_SIZE(strengths); i++) {
- if (ecc->strength <= strengths[i])
+ if (ecc->strength <= strengths[i]) {
+ /*
+ * Update ecc->strength value with the actual strength
+ * that will be used by the ECC engine.
+ */
+ ecc->strength = strengths[i];
break;
+ }
}
if (i >= ARRAY_SIZE(strengths)) {
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] mtd: nand: sunxi: Fix ECC strength choice
2018-01-24 22:49 [PATCH] mtd: nand: sunxi: Fix ECC strength choice Miquel Raynal
@ 2018-01-24 22:59 ` Miquel Raynal
2018-01-25 10:05 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Miquel Raynal @ 2018-01-24 22:59 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Wed, 24 Jan 2018 23:49:31 +0100
Miquel Raynal <miquel.raynal@free-electrons.com> wrote:
> When the requested ECC strength does not exactly match the strengths
> supported by the ECC engine, the driver is selecting the closest
> strength meeting the 'selected_strength > requested_strength'
> constraint. Fix the fact that, in this particular case, ecc->strength
> value was not updated to match the 'selected_strength'.
>
> For instance, one can encounter this issue when no ECC requirement is
> filled in the device tree while the NAND chip minimum requirement is not
> a strength/step_size combo natively supported by the ECC engine.
>
I forgot to add the Fixes/CC tags, but it seems that this problem
has always been out there...
Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller
support")
CC: stable at vger.kernel.org
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
I will wait a review before sending a v2.
Thanks,
Miqu?l
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] mtd: nand: sunxi: Fix ECC strength choice
2018-01-24 22:59 ` Miquel Raynal
@ 2018-01-25 10:05 ` Boris Brezillon
0 siblings, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-01-25 10:05 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 24 Jan 2018 23:59:36 +0100
Miquel Raynal <miquel.raynal@free-electrons.com> wrote:
> Hello,
>
> On Wed, 24 Jan 2018 23:49:31 +0100
> Miquel Raynal <miquel.raynal@free-electrons.com> wrote:
>
> > When the requested ECC strength does not exactly match the strengths
> > supported by the ECC engine, the driver is selecting the closest
> > strength meeting the 'selected_strength > requested_strength'
> > constraint. Fix the fact that, in this particular case, ecc->strength
> > value was not updated to match the 'selected_strength'.
> >
> > For instance, one can encounter this issue when no ECC requirement is
> > filled in the device tree while the NAND chip minimum requirement is not
> > a strength/step_size combo natively supported by the ECC engine.
> >
>
> I forgot to add the Fixes/CC tags, but it seems that this problem
> has always been out there...
>
> Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller
> support")
> CC: stable at vger.kernel.org
No need to send a new version. I added the Fixes+stable tags when
applying.
Thanks,
Boris
>
> > Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
>
> I will wait a review before sending a v2.
>
> Thanks,
> Miqu?l
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-25 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24 22:49 [PATCH] mtd: nand: sunxi: Fix ECC strength choice Miquel Raynal
2018-01-24 22:59 ` Miquel Raynal
2018-01-25 10:05 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).