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: Sun, 3 May 2020 00:34:56 +0200 [thread overview]
Message-ID: <20200503003456.2ddf6047@collabora.com> (raw)
In-Reply-To: <20200502191843.GA363829@furthur.local>
On Sat, 2 May 2020 21:18:43 +0200
Lubomir Rintel <lkundrak@v3.sk> wrote:
> On Sat, May 02, 2020 at 03:18:11PM +0200, Boris Brezillon wrote:
> > 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?
>
> That sounded plausible, but it doesn't seem to be to be the case. With
> the patch the operations doing DMA transfers still seem to time out (the
> identification succeeded, because at that point DMA is turned off):
>
> CAFÉ NAND 0000:00:0c.0: enabling device (0000 -> 0002)
> nand: device found, Manufacturer ID: 0xad, Chip ID: 0xdc
> nand: Hynix NAND 512MiB 3,3V 8-bit
> nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
> nand: 2 chips detected
> Bad block table not found for chip 0
> Bad block table not found for chip 0
> Scanning device for bad blocks
> nand_bbt: error while erasing BBT block -5
> nand_bbt: error -30 while marking block 8191 bad
> nand_bbt: error while erasing BBT block -5
> nand_bbt: error -30 while marking block 8190 bad
> nand_bbt: error while erasing BBT block -5
> nand_bbt: error -30 while marking block 8189 bad
> nand_bbt: error while erasing BBT block -5
> nand_bbt: error -30 while marking block 8188 bad
> No space left to write bad block table
> nand_bbt: error while writing bad block table -28
>
> I've done this on top of your branch:
>
> diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
> index 761d103e438f..2a769033392e 100644
> --- a/drivers/mtd/nand/raw/cafe_nand.c
> +++ b/drivers/mtd/nand/raw/cafe_nand.c
> @@ -642,6 +642,11 @@ static int cafe_nand_exec_subop(struct nand_chip *chip,
>
> ret = readl_poll_timeout(cafe->mmio + CAFE_NAND_IRQ, status,
> (status & wait) == wait, 1, USEC_PER_SEC);
> + for (i = 0; i < subop->ninstrs; i++) {
> + const struct nand_op_instr *instr = &subop->instrs[i];
> + printk("%d: ret=%d instr=%d status=%08x wait=%08x\n", i, ret, instr->type, status, wait);
> + }
> +
> if (ret)
> return ret;
>
> It indeed looks like CAFE_NAND_IRQ_CMD_DONE is never raised if there's a
> data operation involving DMA -- the status remains at 0x50000000. Full log:
I see. The reason I was not entirely happy with the "wait on DMA_DONE
when there's a DMA transfer" is because this transfer might not be the
last instruction in a sub operation, and I feared we would not wait for
the full operation to be done but only the DMA transfer itself. So I
went back to the spec [1], and there's an interesting note page 38:
"
Software waits for <dma_done> field in the Interrupt Register (Table 91
p. 93) for read operation because DMA is the last step of read
operation and waits for <cmd_done>field in the Interrupt Register
(Table 91 p. 93) for write operation because Command execution is the
last step of write operation.
"
I just pushed a new fixup commit implementing this logic. Let me know
if that solves the problem.
[1]http://wiki.laptop.org/images/5/5c/88ALP01_Datasheet_July_2007.pdf
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2020-05-02 22:35 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
[not found] ` <20200502191843.GA363829@furthur.local>
2020-05-02 22:34 ` Boris Brezillon [this message]
[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=20200503003456.2ddf6047@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).