summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccree/cc_sram_mgr.c
diff options
context:
space:
mode:
authorGilad Ben-Yossef <gilad@benyossef.com>2018-02-19 15:51:23 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2018-03-02 17:03:16 +0100
commit27b3b22dd98caef023cbaa4871b356e4596a81af (patch)
treecaeedee7405b5b9e1a885bf2b607aedee64c2534 /drivers/crypto/ccree/cc_sram_mgr.c
parentdt-bindings: Add DT bindings for ccree 710 and 630p (diff)
downloadlinux-27b3b22dd98caef023cbaa4871b356e4596a81af.tar.xz
linux-27b3b22dd98caef023cbaa4871b356e4596a81af.zip
crypto: ccree - add support for older HW revs
Add support for the legacy CryptoCell 630 and 710 revs. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--drivers/crypto/ccree/cc_sram_mgr.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/crypto/ccree/cc_sram_mgr.c b/drivers/crypto/ccree/cc_sram_mgr.c
index fed877d35d3e..c8c276f6dee9 100644
--- a/drivers/crypto/ccree/cc_sram_mgr.c
+++ b/drivers/crypto/ccree/cc_sram_mgr.c
@@ -33,6 +33,19 @@ void cc_sram_mgr_fini(struct cc_drvdata *drvdata)
int cc_sram_mgr_init(struct cc_drvdata *drvdata)
{
struct cc_sram_ctx *ctx;
+ dma_addr_t start = 0;
+ struct device *dev = drvdata_to_dev(drvdata);
+
+ if (drvdata->hw_rev < CC_HW_REV_712) {
+ /* Pool starts after ROM bytes */
+ start = (dma_addr_t)cc_ioread(drvdata,
+ CC_REG(HOST_SEP_SRAM_THRESHOLD));
+
+ if ((start & 0x3) != 0) {
+ dev_err(dev, "Invalid SRAM offset %pad\n", &start);
+ return -EINVAL;
+ }
+ }
/* Allocate "this" context */
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -40,6 +53,7 @@ int cc_sram_mgr_init(struct cc_drvdata *drvdata)
if (!ctx)
return -ENOMEM;
+ ctx->sram_free_offset = start;
drvdata->sram_mgr_handle = ctx;
return 0;