Skip to contentSkip to conversation

crypto: at91/atmel: add Device Tree support

PATCH RESEND In review Nicolas Ferre 2 participants 10 messages Nov 8, 2013 – Nov 20, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover crypto: at91/atmel: add Device Tree support

This series adds Device Tree support to the Atmel crypto drivers (AES/[T]DES/SHA). The Device Tree entries are very simple and only declare the reg/irq values and the link to DMA.

Some trivial patches are preceding this move to Device Tree to clean things up beforehand.

The series has already been sent but a little bit scattered. So I collect everything, this time.

Nicolas Ferre (7):
ARM: at91/dt/trivial: use macro for AES irq type
ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix
ARM: at91/dt/sama5d3: add DMA information to SHA/AES/TDES nodes
crypto: atmel-aes - add support for Device Tree
crypto: atmel-tdes - add support for Device Tree
crypto: atmel-sha - add support for Device Tree
crypto: atmel-sha - add sha information to the log

 .../devicetree/bindings/crypto/atmel-crypto.txt    |  68 ++++++++++
 arch/arm/boot/dts/sama5d3.dtsi                     |  16 ++-
 drivers/crypto/atmel-aes.c                         | 143 ++++++++++++++-------
 drivers/crypto/atmel-sha.c                         | 103 +++++++++++----
 drivers/crypto/atmel-tdes.c                        | 143 ++++++++++++++-------
 5 files changed, 346 insertions(+), 127 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt
Signature · 1 line
1.8.2.2
#1 lore raw

PATCH RESEND 1/7 ARM: at91/dt/trivial: use macro for AES irq type

---
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d3.dtsi +1 -1
index b7f4961..fca56c7 100644
@@ -359,7 +359,7 @@
 			aes at f8038000 {
 				compatible = "atmel,sam9g46-aes";
 				reg = <0xf8038000 0x100>;
-				interrupts = <43 4 0>;
+				interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
 			};
 
 			tdes at f803c000 {
Signature · 1 line
1.8.2.2
#2 lore raw

PATCH RESEND 2/7 ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix

In reply to Nicolas Ferre

Change the sha/aes/tdes compatibility string to match common case for the at91sam9g45 family which is to keep the at91 prefix.

---
 arch/arm/boot/dts/sama5d3.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sama5d3.dtsi +3 -3
index fca56c7..8716fc2 100644
@@ -351,19 +351,19 @@
 			};
 
 			sha at f8034000 {
-				compatible = "atmel,sam9g46-sha";
+				compatible = "atmel,at91sam9g46-sha";
 				reg = <0xf8034000 0x100>;
 				interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
 			};
 
 			aes at f8038000 {
-				compatible = "atmel,sam9g46-aes";
+				compatible = "atmel,at91sam9g46-aes";
 				reg = <0xf8038000 0x100>;
 				interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
 			};
 
 			tdes at f803c000 {
-				compatible = "atmel,sam9g46-tdes";
+				compatible = "atmel,at91sam9g46-tdes";
 				reg = <0xf803c000 0x100>;
 				interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
 			};
Signature · 1 line
1.8.2.2
#3 lore raw

PATCH RESEND 3/7 ARM: at91/dt/sama5d3: add DMA information to SHA/AES/TDES nodes

In reply to Nicolas Ferre
---
 arch/arm/boot/dts/sama5d3.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/sama5d3.dtsi +8 -0
index 8716fc2..56c3b01 100644
@@ -354,18 +354,26 @@
 				compatible = "atmel,at91sam9g46-sha";
 				reg = <0xf8034000 0x100>;
 				interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
+				dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(17)>;
+				dma-names = "tx";
 			};
 
 			aes at f8038000 {
 				compatible = "atmel,at91sam9g46-aes";
 				reg = <0xf8038000 0x100>;
 				interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
+				dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(18)>,
+				       <&dma1 2 AT91_DMA_CFG_PER_ID(19)>;
+				dma-names = "tx", "rx";
 			};
 
 			tdes at f803c000 {
 				compatible = "atmel,at91sam9g46-tdes";
 				reg = <0xf803c000 0x100>;
 				interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
+				dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(20)>,
+				       <&dma1 2 AT91_DMA_CFG_PER_ID(21)>;
+				dma-names = "tx", "rx";
 			};
 
 			dma0: dma-controller at ffffe600 {
Signature · 1 line
1.8.2.2
#4 lore raw

PATCH RESEND 4/7 crypto: atmel-aes - add support for Device Tree

In reply to Nicolas Ferre

Add support for Device Tree and use of the DMA DT API to get the needed channels.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

---
 .../devicetree/bindings/crypto/atmel-crypto.txt    |  23 ++++
 drivers/crypto/atmel-aes.c                         | 143 ++++++++++++++-------
 2 files changed, 117 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt
Documentation/devicetree/bindings/crypto/atmel-crypto.txt new file +23 -0
new file mode 100644
index 0000000..d273f0b
@@ -0,0 +1,23 @@
+* Atmel HW cryptographic accelerators
+
+These are the HW cryptographic accelerators found on some Atmel products.
+
+* Advanced Encryption Standard (AES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-aes".
+- reg: Should contain AES registers location and length.
+- interrupts: Should contain the IRQ line for the AES.
+- dmas: List of two DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property.
+
+Example:
+aes at f8038000 {
+	compatible = "atmel,at91sam9g46-aes";
+	reg = <0xf8038000 0x100>;
+	interrupts = <43 4 0>;
+	dmas = <&dma1 2 18>,
+	       <&dma1 2 19>;
+	dma-names = "tx", "rx";
drivers/crypto/atmel-aes.c +94 -49

190 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#5 lore raw

PATCH RESEND 5/7 crypto: atmel-tdes - add support for Device Tree

In reply to Nicolas Ferre

Add support for Device Tree and use of the DMA DT API to get the channels if needed.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

---
 .../devicetree/bindings/crypto/atmel-crypto.txt    |  23 ++++
 drivers/crypto/atmel-tdes.c                        | 143 ++++++++++++++-------
 2 files changed, 117 insertions(+), 49 deletions(-)
Documentation/devicetree/bindings/crypto/atmel-crypto.txt +23 -0
index d273f0b..9a24fd9 100644
@@ -21,3 +21,26 @@ aes at f8038000 {
 	dmas = <&dma1 2 18>,
 	       <&dma1 2 19>;
 	dma-names = "tx", "rx";
+
+* Triple Data Encryption Standard (Triple DES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-tdes".
+- reg: Should contain TDES registers location and length.
+- interrupts: Should contain the IRQ line for the TDES.
+
+Optional properties:
+- dmas: List of two DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property.
+
+Example:
+tdes at f803c000 {
+	compatible = "atmel,at91sam9g46-tdes";
+	reg = <0xf803c000 0x100>;
+	interrupts = <44 4 0>;
+	dmas = <&dma1 2 20>,
+	       <&dma1 2 21>;
+	dma-names = "tx", "rx";
+};
drivers/crypto/atmel-tdes.c +94 -49

184 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#6 lore raw

PATCH RESEND 6/7 crypto: atmel-sha - add support for Device Tree

In reply to Nicolas Ferre

Add support for Device Tree and use of the DMA DT API to get the channels if needed.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

---
 .../devicetree/bindings/crypto/atmel-crypto.txt    | 22 +++++
 drivers/crypto/atmel-sha.c                         | 99 ++++++++++++++++------
 2 files changed, 97 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/crypto/atmel-crypto.txt +22 -0
index 9a24fd9..f2aab3d 100644
@@ -44,3 +44,25 @@ tdes at f803c000 {
 	       <&dma1 2 21>;
 	dma-names = "tx", "rx";
 };
+
+* Secure Hash Algorithm (SHA)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-sha".
+- reg: Should contain SHA registers location and length.
+- interrupts: Should contain the IRQ line for the SHA.
+
+Optional properties:
+- dmas: One DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property. Only one "tx" string needed.
+
+Example:
+sha at f8034000 {
+	compatible = "atmel,at91sam9g46-sha";
+	reg = <0xf8034000 0x100>;
+	interrupts = <42 4 0>;
+	dmas = <&dma1 2 17>;
+	dma-names = "tx";
+};
drivers/crypto/atmel-sha.c +75 -24

138 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#7 lore raw

PATCH RESEND 7/7 crypto: atmel-sha - add sha information to the log

In reply to Nicolas Ferre

Depending on peripheral capabilities, print SHA information at the end of the probe function.

---
 drivers/crypto/atmel-sha.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/atmel-sha.c +3 -1
index ecfdf72..0618be0 100644
@@ -1469,7 +1469,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
 	if (err)
 		goto err_algs;
 
-	dev_info(dev, "Atmel SHA1/SHA256\n");
+	dev_info(dev, "Atmel SHA1/SHA256%s%s\n",
+			sha_dd->caps.has_sha224 ? "/SHA224" : "",
+			sha_dd->caps.has_sha_384_512 ? "/SHA384/SHA512" : "");
 
 	return 0;
 
Signature · 1 line
1.8.2.2
#8 lore raw
In reply to Nicolas Ferre

On 08/11/2013 16:08, Nicolas Ferre :

Quoted 3 lines

This series adds Device Tree support to the Atmel crypto drivers (AES/[T]DES/SHA). The Device Tree entries are very simple and only declare the reg/irq values and the link to DMA.

Herbert,

ping?

Could I have your "Acked-by" for taking these patches through the arm-soc git tree, or do you want that we split this series so that you can take the driver part of it?

Best regards,

Quoted 23 lines

Some trivial patches are preceding this move to Device Tree to clean things up beforehand.

The series has already been sent but a little bit scattered. So I collect everything, this time.

Nicolas Ferre (7):
ARM: at91/dt/trivial: use macro for AES irq type
ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix
ARM: at91/dt/sama5d3: add DMA information to SHA/AES/TDES nodes
crypto: atmel-aes - add support for Device Tree
crypto: atmel-tdes - add support for Device Tree
crypto: atmel-sha - add support for Device Tree
crypto: atmel-sha - add sha information to the log

  .../devicetree/bindings/crypto/atmel-crypto.txt    |  68 ++++++++++
  arch/arm/boot/dts/sama5d3.dtsi                     |  16 ++-
  drivers/crypto/atmel-aes.c                         | 143 ++++++++++++++-------
  drivers/crypto/atmel-sha.c                         | 103 +++++++++++----
  drivers/crypto/atmel-tdes.c                        | 143 ++++++++++++++-------
  5 files changed, 346 insertions(+), 127 deletions(-)

create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt

Signature · 1 line
Nicolas Ferre
Acked-by
#9 lore raw
Quoted 5 lines · Nicolas Ferre

On 08/11/2013 16:08, Nicolas Ferre :

Quoted 3 lines

This series adds Device Tree support to the Atmel crypto drivers (AES/[T]DES/SHA). The Device Tree entries are very simple and only declare the reg/irq values and the link to DMA.

Quoted 7 lines

Herbert,

ping?

Could I have your "Acked-by" for taking these patches through the arm-soc git tree, or do you want that we split this series so that you can take the driver part of it?

Sure please push them through the arm-soc tree.

You can add my ack:

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt