Skip to contentSkip to conversation

crypto: sahara: Add support for SAHARA in i.MX27.

PATCH Superseded Javier Martin 4 participants 10 messages Feb 27, 2013 – Mar 1, 2013

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover crypto: sahara: Add support for SAHARA in i.MX27.

Hi,
this v2 of the series solves several issues pointed out by Arnd Bergmann and Arnaud Patard.

Moreover, it drops platform support and relies only on device tree (compile tested only).

[PATCH v2 1/3] i.MX27: Add clock support for SAHARA2. [PATCH v2 2/3] crypto: sahara: Add driver for SAHARA2 accelerator. [PATCH v2 3/3] crypto: sahara: Add device tree binding for SAHARA2.

#1 lore raw

PATCH v2 1/3 i.MX27: Add clock support for SAHARA2.

---
 arch/arm/mach-imx/clk-imx27.c |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/clk-imx27.c +2 -0
index 4c1d1e4..0b9664a 100644
@@ -253,6 +253,8 @@ int __init mx27_clocks_init(unsigned long fref)
 	clk_register_clkdev(clk[nfc_baud_gate], NULL, "imx27-nand.0");
 	clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0");
 	clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0");
+	clk_register_clkdev(clk[sahara_ahb_gate], "ahb", "sahara-imx27.0");
+	clk_register_clkdev(clk[sahara_ipg_gate], "ipg", "sahara-imx27.0");
 	clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx27-dma");
 	clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx27-dma");
 	clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0");
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/3 crypto: sahara: Add driver for SAHARA2 accelerator.

In reply to Javier Martin

SAHARA2 HW module is included in the i.MX27 SoC from Freescale. It is capable of performing cipher algorithms such as AES, 3DES..., hashing and RNG too.

This driver provides support for AES-CBC and AES-ECB by now.

---
 drivers/crypto/Kconfig  |   10 +
 drivers/crypto/Makefile |    1 +
 drivers/crypto/sahara.c | 1070 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1081 insertions(+)
 create mode 100644 drivers/crypto/sahara.c
drivers/crypto/Kconfig +10 -0
index 87ec4d0..7d73f5a 100644
@@ -276,6 +276,16 @@ config CRYPTO_DEV_PICOXCELL
 
 	  Saying m here will build a module named pipcoxcell_crypto.
 
+config CRYPTO_DEV_SAHARA
+	tristate "Support for SAHARA crypto accelerator"
+	depends on MACH_MX27 && EXPERIMENTAL && OF
+	select CRYPTO_BLKCIPHER
+	select CRYPTO_AES
+	select CRYPTO_ECB
+	help
+	  This option enables support for the SAHARA HW crypto accelerator
+	  found in some Freescale i.MX chips.
+
 config CRYPTO_DEV_S5P
 	tristate "Support for Samsung S5PV210 crypto accelerator"
 	depends on ARCH_S5PV210
drivers/crypto/Makefile +1 -0
index 880a47b..38ce13d 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/
 obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o
 obj-$(CONFIG_CRYPTO_DEV_OMAP_AES) += omap-aes.o
 obj-$(CONFIG_CRYPTO_DEV_PICOXCELL) += picoxcell_crypto.o
+obj-$(CONFIG_CRYPTO_DEV_SAHARA) += sahara.o
 obj-$(CONFIG_CRYPTO_DEV_S5P) += s5p-sss.o
 obj-$(CONFIG_CRYPTO_DEV_TEGRA_AES) += tegra-aes.o
 obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
drivers/crypto/sahara.c new file +1070 -0

1,070 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v2 2/3 crypto: sahara: Add driver for SAHARA2 accelerator.

Quoted 8 lines · On Wednesday 27 February 2013 11:41:50 Javier Martin wrote:

SAHARA2 HW module is included in the i.MX27 SoC from Freescale. It is capable of performing cipher algorithms such as AES, 3DES..., hashing and RNG too.

This driver provides support for AES-CBC and AES-ECB by now.

Looks good,

#4 lore raw

PATCH v2 2/3 crypto: sahara: Add driver for SAHARA2 accelerator.

In reply to Javier Martin

Javier Martin <[email protected]> writes:

Hi,

Quoted 3 lines

SAHARA2 HW module is included in the i.MX27 SoC from Freescale. It is capable of performing cipher algorithms such as AES, 3DES..., hashing and RNG too.

The rmmod oops is gone with this version, thanks.

Quoted 17 lines

This driver provides support for AES-CBC and AES-ECB by now.

---
 drivers/crypto/Kconfig  |   10 +
 drivers/crypto/Makefile |    1 +
 drivers/crypto/sahara.c | 1070 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1081 insertions(+)
 create mode 100644 drivers/crypto/sahara.c
drivers/crypto/Kconfig +0 -0
index 87ec4d0..7d73f5a 100644

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 281

Quoted 6 lines
drivers/crypto/Kconfig +3 -0
@@ -276,6 +276,16 @@ config CRYPTO_DEV_PICOXCELL
 
 	  Saying m here will build a module named pipcoxcell_crypto.
 
+config CRYPTO_DEV_SAHARA
+	tristate "Support for SAHARA crypto accelerator"
+	depends on MACH_MX27 && EXPERIMENTAL && OF

maybe switch to ARCH_MXC instead of MAC_MX27 ?

[...]

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 284

Quoted 3 lines
drivers/crypto/Kconfig +3 -0
+static struct platform_driver sahara_driver = {
+	.probe		= sahara_probe,
+	.remove		= __devexit_p(sahara_remove),

Please remove the __devexit_p too.

For information, you'll find below what I've changed to test the driver on my imx51. It's not perfect but it's enough for testing things.

Arnaud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imx51-sahara.patch
Type: text/x-diff
Size: 5482 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130228/ba3ba53a/attachment-0001.bin>

#5 lore raw

PATCH v2 2/3 crypto: sahara: Add driver for SAHARA2 accelerator.

Hi Arnaud,

Quoted 42 lines · Arnaud Patard

Javier Martin <[email protected]> writes:

Hi,

Quoted 3 lines

SAHARA2 HW module is included in the i.MX27 SoC from Freescale. It is capable of performing cipher algorithms such as AES, 3DES..., hashing and RNG too.

The rmmod oops is gone with this version, thanks.

Quoted 17 lines

This driver provides support for AES-CBC and AES-ECB by now.

---
 drivers/crypto/Kconfig  |   10 +
 drivers/crypto/Makefile |    1 +
 drivers/crypto/sahara.c | 1070 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1081 insertions(+)
 create mode 100644 drivers/crypto/sahara.c
drivers/crypto/Kconfig +0 -0
index 87ec4d0..7d73f5a 100644

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 281

Quoted 6 lines
drivers/crypto/Kconfig +3 -0
@@ -276,6 +276,16 @@ config CRYPTO_DEV_PICOXCELL
 
        Saying m here will build a module named pipcoxcell_crypto.
 
+config CRYPTO_DEV_SAHARA
+     tristate "Support for SAHARA crypto accelerator"
+     depends on MACH_MX27 && EXPERIMENTAL && OF

maybe switch to ARCH_MXC instead of MAC_MX27 ?

[...]

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 284

Quoted 3 lines
drivers/crypto/Kconfig +3 -0
+static struct platform_driver sahara_driver = {
+     .probe          = sahara_probe,
+     .remove         = __devexit_p(sahara_remove),
Quoted 7 lines

Please remove the __devexit_p too.

For information, you'll find below what I've changed to test the driver on my imx51. It's not perfect but it's enough for testing things.

Since I have to send v3 anyway to comply with Sascha's request maybe it would be worth to include your changes to provide support for i.mx51 too.

Regards.

Signature · 7 lines
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#6 lore raw

PATCH v2 2/3 crypto: sahara: Add driver for SAHARA2 accelerator.

javier Martin <[email protected]> writes:

Hi,

Quoted 48 lines

Hi Arnaud,

Quoted 45 lines · Arnaud Patard

Javier Martin <[email protected]> writes:

Hi,

Quoted 3 lines

SAHARA2 HW module is included in the i.MX27 SoC from Freescale. It is capable of performing cipher algorithms such as AES, 3DES..., hashing and RNG too.

The rmmod oops is gone with this version, thanks.

Quoted 17 lines

This driver provides support for AES-CBC and AES-ECB by now.

---
 drivers/crypto/Kconfig  |   10 +
 drivers/crypto/Makefile |    1 +
 drivers/crypto/sahara.c | 1070 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1081 insertions(+)
 create mode 100644 drivers/crypto/sahara.c
drivers/crypto/Kconfig +0 -0
index 87ec4d0..7d73f5a 100644

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 281

Quoted 6 lines
drivers/crypto/Kconfig +3 -0
@@ -276,6 +276,16 @@ config CRYPTO_DEV_PICOXCELL
 
        Saying m here will build a module named pipcoxcell_crypto.
 
+config CRYPTO_DEV_SAHARA
+     tristate "Support for SAHARA crypto accelerator"
+     depends on MACH_MX27 && EXPERIMENTAL && OF

maybe switch to ARCH_MXC instead of MAC_MX27 ?

[...]

drivers/crypto/Kconfig config CRYPTO_DEV_PICOXCELL · line 284

Quoted 3 lines
drivers/crypto/Kconfig +3 -0
+static struct platform_driver sahara_driver = {
+     .probe          = sahara_probe,
+     .remove         = __devexit_p(sahara_remove),

Please remove the __devexit_p too.

Quoted 8 lines
Quoted 4 lines

For information, you'll find below what I've changed to test the driver on my imx51. It's not perfect but it's enough for testing things.

Since I have to send v3 anyway to comply with Sascha's request maybe it would be worth to include your changes to provide support for i.mx51 too.

If you feel like including my changes or something based on my changes in your v3, it's fine for me.

Arnaud

#7 lore raw

PATCH v2 3/3 crypto: sahara: Add device tree binding for SAHARA2.

In reply to Javier Martin
---
 .../devicetree/bindings/crypto/fsl-imx-sahara.txt  |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt
Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt new file +14 -0
new file mode 100644
index 0000000..44abf11
@@ -0,0 +1,14 @@
+* Freescale i.MX SAHARA Cryptographic Accelerator
+
+Required properties:
+- compatible : Should be "fsl,<soc>-sahara"
+- reg : Should contain SAHARA registers location and length
+- interrupts : Should contain SAHARA interrupt number
+
+Example:
+
+sah at 10025000 {
+	compatible = "fsl,imx27-sahara";
+	reg = <	0x10025000 0x800>;
+	interrupts = <75>;
+};
Signature · 1 line
1.7.9.5
maintainer
#8 lore raw

PATCH v2 3/3 crypto: sahara: Add device tree binding for SAHARA2.

Hi Javier,

Quoted 13 lines · Javier Martin
---
 .../devicetree/bindings/crypto/fsl-imx-sahara.txt  |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt
Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt new file +0 -0
new file mode 100644
index 0000000..44abf11

Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt new file +4 -0
@@ -0,0 +1,14 @@
+* Freescale i.MX SAHARA Cryptographic Accelerator
+
+Required properties:
+- compatible : Should be "fsl,<soc>-sahara"

Please add explicitly which SoCs are supported.

You can fold this patch into the driver patch. This way people reading the commit history have a direct cross link between the driver and the documentation.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#9 lore raw

PATCH v2 3/3 crypto: sahara: Add device tree binding for SAHARA2.

Quoted 23 lines · Sascha Hauer

Hi Javier,

Quoted 13 lines · Javier Martin
---
 .../devicetree/bindings/crypto/fsl-imx-sahara.txt  |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt
Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt new file +0 -0
new file mode 100644
index 0000000..44abf11

Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/crypto/fsl-imx-sahara.txt new file +4 -0
@@ -0,0 +1,14 @@
+* Freescale i.MX SAHARA Cryptographic Accelerator
+
+Required properties:
+- compatible : Should be "fsl,<soc>-sahara"

Please add explicitly which SoCs are supported.

Quoted 3 lines

You can fold this patch into the driver patch. This way people reading the commit history have a direct cross link between the driver and the documentation.

OK Sascha. Thanks.

As we discussed previously it seems only i.MX27 is supported right now.

Signature · 7 lines
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com