aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/mv_cesa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/mv_cesa.c')
-rw-r--r--drivers/crypto/mv_cesa.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index e6ecc5f23943..1cc6b3f3e262 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -16,6 +16,7 @@
16#include <linux/scatterlist.h> 16#include <linux/scatterlist.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/clk.h>
19#include <crypto/internal/hash.h> 20#include <crypto/internal/hash.h>
20#include <crypto/sha.h> 21#include <crypto/sha.h>
21 22
@@ -79,6 +80,7 @@ struct crypto_priv {
79 void __iomem *reg; 80 void __iomem *reg;
80 void __iomem *sram; 81 void __iomem *sram;
81 int irq; 82 int irq;
83 struct clk *clk;
82 struct task_struct *queue_th; 84 struct task_struct *queue_th;
83 85
84 /* the lock protects queue and eng_st */ 86 /* the lock protects queue and eng_st */
@@ -1053,6 +1055,12 @@ static int mv_probe(struct platform_device *pdev)
1053 if (ret) 1055 if (ret)
1054 goto err_thread; 1056 goto err_thread;
1055 1057
1058 /* Not all platforms can gate the clock, so it is not
1059 an error if the clock does not exists. */
1060 cp->clk = clk_get(&pdev->dev, NULL);
1061 if (!IS_ERR(cp->clk))
1062 clk_prepare_enable(cp->clk);
1063
1056 writel(SEC_INT_ACCEL0_DONE, cpg->reg + SEC_ACCEL_INT_MASK); 1064 writel(SEC_INT_ACCEL0_DONE, cpg->reg + SEC_ACCEL_INT_MASK);
1057 writel(SEC_CFG_STOP_DIG_ERR, cpg->reg + SEC_ACCEL_CFG); 1065 writel(SEC_CFG_STOP_DIG_ERR, cpg->reg + SEC_ACCEL_CFG);
1058 writel(SRAM_CONFIG, cpg->reg + SEC_ACCEL_DESC_P0); 1066 writel(SRAM_CONFIG, cpg->reg + SEC_ACCEL_DESC_P0);
@@ -1118,6 +1126,12 @@ static int mv_remove(struct platform_device *pdev)
1118 memset(cp->sram, 0, cp->sram_size); 1126 memset(cp->sram, 0, cp->sram_size);
1119 iounmap(cp->sram); 1127 iounmap(cp->sram);
1120 iounmap(cp->reg); 1128 iounmap(cp->reg);
1129
1130 if (!IS_ERR(cp->clk)) {
1131 clk_disable_unprepare(cp->clk);
1132 clk_put(cp->clk);
1133 }
1134
1121 kfree(cp); 1135 kfree(cp);
1122 cpg = NULL; 1136 cpg = NULL;
1123 return 0; 1137 return 0;