From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Harvey Hunt <harveyhuntnexus@gmail.com>,
list@opendingux.net, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 3/3] mtd: rawnand/ingenic: JZ4740 needs 'oob_first' read page function
Date: Fri, 15 Oct 2021 08:14:47 +0200 [thread overview]
Message-ID: <20211015081447.25836fc7@xps13> (raw)
In-Reply-To: <20211009184952.24591-4-paul@crapouillou.net>
Hi Paul,
paul@crapouillou.net wrote on Sat, 9 Oct 2021 20:49:52 +0200:
> The ECC engine on the JZ4740 SoC requires the ECC data to be read before
> the page; using the default page reading function does not work. Indeed,
> the old JZ4740 NAND driver (removed in 5.4) did use the 'OOB first' flag
> that existed back then.
>
> Use the newly created nand_read_page_hwecc_oob_first() to address this
> issue.
>
> This issue was not found when the new ingenic-nand driver was developed,
> most likely because the Device Tree used had the nand-ecc-mode set to
> "hw_oob_first", which seems to not be supported anymore.
I would rename both the boolean and the helper "*_access_oob_first"
which seems more precise.
>
> Cc: <stable@vger.kernel.org> # v5.2
> Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> index 0e9d426fe4f2..b18861bdcdc8 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> @@ -32,6 +32,7 @@ struct jz_soc_info {
> unsigned long addr_offset;
> unsigned long cmd_offset;
> const struct mtd_ooblayout_ops *oob_layout;
> + bool oob_first;
> };
>
> struct ingenic_nand_cs {
> @@ -240,6 +241,9 @@ static int ingenic_nand_attach_chip(struct nand_chip *chip)
> if (chip->bbt_options & NAND_BBT_USE_FLASH)
> chip->bbt_options |= NAND_BBT_NO_OOB;
>
> + if (nfc->soc_info->oob_first)
> + chip->ecc.read_page = nand_read_page_hwecc_oob_first;
> +
> /* For legacy reasons we use a different layout on the qi,lb60 board. */
> if (of_machine_is_compatible("qi,lb60"))
> mtd_set_ooblayout(mtd, &qi_lb60_ooblayout_ops);
> @@ -534,6 +538,7 @@ static const struct jz_soc_info jz4740_soc_info = {
> .data_offset = 0x00000000,
> .cmd_offset = 0x00008000,
> .addr_offset = 0x00010000,
> + .oob_first = true,
> };
>
> static const struct jz_soc_info jz4725b_soc_info = {
Thanks,
Miquèl
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Harvey Hunt <harveyhuntnexus@gmail.com>,
list@opendingux.net, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 3/3] mtd: rawnand/ingenic: JZ4740 needs 'oob_first' read page function
Date: Fri, 15 Oct 2021 08:14:47 +0200 [thread overview]
Message-ID: <20211015081447.25836fc7@xps13> (raw)
In-Reply-To: <20211009184952.24591-4-paul@crapouillou.net>
Hi Paul,
paul@crapouillou.net wrote on Sat, 9 Oct 2021 20:49:52 +0200:
> The ECC engine on the JZ4740 SoC requires the ECC data to be read before
> the page; using the default page reading function does not work. Indeed,
> the old JZ4740 NAND driver (removed in 5.4) did use the 'OOB first' flag
> that existed back then.
>
> Use the newly created nand_read_page_hwecc_oob_first() to address this
> issue.
>
> This issue was not found when the new ingenic-nand driver was developed,
> most likely because the Device Tree used had the nand-ecc-mode set to
> "hw_oob_first", which seems to not be supported anymore.
I would rename both the boolean and the helper "*_access_oob_first"
which seems more precise.
>
> Cc: <stable@vger.kernel.org> # v5.2
> Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> index 0e9d426fe4f2..b18861bdcdc8 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> @@ -32,6 +32,7 @@ struct jz_soc_info {
> unsigned long addr_offset;
> unsigned long cmd_offset;
> const struct mtd_ooblayout_ops *oob_layout;
> + bool oob_first;
> };
>
> struct ingenic_nand_cs {
> @@ -240,6 +241,9 @@ static int ingenic_nand_attach_chip(struct nand_chip *chip)
> if (chip->bbt_options & NAND_BBT_USE_FLASH)
> chip->bbt_options |= NAND_BBT_NO_OOB;
>
> + if (nfc->soc_info->oob_first)
> + chip->ecc.read_page = nand_read_page_hwecc_oob_first;
> +
> /* For legacy reasons we use a different layout on the qi,lb60 board. */
> if (of_machine_is_compatible("qi,lb60"))
> mtd_set_ooblayout(mtd, &qi_lb60_ooblayout_ops);
> @@ -534,6 +538,7 @@ static const struct jz_soc_info jz4740_soc_info = {
> .data_offset = 0x00000000,
> .cmd_offset = 0x00008000,
> .addr_offset = 0x00010000,
> + .oob_first = true,
> };
>
> static const struct jz_soc_info jz4725b_soc_info = {
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-10-15 6:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-09 18:49 [PATCH 0/3] mtd: Ingenic NAND fix for JZ4740 Paul Cercueil
2021-10-09 18:49 ` Paul Cercueil
2021-10-09 18:49 ` [PATCH 1/3] mtd: rawnand/davinci: Don't calculate ECC when reading page Paul Cercueil
2021-10-09 18:49 ` Paul Cercueil
2021-10-09 18:49 ` [PATCH 2/3] mtd: rawnand: Export nand_read_page_hwecc_oob_first() Paul Cercueil
2021-10-09 18:49 ` Paul Cercueil
2021-10-15 6:13 ` Miquel Raynal
2021-10-15 6:13 ` Miquel Raynal
2021-10-15 8:38 ` Paul Cercueil
2021-10-15 8:38 ` Paul Cercueil
2021-10-15 8:51 ` Miquel Raynal
2021-10-15 8:51 ` Miquel Raynal
2021-10-15 9:27 ` Paul Cercueil
2021-10-15 9:27 ` Paul Cercueil
2021-10-15 9:35 ` Miquel Raynal
2021-10-15 9:35 ` Miquel Raynal
2021-10-15 9:38 ` Paul Cercueil
2021-10-15 9:38 ` Paul Cercueil
2021-10-15 9:44 ` Miquel Raynal
2021-10-15 9:44 ` Miquel Raynal
2021-10-09 18:49 ` [PATCH 3/3] mtd: rawnand/ingenic: JZ4740 needs 'oob_first' read page function Paul Cercueil
2021-10-09 18:49 ` Paul Cercueil
2021-10-15 6:14 ` Miquel Raynal [this message]
2021-10-15 6:14 ` Miquel Raynal
2021-11-07 13:47 ` [PATCH 0/3] mtd: Ingenic NAND fix for JZ4740 H. Nikolaus Schaller
2021-11-07 13:47 ` H. Nikolaus Schaller
2021-11-07 18:43 ` Paul Cercueil
2021-11-07 18:43 ` Paul Cercueil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211015081447.25836fc7@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=harveyhuntnexus@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=list@opendingux.net \
--cc=paul@crapouillou.net \
--cc=richard@nod.at \
--cc=stable@vger.kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.