From 5e23f9d6114784d77fd4ed5848953356c3575532 Mon Sep 17 00:00:00 2001 From: Cedric Neveux Date: Tue, 17 Apr 2018 18:04:39 +0200 Subject: [PATCH] MLK-17909 RNG Instantation done in Secure Firmware - For i.MX 6 and 7 check if the Secure Firmware (OPTEE) is present. If present don't do the RNG instantation in the CAAM driver Reviewed-by: Silvano Di Ninno Signed-off-by: Cedric Neveux (cherry picked from commit 2b9489d18b6eca5b1f72689602f0eed16e88db84) --- drivers/crypto/caam/inst_rng.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/inst_rng.c b/drivers/crypto/caam/inst_rng.c index dff81786ceef..64c382604cc8 100644 --- a/drivers/crypto/caam/inst_rng.c +++ b/drivers/crypto/caam/inst_rng.c @@ -1,7 +1,7 @@ /* * CAAM RNG instantiation driver backend * - * Copyright 2017 NXP + * Copyright 2017-2018 NXP */ #include @@ -286,6 +286,17 @@ int inst_rng_imx6(struct platform_device *pdev) ctrlpriv = dev_get_drvdata(ctrldev); ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl; +#ifndef CONFIG_ARM64 + /* + * Check if the Secure Firmware is running, + * check only for i.MX6 and i.MX7 + */ + if (of_find_compatible_node(NULL, NULL, "linaro,optee-tz")) { + pr_info("RNG Instantation done by Secure Firmware\n"); + return ret; + } +#endif + cha_vid_ls = rd_reg32(&ctrl->perfmon.cha_id_ls); /* * If SEC has RNG version >= 4 and RNG state handle has not been -- 2.17.1