1 From 0547020c73ab7a457f3e1601ef822b61f0b963b9 Mon Sep 17 00:00:00 2001
2 From: Radu Alexe <radu.alexe@nxp.com>
3 Date: Wed, 8 Nov 2017 17:22:12 +0200
4 Subject: [PATCH] crypto: caam - add caam_dma device on caam_probe
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Dynamically create a platform device for the caam_dma driver
12 Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
13 Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
15 Use devres for caam_dma platform device unregistering.
17 Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
19 drivers/crypto/caam/ctrl.c | 24 ++++++++++++++++++++++++
20 1 file changed, 24 insertions(+)
22 --- a/drivers/crypto/caam/ctrl.c
23 +++ b/drivers/crypto/caam/ctrl.c
24 @@ -566,12 +566,22 @@ static void caam_remove_debugfs(void *ro
28 +static void caam_dma_dev_unregister(void *data)
30 + platform_device_unregister(data);
33 /* Probe routine for CAAM top (controller) level */
34 static int caam_probe(struct platform_device *pdev)
36 int ret, ring, gen_sk, ent_delay = RTSDCTL_ENT_DLY_MIN;
38 const struct soc_device_attribute *imx_soc_match;
39 + static struct platform_device_info caam_dma_pdev_info = {
41 + .id = PLATFORM_DEVID_NONE
43 + static struct platform_device *caam_dma_dev;
45 struct device_node *nprop, *np;
46 struct resource res_regs;
47 @@ -849,6 +859,20 @@ set_dma_mask:
51 + caam_dma_pdev_info.parent = dev;
52 + caam_dma_pdev_info.dma_mask = dma_get_mask(dev);
53 + caam_dma_dev = platform_device_register_full(&caam_dma_pdev_info);
54 + if (IS_ERR(caam_dma_dev)) {
55 + dev_err(dev, "Unable to create and register caam-dma dev\n");
56 + return PTR_ERR(caam_dma_dev);
58 + set_dma_ops(&caam_dma_dev->dev, get_dma_ops(dev));
59 + ret = devm_add_action_or_reset(dev, caam_dma_dev_unregister,