RE: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write driver's read_page()/write_page()

From: Naga Sureshkumar Relli
Date: Wed Jun 26 2019 - 07:22:38 EST


Hi Boris,

> -----Original Message-----
> From: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> Sent: Wednesday, June 26, 2019 12:18 PM
> To: Naga Sureshkumar Relli <nagasure@xxxxxxxxxx>
> Cc: miquel.raynal@xxxxxxxxxxx; helmut.grohne@xxxxxxxxxx; richard@xxxxxx;
> dwmw2@xxxxxxxxxxxxx; computersforpeace@xxxxxxxxx; marek.vasut@xxxxxxxxx;
> vigneshr@xxxxxx; bbrezillon@xxxxxxxxxx; yamada.masahiro@xxxxxxxxxxxxx; linux-
> mtd@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write
> driver's read_page()/write_page()
>
> On Mon, 24 Jun 2019 22:46:29 -0600
> Naga Sureshkumar Relli <naga.sureshkumar.relli@xxxxxxxxxx> wrote:
>
> > Add check before assigning chip->ecc.read_page() and
> > chip->ecc.write_page()
> >
> > Signed-off-by: Naga Sureshkumar Relli
> > <naga.sureshkumar.relli@xxxxxxxxxx>
> > ---
> > drivers/mtd/nand/raw/nand_micron.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/raw/nand_micron.c
> > b/drivers/mtd/nand/raw/nand_micron.c
> > index cbd4f09ac178..565f2696c747 100644
> > --- a/drivers/mtd/nand/raw/nand_micron.c
> > +++ b/drivers/mtd/nand/raw/nand_micron.c
> > @@ -500,8 +500,11 @@ static int micron_nand_init(struct nand_chip *chip)
> > chip->ecc.size = 512;
> > chip->ecc.strength = chip->base.eccreq.strength;
> > chip->ecc.algo = NAND_ECC_BCH;
> > - chip->ecc.read_page = micron_nand_read_page_on_die_ecc;
> > - chip->ecc.write_page = micron_nand_write_page_on_die_ecc;
> > + if (!chip->ecc.read_page)
> > + chip->ecc.read_page = micron_nand_read_page_on_die_ecc;
> > +
> > + if (!chip->ecc.write_page)
> > + chip->ecc.write_page = micron_nand_write_page_on_die_ecc;
>
> That's wrong, if you don't want on-die ECC to be used, simply don't set nand-ecc-mode to "on-
> die".
Ok. But if we want to use on-die ECC then you mean to say it is mandatory to use micron_nand_read/write_page_on_die_ecc()?

Regards,
Naga Sureshkumar Relli
>
> >
> > if (ondie == MICRON_ON_DIE_MANDATORY) {
> > chip->ecc.read_page_raw = nand_read_page_raw_notsupp;