Skip to contentSkip to conversation

kontron-sl-mx8mm: Add CAAM support

PATCH Superseded Fabio Estevam 3 participants 3 messages Jun 8, 2022 – Jun 9, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kontron-sl-mx8mm: Add CAAM support

Add CAAM support, which is required when enabling HAB secure boot.

Select CONFIG_SPL_DRIVERS_MISC so that CONFIG_IMX_HAB could build successfully, if selected.

---
 arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi | 17 +++++++++++++++++
 arch/arm/mach-imx/imx8m/Kconfig               |  3 +++
 board/kontron/sl-mx8mm/spl.c                  |  9 +++++++++
 configs/kontron-sl-mx8mm_defconfig            |  1 +
 4 files changed, 30 insertions(+)
arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi +17 -0
index 22d18e6f1cf8..11d915310f74 100644
@@ -25,6 +25,23 @@
 	};
 };
 
+&crypto {
+	u-boot,dm-spl;
+};
+
+&sec_jr0 {
+	u-boot,dm-spl;
+	status = "disabled";
+};
+
+&sec_jr1 {
+	u-boot,dm-spl;
+};
+
+&sec_jr2 {
+	u-boot,dm-spl;
+};
+
 &fec1 {
 	phy-mode = "rgmii-rxid";
 };
arch/arm/mach-imx/imx8m/Kconfig +3 -0
index 61397bf88d13..5c59422ecb79 100644
@@ -106,6 +106,9 @@ config TARGET_KONTRON_MX8MM
 	select IMX8MM
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
+	select FSL_CAAM
+	select ARCH_MISC_INIT
+	select SPL_CRYPTO if SPL
 
 config TARGET_IMX8MN_BSH_SMM_S2
 	bool "imx8mn-bsh-smm-s2"
board/kontron/sl-mx8mm/spl.c +9 -0
index 4ef03c8c172f..5a513722c5d5 100644
@@ -13,6 +13,9 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
 #include <hang.h>
 #include <i2c.h>
 #include <init.h>
@@ -213,6 +216,12 @@ void spl_board_init(void)
 	struct udevice *dev;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
+		if (ret)
+			printf("Failed to initialize %s: %d\n", dev->name, ret);
+	}
+
 	puts("Normal Boot\n");
 
 	ret = uclass_get_device_by_name(UCLASS_CLK,
configs/kontron-sl-mx8mm_defconfig +1 -0
index 2e9d52522b21..eae9ac0dbebf 100644
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_TARGET_KONTRON_MX8MM=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SPL=y
 CONFIG_SYS_LOAD_ADDR=0x42000000
Signature · 1 line
2.25.1
#1 lore raw

Hello Fabio,

Quoted 27 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Fabio Estevam
Sent: Wednesday, June 8, 2022 5:04 PM
To: [email protected]
Cc: [email protected]; [email protected]; Fabio Estevam <[email protected]>
Subject: [PATCH] kontron-sl-mx8mm: Add CAAM support

Add CAAM support, which is required when enabling HAB secure boot.

Select CONFIG_SPL_DRIVERS_MISC so that CONFIG_IMX_HAB could build successfully, if selected.

---
 arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi | 17 +++++++++++++++++
 arch/arm/mach-imx/imx8m/Kconfig               |  3 +++
 board/kontron/sl-mx8mm/spl.c                  |  9 +++++++++
 configs/kontron-sl-mx8mm_defconfig            |  1 +
 4 files changed, 30 insertions(+)
arch/arm/dts/imx8mm- renamed from arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi +0 -0

kontron-n801x-u-boot.dtsi
index 22d18e6f1cf8..11d915310f74 100644

arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi line 34

Quoted 10 lines
arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi +7 -0
@@ -25,6 +25,23 @@
 	};
 };
 
+&crypto {
+	u-boot,dm-spl;
+};
+
+&sec_jr0 {
+	u-boot,dm-spl;
+	status = "disabled";

If this board is supported by upstream Kernel, then perhaps this reservation shall be included there before, and then sync'd back into U-Boot?

This is similar to what EVKs from NXP are undergoing now, with your help of up-steaming Kernel DTB changes in front of U-Boot DTB ones.

Quoted 69 lines
arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi +10 -0
+};
+
+&sec_jr1 {
+	u-boot,dm-spl;
+};
+
+&sec_jr2 {
+	u-boot,dm-spl;
+};
+
 &fec1 {
 	phy-mode = "rgmii-rxid";
 };
arch/arm/mach-imx/imx8m/Kconfig +3 -0
index 61397bf88d13..5c59422ecb79 100644
@@ -106,6 +106,9 @@ config TARGET_KONTRON_MX8MM
 	select IMX8MM
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
+	select FSL_CAAM
+	select ARCH_MISC_INIT
+	select SPL_CRYPTO if SPL
 
 config TARGET_IMX8MN_BSH_SMM_S2
 	bool "imx8mn-bsh-smm-s2"
board/kontron/sl-mx8mm/spl.c +9 -0
index 4ef03c8c172f..5a513722c5d5 100644
@@ -13,6 +13,9 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
 #include <hang.h>
 #include <i2c.h>
 #include <init.h>
@@ -213,6 +216,12 @@ void spl_board_init(void)
 	struct udevice *dev;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
 DM_DRIVER_GET(caam_jr), &dev);
+		if (ret)
+			printf("Failed to initialize %s: %d\n", dev->name, ret);
+	}
+
 	puts("Normal Boot\n");
 
board/kontron/sl-mx8mm/spl.c +0 -0
 	ret = uclass_get_device_by_name(UCLASS_CLK,
configs/kontron-sl- renamed from configs/kontron-sl-mx8mm_defconfig +0 -0

mx8mm_defconfig
index 2e9d52522b21..eae9ac0dbebf 100644

configs/kontron-sl-mx8mm_defconfig +1 -1
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_TARGET_KONTRON_MX8MM=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SPL=y
 CONFIG_SYS_LOAD_ADDR=0x42000000
--
Quoted 1 line

2.25.1

Regards,
Andrey

reviewer
#2 lore raw

Hi Andrey,

Quoted 7 lines · ZHIZHIKIN Andrey

Review

Quoted 3 lines

+&sec_jr0 {

(quoted diff) +2 -0
+     u-boot,dm-spl;
+     status = "disabled";

If this board is supported by upstream Kernel, then perhaps this reservation shall be included there before, and then sync'd back into U-Boot?

Yes, this board is supported by the upstream kernel.

I can remove the status = "disabled" line from this patch and send a v2.

BTW, if you have a chance please send your Tested-by or Reviewed-by patch to my imx8m kernel patch
that disables sec_jr0.

Thanks

Quoted 77 lines

This is similar to what EVKs from NXP are undergoing now, with your help of up-steaming Kernel DTB changes in front of U-Boot DTB ones.

Quoted 69 lines
arch/arm/dts/imx8mm-kontron-n801x-u-boot.dtsi +10 -0
+};
+
+&sec_jr1 {
+     u-boot,dm-spl;
+};
+
+&sec_jr2 {
+     u-boot,dm-spl;
+};
+
 &fec1 {
      phy-mode = "rgmii-rxid";
 };
arch/arm/mach-imx/imx8m/Kconfig +3 -0
index 61397bf88d13..5c59422ecb79 100644
@@ -106,6 +106,9 @@ config TARGET_KONTRON_MX8MM
      select IMX8MM
      select SUPPORT_SPL
      select IMX8M_LPDDR4
+     select FSL_CAAM
+     select ARCH_MISC_INIT
+     select SPL_CRYPTO if SPL
 
 config TARGET_IMX8MN_BSH_SMM_S2
      bool "imx8mn-bsh-smm-s2"
board/kontron/sl-mx8mm/spl.c +9 -0
index 4ef03c8c172f..5a513722c5d5 100644
@@ -13,6 +13,9 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
 #include <hang.h>
 #include <i2c.h>
 #include <init.h>
@@ -213,6 +216,12 @@ void spl_board_init(void)
      struct udevice *dev;
      int ret;
 
+     if (IS_ENABLED(CONFIG_FSL_CAAM)) {
+             ret = uclass_get_device_by_driver(UCLASS_MISC,
 DM_DRIVER_GET(caam_jr), &dev);
+             if (ret)
+                     printf("Failed to initialize %s: %d\n", dev->name, ret);
+     }
+
      puts("Normal Boot\n");
 

ret = uclass_get_device_by_name(UCLASS_CLK,

configs/kontron-sl- renamed from configs/kontron-sl-mx8mm_defconfig +0 -0

mx8mm_defconfig
index 2e9d52522b21..eae9ac0dbebf 100644

configs/kontron-sl-mx8mm_defconfig +1 -1
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_TARGET_KONTRON_MX8MM=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SPL=y
 CONFIG_SYS_LOAD_ADDR=0x42000000
--
Quoted 1 line

2.25.1

Regards,
Andrey