Subject: Re: [PATCH v2 10/36] mtd: nand: Introduce the ECC engine abstraction

From: Miquel Raynal <[email-masked]>
Date: Mon, 6 May 2019 17:49:48 +0200

Hi Boris,

Boris Brezillon <[email-masked]> wrote on Fri, 3 May
2019 17:54:46 +0200:

> On Fri, 3 May 2019 16:34:00 +0200
> Miquel Raynal <[email-masked]> wrote:
> 
> > Hi Boris,
> > 
> > Boris Brezillon <[email-masked]> wrote on Sun, 31 Mar
> > 2019 14:10:25 +0200:
> >   
> > > On Mon,  4 Mar 2019 23:28:15 +0100
> > > Miquel Raynal <[email-masked]> wrote:
> > >     
> > > > Create a generic ECC engine object.
> > > > 
> > > > Later the ecc/engine.c file will receive more generic code coming from
> > > > the raw NAND specific part. This is a base to instantiate ECC engine
> > > > objects.
> > > > 
> > > > Signed-off-by: Miquel Raynal <[email-masked]>
> > > > ---
> > > >  drivers/mtd/nand/Kconfig                     |   1 +
> > > >  drivers/mtd/nand/Makefile                    |   1 +
> > > >  drivers/mtd/nand/ecc/Kconfig                 |   6 +
> > > >  drivers/mtd/nand/ecc/Makefile                |   3 +
> > > >  drivers/mtd/nand/ecc/engine.c                | 138 +++++++++++++++++++
> > > >  drivers/mtd/nand/raw/atmel/nand-controller.c |   9 +-
> > > >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c   |  12 +-
> > > >  drivers/mtd/nand/raw/marvell_nand.c          |   7 +-
> > > >  drivers/mtd/nand/raw/mtk_nand.c              |   4 +-
> > > >  drivers/mtd/nand/raw/nand_base.c             |  17 +--
> > > >  drivers/mtd/nand/raw/nand_esmt.c             |  11 +-
> > > >  drivers/mtd/nand/raw/nand_hynix.c            |  41 +++---
> > > >  drivers/mtd/nand/raw/nand_jedec.c            |   4 +-
> > > >  drivers/mtd/nand/raw/nand_micron.c           |  14 +-
> > > >  drivers/mtd/nand/raw/nand_onfi.c             |   8 +-
> > > >  drivers/mtd/nand/raw/nand_samsung.c          |  19 +--
> > > >  drivers/mtd/nand/raw/nand_toshiba.c          |  11 +-
> > > >  drivers/mtd/nand/raw/sunxi_nand.c            |   5 +-
> > > >  drivers/mtd/nand/raw/tegra_nand.c            |   9 +-
> > > >  drivers/mtd/nand/spi/core.c                  |   4 +-
> > > >  drivers/mtd/nand/spi/macronix.c              |   6 +-
> > > >  drivers/mtd/nand/spi/toshiba.c               |   6 +-      
> > > 
> > > Can we please split that in 3 patches:
> > > 
> > > 1/ introduce the ECC framework
> > > 2/ convert spi nand
> > > 3/ convert raw nand    
> > 
> > Split in 2 patches:
> > 1/ Introduce the ECC framework
> > 2/ Change the eccreq parameter of the nand_device structure which
> > impacts both raw and SPI NAND frameworks.
> >   
> > >     
> > > >  include/linux/mtd/nand.h                     |  82 ++++++++++-
> > > >  include/linux/mtd/spinand.h                  |   2 +-
> > > >  24 files changed, 327 insertions(+), 93 deletions(-)
> > > >  create mode 100644 drivers/mtd/nand/ecc/Kconfig
> > > >  create mode 100644 drivers/mtd/nand/ecc/Makefile
> > > >  create mode 100644 drivers/mtd/nand/ecc/engine.c
> > > > 
> > > > diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> > > > index d2ef8b89568e..75d0bd18b818 100644
> > > > --- a/drivers/mtd/nand/Kconfig
> > > > +++ b/drivers/mtd/nand/Kconfig
> > > > @@ -6,5 +6,6 @@ config MTD_NAND_CORE
> > > >  source "drivers/mtd/nand/onenand/Kconfig"
> > > >  source "drivers/mtd/nand/raw/Kconfig"
> > > >  source "drivers/mtd/nand/spi/Kconfig"
> > > > +source "drivers/mtd/nand/ecc/Kconfig"
> > > >  
> > > >  endmenu
> > > > diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
> > > > index 7ecd80c0a66e..9772e781534d 100644
> > > > --- a/drivers/mtd/nand/Makefile
> > > > +++ b/drivers/mtd/nand/Makefile
> > > > @@ -6,3 +6,4 @@ obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
> > > >  obj-y	+= onenand/
> > > >  obj-y	+= raw/
> > > >  obj-y	+= spi/
> > > > +obj-y	+= ecc/
> > > > diff --git a/drivers/mtd/nand/ecc/Kconfig b/drivers/mtd/nand/ecc/Kconfig
> > > > new file mode 100644
> > > > index 000000000000..01439f66ecbf
> > > > --- /dev/null
> > > > +++ b/drivers/mtd/nand/ecc/Kconfig
> > > > @@ -0,0 +1,6 @@
> > > > +menu "ECC engine support"
> > > > +
> > > > +config MTD_NAND_ECC
> > > > +	tristate
> > > > +      
> > > 
> > > There's already an MTD_NAND_ECC symbol defined in
> > > drivers/mtd/nand/raw/Kconfig,    
> > 
> > Didn't find any?  
> 
> There was one in drivers/mtd/nand/raw/Kconfig [1], but maybe it's gone
> now.
> 
> >   
> > > plus I don't think we want ecc/engine.c
> > > to be compiled as a module, but instead be embedded in nand-core.ko.    
> > 
> > How would you do that? I don't find the right way to embed
> > nand_ecc_engine.o directly in nandcore.o. The only solution I found was
> > to add nandcore-$(<cond>) += ecc/thing.o directly in
> > drivers/mtd/nand/Makefile but I don't think it is acceptable?  
> 
> Or just move the core logic into drivers/mtd/nand/ecc.c and add
> 
> nandcore-$(<cond>) += ecc.o
> 
> to the Makefile.
> 
> 
> >   
> > > Not to mention that the name, engine.ko, is probably too generic.    
> > 
> > Renamed it nand_ecc_engine.ko for now.  
> 
> Still think it's better to have the code embedded in nandcore.ko.
> 
> [1]https://elixir.bootlin.com/linux/v5.1-rc7/source/drivers/mtd/nand/raw/Kconfig#L1

What is there currently was not what I was looking for.

But nevermind, I moved all code to the nand/ directory, dropping the
ecc/ subdir. Now ECC code is called ecc-engine.o and is embedded in
nandcore.ko.

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel