diff options
author | Vabhav Sharma <vabhav.sharma@nxp.com> | 2022-03-17 17:14:59 +0530 |
---|---|---|
committer | Vabhav Sharma <vabhav.sharma@oss.nxp.com> | 2022-05-31 05:58:56 +0530 |
commit | 56656b65c54e2e260eddca3e9a1eadbade881a19 (patch) | |
tree | e0e27f5722425f123be19badfffab862974504d6 /drivers | |
parent | 75f9a0f0df601328736ce05cd5e29a16a3fd7bed (diff) |
LF-6118-3: crypto: caam: read entropy delay from device tree
Read entropy-delay property from device tree for
TRNG configuration.
update the value if entry is missing in DT.
Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 38c14fc2d9f0..d6c43fb906f7 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -623,7 +623,8 @@ static int caam_ctrl_rng_init(struct device *dev) { struct caam_drv_private *ctrlpriv = dev_get_drvdata(dev); struct caam_ctrl __iomem *ctrl = ctrlpriv->ctrl; - int ret, gen_sk, ent_delay = RTSDCTL_ENT_DLY_MIN; + int ret, gen_sk; + u32 ent_delay = RTSDCTL_ENT_DLY_MIN; u8 rng_vid; if (ctrlpriv->era < 10) { @@ -647,6 +648,16 @@ static int caam_ctrl_rng_init(struct device *dev) } /* + * Read entropy-delay property from device tree. If property is not + * available or missing, update the entropy delay value only for imx6sx. + */ + if (device_property_read_u32(dev, "entropy-delay", &ent_delay)) { + dev_dbg(dev, "entropy-delay property missing in DT\n"); + if (needs_entropy_delay_adjustment()) + ent_delay = 12000; + } + + /* * If SEC has RNG version >= 4 and RNG state handle has not been * already instantiated, do RNG instantiation * In case of SoCs with Management Complex, RNG is managed by MC f/w. @@ -673,8 +684,6 @@ 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", |