]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
drivers/crypto/fsl: disable RNG oscillator maximum frequency check
authorAlex Porosanu <alexandru.porosanu@freescale.com>
Tue, 5 May 2015 13:48:33 +0000 (16:48 +0300)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 06:00:47 +0000 (08:00 +0200)
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>
Acked-by: Ruchika Gupta<ruchika.gupta@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
drivers/crypto/fsl/jr.c
include/fsl_sec.h

index f99d59480c816869cde1046e800b6e524f554ae3..aa527ec954dc27cdf4e33126d9d9c9edd804cfb0 100644 (file)
@@ -406,8 +406,8 @@ static void kick_trng(int ent_delay)
        sec_out32(&rng->rtsdctl, val);
        /* min. freq. count, equal to 1/4 of the entropy sample length */
        sec_out32(&rng->rtfreqmin, ent_delay >> 2);
-       /* max. freq. count, equal to 8 times the entropy sample length */
-       sec_out32(&rng->rtfreqmax, ent_delay << 3);
+       /* disable maximum frequency count */
+       sec_out32(&rng->rtfreqmax, RTFRQMAX_DISABLE);
        /* put RNG4 into run mode */
        sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);
 }
index 89d1fc485419e047604ae7a2a46e10b60881c1e7..6ad5262b278acc820642110ec4975ee955ccf101 100644 (file)
@@ -49,6 +49,7 @@ struct rng4tst {
                u32 rttotsam;   /* PRGM=0: total samples register */
        };
        u32 rtfreqmin;          /* frequency count min. limit register */
+#define RTFRQMAX_DISABLE       (1 << 20)
        union {
                u32 rtfreqmax;  /* PRGM=1: freq. count max. limit register */
                u32 rtfreqcnt;  /* PRGM=0: freq. count register */