[PATCHv2 0/5] OMAP4: crypto support

10 messages, 3 authors, 2017-06-14 · open the first message on its own page

[PATCHv2 0/5] OMAP4: crypto support

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:28:54

Hi,

This adds crypto support for OMAP4, which was missing for some reason.
This fixes error about missing hwmod on Droid 4. IP-Cores for AES and
DES are working according to selftest.

Changes since PATCHv1:
 * remove patch adding des_fck to DT
 * add patch removing aes[12]_fck from DT
 * add patch renaming hwmod aes to aes1 in DT
 * update hwmod patches according to feedback from Tero
 * add patch for aes2 hwmod

-- Sebastian

Sebastian Reichel (5):
  ARM: dts: omap4: Fix aes entry
  ARM: dts: omap4.dtsi: remove aes[12]_fck
  ARM: OMAP4: hwmod data: add aes1
  ARM: OMAP4: hwmod data: add aes2
  ARM: OMAP4: hwmod data: add des

 arch/arm/boot/dts/omap4.dtsi               |   4 +-
 arch/arm/boot/dts/omap44xx-clocks.dtsi     |  16 -----
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 100 +++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 18 deletions(-)

-- 
2.11.0

[PATCHv2 1/5] ARM: dts: omap4: Fix aes entry

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:28:58

OMAP4 has a second aes module, so let's use proper name for
the first instance.

Signed-off-by: Sebastian Reichel <redacted>
---
 arch/arm/boot/dts/omap4.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 578c53f08309..589690e034d3 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -900,9 +900,9 @@
 			ctrl-module = <&omap_control_usbotg>;
 		};
 
-		aes: aes at 4b501000 {
+		aes1: aes at 4b501000 {
 			compatible = "ti,omap4-aes";
-			ti,hwmods = "aes";
+			ti,hwmods = "aes1";
 			reg = <0x4b501000 0xa0>;
 			interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
 			dmas = <&sdma 111>, <&sdma 110>;
-- 
2.11.0

[PATCHv2 3/5] ARM: OMAP4: hwmod data: add aes1

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:29:03

This fixes the following error during kernel boot:

platform 4b501000.aes: Cannot lookup hwmod 'aes1'

Unfortunately the AES module is only documented partly
in the OMAP4430 TRM. I found an old patch from Joel,
which I took over and updated for currently mainline.

Signed-off-by: Joel Fernandes <redacted>
Signed-off-by: Sebastian Reichel <redacted>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 41 ++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 94f09c720f29..0aff064d6469 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -953,6 +953,46 @@ static struct omap_hwmod omap44xx_emif2_hwmod = {
 };
 
 /*
+    Crypto modules AES0/1 belong to:
+	PD_L4_PER power domain
+	CD_L4_SEC clock domain
+	On the L3, the AES modules are mapped to
+	L3_CLK2: Peripherals and multimedia sub clock domain
+*/
+static struct omap_hwmod_class_sysconfig omap44xx_aes_sysc = {
+	.rev_offs	= 0x80,
+	.sysc_offs	= 0x84,
+	.syss_offs	= 0x88,
+	.sysc_flags	= SYSS_HAS_RESET_STATUS,
+};
+
+static struct omap_hwmod_class omap44xx_aes_hwmod_class = {
+	.name		= "aes",
+	.sysc		= &omap44xx_aes_sysc,
+};
+
+static struct omap_hwmod omap44xx_aes1_hwmod = {
+	.name		= "aes1",
+	.class		= &omap44xx_aes_hwmod_class,
+	.clkdm_name	= "l4_secure_clkdm",
+	.main_clk	= "l3_div_ck",
+	.prcm		= {
+		.omap4	= {
+			.context_offs	= OMAP4_RM_L4SEC_AES1_CONTEXT_OFFSET,
+			.clkctrl_offs	= OMAP4_CM_L4SEC_AES1_CLKCTRL_OFFSET,
+			.modulemode	= MODULEMODE_SWCTRL,
+		},
+	},
+};
+
+static struct omap_hwmod_ocp_if omap44xx_l3_main_2__aes1 = {
+	.master		= &omap44xx_l4_per_hwmod,
+	.slave		= &omap44xx_aes1_hwmod,
+	.clk		= "l3_div_ck",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/*
  * 'fdif' class
  * face detection hw accelerator module
  */
@@ -4793,6 +4833,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
 	&omap44xx_l4_abe__wd_timer3_dma,
 	&omap44xx_mpu__emif1,
 	&omap44xx_mpu__emif2,
+	&omap44xx_l3_main_2__aes1,
 	NULL,
 };
 
-- 
2.11.0

[RFCv2 4/5] ARM: OMAP4: hwmod data: add aes2

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:29:05

This adds the hwmod entry for the second AES module
available on OMAP4.

Signed-off-by: Sebastian Reichel <redacted>
---
Hi,

This module is currently missing from DT and the public TRM does not provide
enough information for me to add it (the memory area for the crypto cores is
"reserved"). Adding it without the DT entry results in the following error
during boot:

[    0.456085] omap_hwmod: aes2: no dt node
[    0.460205] ------------[ cut here ]------------
[    0.464996] WARNING: CPU: 0 PID: 1 at arch/arm/mach-omap2/omap_hwmod.c:2359 _init.constprop.19+0x1e4/0x4cc
[    0.475036] omap_hwmod: aes2: doesn't have mpu register target base
[    0.481536] Modules linked in:
[    0.484710] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc4-00030-gcc9206ecc9d9-dirty #421
[    0.493743] Hardware name: Generic OMAP4 (Flattened Device Tree)
[    0.499969] [<c0110260>] (unwind_backtrace) from [<c010c2dc>] (show_stack+0x10/0x14)
[    0.507995] [<c010c2dc>] (show_stack) from [<c04d20e4>] (dump_stack+0xac/0xe0)
[    0.515502] [<c04d20e4>] (dump_stack) from [<c013ab48>] (__warn+0xd8/0x104)
[    0.522735] [<c013ab48>] (__warn) from [<c013aba8>] (warn_slowpath_fmt+0x34/0x44)
[    0.530487] [<c013aba8>] (warn_slowpath_fmt) from [<c0f0cfdc>] (_init.constprop.19+0x1e4/0x4cc)
[    0.539489] [<c0f0cfdc>] (_init.constprop.19) from [<c0f0d7c8>] (__omap_hwmod_setup_all+0x3c/0x100)
[    0.548889] [<c0f0d7c8>] (__omap_hwmod_setup_all) from [<c0101874>] (do_one_initcall+0x3c/0x170)
[    0.557983] [<c0101874>] (do_one_initcall) from [<c0f00eb4>] (kernel_init_freeable+0x210/0x2dc)
[    0.567016] [<c0f00eb4>] (kernel_init_freeable) from [<c0ad6a34>] (kernel_init+0x8/0x114)
[    0.575500] [<c0ad6a34>] (kernel_init) from [<c01077d0>] (ret_from_fork+0x14/0x24)
[    0.583374] ---[ end trace 7e68b72794b10f28 ]---

-- Sebastian

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 0aff064d6469..3d58eaef387e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -992,6 +992,27 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__aes1 = {
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod omap44xx_aes2_hwmod = {
+	.name		= "aes2",
+	.class		= &omap44xx_aes_hwmod_class,
+	.clkdm_name	= "l4_secure_clkdm",
+	.main_clk	= "l3_div_ck",
+	.prcm		= {
+		.omap4	= {
+			.context_offs	= OMAP4_RM_L4SEC_AES2_CONTEXT_OFFSET,
+			.clkctrl_offs	= OMAP4_CM_L4SEC_AES2_CLKCTRL_OFFSET,
+			.modulemode	= MODULEMODE_SWCTRL,
+		},
+	},
+};
+
+static struct omap_hwmod_ocp_if omap44xx_l3_main_2__aes2 = {
+	.master		= &omap44xx_l4_per_hwmod,
+	.slave		= &omap44xx_aes2_hwmod,
+	.clk		= "l3_div_ck",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /*
  * 'fdif' class
  * face detection hw accelerator module
@@ -4834,6 +4855,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
 	&omap44xx_mpu__emif1,
 	&omap44xx_mpu__emif2,
 	&omap44xx_l3_main_2__aes1,
+	&omap44xx_l3_main_2__aes2,
 	NULL,
 };
 
-- 
2.11.0

[PATCHv2 5/5] ARM: OMAP4: hwmod data: add des

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:29:09

This fixes the following error during kernel boot:

platform 480a5000.des: Cannot lookup hwmod 'des'

Unfortunately the DES module is only documented partly
in the OMAP4430 TRM. I found an old patch from Joel,
which I took over and updated for currently mainline.

Signed-off-by: Joel Fernandes <redacted>
Signed-off-by: Sebastian Reichel <redacted>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 37 ++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 3d58eaef387e..6353e8df9b76 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1014,6 +1014,42 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__aes2 = {
 };
 
 /*
+ * 'des' class for DES3DES module
+ */
+static struct omap_hwmod_class_sysconfig omap44xx_des_sysc = {
+	.rev_offs	= 0x30,
+	.sysc_offs	= 0x34,
+	.syss_offs	= 0x38,
+	.sysc_flags	= SYSS_HAS_RESET_STATUS,
+};
+
+static struct omap_hwmod_class omap44xx_des_hwmod_class = {
+	.name		= "des",
+	.sysc		= &omap44xx_des_sysc,
+};
+
+static struct omap_hwmod omap44xx_des_hwmod = {
+	.name		= "des",
+	.class		= &omap44xx_des_hwmod_class,
+	.clkdm_name	= "l4_secure_clkdm",
+	.main_clk	= "l3_div_ck",
+	.prcm		= {
+		.omap4	= {
+			.context_offs	= OMAP4_RM_L4SEC_DES3DES_CONTEXT_OFFSET,
+			.clkctrl_offs	= OMAP4_CM_L4SEC_DES3DES_CLKCTRL_OFFSET,
+			.modulemode	= MODULEMODE_SWCTRL,
+		},
+	},
+};
+
+struct omap_hwmod_ocp_if omap44xx_l3_main_2__des = {
+	.master		= &omap44xx_l3_main_2_hwmod,
+	.slave		= &omap44xx_des_hwmod,
+	.clk		= "l3_div_ck",
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/*
  * 'fdif' class
  * face detection hw accelerator module
  */
@@ -4856,6 +4892,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
 	&omap44xx_mpu__emif2,
 	&omap44xx_l3_main_2__aes1,
 	&omap44xx_l3_main_2__aes2,
+	&omap44xx_l3_main_2__des,
 	NULL,
 };
 
-- 
2.11.0

[PATCHv2 2/5] ARM: dts: omap4.dtsi: remove aes[12]_fck

From: Sebastian Reichel <hidden>
Date: 2017-06-13 09:29:19

"aes1_fck" and "aes2_fck" are controlled by hwmod. Drop clock
entries to avoid conflicts.

Signed-off-by: Sebastian Reichel <redacted>
---
 arch/arm/boot/dts/omap44xx-clocks.dtsi | 16 ----------------
 1 file changed, 16 deletions(-)
diff --git a/arch/arm/boot/dts/omap44xx-clocks.dtsi b/arch/arm/boot/dts/omap44xx-clocks.dtsi
index 9573b37fbaa7..008693b0b17a 100644
--- a/arch/arm/boot/dts/omap44xx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap44xx-clocks.dtsi
@@ -969,22 +969,6 @@
 		ti,max-div = <2>;
 	};
 
-	aes1_fck: aes1_fck at 15a0 {
-		#clock-cells = <0>;
-		compatible = "ti,gate-clock";
-		clocks = <&l3_div_ck>;
-		ti,bit-shift = <1>;
-		reg = <0x15a0>;
-	};
-
-	aes2_fck: aes2_fck at 15a8 {
-		#clock-cells = <0>;
-		compatible = "ti,gate-clock";
-		clocks = <&l3_div_ck>;
-		ti,bit-shift = <1>;
-		reg = <0x15a8>;
-	};
-
 	dss_sys_clk: dss_sys_clk at 1120 {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-- 
2.11.0

Re: [PATCHv2 0/5] OMAP4: crypto support

From: Tero Kristo <hidden>
Date: 2017-06-13 13:50:48

On 13/06/17 12:28, Sebastian Reichel wrote:
Hi,

This adds crypto support for OMAP4, which was missing for some reason.
This fixes error about missing hwmod on Droid 4. IP-Cores for AES and
DES are working according to selftest.

Changes since PATCHv1:
  * remove patch adding des_fck to DT
  * add patch removing aes[12]_fck from DT
  * add patch renaming hwmod aes to aes1 in DT
  * update hwmod patches according to feedback from Tero
  * add patch for aes2 hwmod

-- Sebastian
I just posted a few extra patches on top of this series, for adding the 
missing dts data for aes2 and adding sham accelerator also. The dts data 
should be applied first if you want to avoid any issues with hwmod core 
complaining about missing DT data, so the sequencing of this series and 
mine need to be done carefully.

The patches themselves in this series look fine now, so:

Acked-by: Tero Kristo <redacted>
Sebastian Reichel (5):
   ARM: dts: omap4: Fix aes entry
   ARM: dts: omap4.dtsi: remove aes[12]_fck
   ARM: OMAP4: hwmod data: add aes1
   ARM: OMAP4: hwmod data: add aes2
   ARM: OMAP4: hwmod data: add des

  arch/arm/boot/dts/omap4.dtsi               |   4 +-
  arch/arm/boot/dts/omap44xx-clocks.dtsi     |  16 -----
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 100 +++++++++++++++++++++++++++++
  3 files changed, 102 insertions(+), 18 deletions(-)

Re: [PATCHv2 0/5] OMAP4: crypto support

From: Sebastian Reichel <hidden>
Date: 2017-06-13 14:25:04

Hi,

On Tue, Jun 13, 2017 at 04:49:18PM +0300, Tero Kristo wrote:
On 13/06/17 12:28, Sebastian Reichel wrote:
quoted
This adds crypto support for OMAP4, which was missing for some reason.
This fixes error about missing hwmod on Droid 4. IP-Cores for AES and
DES are working according to selftest.

Changes since PATCHv1:
  * remove patch adding des_fck to DT
  * add patch removing aes[12]_fck from DT
  * add patch renaming hwmod aes to aes1 in DT
  * update hwmod patches according to feedback from Tero
  * add patch for aes2 hwmod

-- Sebastian
I just posted a few extra patches on top of this series, for adding
the missing dts data for aes2 and adding sham accelerator also.
Thanks :)
The dts data should be applied first if you want to avoid any
issues with hwmod core complaining about missing DT data, so the
sequencing of this series and mine need to be done carefully.
There is also a warning printed if DT references a missing hwmod
entry (that's how I noticed this in the first place). It's less
noisy, though. Since kernel builds and boots with any order and
crypto hardware does not work at the moment there is no real
problem with bisect. I suggest to merge the DTS patches normally
through the separate dt branch.
The patches themselves in this series look fine now, so:

Acked-by: Tero Kristo <redacted>
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170613/ab6c3789/attachment.sig>

Re: [PATCHv2 0/5] OMAP4: crypto support

From: Tero Kristo <hidden>
Date: 2017-06-13 14:44:18

On 13/06/17 17:24, Sebastian Reichel wrote:
Hi,

On Tue, Jun 13, 2017 at 04:49:18PM +0300, Tero Kristo wrote:
quoted
On 13/06/17 12:28, Sebastian Reichel wrote:
quoted
This adds crypto support for OMAP4, which was missing for some reason.
This fixes error about missing hwmod on Droid 4. IP-Cores for AES and
DES are working according to selftest.

Changes since PATCHv1:
   * remove patch adding des_fck to DT
   * add patch removing aes[12]_fck from DT
   * add patch renaming hwmod aes to aes1 in DT
   * update hwmod patches according to feedback from Tero
   * add patch for aes2 hwmod

-- Sebastian
I just posted a few extra patches on top of this series, for adding
the missing dts data for aes2 and adding sham accelerator also.
Thanks :)
quoted
The dts data should be applied first if you want to avoid any
issues with hwmod core complaining about missing DT data, so the
sequencing of this series and mine need to be done carefully.
There is also a warning printed if DT references a missing hwmod
entry (that's how I noticed this in the first place). It's less
noisy, though. Since kernel builds and boots with any order and
crypto hardware does not work at the moment there is no real
problem with bisect. I suggest to merge the DTS patches normally
through the separate dt branch.
Yeah thats actually true also. Up to Tony to decide how he wants to 
handle these. The huge warning is mainly an annoyance.

-Tero

Re: [PATCHv2 0/5] OMAP4: crypto support

From: Tony Lindgren <tony@atomide.com>
Date: 2017-06-14 07:57:56

* Tero Kristo [off-list ref] [170613 07:46]:
On 13/06/17 17:24, Sebastian Reichel wrote:
quoted
Hi,

On Tue, Jun 13, 2017 at 04:49:18PM +0300, Tero Kristo wrote:
quoted
On 13/06/17 12:28, Sebastian Reichel wrote:
quoted
This adds crypto support for OMAP4, which was missing for some reason.
This fixes error about missing hwmod on Droid 4. IP-Cores for AES and
DES are working according to selftest.

Changes since PATCHv1:
   * remove patch adding des_fck to DT
   * add patch removing aes[12]_fck from DT
   * add patch renaming hwmod aes to aes1 in DT
   * update hwmod patches according to feedback from Tero
   * add patch for aes2 hwmod

-- Sebastian
I just posted a few extra patches on top of this series, for adding
the missing dts data for aes2 and adding sham accelerator also.
Thanks :)
quoted
The dts data should be applied first if you want to avoid any
issues with hwmod core complaining about missing DT data, so the
sequencing of this series and mine need to be done carefully.
There is also a warning printed if DT references a missing hwmod
entry (that's how I noticed this in the first place). It's less
noisy, though. Since kernel builds and boots with any order and
crypto hardware does not work at the moment there is no real
problem with bisect. I suggest to merge the DTS patches normally
through the separate dt branch.
Yeah thats actually true also. Up to Tony to decide how he wants to handle
these. The huge warning is mainly an annoyance.
Applying patches from both Sebastian's and Tero's sets into
split into omap-for-v4.13/dt and omap-for-v4.13/soc-v4 branches.

Thanks,

Tony
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help