linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
@ 2025-05-26  3:43 Wentao Liang
  2025-05-26  8:12 ` Miquel Raynal
  2025-05-26  9:31 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-05-26  3:43 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, wens, jernej.skrabec, samuel
  Cc: ruanjinjie, u.kleine-koenig, linux-kernel, linux-mtd,
	linux-arm-kernel, linux-sunxi, Wentao Liang, stable

The function sunxi_nfc_hw_ecc_write_chunk() calls the
sunxi_nfc_hw_ecc_write_chunk(), but does not call the configuration
function sunxi_nfc_randomizer_config(). Consequently, the randomization
might not conduct correctly, which will affect the lifespan of NAND flash.
A proper implementation can be found in sunxi_nfc_hw_ecc_write_page_dma().

Add the sunxi_nfc_randomizer_config() to config randomizer.

Fixes: 4be4e03efc7f ("mtd: nand: sunxi: add randomizer support")
Cc: stable@vger.kernel.org # v4.6
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/mtd/nand/raw/sunxi_nand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 9179719f639e..162cd5f4f234 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -1050,6 +1050,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct nand_chip *nand,
 	if (ret)
 		return ret;
 
+	sunxi_nfc_randomizer_config(nand, page, false);
 	sunxi_nfc_randomizer_enable(nand);
 	sunxi_nfc_hw_ecc_set_prot_oob_bytes(nand, oob, 0, bbm, page);
 
-- 
2.42.0.windows.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
  2025-05-26  3:43 [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk Wentao Liang
@ 2025-05-26  8:12 ` Miquel Raynal
  2025-05-26  9:31 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-05-26  8:12 UTC (permalink / raw)
  To: Wentao Liang
  Cc: richard, vigneshr, wens, jernej.skrabec, samuel, ruanjinjie,
	u.kleine-koenig, linux-kernel, linux-mtd, linux-arm-kernel,
	linux-sunxi, stable

Hi Liang,

On 26/05/2025 at 11:43:44 +08, Wentao Liang <vulab@iscas.ac.cn> wrote:

> The function sunxi_nfc_hw_ecc_write_chunk() calls the
> sunxi_nfc_hw_ecc_write_chunk(), but does not call the configuration
> function sunxi_nfc_randomizer_config(). Consequently, the randomization
> might not conduct correctly, which will affect the lifespan of NAND flash.
> A proper implementation can be found in sunxi_nfc_hw_ecc_write_page_dma().
>
> Add the sunxi_nfc_randomizer_config() to config randomizer.
>
> Fixes: 4be4e03efc7f ("mtd: nand: sunxi: add randomizer support")
> Cc: stable@vger.kernel.org # v4.6
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/mtd/nand/raw/sunxi_nand.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> index 9179719f639e..162cd5f4f234 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -1050,6 +1050,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct nand_chip *nand,
>  	if (ret)
>  		return ret;
>  
> +	sunxi_nfc_randomizer_config(nand, page, false);
>  	sunxi_nfc_randomizer_enable(nand);
>  	sunxi_nfc_hw_ecc_set_prot_oob_bytes(nand, oob, 0, bbm, page);

Please next time send all these "identical" changes in a single patch.

Cheers,
Miquèl



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
  2025-05-26  3:43 [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk Wentao Liang
  2025-05-26  8:12 ` Miquel Raynal
@ 2025-05-26  9:31 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-05-26  9:31 UTC (permalink / raw)
  To: richard, vigneshr, wens, jernej.skrabec, samuel, Wentao Liang
  Cc: ruanjinjie, u.kleine-koenig, linux-kernel, linux-mtd,
	linux-arm-kernel, linux-sunxi, stable

On Mon, 26 May 2025 11:43:44 +0800, Wentao Liang wrote:
> The function sunxi_nfc_hw_ecc_write_chunk() calls the
> sunxi_nfc_hw_ecc_write_chunk(), but does not call the configuration
> function sunxi_nfc_randomizer_config(). Consequently, the randomization
> might not conduct correctly, which will affect the lifespan of NAND flash.
> A proper implementation can be found in sunxi_nfc_hw_ecc_write_page_dma().
> 
> Add the sunxi_nfc_randomizer_config() to config randomizer.
> 
> [...]

Applied to nand/next, thanks!

[1/1] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
      (no commit info)

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-26  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26  3:43 [PATCH] mtd: nand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk Wentao Liang
2025-05-26  8:12 ` Miquel Raynal
2025-05-26  9:31 ` Miquel Raynal

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).