summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/ctrl.c
diff options
context:
space:
mode:
authorVakul Garg <vakul@freescale.com>2013-04-25 05:29:26 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-05-14 20:38:42 (GMT)
commitf9aa75c4fb1c8ec37dab9c676c67c7d06ecb461d (patch)
tree6c47bbcc36f850141f9d4df9e2c727cadb7f350d /drivers/crypto/caam/ctrl.c
parent478d1d2b99412a2d276e521b4fd8363ac048a1a2 (diff)
downloadlinux-fsl-qoriq-f9aa75c4fb1c8ec37dab9c676c67c7d06ecb461d.tar.xz
crypto: caam - Adding backend driver for CAAM queue interface
CAAM supports two interfaces for crypto job submission. These are job ring based and QMAN based interfaces. QMAN based interfaces are present of DPAA enabled platforms. This patch adds a platform device for accessing the caam's queue interface. The requests are submitted to caam using one frame queue per cryptographic context. Each crypto context has one shared descriptor. This shared descriptor is attached to frame queue associated with corresponding driver context using context_a. The driver hides the mechanics of FQ creation, initialisation from its applications. Each cryptographic context needs to be associated with driver context which houses the FQ to be used to transport the job to SEC. The driver provides apis for: (a) Context creation (b) Job submission (c) Context deletion (d) Checking if path to SEC or from SEC is congested The driver supports affining its context to a particular CPU. This means that any responses from the SEC for the context in question would arrive at the given CPU. This helps in implementing one cpu per pkt round trip in ipsec application. The driver processes the caam respones under NAPI contexts. NAPI contexts are instantiated only on cores with affined portals since only cores having their own portal can receive responses from DQRR. The responses from CAAM for all cryptographic contexts ride on a fixed set of FQs. We use one response FQ per portal owning core. The response FQ is configured in each core's and thus portal's dedicated channel. This gives the flexibility to direct the caam's responses for a crypto context on a given core. Change-Id: Id9661caae0ecda933e35eef40fb0b25013365397 Signed-off-by: Vakul Garg <vakul@freescale.com> Change-Id: I79819af83d57c64acb4a76213452ce912cba0273 Reviewed-on: http://git.am.freescale.net:8181/2075 Reviewed-by: Geanta Neag Horia Ioan-B05471 <horia.geanta@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/crypto/caam/ctrl.c')
-rw-r--r--drivers/crypto/caam/ctrl.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 644d145..33b3899 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -13,6 +13,10 @@
#include "error.h"
#include "ctrl.h"
+#ifdef CONFIG_FSL_QMAN
+#include "qi.h"
+#endif
+
static int caam_remove(struct platform_device *pdev)
{
struct device *ctrldev;
@@ -32,6 +36,11 @@ static int caam_remove(struct platform_device *pdev)
irq_dispose_mapping(jrpriv->irq);
}
+#ifdef CONFIG_FSL_QMAN
+ if (ctrlpriv->qidev)
+ caam_qi_shutdown(ctrlpriv->qidev);
+#endif
+
/* Shut down debug views */
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(ctrlpriv->dfs_root);
@@ -285,6 +294,12 @@ static int caam_probe(struct platform_device *pdev)
ctrlpriv->qi = (struct caam_queue_if __force *)&topregs->qi;
/* This is all that's required to physically enable QI */
wr_reg32(&topregs->qi.qi_control_lo, QICTL_DQEN);
+
+ /* If QMAN driver is present, init CAAM-QI backend */
+#ifdef CONFIG_FSL_QMAN
+ if (caam_qi_init(pdev, nprop))
+ dev_err(dev, "caam qi i/f init failed\n");
+#endif
}
/* If no QI and no rings specified, quit and go home */