From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 7/7] ARM: i.MX8M: init CAAM when CONFIG_FSL_CAAM_RNG_PBL_INIT
Date: Wed, 11 Jan 2023 08:59:40 +0100 [thread overview]
Message-ID: <20230111075940.922817-8-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230111075940.922817-1-a.fatoum@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-imx/Kconfig | 1 +
arch/arm/mach-imx/atf.c | 10 ++++++++++
arch/arm/mach-imx/include/mach/imx8m-regs.h | 3 +++
drivers/crypto/caam/Kconfig | 3 ++-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 84b763f83fb1..774c4cacb7f7 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -184,6 +184,7 @@ config ARCH_IMX8M
select IMX8M_DRAM
select PBL_VERIFY_PIGGY if HABV4
select ARM_USE_COMPRESSED_DTB
+ imply FSL_CAAM_RNG_PBL_INIT if HAVE_OPTEE
config ARCH_IMX8MM
select ARCH_IMX8M
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 61b602816623..2a3e3f53b885 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -8,6 +8,7 @@
#include <mach/xload.h>
#include <mach/romapi.h>
#include <soc/fsl/fsl_udc.h>
+#include <soc/fsl/caam.h>
/**
* imx8m_atf_load_bl31 - Load ATF BL31 blob and transfer control to it
@@ -38,9 +39,18 @@
static __noreturn void imx8m_atf_start_bl31(const void *fw, size_t fw_size, void *atf_dest)
{
void __noreturn (*bl31)(void) = atf_dest;
+ int ret;
BUG_ON(fw_size > MX8M_ATF_BL31_SIZE_LIMIT);
+ if (IS_ENABLED(CONFIG_FSL_CAAM_RNG_PBL_INIT)) {
+ ret = imx_early_caam_init(MX8M_CAAM_BASE_ADDR);
+ if (ret)
+ pr_debug("CAAM early init failed: %d\n", ret);
+ else
+ pr_debug("CAAM early init successful\n");
+ }
+
memcpy(bl31, fw, fw_size);
asm volatile("msr sp_el2, %0" : :
diff --git a/arch/arm/mach-imx/include/mach/imx8m-regs.h b/arch/arm/mach-imx/include/mach/imx8m-regs.h
index 794e1bdd88a4..d101b88cc4a6 100644
--- a/arch/arm/mach-imx/include/mach/imx8m-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx8m-regs.h
@@ -3,6 +3,8 @@
#ifndef __MACH_IMX8M_REGS_H
#define __MACH_IMX8M_REGS_H
+#include <linux/compiler.h>
+
/*
* Actual addressable OCRAM size may differ from SoC to SoC, but all of
* i.MX8MQ/M/N/P have this region of MMIO address space set aside for
@@ -31,6 +33,7 @@
#define MX8M_UART1_BASE_ADDR 0x30860000
#define MX8M_UART3_BASE_ADDR 0x30880000
#define MX8M_UART2_BASE_ADDR 0x30890000
+#define MX8M_CAAM_BASE_ADDR IOMEM(0x30900000)
#define MX8M_I2C1_BASE_ADDR 0x30A20000
#define MX8M_I2C2_BASE_ADDR 0x30A30000
#define MX8M_I2C3_BASE_ADDR 0x30A40000
diff --git a/drivers/crypto/caam/Kconfig b/drivers/crypto/caam/Kconfig
index 33d7b0fb8329..e7f57708f3ea 100644
--- a/drivers/crypto/caam/Kconfig
+++ b/drivers/crypto/caam/Kconfig
@@ -36,4 +36,5 @@ config CRYPTO_DEV_FSL_CAAM_RNG
Selecting this will register the SEC4 hardware rng.
config FSL_CAAM_RNG_PBL_INIT
- bool
+ bool "Setup CAAM in EL3"
+ depends on ARCH_IMX8M
--
2.30.2
next prev parent reply other threads:[~2023-01-11 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 7:59 [PATCH 0/7] ARM: i.MX8M: add optional CAAM init in PBL Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 1/7] ARM: i.MX8M: bootrom: access OCRAM directly if running in EL3 Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 2/7] crypto: caam - sync 64-bit accessors with Linux Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 3/7] crypto: caam - add job ring accessors from Linux Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 4/7] crypto: caam - make command constants unsigned Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 5/7] crypto: caam - implement early PBL init Ahmad Fatoum
2023-01-11 7:59 ` [PATCH 6/7] common: add new CONFIG_HAVE_OPTEE symbol Ahmad Fatoum
2023-01-11 7:59 ` Ahmad Fatoum [this message]
2023-01-11 9:10 ` [PATCH 0/7] ARM: i.MX8M: add optional CAAM init in PBL Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230111075940.922817-8-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox