aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorAlex Porosanu <alexandru.porosanu@freescale.com>2014-08-11 04:40:15 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-08-25 08:32:34 -0400
commitb061f3fefcffa0cdcdc61ae2a1123a4e7697d452 (patch)
tree393357cc5eff36832f90dd9ae5a5d9f996307816 /drivers/crypto
parentd4c85f9bb53f25491524839ab1610b30810ab898 (diff)
crypto: caam - disable RNG oscillator maximum frequency check
The rtfrqmax & rtfrqmin set the bounds of the expected frequency of the oscillator, when SEC runs at its maximum frequency. For certain platforms (f.i. T2080), the oscillator is very fast and thus if the SEC runs at a lower than normal frequency, the ring oscillator is incorrectly detected as being out of bounds. This patch effectively disables the maximum frequency check, by setting a high enough maximum allowable frequency for the oscillator. The reasoning behind this is that usually a broken oscillator will run too slow (i.e. not run at all) rather than run too fast. Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/caam/ctrl.c4
-rw-r--r--drivers/crypto/caam/regs.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 3cade79ea41e..8908d040b1f2 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -355,8 +355,8 @@ static void kick_trng(struct platform_device *pdev, int ent_delay)
355 wr_reg32(&r4tst->rtsdctl, val); 355 wr_reg32(&r4tst->rtsdctl, val);
356 /* min. freq. count, equal to 1/4 of the entropy sample length */ 356 /* min. freq. count, equal to 1/4 of the entropy sample length */
357 wr_reg32(&r4tst->rtfrqmin, ent_delay >> 2); 357 wr_reg32(&r4tst->rtfrqmin, ent_delay >> 2);
358 /* max. freq. count, equal to 8 times the entropy sample length */ 358 /* disable maximum frequency count */
359 wr_reg32(&r4tst->rtfrqmax, ent_delay << 3); 359 wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE);
360 /* put RNG4 into run mode */ 360 /* put RNG4 into run mode */
361 clrbits32(&r4tst->rtmctl, RTMCTL_PRGM); 361 clrbits32(&r4tst->rtmctl, RTMCTL_PRGM);
362} 362}
diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
index f48e344ffc39..b8bd980ac00a 100644
--- a/drivers/crypto/caam/regs.h
+++ b/drivers/crypto/caam/regs.h
@@ -286,6 +286,7 @@ struct rng4tst {
286 u32 rttotsam; /* PRGM=0: total samples register */ 286 u32 rttotsam; /* PRGM=0: total samples register */
287 }; 287 };
288 u32 rtfrqmin; /* frequency count min. limit register */ 288 u32 rtfrqmin; /* frequency count min. limit register */
289#define RTFRQMAX_DISABLE (1 << 20)
289 union { 290 union {
290 u32 rtfrqmax; /* PRGM=1: freq. count max. limit register */ 291 u32 rtfrqmax; /* PRGM=1: freq. count max. limit register */
291 u32 rtfrqcnt; /* PRGM=0: freq. count register */ 292 u32 rtfrqcnt; /* PRGM=0: freq. count register */