@@ -619,7 +619,7 @@ static bool needs_entropy_delay_adjustment(void)
/* Probe routine for CAAM top (controller) level */
static int caam_probe(struct platform_device *pdev)
{
- int ret, ring, gen_sk, ent_delay = RTSDCTL_ENT_DLY_MIN;
+ int ret, ring, gen_sk;
u64 caam_id;
const struct soc_device_attribute *imx_soc_match;
struct device *dev;
@@ -627,7 +627,7 @@ static int caam_probe(struct platform_device *pdev)
struct caam_ctrl __iomem *ctrl;
struct caam_drv_private *ctrlpriv;
struct dentry *dfs_root;
- u32 scfgr, comp_params;
+ u32 scfgr, comp_params, ent_delay = RTSDCTL_ENT_DLY_MIN;
u8 rng_vid;
int pg_size;
int BLOCK_OFFSET = 0;
@@ -847,6 +847,16 @@ static int caam_probe(struct platform_device *pdev)
(rd_reg32(&ctrl->vreg.aesa) & CHA_VER_MISC_AES_NUM_MASK);
}
+ /*
+ * 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
@@ -875,8 +885,6 @@ static int caam_probe(struct platform_device *pdev)
* 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",