aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/msm-rng.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/hw_random/msm-rng.c')
-rw-r--r--drivers/char/hw_random/msm-rng.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/char/hw_random/msm-rng.c b/drivers/char/hw_random/msm-rng.c
index 841fee845ec9..48f2ef138d4a 100644
--- a/drivers/char/hw_random/msm-rng.c
+++ b/drivers/char/hw_random/msm-rng.c
@@ -14,6 +14,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/hw_random.h>
+#include <linux/interconnect.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -39,6 +40,7 @@ struct msm_rng {
void __iomem *base;
struct clk *clk;
struct hwrng hwrng;
+ struct icc_path *path;
};
#define to_msm_rng(p) container_of(p, struct msm_rng, hwrng)
@@ -94,6 +96,8 @@ static int msm_rng_read(struct hwrng *hwrng, void *data, size_t max, bool wait)
if (ret)
return ret;
+ icc_set(rng->path, 0, 800);
+
/* read random data from hardware */
do {
val = readl_relaxed(rng->base + PRNG_STATUS);
@@ -112,6 +116,8 @@ static int msm_rng_read(struct hwrng *hwrng, void *data, size_t max, bool wait)
break;
} while (currsize < maxsize);
+ icc_set(rng->path, 0, 0);
+
clk_disable_unprepare(rng->clk);
return currsize;
@@ -148,6 +154,10 @@ static int msm_rng_probe(struct platform_device *pdev)
if (IS_ERR(rng->clk))
return PTR_ERR(rng->clk);
+ rng->path = of_icc_get(&pdev->dev, "cpu");
+ if (IS_ERR(rng->path))
+ return PTR_ERR(rng->path);
+
rng->hwrng.name = KBUILD_MODNAME,
rng->hwrng.init = msm_rng_init,
rng->hwrng.cleanup = msm_rng_cleanup,