Message ID | 20190625044630.31717-1-naga.sureshkumar.relli@xilinx.com |
---|---|
State | Changes Requested |
Delegated to: | Miquel Raynal |
Headers | show |
Series | [LINUX,v17,1/2] mtd: rawnand: nand_micron: Do not over write driver's read_page()/write_page() | expand |
On Tue, Jun 25, 2019 at 06:46:29AM +0200, Naga Sureshkumar Relli wrote: > --- 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; When used with pl353_nand.c, this change prioritizes the pl353_nand_read_page_raw/pl353_nand_write_page_raw implementations over micron_nand_read_page_on_die_ecc/micron_nand_write_page_on_die_ecc. The pl353 implementations don't check the status register of the flash for NAND_ECC_STATUS_WRITE_RECOMMENDED nor do they update ecc_stats.failed in any way. Unless I am mistaken, this implies that bitflips cannot be detected at all anymore. However, this is the change that makes a MT29F2G08ABAEAWP practically work with jffs2 on the Zynq platform. In this context, I countered a document from Micron[1] indicating that their on-die chips are incompatible with jffs2 as is, because the on-die oob layout is incompatible with jffs2. I suppose that using the raw variants puts jffs2 in full control of the oob area, but is this really the correct solution? Helmut [1] https://www.micron.com/~/media/Documents/Products/Technical%20Note/NAND%20Flash/tn2975_enable_on-die-ECC_NAND_JFFS2.pdf
On Mon, 24 Jun 2019 22:46:29 -0600 Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> wrote: > Add check before assigning chip->ecc.read_page() and chip->ecc.write_page() > > Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> > --- > 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". > > if (ondie == MICRON_ON_DIE_MANDATORY) { > chip->ecc.read_page_raw = nand_read_page_raw_notsupp;
Hi Boris, > -----Original Message----- > From: Boris Brezillon <boris.brezillon@collabora.com> > Sent: Wednesday, June 26, 2019 12:18 PM > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > 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@xilinx.com> wrote: > > > Add check before assigning chip->ecc.read_page() and > > chip->ecc.write_page() > > > > Signed-off-by: Naga Sureshkumar Relli > > <naga.sureshkumar.relli@xilinx.com> > > --- > > 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;
On Wed, 26 Jun 2019 11:22:33 +0000 Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > Hi Boris, > > > -----Original Message----- > > From: Boris Brezillon <boris.brezillon@collabora.com> > > Sent: Wednesday, June 26, 2019 12:18 PM > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > > 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@xilinx.com> wrote: > > > > > Add check before assigning chip->ecc.read_page() and > > > chip->ecc.write_page() > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > <naga.sureshkumar.relli@xilinx.com> > > > --- > > > 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()? Absolutely, and if it doesn't work that means you driver does not implement raw accesses correctly, which means it's still buggy...
Hi Boris, > -----Original Message----- > From: Boris Brezillon <boris.brezillon@collabora.com> > Sent: Wednesday, June 26, 2019 4:57 PM > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > driver's read_page()/write_page() > > On Wed, 26 Jun 2019 11:22:33 +0000 > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > Hi Boris, > > > > > -----Original Message----- > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > linux-kernel@vger.kernel.org > > > 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@xilinx.com> wrote: > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > chip->ecc.write_page() > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > <naga.sureshkumar.relli@xilinx.com> > > > > --- > > > > 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()? > > Absolutely, and if it doesn't work that means you driver does not > implement raw accesses correctly, which means it's still buggy... I agree. But let's say, if there is a limitation with the controller. Then it is must to have this check right? I mean, for pl353 controller, we must clear the CS during the data phase, hence we are splitting the Transfer in the pl353_read/write_page_raw(). + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); + p = chip->oob_poi; + pl353_nand_read_data_op(chip, p, + (mtd->oobsize - + PL353_NAND_LAST_TRANSFER_LENGTH), false); + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; + pl353_nand_read_data_op(chip, p, PL353_NAND_LAST_TRANSFER_LENGTH, + false); As the above sequence is needed even for raw access, PL353 is unable to use the on_die_page reads. Thanks, Naga Sureshkumar Relli
On Wed, 26 Jun 2019 11:51:12 +0000 Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > Hi Boris, > > > -----Original Message----- > > From: Boris Brezillon <boris.brezillon@collabora.com> > > Sent: Wednesday, June 26, 2019 4:57 PM > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > > driver's read_page()/write_page() > > > > On Wed, 26 Jun 2019 11:22:33 +0000 > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > Hi Boris, > > > > > > > -----Original Message----- > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > linux-kernel@vger.kernel.org > > > > 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@xilinx.com> wrote: > > > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > > chip->ecc.write_page() > > > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > > <naga.sureshkumar.relli@xilinx.com> > > > > > --- > > > > > 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()? > > > > Absolutely, and if it doesn't work that means you driver does not > > implement raw accesses correctly, which means it's still buggy... > I agree. But let's say, if there is a limitation with the controller. Then it is must to have this check right? > I mean, for pl353 controller, we must clear the CS during the data phase, hence we are splitting the > Transfer in the pl353_read/write_page_raw(). > + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); > + p = chip->oob_poi; > + pl353_nand_read_data_op(chip, p, > + (mtd->oobsize - > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; > + pl353_nand_read_data_op(chip, p, PL353_NAND_LAST_TRANSFER_LENGTH, > + false); > As the above sequence is needed even for raw access, PL353 is unable to use the on_die_page reads. This "de-assert CS on last access" logic should be done in the exec_op() implementation. I also wonder how that works for operations that don't have data cycles. Oh, BTW, most chips are CE-don't-care, which means you can assert/de-assert CS on each read_data_op() without any issues.
Hi Boris, > -----Original Message----- > From: Boris Brezillon <boris.brezillon@collabora.com> > Sent: Wednesday, June 26, 2019 5:34 PM > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > driver's read_page()/write_page() > > On Wed, 26 Jun 2019 11:51:12 +0000 > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > Hi Boris, > > > > > -----Original Message----- > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > Sent: Wednesday, June 26, 2019 4:57 PM > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > linux-kernel@vger.kernel.org > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not > > > over write driver's read_page()/write_page() > > > > > > On Wed, 26 Jun 2019 11:22:33 +0000 > > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > > > Hi Boris, > > > > > > > > > -----Original Message----- > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > > linux-kernel@vger.kernel.org > > > > > 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@xilinx.com> wrote: > > > > > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > > > chip->ecc.write_page() > > > > > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > > > <naga.sureshkumar.relli@xilinx.com> > > > > > > --- > > > > > > 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()? > > > > > > Absolutely, and if it doesn't work that means you driver does not > > > implement raw accesses correctly, which means it's still buggy... > > I agree. But let's say, if there is a limitation with the controller. Then it is must to have this > check right? > > I mean, for pl353 controller, we must clear the CS during the data > > phase, hence we are splitting the Transfer in the pl353_read/write_page_raw(). > > + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); > > + p = chip->oob_poi; > > + pl353_nand_read_data_op(chip, p, > > + (mtd->oobsize - > > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; > > + pl353_nand_read_data_op(chip, p, PL353_NAND_LAST_TRANSFER_LENGTH, > > + false); > > As the above sequence is needed even for raw access, PL353 is unable to use the on_die_page > reads. > > This "de-assert CS on last access" logic should be done in the > exec_op() implementation. I also wonder how that works for operations that don't have data > cycles. Oh, BTW, most chips are CE-don't-care, which means you can assert/de-assert CS on > each read_data_op() without any issues. Yes, we can assert/de-assert CS on each read/write_data_op(). But what about transfer length splitting? + p = chip->oob_poi; + pl353_nand_read_data_op(chip, p, + (mtd->oobsize - + PL353_NAND_LAST_TRANSFER_LENGTH), false); + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); This should be done as a part of pl353_raw_read/write() right? Thanks, Naga Sureshkumar Relli
On Wed, 26 Jun 2019 12:12:47 +0000 Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > Hi Boris, > > > -----Original Message----- > > From: Boris Brezillon <boris.brezillon@collabora.com> > > Sent: Wednesday, June 26, 2019 5:34 PM > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > > driver's read_page()/write_page() > > > > On Wed, 26 Jun 2019 11:51:12 +0000 > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > Hi Boris, > > > > > > > -----Original Message----- > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > Sent: Wednesday, June 26, 2019 4:57 PM > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > linux-kernel@vger.kernel.org > > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not > > > > over write driver's read_page()/write_page() > > > > > > > > On Wed, 26 Jun 2019 11:22:33 +0000 > > > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > > > > > Hi Boris, > > > > > > > > > > > -----Original Message----- > > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > > > linux-kernel@vger.kernel.org > > > > > > 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@xilinx.com> wrote: > > > > > > > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > > > > chip->ecc.write_page() > > > > > > > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > > > > <naga.sureshkumar.relli@xilinx.com> > > > > > > > --- > > > > > > > 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()? > > > > > > > > Absolutely, and if it doesn't work that means you driver does not > > > > implement raw accesses correctly, which means it's still buggy... > > > I agree. But let's say, if there is a limitation with the controller. Then it is must to have this > > check right? > > > I mean, for pl353 controller, we must clear the CS during the data > > > phase, hence we are splitting the Transfer in the pl353_read/write_page_raw(). > > > + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); > > > + p = chip->oob_poi; > > > + pl353_nand_read_data_op(chip, p, > > > + (mtd->oobsize - > > > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > > + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; > > > + pl353_nand_read_data_op(chip, p, PL353_NAND_LAST_TRANSFER_LENGTH, > > > + false); > > > As the above sequence is needed even for raw access, PL353 is unable to use the on_die_page > > reads. > > > > This "de-assert CS on last access" logic should be done in the > > exec_op() implementation. I also wonder how that works for operations that don't have data > > cycles. Oh, BTW, most chips are CE-don't-care, which means you can assert/de-assert CS on > > each read_data_op() without any issues. > Yes, we can assert/de-assert CS on each read/write_data_op(). > But what about transfer length splitting? > + p = chip->oob_poi; > + pl353_nand_read_data_op(chip, p, > + (mtd->oobsize - > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > This should be done as a part of pl353_raw_read/write() right? Are you sure you need to do that, and if that's the case, do you have an idea why this is needed? Is this "read last 4 bytes separately" thing is needed, I suspect it's needed for any kind of input-data cycles, not just page reads.
Hi Boris, > -----Original Message----- > From: Boris Brezillon <boris.brezillon@collabora.com> > Sent: Wednesday, June 26, 2019 5:50 PM > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at; > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; > vigneshr@ti.com; bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux- > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > driver's read_page()/write_page() > > On Wed, 26 Jun 2019 12:12:47 +0000 > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > Hi Boris, > > > > > -----Original Message----- > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > Sent: Wednesday, June 26, 2019 5:34 PM > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > linux-kernel@vger.kernel.org > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not > > > over write driver's read_page()/write_page() > > > > > > On Wed, 26 Jun 2019 11:51:12 +0000 > > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > > > Hi Boris, > > > > > > > > > -----Original Message----- > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > Sent: Wednesday, June 26, 2019 4:57 PM > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > > linux-kernel@vger.kernel.org > > > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do > > > > > not over write driver's read_page()/write_page() > > > > > > > > > > On Wed, 26 Jun 2019 11:22:33 +0000 Naga Sureshkumar Relli > > > > > <nagasure@xilinx.com> wrote: > > > > > > > > > > > Hi Boris, > > > > > > > > > > > > > -----Original Message----- > > > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > > > yamada.masahiro@socionext.com; linux- > > > > > > > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > > > > > > > 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@xilinx.com> wrote: > > > > > > > > > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > > > > > chip->ecc.write_page() > > > > > > > > > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > > > > > <naga.sureshkumar.relli@xilinx.com> > > > > > > > > --- > > > > > > > > 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()? > > > > > > > > > > Absolutely, and if it doesn't work that means you driver does > > > > > not implement raw accesses correctly, which means it's still buggy... > > > > I agree. But let's say, if there is a limitation with the > > > > controller. Then it is must to have this > > > check right? > > > > I mean, for pl353 controller, we must clear the CS during the data > > > > phase, hence we are splitting the Transfer in the pl353_read/write_page_raw(). > > > > + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); > > > > + p = chip->oob_poi; > > > > + pl353_nand_read_data_op(chip, p, > > > > + (mtd->oobsize - > > > > + PL353_NAND_LAST_TRANSFER_LENGTH), > false); > > > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > > > + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; > > > > + pl353_nand_read_data_op(chip, p, > PL353_NAND_LAST_TRANSFER_LENGTH, > > > > + false); > > > > As the above sequence is needed even for raw access, PL353 is > > > > unable to use the on_die_page > > > reads. > > > > > > This "de-assert CS on last access" logic should be done in the > > > exec_op() implementation. I also wonder how that works for > > > operations that don't have data cycles. Oh, BTW, most chips are > > > CE-don't-care, which means you can assert/de-assert CS on each read_data_op() without > any issues. > > Yes, we can assert/de-assert CS on each read/write_data_op(). > > But what about transfer length splitting? > > + p = chip->oob_poi; > > + pl353_nand_read_data_op(chip, p, > > + (mtd->oobsize - > > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > This should be done as a part of pl353_raw_read/write() right? > > Are you sure you need to do that, and if that's the case, do you have an idea why this is needed? > Is this "read last 4 bytes separately" > thing is needed, I suspect it's needed for any kind of input-data cycles, not just page reads. Yes. It is needed. This is Limitation in the HW, need to handle last 4 bytes separately for both page read/writes Regards, Naga Sureshkumar Relli
Hi Boris, > -----Original Message----- > From: linux-mtd <linux-mtd-bounces@lists.infradead.org> On Behalf Of Naga Sureshkumar > Relli > Sent: Wednesday, June 26, 2019 6:04 PM > To: Boris Brezillon <boris.brezillon@collabora.com> > Cc: vigneshr@ti.com; bbrezillon@kernel.org; helmut.grohne@intenta.de; richard@nod.at; > linux-kernel@vger.kernel.org; marek.vasut@gmail.com; yamada.masahiro@socionext.com; > linux-mtd@lists.infradead.org; miquel.raynal@bootlin.com; computersforpeace@gmail.com; > dwmw2@infradead.org > Subject: RE: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write > driver's read_page()/write_page() > > Hi Boris, > > > -----Original Message----- > > From: Boris Brezillon <boris.brezillon@collabora.com> > > Sent: Wednesday, June 26, 2019 5:50 PM > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > linux-kernel@vger.kernel.org > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not > > over write driver's read_page()/write_page() > > > > On Wed, 26 Jun 2019 12:12:47 +0000 > > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote: > > > > > Hi Boris, > > > > > > > -----Original Message----- > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > Sent: Wednesday, June 26, 2019 5:34 PM > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com; > > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org; > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > linux-kernel@vger.kernel.org > > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do > > > > not over write driver's read_page()/write_page() > > > > > > > > On Wed, 26 Jun 2019 11:51:12 +0000 Naga Sureshkumar Relli > > > > <nagasure@xilinx.com> wrote: > > > > > > > > > Hi Boris, > > > > > > > > > > > -----Original Message----- > > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > > Sent: Wednesday, June 26, 2019 4:57 PM > > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org; > > > > > > linux-kernel@vger.kernel.org > > > > > > Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: > > > > > > Do not over write driver's read_page()/write_page() > > > > > > > > > > > > On Wed, 26 Jun 2019 11:22:33 +0000 Naga Sureshkumar Relli > > > > > > <nagasure@xilinx.com> wrote: > > > > > > > > > > > > > Hi Boris, > > > > > > > > > > > > > > > -----Original Message----- > > > > > > > > From: Boris Brezillon <boris.brezillon@collabora.com> > > > > > > > > Sent: Wednesday, June 26, 2019 12:18 PM > > > > > > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com> > > > > > > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; > > > > > > > > richard@nod.at; dwmw2@infradead.org; > > > > > > > > computersforpeace@gmail.com; marek.vasut@gmail.com; > > > > > > > > vigneshr@ti.com; bbrezillon@kernel.org; > > > > > > > > yamada.masahiro@socionext.com; linux- > > > > > > > > mtd@lists.infradead.org; linux-kernel@vger.kernel.org > > > > > > > > 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@xilinx.com> wrote: > > > > > > > > > > > > > > > > > Add check before assigning chip->ecc.read_page() and > > > > > > > > > chip->ecc.write_page() > > > > > > > > > > > > > > > > > > Signed-off-by: Naga Sureshkumar Relli > > > > > > > > > <naga.sureshkumar.relli@xilinx.com> > > > > > > > > > --- > > > > > > > > > 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()? > > > > > > > > > > > > Absolutely, and if it doesn't work that means you driver does > > > > > > not implement raw accesses correctly, which means it's still buggy... > > > > > I agree. But let's say, if there is a limitation with the > > > > > controller. Then it is must to have this > > > > check right? > > > > > I mean, for pl353 controller, we must clear the CS during the > > > > > data phase, hence we are splitting the Transfer in the pl353_read/write_page_raw(). > > > > > + pl353_nand_read_data_op(chip, buf, mtd->writesize, false); > > > > > + p = chip->oob_poi; > > > > > + pl353_nand_read_data_op(chip, p, > > > > > + (mtd->oobsize - > > > > > + PL353_NAND_LAST_TRANSFER_LENGTH), > > false); > > > > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > > > > + xnfc->dataphase_addrflags |= PL353_NAND_CLEAR_CS; > > > > > + pl353_nand_read_data_op(chip, p, > > PL353_NAND_LAST_TRANSFER_LENGTH, > > > > > + false); > > > > > As the above sequence is needed even for raw access, PL353 is > > > > > unable to use the on_die_page > > > > reads. > > > > > > > > This "de-assert CS on last access" logic should be done in the > > > > exec_op() implementation. I also wonder how that works for > > > > operations that don't have data cycles. Oh, BTW, most chips are > > > > CE-don't-care, which means you can assert/de-assert CS on each > > > > read_data_op() without > > any issues. > > > Yes, we can assert/de-assert CS on each read/write_data_op(). > > > But what about transfer length splitting? > > > + p = chip->oob_poi; > > > + pl353_nand_read_data_op(chip, p, > > > + (mtd->oobsize - > > > + PL353_NAND_LAST_TRANSFER_LENGTH), false); > > > + p += (mtd->oobsize - PL353_NAND_LAST_TRANSFER_LENGTH); > > > This should be done as a part of pl353_raw_read/write() right? > > > > Are you sure you need to do that, and if that's the case, do you have an idea why this is > needed? > > Is this "read last 4 bytes separately" > > thing is needed, I suspect it's needed for any kind of input-data cycles, not just page reads. > Yes. It is needed. This is Limitation in the HW, need to handle last 4 bytes separately for both > page read/writes Just wanted to know, is this fix OK? Regards, Naga Sureshkumar Relli > > Regards, > Naga Sureshkumar Relli > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/
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; if (ondie == MICRON_ON_DIE_MANDATORY) { chip->ecc.read_page_raw = nand_read_page_raw_notsupp;
Add check before assigning chip->ecc.read_page() and chip->ecc.write_page() Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> --- drivers/mtd/nand/raw/nand_micron.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)