2012-09-17 23:24:20

by Kim Phillips

[permalink] [raw]
Subject: [PATCH] crypto: caam - increase TRNG clocks per sample

we need to configure the TRNG to use more clocks per sample
to handle the two back-to-back 64KiB random descriptor requests
on higher frequency P5040s.

Signed-off-by: Kim Phillips <[email protected]>
---
fixes booting on the p5040, but since p5040 support isn't in
3.6, this can wait for 3.7.

Also, Herbert, this:

http://www.mail-archive.com/[email protected]/msg07586.html

got dropped on the floor.

drivers/crypto/caam/ctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 414ba20..bf20dd8 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -129,7 +129,7 @@ static int instantiate_rng(struct device *jrdev)

/*
* By default, the TRNG runs for 200 clocks per sample;
- * 800 clocks per sample generates better entropy.
+ * 1600 clocks per sample generates better entropy.
*/
static void kick_trng(struct platform_device *pdev)
{
@@ -144,9 +144,9 @@ static void kick_trng(struct platform_device *pdev)

/* put RNG4 into program mode */
setbits32(&r4tst->rtmctl, RTMCTL_PRGM);
- /* 800 clocks per sample */
+ /* 1600 clocks per sample */
val = rd_reg32(&r4tst->rtsdctl);
- val = (val & ~RTSDCTL_ENT_DLY_MASK) | (800 << RTSDCTL_ENT_DLY_SHIFT);
+ val = (val & ~RTSDCTL_ENT_DLY_MASK) | (1600 << RTSDCTL_ENT_DLY_SHIFT);
wr_reg32(&r4tst->rtsdctl, val);
/* min. freq. count */
wr_reg32(&r4tst->rtfrqmin, 400);
--
1.7.12


2012-09-27 05:44:40

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: caam - increase TRNG clocks per sample

On Mon, Sep 17, 2012 at 06:21:55PM -0500, Kim Phillips wrote:
> we need to configure the TRNG to use more clocks per sample
> to handle the two back-to-back 64KiB random descriptor requests
> on higher frequency P5040s.
>
> Signed-off-by: Kim Phillips <[email protected]>

Patch applied. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt