linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Lubomir Rintel <lkundrak@v3.sk>
Cc: vigneshr@ti.com, tudor.ambarus@microchip.com, richard@nod.at,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
	dwmw2@infradead.org
Subject: Re: [PATCH 13/17] mtd: rawnand: cafe: Add exec_op() support
Date: Sat, 2 May 2020 15:18:11 +0200	[thread overview]
Message-ID: <20200502151811.328eebb0@collabora.com> (raw)
In-Reply-To: <20200502111410.330584-1-lkundrak@v3.sk>

On Sat,  2 May 2020 13:14:10 +0200
Lubomir Rintel <lkundrak@v3.sk> wrote:

> Boris Brezillon wrote:
> > Implementing exec_op() will help us get rid of the legacy interface and
> > should make drivers much cleaner too.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >  drivers/mtd/nand/raw/cafe_nand.c | 137 ++++++++++++++++++++++++++++++-
> >  1 file changed, 136 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
> > index edf65197604b..ada9c8b06a41 100644
> > --- a/drivers/mtd/nand/raw/cafe_nand.c
> > +++ b/drivers/mtd/nand/raw/cafe_nand.c  
> ...
> 
> > +	ret = readl_poll_timeout(cafe->mmio + CAFE_NAND_IRQ, status,
> > +				 (status & wait) == wait, 1, USEC_PER_SEC);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (ctrl1 & CAFE_NAND_DMA_CTRL_DATA_IN)  
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
> s/CAFE_NAND_DMA_CTRL_DATA_IN/CAFE_NAND_CTRL1_HAS_DATA_IN/ here please.
> 
> 
> > +		cafe_read_buf(chip, data_instr->ctx.data.buf.in,
> > +			      data_instr->ctx.data.len);
> > +
> > +	return 0;
> > +}  
> ...
> 
> Other than that, when DMA is in use, only CAFE_NAND_IRQ_DMA_DONE seem to pop
> up in CAFE_NAND_IRQ when the command completes, not CAFE_NAND_IRQ_CMD_DONE.
> I suppose you ought to do this or something equivalent:

I suspect it has to do with the fact that you might have operations with
DATA_IN() instructions only. I pushed an alternate fix [1] to my branch.
Would you mind testing it?

> 
> diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
> index 307c9a68afa9..356a07e61c88 100644
> --- a/drivers/mtd/nand/raw/cafe_nand.c
> +++ b/drivers/mtd/nand/raw/cafe_nand.c
> @@ -778,7 +778,7 @@ static int cafe_nand_exec_subop(struct nand_chip *chip,
>  {
>         struct cafe_priv *cafe = nand_get_controller_data(chip);
>         u32 ctrl1 = 0, ctrl2 = cafe->ctl2, addr1 = 0, addr2 = 0;
> -       u32 status, wait = CAFE_NAND_IRQ_CMD_DONE;
> +       u32 status, wait = 0;
>         int ret, data_instr = -1;
>         bool waitrdy = false;
>         unsigned int i, j;
> @@ -856,6 +856,8 @@ static int cafe_nand_exec_subop(struct nand_chip *chip,
>                         dmactrl |= CAFE_NAND_DMA_CTRL_DATA_IN;
>  
>                 cafe_writel(cafe, dmactrl, NAND_DMA_CTRL);
> +       } else {
> +               wait |= CAFE_NAND_IRQ_CMD_DONE;
>         }
>  
>         /* Clear the pending interrupts before starting the operation. */
> 
> cafe_nand_cmdfunc() seems to do the same thing (note the "=" instead of
> "|=") though the use of word "just" in the comment is somewhat misleading:
> 
>  244 static void cafe_nand_cmdfunc(struct nand_chip *chip, unsigned command,
>  245                               int column, int page_addr)
>  246 {
>  ...
>  359                 /* If WR or RD bits set, set up DMA */
>  360                 if (ctl1 & CAFE_NAND_CTRL1_HAS_DATA_IN) {
>  361                         /* It's a read */
>  362                         dmactl |= CAFE_NAND_DMA_CTRL_DATA_IN;
>  363                         /* ... so it's done when the DMA is done, not just
>  364                            the command. */
>  365                         doneint = CAFE_NAND_IRQ_DMA_DONE;
>  366                 }
> 
> With the changes I suggested above, you can add:
> 
> Reviewed-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> Thank you!
> Lubo

[1]https://github.com/bbrezillon/linux/commit/ecf93c3c2e94ab0710babe856f272ff2e8b2a35b

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

  parent reply	other threads:[~2020-05-02 13:18 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27  8:20 [PATCH 00/17] mtd: rawnand: cafe: Convert to exec_op() (and more) Boris Brezillon
2020-04-27  8:20 ` [PATCH 01/17] mtd: rawnand: cafe: Get rid of an inaccurate kernel doc header Boris Brezillon
2020-04-27 19:33   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 02/17] mtd: rawnand: cafe: Rename cafe_nand_write_page_lowlevel() Boris Brezillon
2020-04-27 19:33   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 03/17] mtd: rawnand: cafe: Use a correct ECC mode and pass the ECC alg Boris Brezillon
2020-04-27 19:34   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 04/17] mtd: rawnand: cafe: Include linux/io.h instead of asm/io.h Boris Brezillon
2020-04-27 19:35   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 05/17] mtd: rawnand: cafe: Demistify register fields Boris Brezillon
2020-04-27 19:42   ` Miquel Raynal
2020-04-28  6:06     ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 06/17] mtd: rawnand: cafe: Factor out the controller initialization logic Boris Brezillon
2020-04-27 19:45   ` Miquel Raynal
2020-04-28  6:06     ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 07/17] mtd: rawnand: cafe: Get rid of the debug module param Boris Brezillon
2020-04-27 19:46   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 08/17] mtd: rawnand: cafe: Use devm_kzalloc and devm_request_irq() Boris Brezillon
2020-04-27 19:47   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 09/17] mtd: rawnand: cafe: Get rid of a useless label Boris Brezillon
2020-04-27 19:47   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 10/17] mtd: rawnand: cafe: Explicitly inherit from nand_controller Boris Brezillon
2020-04-27 19:49   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 11/17] mtd: rawnand: cafe: Don't leave ECC enabled in the write path Boris Brezillon
2020-04-27 19:51   ` Miquel Raynal
2020-04-28  6:08     ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 12/17] mtd: rawnand: cafe: Don't split things when reading/writing a page Boris Brezillon
2020-04-27 19:53   ` Miquel Raynal
2020-04-28  6:20     ` Boris Brezillon
2020-04-28  7:44       ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 13/17] mtd: rawnand: cafe: Add exec_op() support Boris Brezillon
2020-04-27 19:59   ` Miquel Raynal
2020-04-28  6:24     ` Boris Brezillon
     [not found]   ` <20200502111410.330584-1-lkundrak@v3.sk>
2020-05-02 13:18     ` Boris Brezillon [this message]
     [not found]       ` <20200502191843.GA363829@furthur.local>
2020-05-02 22:34         ` Boris Brezillon
     [not found]           ` <20200503060610.GA386731@furthur.local>
2020-05-03  7:04             ` Boris Brezillon
2020-05-03  7:26               ` Boris Brezillon
     [not found]                 ` <20200503175537.GA404453@furthur.local>
2020-05-03 19:49                   ` Boris Brezillon
     [not found]               ` <20200503075208.GA387473@furthur.local>
2020-05-03  8:13                 ` Boris Brezillon
2020-05-03  8:35                   ` Boris Brezillon
2020-05-09 20:10         ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 14/17] mtd: rawnand: cafe: Get rid of the legacy interface implementation Boris Brezillon
2020-04-27 20:00   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 15/17] mtd: rawnand: cafe: Adjust the cafe_{read, write}_buf() prototypes Boris Brezillon
2020-04-27 20:00   ` [PATCH 15/17] mtd: rawnand: cafe: Adjust the cafe_{read,write}_buf() prototypes Miquel Raynal
2020-04-28  6:24     ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 16/17] mtd: rawnand: cafe: Handle non-32bit aligned reads/writes Boris Brezillon
2020-04-27 20:04   ` Miquel Raynal
2020-04-28  6:26     ` Boris Brezillon
2020-04-27  8:20 ` [PATCH 17/17] mtd: rawnand: cafe: s/uint{8,16,32}_t/u{8,16,32}/ Boris Brezillon
2020-04-27 20:05   ` Miquel Raynal
2020-04-27  8:20 ` [PATCH 17/17] mtd: rawnand: s/uint{8,16,32}_t/u{8,16,32}/ Boris Brezillon
2020-04-27  8:25   ` Boris Brezillon
2020-04-29  6:37 ` [PATCH 00/17] mtd: rawnand: cafe: Convert to exec_op() (and more) Thomas Petazzoni
2020-04-29  8:28   ` Boris Brezillon
     [not found]     ` <20200501055209.GA44510@furthur.local>
2020-05-01  6:21       ` Boris Brezillon
     [not found] ` <20200502112732.330971-1-lkundrak@v3.sk>
2020-05-02 13:15   ` Boris Brezillon
2020-05-08 10:32     ` 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=20200502151811.328eebb0@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lkundrak@v3.sk \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).