Fix commit 3df7e5f2ccb8 merge conflict, refer to
commit c013f7d1cd92 ("crypto: CAAM - fix i.mx6sx
entry delay value"), needs_ entropy_ delay_ Adjustment
function is referenced for this reason.

Signed-off-by: Xiaolei Wang <[email protected]>
---
 drivers/crypto/caam/ctrl.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 679e182c3520..0d8c96d29299 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -612,6 +612,13 @@ static void caam_dma_dev_unregister(void *data)
        platform_device_unregister(data);
 }
 
+static bool needs_entropy_delay_adjustment(void)
+{
+        if (of_machine_is_compatible("fsl,imx6sx"))
+                return true;
+        return false;
+}
+
 static int caam_ctrl_rng_init(struct device *dev)
 {
        struct caam_drv_private *ctrlpriv = dev_get_drvdata(dev);
@@ -666,6 +673,8 @@ static int caam_ctrl_rng_init(struct device *dev)
                         * Also, if a handle was instantiated, do not change
                         * the TRNG parameters.
                         */
+                       if (needs_entropy_delay_adjustment())
+                               ent_delay = 12000;
                        if (!(ctrlpriv->rng4_sh_init || inst_handles)) {
                                dev_info(dev,
                                         "Entropy delay = %u\n",
@@ -682,6 +691,15 @@ static int caam_ctrl_rng_init(struct device *dev)
                         */
                        ret = instantiate_rng(dev, inst_handles,
                                              gen_sk);
+                       /*
+                         * Entropy delay is determined via TRNG 
characterization.
+                         * TRNG characterization is run across different 
voltages
+                         * and temperatures.
+                         * If worst case value for ent_dly is identified,
+                         * the loop can be skipped for that platform.
+                         */
+                        if (needs_entropy_delay_adjustment())
+                                break;
                        if (ret == -EAGAIN)
                                /*
                                 * if here, the loop will rerun,
@@ -835,13 +853,6 @@ static bool check_version(struct fsl_mc_version 
*mc_version, u32 major,
 }
 #endif
 
-static bool needs_entropy_delay_adjustment(void)
-{
-       if (of_machine_is_compatible("fsl,imx6sx"))
-               return true;
-       return false;
-}
-
 /* Probe routine for CAAM top (controller) level */
 static int caam_probe(struct platform_device *pdev)
 {
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#11438): 
https://lists.yoctoproject.org/g/linux-yocto/message/11438
Mute This Topic: https://lists.yoctoproject.org/mt/92220186/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to