All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Ezequiel Garcia <ezequiel@collabora.co.uk>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-mips@linux-mips.org,
	James Hogan <jhogan@kernel.org>
Subject: Re: [PATCH v2 10/14] mmc: jz4740: Use dma_request_chan()
Date: Thu, 15 Mar 2018 19:33:40 -0300	[thread overview]
Message-ID: <1521153221.9698.0@smtp.crapouillou.net> (raw)
In-Reply-To: <1521148366.26589.14.camel@collabora.co.uk>



Le jeu. 15 mars 2018 à 18:12, Ezequiel Garcia 
<ezequiel@collabora.co.uk> a écrit :
> On Thu, 2018-03-15 at 17:59 -0300, Paul Cercueil wrote:
>>  Hi,
>> 
>>  Le lun. 12 mars 2018 à 18:55, Ezequiel Garcia
>>  <ezequiel@vanguardiasur.com.ar> a écrit :
>>  > From: Ezequiel Garcia <ezequiel@collabora.co.uk>
>>  >
>>  > Replace dma_request_channel() with dma_request_chan(),
>>  > which also supports probing from the devicetree.
>>  >
>>  > Tested-by: Mathieu Malaterre <malat@debian.org>
>>  > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.co.uk>
>>  > ---
>>  >  drivers/mmc/host/jz4740_mmc.c | 22 +++++++---------------
>>  >  1 file changed, 7 insertions(+), 15 deletions(-)
>>  >
>>  > diff --git a/drivers/mmc/host/jz4740_mmc.c
>>  > b/drivers/mmc/host/jz4740_mmc.c
>>  > index c3ec8e662706..37183fe32ef8 100644
>>  > --- a/drivers/mmc/host/jz4740_mmc.c
>>  > +++ b/drivers/mmc/host/jz4740_mmc.c
>>  > @@ -225,31 +225,23 @@ static void
>>  > jz4740_mmc_release_dma_channels(struct jz4740_mmc_host *host)
>>  >
>>  >  static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host
>>  > *host)
>>  >  {
>>  > -	dma_cap_mask_t mask;
>>  > -
>>  > -	dma_cap_zero(mask);
>>  > -	dma_cap_set(DMA_SLAVE, mask);
>>  > -
>>  > -	host->dma_tx = dma_request_channel(mask, NULL, host);
>>  > -	if (!host->dma_tx) {
>>  > +	host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
>>  > +	if (IS_ERR(host->dma_tx)) {
>>  >  		dev_err(mmc_dev(host->mmc), "Failed to get dma_tx
>>  > channel\n");
>>  > -		return -ENODEV;
>>  > +		return PTR_ERR(host->dma_tx);
>>  >  	}
>>  >
>>  > -	host->dma_rx = dma_request_channel(mask, NULL, host);
>>  > -	if (!host->dma_rx) {
>>  > +	host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx");
>> 
>>  I suspect this breaks on jz4740... Did you test?
>> 
> 
> No, but code inspecting I was expecting it wouldn't break anything.
> dma_request_channel() searches for a slave channel, via the DMA_SLAVE
> mask that the driver sets.
> 
> dma_request_chan() seems to fallback to do the same.

Alright, I overlooked that. I guess it's fine then.

> struct dma_chan *dma_request_chan(struct device *dev, const char 
> *name)
> {
>         struct dma_device *d, *_d;
>         struct dma_chan *chan = NULL;
> 
>         /* If device-tree is present get slave info from here */
>         if (dev->of_node)
>                 chan = of_dma_request_slave_channel(dev->of_node,
> name);
> 
>         /* ... */
> 
>         if (chan) {
>                 /* Valid channel found or requester need to be 
> deferred
> */
>                 if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER)
>                         return chan;
>         }
> 
>         /* Try to find the channel via the DMA filter map(s) */
>         mutex_lock(&dma_list_mutex);
>         list_for_each_entry_safe(d, _d, &dma_device_list, global_node)
> {
>                 dma_cap_mask_t mask;
>                 const struct dma_slave_map *map = dma_filter_match(d,
> name, dev);
> 
>                 if (!map)
>                         continue;
> 
>                 dma_cap_zero(mask);
>                 dma_cap_set(DMA_SLAVE, mask);
> 
>                 chan = find_candidate(d, &mask, d->filter.fn, map-
>> param);
>                 if (!IS_ERR(chan))
>                         break;
>         }
>         mutex_unlock(&dma_list_mutex);
> 
>         return chan ? chan : ERR_PTR(-EPROBE_DEFER);
> }
> 
> Unfortunately, I don't have anything but a jz4780 Ci20, so can't 
> really
> test this.

Apart from this patch, your patchset looks sufficiently similar to what 
I
successfully tested on jz4740, so it's safe to assume it doesn't break 
anything.
Unfortunately I won't be able to test it on jz4740 before the end of 
this year.

> Thanks,
> Eze

  reply	other threads:[~2018-03-15 22:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 21:55 [PATCH v2 00/14] Enable SD/MMC on JZ4780 SoCs Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 01/14] mmc: jz4740: Fix race condition in IRQ mask update Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 02/14] mmc: jz4740: Fix error exit path in driver's probe Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 03/14] mmc: jz4780: Order headers alphabetically Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 04/14] mmc: jz4740: Use dev_get_platdata Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 05/14] mmc: jz4740: Reset the device requesting the interrupt Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 06/14] mmc: jz4740: Introduce devicetree probe Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 07/14] mmc: dt-bindings: add MMC support to JZ4740 SoC Ezequiel Garcia
2018-03-18 12:49   ` Rob Herring
2018-03-12 21:55 ` [PATCH v2 08/14] mmc: jz4740: Set clock rate to mmc->f_max rather than JZ_MMC_CLK_RATE Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 09/14] mmc: jz4740: Add support for the JZ4780 Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 10/14] mmc: jz4740: Use dma_request_chan() Ezequiel Garcia
2018-03-15 20:59   ` Paul Cercueil
2018-03-15 21:12     ` Ezequiel Garcia
2018-03-15 22:33       ` Paul Cercueil [this message]
2018-03-12 21:55 ` [PATCH v2 11/14] MIPS: dts: jz4780: Add DMA controller node to the devicetree Ezequiel Garcia
2018-03-12 22:31   ` James Hogan
2018-03-15  9:46     ` Ulf Hansson
2018-03-12 21:55 ` [PATCH v2 12/14] MIPS: dts: jz4780: Add MMC " Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 13/14] MIPS: dts: ci20: Enable MMC in " Ezequiel Garcia
2018-03-12 21:55 ` [PATCH v2 14/14] MIPS: configs: ci20: Enable DMA and MMC support Ezequiel Garcia

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=1521153221.9698.0@smtp.crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=ezequiel@collabora.co.uk \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=jhogan@kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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.