crypto: caam - set RDB bit in security configuration register
authorVakul Garg <vakul@freescale.com>
Tue, 12 Mar 2013 08:25:21 +0000 (13:55 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Mar 2013 10:13:54 +0000 (18:13 +0800)
This change is required for post SEC-5.0 devices which have RNG4.
Setting RDB in security configuration register allows CAAM to use the
"Random Data Buffer" to be filled by a single request. The Random Data
Buffer is large enough for ten packets to get their IVs from a single
request. If the Random Data Buffer is not enabled, then each IV causes a
separate request, and RNG4 hardware cannot keep up resulting in lower
IPSEC throughput if random IVs are used.

Signed-off-by: Vakul Garg <vakul@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/ctrl.c
drivers/crypto/caam/regs.h

index 1c56f63524f27b2139860518f3ee672fdeef07cb..19faea2c31d17f960218eaa0b386d131aa8f57a8 100644 (file)
@@ -304,6 +304,9 @@ static int caam_probe(struct platform_device *pdev)
                        caam_remove(pdev);
                        return ret;
                }
+
+               /* Enable RDB bit so that RNG works faster */
+               setbits32(&topregs->ctrl.scfgr, SCFGR_RDBENABLE);
        }
 
        /* NOTE: RTIC detection ought to go here, around Si time */
index 3223fc6d647cd55c0367b5ee1f6b003bc8029080..cd6fedad9935983191217f227b11fa496dccc715 100644 (file)
@@ -252,7 +252,8 @@ struct caam_ctrl {
        /* Read/Writable                                                */
        u32 rsvd1;
        u32 mcr;                /* MCFG      Master Config Register  */
-       u32 rsvd2[2];
+       u32 rsvd2;
+       u32 scfgr;              /* SCFGR, Security Config Register */
 
        /* Bus Access Configuration Section                     010-11f */
        /* Read/Writable                                                */
@@ -299,6 +300,7 @@ struct caam_ctrl {
 #define MCFGR_WDFAIL           0x20000000 /* DECO watchdog force-fail */
 #define MCFGR_DMA_RESET                0x10000000
 #define MCFGR_LONG_PTR         0x00010000 /* Use >32-bit desc addressing */
+#define SCFGR_RDBENABLE                0x00000400
 
 /* AXI read cache control */
 #define MCFGR_ARCACHE_SHIFT    12