Commit 62f72cbd authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Herbert Xu

crypto: atmel-aes - Retire dma_request_slave_channel_compat()

The driver no longer boots in legacy mode, only via DT. This makes the
dma_request_slave_channel_compat() redundant.
If ever the filter function would be executed it will return false as the
dma_slave is not really initialized.

Switch to use dma_request_chan() which would allow legacy boot if ever
needed again by configuring dma_slave_map for the DMA driver.

At the same time skip allocating memory for dma_slave as it is not used
anymore.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2452cfdf
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <crypto/internal/aead.h> #include <crypto/internal/aead.h>
#include <crypto/internal/skcipher.h> #include <crypto/internal/skcipher.h>
#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/crypto-atmel.h>
#include <dt-bindings/dma/at91.h>
#include "atmel-aes-regs.h" #include "atmel-aes-regs.h"
#include "atmel-authenc.h" #include "atmel-authenc.h"
...@@ -2364,39 +2363,23 @@ static void atmel_aes_buff_cleanup(struct atmel_aes_dev *dd) ...@@ -2364,39 +2363,23 @@ static void atmel_aes_buff_cleanup(struct atmel_aes_dev *dd)
free_page((unsigned long)dd->buf); free_page((unsigned long)dd->buf);
} }
static bool atmel_aes_filter(struct dma_chan *chan, void *slave)
{
struct at_dma_slave *sl = slave;
if (sl && sl->dma_dev == chan->device->dev) {
chan->private = sl;
return true;
} else {
return false;
}
}
static int atmel_aes_dma_init(struct atmel_aes_dev *dd, static int atmel_aes_dma_init(struct atmel_aes_dev *dd,
struct crypto_platform_data *pdata) struct crypto_platform_data *pdata)
{ {
struct at_dma_slave *slave; int ret;
dma_cap_mask_t mask;
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
/* Try to grab 2 DMA channels */ /* Try to grab 2 DMA channels */
slave = &pdata->dma_slave->rxdata; dd->src.chan = dma_request_chan(dd->dev, "tx");
dd->src.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter, if (IS_ERR(dd->src.chan)) {
slave, dd->dev, "tx"); ret = PTR_ERR(dd->src.chan);
if (!dd->src.chan)
goto err_dma_in; goto err_dma_in;
}
slave = &pdata->dma_slave->txdata; dd->dst.chan = dma_request_chan(dd->dev, "rx");
dd->dst.chan = dma_request_slave_channel_compat(mask, atmel_aes_filter, if (IS_ERR(dd->dst.chan)) {
slave, dd->dev, "rx"); ret = PTR_ERR(dd->dst.chan);
if (!dd->dst.chan)
goto err_dma_out; goto err_dma_out;
}
return 0; return 0;
...@@ -2404,7 +2387,7 @@ static int atmel_aes_dma_init(struct atmel_aes_dev *dd, ...@@ -2404,7 +2387,7 @@ static int atmel_aes_dma_init(struct atmel_aes_dev *dd,
dma_release_channel(dd->src.chan); dma_release_channel(dd->src.chan);
err_dma_in: err_dma_in:
dev_warn(dd->dev, "no DMA channel available\n"); dev_warn(dd->dev, "no DMA channel available\n");
return -ENODEV; return ret;
} }
static void atmel_aes_dma_cleanup(struct atmel_aes_dev *dd) static void atmel_aes_dma_cleanup(struct atmel_aes_dev *dd)
...@@ -2592,14 +2575,6 @@ static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pd ...@@ -2592,14 +2575,6 @@ static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pd
if (!pdata) if (!pdata)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
pdata->dma_slave = devm_kzalloc(&pdev->dev,
sizeof(*(pdata->dma_slave)),
GFP_KERNEL);
if (!pdata->dma_slave) {
devm_kfree(&pdev->dev, pdata);
return ERR_PTR(-ENOMEM);
}
return pdata; return pdata;
} }
#else #else
...@@ -2626,11 +2601,6 @@ static int atmel_aes_probe(struct platform_device *pdev) ...@@ -2626,11 +2601,6 @@ static int atmel_aes_probe(struct platform_device *pdev)
} }
} }
if (!pdata->dma_slave) {
err = -ENXIO;
goto aes_dd_err;
}
aes_dd = devm_kzalloc(&pdev->dev, sizeof(*aes_dd), GFP_KERNEL); aes_dd = devm_kzalloc(&pdev->dev, sizeof(*aes_dd), GFP_KERNEL);
if (aes_dd == NULL) { if (aes_dd == NULL) {
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment