[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1432646768-12532-12-git-send-email-peter.ujfalusi@ti.com>
Date: Tue, 26 May 2015 16:26:06 +0300
From: Peter Ujfalusi <peter.ujfalusi@...com>
To: <vinod.koul@...el.com>, <tony@...mide.com>
CC: <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<dan.j.williams@...el.com>, <dmaengine@...r.kernel.org>,
<linux-serial@...r.kernel.org>, <linux-omap@...r.kernel.org>,
<linux-mmc@...r.kernel.org>, <linux-crypto@...r.kernel.org>,
<linux-spi@...r.kernel.org>, <linux-media@...r.kernel.org>,
<alsa-devel@...a-project.org>, Mark Brown <broonie@...nel.org>
Subject: [PATCH 11/13] spi: omap2-mcspi: Support for deferred probing when requesting DMA channels
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
CC: Mark Brown <broonie@...nel.org>
---
drivers/spi/spi-omap2-mcspi.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index a7d85c5ab2fa..e6ff937688ff 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -948,6 +948,7 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
struct omap2_mcspi_dma *mcspi_dma;
dma_cap_mask_t mask;
unsigned sig;
+ int ret = 0;
mcspi = spi_master_get_devdata(master);
mcspi_dma = mcspi->dma_channels + spi->chip_select;
@@ -959,30 +960,35 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
dma_cap_set(DMA_SLAVE, mask);
sig = mcspi_dma->dma_rx_sync_dev;
- mcspi_dma->dma_rx =
- dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
- &sig, &master->dev,
- mcspi_dma->dma_rx_ch_name);
- if (!mcspi_dma->dma_rx)
+ mcspi_dma->dma_rx = dma_request_slave_channel_compat_reason(mask,
+ omap_dma_filter_fn, &sig, &master->dev,
+ mcspi_dma->dma_rx_ch_name);
+ if (IS_ERR(mcspi_dma->dma_rx)) {
+ ret = PTR_ERR(mcspi_dma->dma_rx);
+ mcspi_dma->dma_rx = NULL;
+ if (ret != -EPROBE_DEFER)
+ ret = -EAGAIN;
goto no_dma;
+ }
sig = mcspi_dma->dma_tx_sync_dev;
- mcspi_dma->dma_tx =
- dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
- &sig, &master->dev,
- mcspi_dma->dma_tx_ch_name);
+ mcspi_dma->dma_tx = dma_request_slave_channel_compat_reason(mask,
+ omap_dma_filter_fn, &sig, &master->dev,
+ mcspi_dma->dma_tx_ch_name);
- if (!mcspi_dma->dma_tx) {
+ if (IS_ERR(mcspi_dma->dma_tx)) {
+ ret = PTR_ERR(mcspi_dma->dma_tx);
+ mcspi_dma->dma_tx = NULL;
dma_release_channel(mcspi_dma->dma_rx);
mcspi_dma->dma_rx = NULL;
- goto no_dma;
+ if (ret != -EPROBE_DEFER)
+ ret = -EAGAIN;
}
- return 0;
-
no_dma:
- dev_warn(&spi->dev, "not using DMA for McSPI\n");
- return -EAGAIN;
+ if (ret && ret != -EPROBE_DEFER)
+ dev_warn(&spi->dev, "not using DMA for McSPI\n");
+ return ret;
}
static int omap2_mcspi_setup(struct spi_device *spi)
--
2.3.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists