aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam/ctrl.c
diff options
context:
space:
mode:
authorRuchika Gupta <ruchika.gupta@freescale.com>2013-04-26 06:14:54 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-05-13 22:14:51 -0400
commit986dfbcf8b493928188f0e634068993bf2067ad7 (patch)
treec9d23460896b7d75658c901465029c26eb818a6f /drivers/crypto/caam/ctrl.c
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
crypto: caam - FIX RNG init for RNG greater than equal to 4
For SEC including a RNG block version >= 4, special initialization must occur before any descriptor that uses RNG block can be submitted. This initialization is required not only for SEC with version greater than 5.0, but for SEC with RNG version >=4. There may be a case where RNG has already been instantiated by u-boot or boot ROM code.In such SoCs, if RNG is initialized again SEC would returns "Instantiation error". Hence, the initialization status of RNG4 should be also checked before doing RNG init. Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com> Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com> Reviewed-by: Vakul Garg <vakul@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam/ctrl.c')
-rw-r--r--drivers/crypto/caam/ctrl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 6e94bcd94678..f5d6deced1cb 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -202,6 +202,7 @@ static int caam_probe(struct platform_device *pdev)
202#ifdef CONFIG_DEBUG_FS 202#ifdef CONFIG_DEBUG_FS
203 struct caam_perfmon *perfmon; 203 struct caam_perfmon *perfmon;
204#endif 204#endif
205 u64 cha_vid;
205 206
206 ctrlpriv = kzalloc(sizeof(struct caam_drv_private), GFP_KERNEL); 207 ctrlpriv = kzalloc(sizeof(struct caam_drv_private), GFP_KERNEL);
207 if (!ctrlpriv) 208 if (!ctrlpriv)
@@ -293,11 +294,14 @@ static int caam_probe(struct platform_device *pdev)
293 return -ENOMEM; 294 return -ENOMEM;
294 } 295 }
295 296
297 cha_vid = rd_reg64(&topregs->ctrl.perfmon.cha_id);
298
296 /* 299 /*
297 * RNG4 based SECs (v5+) need special initialization prior 300 * If SEC has RNG version >= 4 and RNG state handle has not been
298 * to executing any descriptors 301 * already instantiated ,do RNG instantiation
299 */ 302 */
300 if (of_device_is_compatible(nprop, "fsl,sec-v5.0")) { 303 if ((cha_vid & CHA_ID_RNG_MASK) >> CHA_ID_RNG_SHIFT >= 4 &&
304 !(rd_reg32(&topregs->ctrl.r4tst[0].rdsta) & RDSTA_IF0)) {
301 kick_trng(pdev); 305 kick_trng(pdev);
302 ret = instantiate_rng(ctrlpriv->jrdev[0]); 306 ret = instantiate_rng(ctrlpriv->jrdev[0]);
303 if (ret) { 307 if (ret) {