[PATCH] mtd: nand: raw: atmel: Use ONFI ECC params if available

When ECC parameters are not specified in DT, first try ONFI ECC parameters before fallback to maximum strength. To be inline with kernel driver behavior.
Signed-off-by: Zixun LI zli@ogga.fr --- drivers/mtd/nand/raw/atmel/nand-controller.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 9873d11254..d29a9c6f10 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -1064,11 +1064,15 @@ static int atmel_nand_pmecc_init(struct nand_chip *chip) req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH; else if (chip->ecc.strength) req.ecc.strength = chip->ecc.strength; + else if(chip->ecc_strength_ds) + req.ecc.strength = chip->ecc_strength_ds; else req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH;
if (chip->ecc.size) req.ecc.sectorsize = chip->ecc.size; + else if(chip->ecc_step_ds) + req.ecc.sectorsize = chip->ecc_step_ds; else req.ecc.sectorsize = ATMEL_PMECC_SECTOR_SIZE_AUTO;

Hello,
Am Tue, Jul 09, 2024 at 10:28:12PM +0000 schrieb Zixun Li:
When ECC parameters are not specified in DT, first try ONFI ECC parameters before fallback to maximum strength. To be inline with kernel driver behavior.
Signed-off-by: Zixun LI zli@ogga.fr
drivers/mtd/nand/raw/atmel/nand-controller.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 9873d11254..d29a9c6f10 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -1064,11 +1064,15 @@ static int atmel_nand_pmecc_init(struct nand_chip *chip) req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH; else if (chip->ecc.strength) req.ecc.strength = chip->ecc.strength;
else if(chip->ecc_strength_ds)
req.ecc.strength = chip->ecc_strength_ds;
else req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH;
if (chip->ecc.size) req.ecc.sectorsize = chip->ecc.size;
else if(chip->ecc_step_ds)
req.ecc.sectorsize = chip->ecc_step_ds;
Despite the missing space between 'if' and the opening bracket (checkpatch should have told you?) this looks very much like what got into linux with v4.11 but was changed/reworked multiple times afterwards. I wonder why this was not ported to U-Boot when introducing this driver? In 6a8dfd57220d ("nand: atmel: Add DM based NAND driver") it was claimed the driver was ported from linux-5.4-at91, so this feature was probably dropped intentionally? Does anyone know why?
(Cc-ing the original driver author/porter.)
Greets Alex
else req.ecc.sectorsize = ATMEL_PMECC_SECTOR_SIZE_AUTO;
-- 2.45.1

On 10/07/2024 09:28, Alexander Dahl wrote:
Despite the missing space between 'if' and the opening bracket (checkpatch should have told you?) this looks very much like what got into linux with v4.11 but was changed/reworked multiple times afterwards. I wonder why this was not ported to U-Boot when introducing this driver? In 6a8dfd57220d ("nand: atmel: Add DM based NAND driver") it was claimed the driver was ported from linux-5.4-at91, so this feature was probably dropped intentionally? Does anyone know why?
Hi,
Sorry for the format issue. Is there any comment from maintainers ?
I'll push a v2 if this patch is considered. -- Zixun LI

Hi
On Thu, Jul 18, 2024 at 9:40 PM Zixun Li zli@ogga.fr wrote:
On 10/07/2024 09:28, Alexander Dahl wrote:
Despite the missing space between 'if' and the opening bracket (checkpatch should have told you?) this looks very much like what got into linux with v4.11 but was changed/reworked multiple times afterwards. I wonder why this was not ported to U-Boot when introducing this driver? In 6a8dfd57220d ("nand: atmel: Add DM based NAND driver") it was claimed the driver was ported from linux-5.4-at91, so this feature was probably dropped intentionally? Does anyone know why?
Hi,
Sorry for the format issue. Is there any comment from maintainers ?
I'll push a v2 if this patch is considered.
Looking on it. Anyway expand the commit message with original information of it. Like:
Upstream commit <short sha>
Try to report some original context from kernel
Micahel
-- Zixun LI

Hi,
On 19/07/24 1:17 am, Michael Nazzareno Trimarchi wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Hi
On Thu, Jul 18, 2024 at 9:40 PM Zixun Li zli@ogga.fr wrote:
On 10/07/2024 09:28, Alexander Dahl wrote:
Despite the missing space between 'if' and the opening bracket (checkpatch should have told you?) this looks very much like what got into linux with v4.11 but was changed/reworked multiple times afterwards. I wonder why this was not ported to U-Boot when introducing this driver? In 6a8dfd57220d ("nand: atmel: Add DM based NAND driver") it was claimed the driver was ported from linux-5.4-at91, so this feature was probably dropped intentionally? Does anyone know why?
Hi,
Sorry for the format issue. Is there any comment from maintainers ?
I'll push a v2 if this patch is considered.
Looking on it. Anyway expand the commit message with original information of it. Like:
Upstream commit <short sha>
Try to report some original context from kernel
Micahel
Sorry for the delay in response. This change was accidentally missed during porting. And was not dropped intentionally. Thanks for the patch.
Bala.
-- Zixun LI
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com
participants (4)
-
Alexander Dahl
-
Balamanikandan.Gunasundar@microchip.com
-
Michael Nazzareno Trimarchi
-
Zixun Li