summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccp/ccp-dev-v5.c
diff options
context:
space:
mode:
authorGary R Hook <gary.hook@amd.com>2016-07-26 19:10:49 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-09 18:47:18 +0800
commite14e7d126765ce0156ab5e3b250b1270998c207d (patch)
tree5bfb2c89295e0955dd29d26d739e5ccd70e22371 /drivers/crypto/ccp/ccp-dev-v5.c
parent99d90b2ebd8b327c0c496798db99009b30c70945 (diff)
downloadlinux-stable-e14e7d126765ce0156ab5e3b250b1270998c207d.tar.gz
linux-stable-e14e7d126765ce0156ab5e3b250b1270998c207d.tar.bz2
linux-stable-e14e7d126765ce0156ab5e3b250b1270998c207d.zip
crypto: ccp - Enable use of the additional CCP
A second CCP is available, identical to the first, with its ownn PCI ID. Make it available for use by the crypto subsystem, as well as for DMA activity and random number generation. This device is not pre-configured at at boot time. The driver must configure it (during the probe) for use. Signed-off-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-dev-v5.c')
-rw-r--r--drivers/crypto/ccp/ccp-dev-v5.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c
index 40867141aea8..f499e34df389 100644
--- a/drivers/crypto/ccp/ccp-dev-v5.c
+++ b/drivers/crypto/ccp/ccp-dev-v5.c
@@ -835,7 +835,7 @@ static int ccp5_init(struct ccp_device *ccp)
/* Register the DMA engine support */
ret = ccp_dmaengine_register(ccp);
if (ret)
- goto e_hwrng;
+ goto e_kthread;
return 0;
@@ -952,6 +952,33 @@ static void ccp5_config(struct ccp_device *ccp)
iowrite32(0x00001249, ccp->io_regs + CMD5_REQID_CONFIG_OFFSET);
}
+static void ccp5other_config(struct ccp_device *ccp)
+{
+ int i;
+ u32 rnd;
+
+ /* We own all of the queues on the NTB CCP */
+
+ iowrite32(0x00012D57, ccp->io_regs + CMD5_TRNG_CTL_OFFSET);
+ iowrite32(0x00000003, ccp->io_regs + CMD5_CONFIG_0_OFFSET);
+ for (i = 0; i < 12; i++) {
+ rnd = ioread32(ccp->io_regs + TRNG_OUT_REG);
+ iowrite32(rnd, ccp->io_regs + CMD5_AES_MASK_OFFSET);
+ }
+
+ iowrite32(0x0000001F, ccp->io_regs + CMD5_QUEUE_MASK_OFFSET);
+ iowrite32(0x00005B6D, ccp->io_regs + CMD5_QUEUE_PRIO_OFFSET);
+ iowrite32(0x00000000, ccp->io_regs + CMD5_CMD_TIMEOUT_OFFSET);
+
+ iowrite32(0x3FFFFFFF, ccp->io_regs + LSB_PRIVATE_MASK_LO_OFFSET);
+ iowrite32(0x000003FF, ccp->io_regs + LSB_PRIVATE_MASK_HI_OFFSET);
+
+ iowrite32(0x00108823, ccp->io_regs + CMD5_CLK_GATE_CTL_OFFSET);
+
+ ccp5_config(ccp);
+}
+
+/* Version 5 adds some function, but is essentially the same as v5 */
static const struct ccp_actions ccp5_actions = {
.aes = ccp5_perform_aes,
.xts_aes = ccp5_perform_xts_aes,
@@ -974,3 +1001,11 @@ struct ccp_vdata ccpv5 = {
.bar = 2,
.offset = 0x0,
};
+
+struct ccp_vdata ccpv5other = {
+ .version = CCP_VERSION(5, 0),
+ .setup = ccp5other_config,
+ .perform = &ccp5_actions,
+ .bar = 2,
+ .offset = 0x0,
+};