* [PATCH 1/2] spi: atmel: remove compat for non DT board when requesting dma chan @ 2014-11-14 16:12 Ludovic Desroches [not found] ` <1415981574-11165-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Ludovic Desroches @ 2014-11-14 16:12 UTC (permalink / raw) To: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A, Ludovic Desroches All boards with a dma controller have DT support so using dma_request_slave_channel_compat is no more needed. Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> --- drivers/spi/spi-atmel.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 649dcb5..f1760fa 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -414,23 +414,6 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, return err; } -static bool filter(struct dma_chan *chan, void *pdata) -{ - struct atmel_spi_dma *sl_pdata = pdata; - struct at_dma_slave *sl; - - if (!sl_pdata) - return false; - - sl = &sl_pdata->dma_slave; - if (sl->dma_dev == chan->device->dev) { - chan->private = sl; - return true; - } else { - return false; - } -} - static int atmel_spi_configure_dma(struct atmel_spi *as) { struct dma_slave_config slave_config; @@ -441,9 +424,7 @@ static int atmel_spi_configure_dma(struct atmel_spi *as) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - as->dma.chan_tx = dma_request_slave_channel_compat(mask, filter, - &as->dma, - dev, "tx"); + as->dma.chan_tx = dma_request_slave_channel(dev, "tx"); if (!as->dma.chan_tx) { dev_err(dev, "DMA TX channel not available, SPI unable to use DMA\n"); @@ -451,9 +432,7 @@ static int atmel_spi_configure_dma(struct atmel_spi *as) goto error; } - as->dma.chan_rx = dma_request_slave_channel_compat(mask, filter, - &as->dma, - dev, "rx"); + as->dma.chan_rx = dma_request_slave_channel(dev, "rx"); if (!as->dma.chan_rx) { dev_err(dev, -- 2.0.3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1415981574-11165-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>]
* [PATCH 2/2] spi: atmel: introduce probe deferring [not found] ` <1415981574-11165-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> @ 2014-11-14 16:12 ` Ludovic Desroches 2014-11-24 18:57 ` [PATCH 1/2] spi: atmel: remove compat for non DT board when requesting dma chan Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Ludovic Desroches @ 2014-11-14 16:12 UTC (permalink / raw) To: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A, Ludovic Desroches Return probe defer if requesting a dma channel without a dma controller probed. Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> --- drivers/spi/spi-atmel.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index f1760fa..62c293d 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -424,14 +424,23 @@ static int atmel_spi_configure_dma(struct atmel_spi *as) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - as->dma.chan_tx = dma_request_slave_channel(dev, "tx"); - if (!as->dma.chan_tx) { + as->dma.chan_tx = dma_request_slave_channel_reason(dev, "tx"); + if (IS_ERR(as->dma.chan_tx)) { + err = PTR_ERR(as->dma.chan_tx); + if (err == -EPROBE_DEFER) { + dev_warn(dev, "no DMA channel available at the moment\n"); + return err; + } dev_err(dev, "DMA TX channel not available, SPI unable to use DMA\n"); err = -EBUSY; goto error; } + /* + * No reason to check EPROBE_DEFER here since we have already requested + * tx channel. If it fails here, it's for another reason. + */ as->dma.chan_rx = dma_request_slave_channel(dev, "rx"); if (!as->dma.chan_rx) { @@ -453,7 +462,7 @@ static int atmel_spi_configure_dma(struct atmel_spi *as) error: if (as->dma.chan_rx) dma_release_channel(as->dma.chan_rx); - if (as->dma.chan_tx) + if (!IS_ERR(as->dma.chan_tx)) dma_release_channel(as->dma.chan_tx); return err; } @@ -1324,8 +1333,11 @@ static int atmel_spi_probe(struct platform_device *pdev) as->use_dma = false; as->use_pdc = false; if (as->caps.has_dma_support) { - if (atmel_spi_configure_dma(as) == 0) + ret = atmel_spi_configure_dma(as); + if (ret == 0) as->use_dma = true; + else if (ret == -EPROBE_DEFER) + return ret; } else { as->use_pdc = true; } -- 2.0.3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] spi: atmel: remove compat for non DT board when requesting dma chan [not found] ` <1415981574-11165-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> 2014-11-14 16:12 ` [PATCH 2/2] spi: atmel: introduce probe deferring Ludovic Desroches @ 2014-11-24 18:57 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Mark Brown @ 2014-11-24 18:57 UTC (permalink / raw) To: Ludovic Desroches Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w [-- Attachment #1: Type: text/plain, Size: 204 bytes --] On Fri, Nov 14, 2014 at 05:12:53PM +0100, Ludovic Desroches wrote: > All boards with a dma controller have DT support so using > dma_request_slave_channel_compat is no more needed. Applied both, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-24 18:57 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-14 16:12 [PATCH 1/2] spi: atmel: remove compat for non DT board when requesting dma chan Ludovic Desroches [not found] ` <1415981574-11165-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> 2014-11-14 16:12 ` [PATCH 2/2] spi: atmel: introduce probe deferring Ludovic Desroches 2014-11-24 18:57 ` [PATCH 1/2] spi: atmel: remove compat for non DT board when requesting dma chan Mark Brown
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).