mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
crypto: stm32/hash - defer probe for dma device
Change stm32 HASH driver to defer its probe operation when DMA channel device is registered but has not been probed yet. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Reviewed-by: Lionel DEBIEVE <lionel.debieve@st.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
43b05ce767
commit
45dafed6c5
1 changed files with 15 additions and 7 deletions
|
@ -507,6 +507,7 @@ static int stm32_hash_hmac_dma_send(struct stm32_hash_dev *hdev)
|
||||||
static int stm32_hash_dma_init(struct stm32_hash_dev *hdev)
|
static int stm32_hash_dma_init(struct stm32_hash_dev *hdev)
|
||||||
{
|
{
|
||||||
struct dma_slave_config dma_conf;
|
struct dma_slave_config dma_conf;
|
||||||
|
struct dma_chan *chan;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
memset(&dma_conf, 0, sizeof(dma_conf));
|
memset(&dma_conf, 0, sizeof(dma_conf));
|
||||||
|
@ -518,11 +519,11 @@ static int stm32_hash_dma_init(struct stm32_hash_dev *hdev)
|
||||||
dma_conf.dst_maxburst = hdev->dma_maxburst;
|
dma_conf.dst_maxburst = hdev->dma_maxburst;
|
||||||
dma_conf.device_fc = false;
|
dma_conf.device_fc = false;
|
||||||
|
|
||||||
hdev->dma_lch = dma_request_chan(hdev->dev, "in");
|
chan = dma_request_chan(hdev->dev, "in");
|
||||||
if (IS_ERR(hdev->dma_lch)) {
|
if (IS_ERR(chan))
|
||||||
dev_err(hdev->dev, "Couldn't acquire a slave DMA channel.\n");
|
return PTR_ERR(chan);
|
||||||
return PTR_ERR(hdev->dma_lch);
|
|
||||||
}
|
hdev->dma_lch = chan;
|
||||||
|
|
||||||
err = dmaengine_slave_config(hdev->dma_lch, &dma_conf);
|
err = dmaengine_slave_config(hdev->dma_lch, &dma_conf);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1498,8 +1499,15 @@ static int stm32_hash_probe(struct platform_device *pdev)
|
||||||
platform_set_drvdata(pdev, hdev);
|
platform_set_drvdata(pdev, hdev);
|
||||||
|
|
||||||
ret = stm32_hash_dma_init(hdev);
|
ret = stm32_hash_dma_init(hdev);
|
||||||
if (ret)
|
switch (ret) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case -ENOENT:
|
||||||
dev_dbg(dev, "DMA mode not available\n");
|
dev_dbg(dev, "DMA mode not available\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto err_dma;
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock(&stm32_hash.lock);
|
spin_lock(&stm32_hash.lock);
|
||||||
list_add_tail(&hdev->list, &stm32_hash.dev_list);
|
list_add_tail(&hdev->list, &stm32_hash.dev_list);
|
||||||
|
@ -1537,7 +1545,7 @@ err_engine:
|
||||||
spin_lock(&stm32_hash.lock);
|
spin_lock(&stm32_hash.lock);
|
||||||
list_del(&hdev->list);
|
list_del(&hdev->list);
|
||||||
spin_unlock(&stm32_hash.lock);
|
spin_unlock(&stm32_hash.lock);
|
||||||
|
err_dma:
|
||||||
if (hdev->dma_lch)
|
if (hdev->dma_lch)
|
||||||
dma_release_channel(hdev->dma_lch);
|
dma_release_channel(hdev->dma_lch);
|
||||||
err_reset:
|
err_reset:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue