mbox series

[0/3] mtd: Ingenic NAND fix for JZ4740

Message ID 20211009184952.24591-1-paul@crapouillou.net (mailing list archive)
Headers show
Series mtd: Ingenic NAND fix for JZ4740 | expand

Message

Paul Cercueil Oct. 9, 2021, 6:49 p.m. UTC
Hi,

Looks like NAND support has been broken on the JZ4740 SoC for a while;
it looks like it comes from the fact that the "hw_oob_first" mechanism
was dropped from the NAND core and moved to the Davinci driver.

It turns out the JZ4740 SoC needs it too; I didn't notice it when
writing the new ingenic-nand driver (to replace the old jz4740-nand
driver) most likely because my Device Tree had the "nand-ecc-mode" set
to "hw_oob_first".

I am not very sure about patch [1/3]; to me the original code does not
make sense, and it didn't work out-of-the-box on the JZ4740 without it.
By applying patch [1/3] the function nand_read_page_hwecc_oob_first()
can be reused for the JZ4740 SoC as well. But I did not test patch [1/3]
on Davinci.

Cheers,
-Paul

Paul Cercueil (3):
  mtd: rawnand/davinci: Don't calculate ECC when reading page
  mtd: rawnand: Export nand_read_page_hwecc_oob_first()
  mtd: rawnand/ingenic: JZ4740 needs 'oob_first' read page function

 drivers/mtd/nand/raw/davinci_nand.c           | 73 +------------------
 .../mtd/nand/raw/ingenic/ingenic_nand_drv.c   |  5 ++
 drivers/mtd/nand/raw/nand_base.c              | 69 ++++++++++++++++++
 include/linux/mtd/rawnand.h                   |  2 +
 4 files changed, 77 insertions(+), 72 deletions(-)

Comments

H. Nikolaus Schaller Nov. 7, 2021, 1:47 p.m. UTC | #1
Hi Paul,

> Am 09.10.2021 um 20:49 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi,
> 
> Looks like NAND support has been broken on the JZ4740 SoC for a while;

Yes, I remember someone telling that something was fundamentally broken
and impossible to be fixed a while ago.

> it looks like it comes from the fact that the "hw_oob_first" mechanism
> was dropped from the NAND core and moved to the Davinci driver.
> 
> It turns out the JZ4740 SoC needs it too; I didn't notice it when
> writing the new ingenic-nand driver (to replace the old jz4740-nand
> driver) most likely because my Device Tree had the "nand-ecc-mode" set
> to "hw_oob_first".
> 
> I am not very sure about patch [1/3]; to me the original code does not
> make sense, and it didn't work out-of-the-box on the JZ4740 without it.
> By applying patch [1/3] the function nand_read_page_hwecc_oob_first()
> can be reused for the JZ4740 SoC as well. But I did not test patch [1/3]
> on Davinci.

would this also work for jz4780 NAND?

BR,
Nikolaus
Paul Cercueil Nov. 7, 2021, 6:43 p.m. UTC | #2
Hi Nikolaus,

Le dim., nov. 7 2021 at 14:47:43 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> Hi Paul,
> 
>>  Am 09.10.2021 um 20:49 schrieb Paul Cercueil <paul@crapouillou.net>:
>> 
>>  Hi,
>> 
>>  Looks like NAND support has been broken on the JZ4740 SoC for a 
>> while;
> 
> Yes, I remember someone telling that something was fundamentally 
> broken
> and impossible to be fixed a while ago.

You mean MLC NAND, and that's still broken.

>>  it looks like it comes from the fact that the "hw_oob_first" 
>> mechanism
>>  was dropped from the NAND core and moved to the Davinci driver.
>> 
>>  It turns out the JZ4740 SoC needs it too; I didn't notice it when
>>  writing the new ingenic-nand driver (to replace the old jz4740-nand
>>  driver) most likely because my Device Tree had the "nand-ecc-mode" 
>> set
>>  to "hw_oob_first".
>> 
>>  I am not very sure about patch [1/3]; to me the original code does 
>> not
>>  make sense, and it didn't work out-of-the-box on the JZ4740 without 
>> it.
>>  By applying patch [1/3] the function 
>> nand_read_page_hwecc_oob_first()
>>  can be reused for the JZ4740 SoC as well. But I did not test patch 
>> [1/3]
>>  on Davinci.
> 
> would this also work for jz4780 NAND?

The JZ4780 NAND driver does work, but UBI refuses to use the CI20's 
NAND as it's a MLC.

-Paul