summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam/ctrl.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-08-05 15:55:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-08-06 09:18:40 +0200
commit655e085e3a22d52eb040e7c3bbd2fa1cb6c249c1 (patch)
tree0e8d7ea1e317894e8432c6a665650c36dd39fc4b /drivers/crypto/caam/ctrl.c
parentd31741518a19bcc91084fd29a5dd3d07a2156089 (diff)
downloadbarebox-655e085e3a22d52eb040e7c3bbd2fa1cb6c249c1.tar.gz
barebox-655e085e3a22d52eb040e7c3bbd2fa1cb6c249c1.tar.xz
crypto: caam - Always do rng selftest
The caam rng selftest is known to be broken in several i.MX incarnations. To be on the safe side just unconditionally execute it rather than trying to guess from HAB failure events if this is necessary. We can only do the selftest once per boot though, doing it a second time yields an error: rng_self_test: Job Error: 2101000.jr0@1000.of: 20001953: CCB: desc idx 25: RNG: Instantiate so only do the test when rng is not yet initialized as tested with the RDSTA_IFx status bits. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/crypto/caam/ctrl.c')
-rw-r--r--drivers/crypto/caam/ctrl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 06b075e74a..afa3b38a35 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -572,8 +572,12 @@ static int caam_probe(struct device_d *dev)
cha_vid_ls = rd_reg32(&ctrl->perfmon.cha_id_ls);
- /* habv4_need_rng_software_self_test is determined by habv4_get_status() */
- if (caam_need_rng_software_selftest()) {
+ /*
+ * Only do the rng self test when the state handles are not yet
+ * instantiated as indicated by the RDSTA_IF1 and RDSTA_IF2 flags.
+ * Otherwise the self test fails.
+ */
+ if (!(rd_reg32(&ctrl->r4tst[0].rdsta) & RDSTA_IFMASK)) {
u8 caam_era;
u8 rngvid;
u8 rngrev;