Commit ba3ab637 authored by Vinod Koul's avatar Vinod Koul Committed by Herbert Xu

crypto: qcom-rng - Add support for prng-ee

Qcom 8996 and later chips features multiple Execution Environments
(EE) and secure world is typically responsible for configuring the
prng.

Add driver data for qcom,prng as 0 and qcom,prng-ee as 1 and use
that to skip initialization routine.
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3be36ce1
...@@ -28,6 +28,7 @@ struct qcom_rng { ...@@ -28,6 +28,7 @@ struct qcom_rng {
struct mutex lock; struct mutex lock;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
unsigned int skip_init;
}; };
struct qcom_rng_ctx { struct qcom_rng_ctx {
...@@ -128,7 +129,10 @@ static int qcom_rng_init(struct crypto_tfm *tfm) ...@@ -128,7 +129,10 @@ static int qcom_rng_init(struct crypto_tfm *tfm)
ctx->rng = qcom_rng_dev; ctx->rng = qcom_rng_dev;
return qcom_rng_enable(ctx->rng); if (!ctx->rng->skip_init)
return qcom_rng_enable(ctx->rng);
return 0;
} }
static struct rng_alg qcom_rng_alg = { static struct rng_alg qcom_rng_alg = {
...@@ -168,6 +172,8 @@ static int qcom_rng_probe(struct platform_device *pdev) ...@@ -168,6 +172,8 @@ static int qcom_rng_probe(struct platform_device *pdev)
if (IS_ERR(rng->clk)) if (IS_ERR(rng->clk))
return PTR_ERR(rng->clk); return PTR_ERR(rng->clk);
rng->skip_init = (unsigned long)device_get_match_data(&pdev->dev);
qcom_rng_dev = rng; qcom_rng_dev = rng;
ret = crypto_register_rng(&qcom_rng_alg); ret = crypto_register_rng(&qcom_rng_alg);
if (ret) { if (ret) {
...@@ -188,7 +194,8 @@ static int qcom_rng_remove(struct platform_device *pdev) ...@@ -188,7 +194,8 @@ static int qcom_rng_remove(struct platform_device *pdev)
} }
static const struct of_device_id qcom_rng_of_match[] = { static const struct of_device_id qcom_rng_of_match[] = {
{ .compatible = "qcom,prng" }, { .compatible = "qcom,prng", .data = (void *)0},
{ .compatible = "qcom,prng-ee", .data = (void *)1},
{} {}
}; };
MODULE_DEVICE_TABLE(of, qcom_rng_of_match); MODULE_DEVICE_TABLE(of, qcom_rng_of_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment