All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 4/7] dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver
Date: Thu, 17 Jul 2014 01:08:53 +0000	[thread overview]
Message-ID: <25577078.3zuHvqsEun@avalon> (raw)
In-Reply-To: <1405455522-20676-5-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

Hi Morimoto-san,

On Wednesday 16 July 2014 17:59:39 Kuninori Morimoto wrote:
> Hi Laurent
> 
> > > > +	if (chan->mid_rid >= 0)
> > > > +		rcar_dmac_chan_write(chan, RCAR_DMARS, chan->mid_rid);
> > > 
> > > I guess (chan->mid_rid < 0) case should be error
> > 
> > No, chan->mid_rid can be 0 when using memcpy mode. It's an error in slave
> > mode only.
> 
> ?
> mid_rid > 0 : slave mode
> mid_rid = 0 : memcpy mode
> mid_rid < 0 : error

Sorry, I spoke too fast. mid_rid = 0 is a valid hardware value in slave mode. 
mid_rid < 0 denotes memcpy mode.

> We can't do this ?
> 
> static void rcar_dmac_chan_start_xfer(xxx)
> {
>    if (chan->mid_rid < 0)
>           return err;
>    ...
>    rcar_dmac_chan_write(chan, RCAR_DMARS, chan->mid_rid);
>    ...
> }
> 
> > > This kcalloc() is using fixed size.
> > > we can't use this ?
> > > 
> > > 	struct scatterlist sgl[RCAR_DMAC_MAX_SG_LEN];
> > 
> > That's what the shdma-base driver does, and gcc warns that it consumes
> > more than 1024 bytes of stack space. Given that the kernel stack size is
> > fixed we should be conservative to avoid stack overflows. I think we
> > should fix shdma- base.
> 
> Ahh... I understand
> Is it possible to put this in comment line ?

Sure.

> > > > +	dmac->clk = clk_get(&pdev->dev, "fck");
> > > > +	if (IS_ERR(dmac->clk)) {
> > > > +		dev_err(&pdev->dev, "unable to get fck clock\n");
> > > > +		return PTR_ERR(dmac->clk);
> > > > +	}
> > > 
> > > Maybe this is my misunderstanding,
> > > but, which clock are you expecting to "fck" clock ?
> > > Is it not same as pm_runtime_xxx()'s clock ?
> > 
> > It's the MSTP clock for the DMAC.
> 
> Hmm...
> So why do you use clk_xxx() instead of pm_runime_xxx() on suspend/resume ?
> I forgot detail, but, I got trouble when it used both clk_xxx() and
> pm_runime_xxx() for same clock.
> Because these have different counter.

Are you talking about letting the drivers/sh/pm_runtime.c code handle the 
clock automatically ? Yes, I think that should work. I'll test it.

> > > > +	/* Enable runtime PM and initialize the device. */
> > > > +	pm_runtime_enable(&pdev->dev);
> > > > +	ret = pm_runtime_get_sync(&pdev->dev);
> > > > +	if (ret < 0) {
> > > > +		dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	ret = rcar_dmac_init(dmac);
> > > > +	pm_runtime_put(&pdev->dev);
> > > 
> > > power ON -> initialize -> power OFF here,
> > > and shdmac.c has similar method.
> > > And it works, but, it is a littile bit strange for me :P
> > 
> > Don't forget that runtime PM can be disabled in the kernel configuration.
> > In that case this is the only place where the DMAC hardware will be
> > initialized.
>
> This driver is counting driver users.
> So, I thought that we can initialize driver if it was 1st user.

It could be done, but that would be more complex as the DMAC would be 
reinitialized every time the use count increases from 0 to 1.

-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2014-07-17  1:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 20:18 [PATCH 4/7] dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver Laurent Pinchart
2014-07-16  1:33 ` Kuninori Morimoto
2014-07-16  9:30 ` Laurent Pinchart
2014-07-17  0:59 ` Kuninori Morimoto
2014-07-17  1:08 ` Laurent Pinchart [this message]
2014-07-17  3:02 ` Kuninori Morimoto
2014-07-17  3:25 ` Kuninori Morimoto
2014-07-18 12:52 ` Laurent Pinchart
2014-07-18 13:06 ` Laurent Pinchart

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=25577078.3zuHvqsEun@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.org \
    /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.