All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Michal Simek <monstr@monstr.eu>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Naga Sureshkumar Relli <nagasure@xilinx.com>
Subject: Re: [PATCH v3 09/13] mtd: rawnand: onfi: Adapt the parameter page read to constraint controllers
Date: Mon, 4 May 2020 11:01:44 +0200	[thread overview]
Message-ID: <20200504110144.273826dd@xps13> (raw)
In-Reply-To: <20200504104722.5dfe66eb@collabora.com>


Boris Brezillon <boris.brezillon@collabora.com> wrote on Mon, 4 May
2020 10:47:22 +0200:

> On Mon,  4 May 2020 10:24:10 +0200
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > We already know that there are controllers not able to read the three
> > copies of the parameter page in one go. The workaround was to first
> > request the controller to assert command and address cycles on the
> > NAND bus to trigger a parameter page read, and then do a simple read
> > operation for each page.
> > 
> > But there are also controllers which are not able to split the
> > parameter page read between the command/address cycles and the actual
> > data operation.
> > 
> > Let's use a regular PARAMETER PAGE READ operation for the first
> > iteration and use either a CHANGE READ COLUMN or a simple DATA READ
> > operation for the following copies, depending on what the controller
> > supports. The default behavior for non-exec-op compliant drivers
> > remains the same: DATA READ.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/mtd/nand/raw/nand_onfi.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/nand_onfi.c b/drivers/mtd/nand/raw/nand_onfi.c
> > index e6ffbe8c9a0c..49cb04c02e9f 100644
> > --- a/drivers/mtd/nand/raw/nand_onfi.c
> > +++ b/drivers/mtd/nand/raw/nand_onfi.c
> > @@ -143,6 +143,7 @@ int nand_onfi_detect(struct nand_chip *chip)
> >  	struct nand_memory_organization *memorg;
> >  	struct nand_onfi_params *p = NULL, *pbuf;
> >  	struct onfi_params *onfi;
> > +	bool use_datain = false;
> >  	int onfi_version = 0;
> >  	char id[4];
> >  	int i, ret, val;
> > @@ -160,15 +161,21 @@ int nand_onfi_detect(struct nand_chip *chip)
> >  	if (!pbuf)
> >  		return -ENOMEM;
> >  
> > -	ret = nand_read_param_page_op(chip, 0, NULL, 0);
> > -	if (ret) {
> > -		ret = 0;
> > -		goto free_onfi_param_page;
> > -	}
> > +	if (!nand_has_exec_op(chip) ||
> > +	    (nand_read_data_op(chip, &pbuf[0], sizeof(*pbuf), true, true) == 0))  
> 
> Just nitpicking, but isn't checkpatch complaining about unneeded parens?

Mmmh no, where? I think there is no need for (!nand_has_exec_op(chip))
if this is what you mean? Checkpatch --strict does not produce a
warning here.

> Any reason you didn't use
> 
> 	    !nand_read_data_op(chip, &pbuf[0], sizeof(*pbuf), true, true)

I usually write conditions this way, but here I read it like "if not
nand_read_data_op is supported" which means the opposite of what it is
doing. Instead, I read the "== 0" as "I expect it to return 0 and
it means it is okay". Maybe its purely personal :)

> 
> here?
> 
> The rest looks good,
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-05-04  9:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04  8:24 [PATCH v3 00/13] Supporting restricted NAND controllers Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 01/13] mtd: rawnand: Translate obscure bitfields into readable macros Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 02/13] mtd: rawnand: Reorder the nand_chip->options flags Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 03/13] mtd: rawnand: Rename a NAND chip option Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 04/13] mtd: rawnand: Fix comments about the use of bufpoi Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 05/13] mtd: rawnand: Rename the use_bufpoi variables Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 06/13] mtd: rawnand: Avoid indirect access to ->data_buf() Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 07/13] mtd: rawnand: Add a helper to check supported operations Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 08/13] mtd: rawnand: Give the possibility to verify a read operation is supported Miquel Raynal
2020-05-04  8:42   ` Boris Brezillon
2020-05-04  8:24 ` [PATCH v3 09/13] mtd: rawnand: onfi: Adapt the parameter page read to constraint controllers Miquel Raynal
2020-05-04  8:47   ` Boris Brezillon
2020-05-04  9:01     ` Miquel Raynal [this message]
2020-05-04  8:24 ` [PATCH v3 10/13] mtd: rawnand: jedec: " Miquel Raynal
2020-05-04  8:51   ` Boris Brezillon
2020-05-04  8:57     ` Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 11/13] mtd: rawnand: Expose monolithic read/write_page_raw() helpers Miquel Raynal
2020-05-04  8:54   ` Boris Brezillon
2020-05-04  8:24 ` [PATCH v3 12/13] mtd: rawnand: Allow controllers to overload soft ECC hooks Miquel Raynal
2020-05-04  8:24 ` [PATCH v3 13/13] mtd: rawnand: micron: Allow controllers to overload raw accessors Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504110144.273826dd@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=boris.brezillon@collabora.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=monstr@monstr.eu \
    --cc=nagasure@xilinx.com \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.