crypto: mv_cesa - use gen_pool to reserve the SRAM memory region
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Thu, 18 Jun 2015 13:46:18 +0000 (15:46 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 19 Jun 2015 14:18:02 +0000 (22:18 +0800)
The mv_cesa driver currently expects the SRAM memory region to be passed
as a platform device resource.

This approach implies two drawbacks:
- the DT representation is wrong
- the only one that can access the SRAM is the crypto engine

The last point is particularly annoying in some cases: for example on
armada 370, a small region of the crypto SRAM is used to implement the
cpuidle, which means you would not be able to enable both cpuidle and the
CESA driver.

To address that problem, we explicitly define the SRAM device in the DT
and then reference the sram node from the crypto engine node.

Also note that the old way of retrieving the SRAM memory region is still
supported, or in other words, backward compatibility is preserved.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Documentation/devicetree/bindings/crypto/mv_cesa.txt
drivers/crypto/Kconfig
drivers/crypto/mv_cesa.c

index eaa2873..13b8fc5 100644 (file)
@@ -2,21 +2,29 @@ Marvell Cryptographic Engines And Security Accelerator
 
 Required properties:
 - compatible : should be "marvell,orion-crypto"
-- reg : base physical address of the engine and length of memory mapped
-        region, followed by base physical address of sram and its memory
-        length
-- reg-names : "regs" , "sram";
-- interrupts : interrupt number
+- reg: base physical address of the engine and length of memory mapped
+       region. Can also contain an entry for the SRAM attached to the CESA,
+       but this representation is deprecated and marvell,crypto-srams should
+       be used instead
+- reg-names: "regs". Can contain an "sram" entry, but this representation
+            is deprecated and marvell,crypto-srams should be used instead
+- interrupts: interrupt number
 - clocks: reference to the crypto engines clocks. This property is only
          required for Dove platforms
+- marvell,crypto-srams: phandle to crypto SRAM definitions
+
+Optional properties:
+- marvell,crypto-sram-size: SRAM size reserved for crypto operations, if not
+                           specified the whole SRAM is used (2KB)
 
 Examples:
 
        crypto@30000 {
                compatible = "marvell,orion-crypto";
-               reg = <0x30000 0x10000>,
-                     <0x4000000 0x800>;
-               reg-names = "regs" , "sram";
+               reg = <0x30000 0x10000>;
+               reg-names = "regs";
                interrupts = <22>;
+               marvell,crypto-srams = <&crypto_sram>;
+               marvell,crypto-sram-size = <0x600>;
                status = "okay";
        };
Simple merge
Simple merge