2023-12-31 18:12:06

by Elad Nachman

[permalink] [raw]
Subject: [PATCH] mtd: rawnand: marvell: fix layouts

From: Elad Nachman <[email protected]>

Check in nand_base.c, nand_scan_tail() :
if (ecc->steps * ecc->size != mtd->writesize)
Fails for some NAND chips.
Remove entries which cannot create integral
multiplications, and adjust the number of chunks
for entries which fails the above calculation to
calculate correctly (this was previously done
automatically before the check).
Also fix spacing of the said table.

Fixes: 68c18dae6888 ("mtd: rawnand: marvell: add missing layouts")
Signed-off-by: Elad Nachman <[email protected]>
---
drivers/mtd/nand/raw/marvell_nand.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index a46698744850..21f4469b5cda 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -285,21 +285,18 @@ struct marvell_hw_ecc_layout {

/* Layouts explained in AN-379_Marvell_SoC_NFC_ECC */
static const struct marvell_hw_ecc_layout marvell_nfc_layouts[] = {
- MARVELL_LAYOUT( 512, 512, 1, 1, 1, 512, 8, 8, 0, 0, 0),
- MARVELL_LAYOUT( 2048, 512, 1, 1, 1, 2048, 40, 24, 0, 0, 0),
- MARVELL_LAYOUT( 2048, 512, 4, 1, 1, 2048, 32, 30, 0, 0, 0),
- MARVELL_LAYOUT( 2048, 512, 8, 2, 1, 1024, 0, 30,1024,32, 30),
- MARVELL_LAYOUT( 2048, 512, 8, 2, 1, 1024, 0, 30,1024,64, 30),
- MARVELL_LAYOUT( 2048, 512, 12, 3, 2, 704, 0, 30,640, 0, 30),
- MARVELL_LAYOUT( 2048, 512, 16, 5, 4, 512, 0, 30, 0, 32, 30),
- MARVELL_LAYOUT( 4096, 512, 4, 2, 2, 2048, 32, 30, 0, 0, 0),
- MARVELL_LAYOUT( 4096, 512, 8, 5, 4, 1024, 0, 30, 0, 64, 30),
- MARVELL_LAYOUT( 4096, 512, 12, 6, 5, 704, 0, 30,576, 32, 30),
- MARVELL_LAYOUT( 4096, 512, 16, 9, 8, 512, 0, 30, 0, 32, 30),
- MARVELL_LAYOUT( 8192, 512, 4, 4, 4, 2048, 0, 30, 0, 0, 0),
- MARVELL_LAYOUT( 8192, 512, 8, 9, 8, 1024, 0, 30, 0, 160, 30),
- MARVELL_LAYOUT( 8192, 512, 12, 12, 11, 704, 0, 30,448, 64, 30),
- MARVELL_LAYOUT( 8192, 512, 16, 17, 16, 512, 0, 30, 0, 32, 30),
+ MARVELL_LAYOUT(512, 512, 1, 1, 1, 512, 8, 8, 0, 0, 0),
+ MARVELL_LAYOUT(2048, 512, 1, 1, 1, 2048, 40, 24, 0, 0, 0),
+ MARVELL_LAYOUT(2048, 512, 4, 1, 1, 2048, 32, 30, 0, 0, 0),
+ MARVELL_LAYOUT(2048, 512, 8, 2, 1, 1024, 0, 30, 1024, 32, 30),
+ MARVELL_LAYOUT(2048, 512, 8, 2, 1, 1024, 0, 30, 1024, 64, 30),
+ MARVELL_LAYOUT(2048, 512, 16, 4, 4, 512, 0, 30, 0, 32, 30),
+ MARVELL_LAYOUT(4096, 512, 4, 2, 2, 2048, 32, 30, 0, 0, 0),
+ MARVELL_LAYOUT(4096, 512, 8, 4, 4, 1024, 0, 30, 0, 64, 30),
+ MARVELL_LAYOUT(4096, 512, 16, 8, 8, 512, 0, 30, 0, 32, 30),
+ MARVELL_LAYOUT(8192, 512, 4, 4, 4, 2048, 0, 30, 0, 0, 0),
+ MARVELL_LAYOUT(8192, 512, 8, 8, 8, 1024, 0, 30, 0, 160, 30),
+ MARVELL_LAYOUT(8192, 512, 16, 16, 16, 512, 0, 30, 0, 32, 30),
};

/**
--
2.25.1



2024-01-02 10:39:06

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH] mtd: rawnand: marvell: fix layouts

Hi Elad,

[email protected] wrote on Sun, 31 Dec 2023 19:49:50 +0200:

> From: Elad Nachman <[email protected]>
>

Please fix your mailer because this paragraph is way too small (<50
chars!).

> Check in nand_base.c, nand_scan_tail() :
> if (ecc->steps * ecc->size != mtd->writesize)
> Fails for some NAND chips.
> Remove entries which cannot create integral
> multiplications, and adjust the number of chunks
> for entries which fails the above calculation to
> calculate correctly (this was previously done
> automatically before the check).

I'm okay with that.

> Also fix spacing of the said table.

No, please don't do this in the same commit, it becomes totally
unreadable.

Please keep the spacing as it is, or if you want to change the spacing,
keep additional spaces so that it is easily readable by keeping clear
columns.

>
> Fixes: 68c18dae6888 ("mtd: rawnand: marvell: add missing layouts")

Please add:

Cc: [email protected]

> Signed-off-by: Elad Nachman <[email protected]>
> ---
> drivers/mtd/nand/raw/marvell_nand.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> index a46698744850..21f4469b5cda 100644
> --- a/drivers/mtd/nand/raw/marvell_nand.c
> +++ b/drivers/mtd/nand/raw/marvell_nand.c
> @@ -285,21 +285,18 @@ struct marvell_hw_ecc_layout {
>
> /* Layouts explained in AN-379_Marvell_SoC_NFC_ECC */
> static const struct marvell_hw_ecc_layout marvell_nfc_layouts[] = {
> - MARVELL_LAYOUT( 512, 512, 1, 1, 1, 512, 8, 8, 0, 0, 0),
> - MARVELL_LAYOUT( 2048, 512, 1, 1, 1, 2048, 40, 24, 0, 0, 0),
> - MARVELL_LAYOUT( 2048, 512, 4, 1, 1, 2048, 32, 30, 0, 0, 0),
> - MARVELL_LAYOUT( 2048, 512, 8, 2, 1, 1024, 0, 30,1024,32, 30),
> - MARVELL_LAYOUT( 2048, 512, 8, 2, 1, 1024, 0, 30,1024,64, 30),
> - MARVELL_LAYOUT( 2048, 512, 12, 3, 2, 704, 0, 30,640, 0, 30),
> - MARVELL_LAYOUT( 2048, 512, 16, 5, 4, 512, 0, 30, 0, 32, 30),
> - MARVELL_LAYOUT( 4096, 512, 4, 2, 2, 2048, 32, 30, 0, 0, 0),
> - MARVELL_LAYOUT( 4096, 512, 8, 5, 4, 1024, 0, 30, 0, 64, 30),
> - MARVELL_LAYOUT( 4096, 512, 12, 6, 5, 704, 0, 30,576, 32, 30),
> - MARVELL_LAYOUT( 4096, 512, 16, 9, 8, 512, 0, 30, 0, 32, 30),
> - MARVELL_LAYOUT( 8192, 512, 4, 4, 4, 2048, 0, 30, 0, 0, 0),
> - MARVELL_LAYOUT( 8192, 512, 8, 9, 8, 1024, 0, 30, 0, 160, 30),
> - MARVELL_LAYOUT( 8192, 512, 12, 12, 11, 704, 0, 30,448, 64, 30),
> - MARVELL_LAYOUT( 8192, 512, 16, 17, 16, 512, 0, 30, 0, 32, 30),
> + MARVELL_LAYOUT(512, 512, 1, 1, 1, 512, 8, 8, 0, 0, 0),
> + MARVELL_LAYOUT(2048, 512, 1, 1, 1, 2048, 40, 24, 0, 0, 0),
> + MARVELL_LAYOUT(2048, 512, 4, 1, 1, 2048, 32, 30, 0, 0, 0),
> + MARVELL_LAYOUT(2048, 512, 8, 2, 1, 1024, 0, 30, 1024, 32, 30),
> + MARVELL_LAYOUT(2048, 512, 8, 2, 1, 1024, 0, 30, 1024, 64, 30),
> + MARVELL_LAYOUT(2048, 512, 16, 4, 4, 512, 0, 30, 0, 32, 30),
> + MARVELL_LAYOUT(4096, 512, 4, 2, 2, 2048, 32, 30, 0, 0, 0),
> + MARVELL_LAYOUT(4096, 512, 8, 4, 4, 1024, 0, 30, 0, 64, 30),
> + MARVELL_LAYOUT(4096, 512, 16, 8, 8, 512, 0, 30, 0, 32, 30),
> + MARVELL_LAYOUT(8192, 512, 4, 4, 4, 2048, 0, 30, 0, 0, 0),
> + MARVELL_LAYOUT(8192, 512, 8, 8, 8, 1024, 0, 30, 0, 160, 30),
> + MARVELL_LAYOUT(8192, 512, 16, 16, 16, 512, 0, 30, 0, 32, 30),
> };
>
> /**


Thanks,
Miquèl