MLK-17909 RNG Instantation done in Secure Firmware
authorCedric Neveux <cedric.neveux@nxp.com>
Tue, 17 Apr 2018 16:04:39 +0000 (18:04 +0200)
committerAymen Sghaier <aymen.sghaier@nxp.com>
Mon, 30 Apr 2018 14:41:31 +0000 (16:41 +0200)
   - 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 <silvano.dininno@nxp.com>
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
(cherry picked from commit 2b9489d18b6eca5b1f72689602f0eed16e88db84)

drivers/crypto/caam/inst_rng.c

index dff8178..64c3826 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * CAAM RNG instantiation driver backend
  *
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
  */
 
 #include <linux/device.h>
@@ -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