linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Manuel Dipolt <mdipolt@robart.cc>
Cc: Roland Ruckerbauer <rruckerbauer@robart.cc>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	miquel.raynal@bootlin.com
Subject: Re: [PATCH v4] mtd: sunxi-nand: add mdma support for allwinner h3
Date: Thu, 8 Oct 2020 17:33:50 +0200	[thread overview]
Message-ID: <20201008173350.6fba74be@collabora.com> (raw)
In-Reply-To: <1096989423.982216.1602168710935.JavaMail.zimbra@robart.cc>

On Thu, 8 Oct 2020 16:51:50 +0200 (CEST)
Manuel Dipolt <mdipolt@robart.cc> wrote:

> > >  				       int page)
> > >  {
> > >  	struct mtd_info *mtd = nand_to_mtd(nand);
> > > @@ -1277,6 +1338,8 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *nand,
> > >  	struct nand_ecc_ctrl *ecc = &nand->ecc;
> > >  	struct scatterlist sg;
> > >  	int ret, i;
> > > +	u32 wait_event_flags;  
> > 
> > Or just "wait".
> >   
> 
> 
> removed variable cause waiting again only for nfc interrupt

I think you should wait for both.

> 
> 
> > > +	__u32 mem_addr;
> > >  
> > >  	sunxi_nfc_select_chip(nand, nand->cur_cs);
> > >  
> > > @@ -1284,10 +1347,14 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *nand,
> > >  	if (ret)
> > >  		return ret;
> > >  
> > > -	ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, ecc->steps,
> > > -				       DMA_TO_DEVICE, &sg);
> > > +	if (nfc->caps->has_mdma)
> > > +		ret = sunxi_nfc_mdma_op_prepare(nfc, buf, ecc->size, ecc->steps,
> > > +						DMA_TO_DEVICE, &mem_addr);
> > > +	else
> > > +		ret = sunxi_nfc_dma_op_prepare(nfc, buf, ecc->size, ecc->steps, DMA_TO_DEVICE, &sg);
> > > +
> > >  	if (ret)
> > > -		goto pio_fallback;
> > > +		return ret;
> > >  
> > >  	for (i = 0; i < ecc->steps; i++) {
> > >  		const u8 *oob = nand->oob_poi + (i * (ecc->bytes + 4));
> > > @@ -1304,20 +1371,28 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *nand,
> > >  	writel((NAND_CMD_RNDIN << 8) | NAND_CMD_PAGEPROG,
> > >  	       nfc->regs + NFC_REG_WCMD_SET);
> > >  
> > > -	dma_async_issue_pending(nfc->dmac);
> > > +	wait_event_flags = NFC_CMD_INT_FLAG;
> > > +
> > > +	if (nfc->caps->has_mdma)
> > > +		wait_event_flags = NFC_DMA_INT_FLAG;  
> > 
> > Are you sure you don't need the NFC_CMD_INT_FLAG flag in that case? I'm
> > pretty sure the DMA transfer is done before the PAGEPROG command is
> > issued, meaning that you might be queuing new operations before the
> > operation is actually finished.  
> 
> 
> can never be sure without any proper documentation about this nand controller ):
> was guessing cause i saw dma int triggered,
> tested again always both flags were set, so changed it to NFC_CMD_INT_FLAG to be on safe side

Actually, if you want to be on safe side, you should probably set both
(and that applies to the read path as well, unless no commands are
issued in that case).


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

  reply	other threads:[~2020-10-08 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <304519774.774313.1602080709781.JavaMail.zimbra@robart.cc>
     [not found] ` <17724780.774891.1602080826472.JavaMail.zimbra@robart.cc>
     [not found]   ` <20201007175321.38826b16@collabora.com>
     [not found]     ` <2107658632.970740.1602162997119.JavaMail.zimbra@robart.cc>
2020-10-08 14:51       ` Fwd: [PATCH v4] mtd: sunxi-nand: add mdma support for allwinner h3 Manuel Dipolt
2020-10-08 15:33         ` Boris Brezillon [this message]
2020-10-08 14:36 Manuel Dipolt

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=20201008173350.6fba74be@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mdipolt@robart.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=rruckerbauer@robart.cc \
    /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).