diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2016-04-29 09:03:41 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-05-03 04:09:14 -0400 |
commit | dbe246209bc1a2a870250499b8f584251838d5b4 (patch) | |
tree | a679186e36fb205df33ffa63795b870874a1ef90 /drivers/crypto/omap-sham.c | |
parent | 2f6f0680c78e2bc35f576ea956b284aa45cef0d1 (diff) |
crypto: omap-sham - Use dma_request_chan() for requesting DMA channel
With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: David S. Miller <davem@davemloft.net>
CC: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/omap-sham.c')
-rw-r--r-- | drivers/crypto/omap-sham.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 48adb2a0903e..6eefaa2fe58f 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/scatterlist.h> | 29 | #include <linux/scatterlist.h> |
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/dmaengine.h> | 31 | #include <linux/dmaengine.h> |
32 | #include <linux/omap-dma.h> | ||
33 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
34 | #include <linux/of.h> | 33 | #include <linux/of.h> |
35 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
@@ -219,7 +218,6 @@ struct omap_sham_dev { | |||
219 | int irq; | 218 | int irq; |
220 | spinlock_t lock; | 219 | spinlock_t lock; |
221 | int err; | 220 | int err; |
222 | unsigned int dma; | ||
223 | struct dma_chan *dma_lch; | 221 | struct dma_chan *dma_lch; |
224 | struct tasklet_struct done_task; | 222 | struct tasklet_struct done_task; |
225 | u8 polling_mode; | 223 | u8 polling_mode; |
@@ -1842,7 +1840,6 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, | |||
1842 | goto err; | 1840 | goto err; |
1843 | } | 1841 | } |
1844 | 1842 | ||
1845 | dd->dma = -1; /* Dummy value that's unused */ | ||
1846 | dd->pdata = match->data; | 1843 | dd->pdata = match->data; |
1847 | 1844 | ||
1848 | err: | 1845 | err: |
@@ -1884,15 +1881,6 @@ static int omap_sham_get_res_pdev(struct omap_sham_dev *dd, | |||
1884 | goto err; | 1881 | goto err; |
1885 | } | 1882 | } |
1886 | 1883 | ||
1887 | /* Get the DMA */ | ||
1888 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
1889 | if (!r) { | ||
1890 | dev_err(dev, "no DMA resource info\n"); | ||
1891 | err = -ENODEV; | ||
1892 | goto err; | ||
1893 | } | ||
1894 | dd->dma = r->start; | ||
1895 | |||
1896 | /* Only OMAP2/3 can be non-DT */ | 1884 | /* Only OMAP2/3 can be non-DT */ |
1897 | dd->pdata = &omap_sham_pdata_omap2; | 1885 | dd->pdata = &omap_sham_pdata_omap2; |
1898 | 1886 | ||
@@ -1946,9 +1934,12 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
1946 | dma_cap_zero(mask); | 1934 | dma_cap_zero(mask); |
1947 | dma_cap_set(DMA_SLAVE, mask); | 1935 | dma_cap_set(DMA_SLAVE, mask); |
1948 | 1936 | ||
1949 | dd->dma_lch = dma_request_slave_channel_compat(mask, omap_dma_filter_fn, | 1937 | dd->dma_lch = dma_request_chan(dev, "rx"); |
1950 | &dd->dma, dev, "rx"); | 1938 | if (IS_ERR(dd->dma_lch)) { |
1951 | if (!dd->dma_lch) { | 1939 | err = PTR_ERR(dd->dma_lch); |
1940 | if (err == -EPROBE_DEFER) | ||
1941 | goto data_err; | ||
1942 | |||
1952 | dd->polling_mode = 1; | 1943 | dd->polling_mode = 1; |
1953 | dev_dbg(dev, "using polling mode instead of dma\n"); | 1944 | dev_dbg(dev, "using polling mode instead of dma\n"); |
1954 | } | 1945 | } |
@@ -1995,7 +1986,7 @@ err_algs: | |||
1995 | &dd->pdata->algs_info[i].algs_list[j]); | 1986 | &dd->pdata->algs_info[i].algs_list[j]); |
1996 | err_pm: | 1987 | err_pm: |
1997 | pm_runtime_disable(dev); | 1988 | pm_runtime_disable(dev); |
1998 | if (dd->dma_lch) | 1989 | if (dd->polling_mode) |
1999 | dma_release_channel(dd->dma_lch); | 1990 | dma_release_channel(dd->dma_lch); |
2000 | data_err: | 1991 | data_err: |
2001 | dev_err(dev, "initialization failed.\n"); | 1992 | dev_err(dev, "initialization failed.\n"); |
@@ -2021,7 +2012,7 @@ static int omap_sham_remove(struct platform_device *pdev) | |||
2021 | tasklet_kill(&dd->done_task); | 2012 | tasklet_kill(&dd->done_task); |
2022 | pm_runtime_disable(&pdev->dev); | 2013 | pm_runtime_disable(&pdev->dev); |
2023 | 2014 | ||
2024 | if (dd->dma_lch) | 2015 | if (!dd->polling_mode) |
2025 | dma_release_channel(dd->dma_lch); | 2016 | dma_release_channel(dd->dma_lch); |
2026 | 2017 | ||
2027 | return 0; | 2018 | return 0; |