TF-A-STM32MP: update to v2.4-stm32mp-r2

Change-Id: I8ff248b82c8f4da0f5905d381176402e16e096ff
Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
This commit is contained in:
Lionel VITTE 2021-11-16 09:22:57 +01:00
parent 0e297b657a
commit fe84eb5c3c
4 changed files with 8386 additions and 8 deletions

View File

@ -35,8 +35,11 @@ DEPENDS_append = " ${@bb.utils.contains('TF_A_ENABLE_DEBUG_WRAPPER', '1', 'stm32
# Default log level
ST_TF_A_DEBUG_LOG_LEVEL ??= "40"
# Extra make settings
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX}'
# Configure make settings
EXTRA_OEMAKE += 'PLAT=${TFA_PLATFORM}'
EXTRA_OEMAKE += 'ARCH=${TFA_ARM_ARCH}'
EXTRA_OEMAKE += 'ARM_ARCH_MAJOR=${TFA_ARM_MAJOR}'
EXTRA_OEMAKE += 'CROSS_COMPILE=${TARGET_PREFIX}'
# Debug support
EXTRA_OEMAKE += '${@bb.utils.contains('ST_TF_A_DEBUG_TRACE', '1', 'DEBUG=1', '', d)}'
EXTRA_OEMAKE += '${@bb.utils.contains('ST_TF_A_DEBUG_TRACE', '1', 'LOG_LEVEL=${ST_TF_A_DEBUG_LOG_LEVEL}', '', d)}'

View File

@ -0,0 +1,157 @@
From 903a55e874e91ccd1fb435bea3a675e2eb4257fa Mon Sep 17 00:00:00 2001
From: Romuald JEANNE <romuald.jeanne@st.com>
Date: Wed, 2 Jun 2021 16:45:18 +0200
Subject: [PATCH 2/3] v2.4-stm32mp-r1.1-rc1
---
docs/plat/stm32mp1.rst | 9 ++++++---
drivers/st/clk/stm32mp1_clk.c | 4 ++--
include/drivers/st/stm32mp1_rcc.h | 16 ++++++++++++++++
plat/st/common/stm32mp_crypto_lib.c | 5 ++++-
plat/st/stm32mp1/stm32mp1_def.h | 2 ++
plat/st/stm32mp1/stm32mp1_helper.S | 13 +++++++++++++
6 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/docs/plat/stm32mp1.rst b/docs/plat/stm32mp1.rst
index fb7afdbbb0..95f4a186f5 100644
--- a/docs/plat/stm32mp1.rst
+++ b/docs/plat/stm32mp1.rst
@@ -153,7 +153,10 @@ To build TF-A BL2 with its STM32 header for SD-card boot:
.. code:: bash
make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
- DTB_FILE_NAME=stm32mp157c-ev1.dtb
+ DTB_FILE_NAME=stm32mp157c-ev1.dtb STM32MP_SDMMC=1
+
+For other boot devices, you have to replace STM32MP_SDMMC in the previous command
+with the desired devive flag.
This BL2 is independent of the BL32 used (SP_min or OP-TEE)
@@ -204,14 +207,14 @@ __________________
--nt-fw <u-boot_directory>/u-boot-nodtb.bin \
--nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \
--nt-fw-key-cert build/stm32mp1/cert_images/u-boot.bin.key-crt \
- --hw-config <u-boot_directory>/u-boot.dtb
+ --hw-config <u-boot_directory>/u-boot.dtb \
--fw-config build/stm32mp1/debug/fdts/fw-config.dtb
tools/fiptool/fiptool create --tos-fw <optee_directory>/tee-header_v2.bin \
--tos-fw-extra1 <optee_directory>/tee-pager_v2.bin \
--tos-fw-extra2 <optee_directory>/tee-pageable_v2.bin \
--nt-fw <u-boot_directory>/u-boot-nodtb.bin \
- --hw-config <u-boot_directory>/uboot-nodtb.dtb \
+ --hw-config <u-boot_directory>/u-boot.dtb \
--tos-fw-cert build/stm32mp1/cert_images/tee-header_v2.bin.crt \
--tos-fw-key-cert build/stm32mp1/cert_images/tee-header_v2.bin.key-crt \
--nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \
diff --git a/drivers/st/clk/stm32mp1_clk.c b/drivers/st/clk/stm32mp1_clk.c
index 00954cb2e8..d074a1568c 100644
--- a/drivers/st/clk/stm32mp1_clk.c
+++ b/drivers/st/clk/stm32mp1_clk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2020, STMicroelectronics - All Rights Reserved
+ * Copyright (C) 2018-2021, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
*/
@@ -1853,7 +1853,7 @@ static void stm32mp1_set_rtcsrc(unsigned int clksrc, bool lse_css)
(clksrc != (uint32_t)CLK_RTC_DISABLED)) {
mmio_clrsetbits_32(address,
RCC_BDCR_RTCSRC_MASK,
- clksrc << RCC_BDCR_RTCSRC_SHIFT);
+ (clksrc & RCC_SELR_SRC_MASK) << RCC_BDCR_RTCSRC_SHIFT);
mmio_setbits_32(address, RCC_BDCR_RTCCKEN);
}
diff --git a/include/drivers/st/stm32mp1_rcc.h b/include/drivers/st/stm32mp1_rcc.h
index feaac43a13..616051e772 100644
--- a/include/drivers/st/stm32mp1_rcc.h
+++ b/include/drivers/st/stm32mp1_rcc.h
@@ -576,6 +576,22 @@
#define RCC_FMCCKSELR_FMCSRC_MASK GENMASK(1, 0)
#define RCC_FMCCKSELR_FMCSRC_SHIFT 0
+/* RCC_APB1RSTSETR register fields */
+#define RCC_APB1RSTSETR_USART2RST BIT(14)
+#define RCC_APB1RSTSETR_USART3RST BIT(15)
+#define RCC_APB1RSTSETR_UART4RST BIT(16)
+#define RCC_APB1RSTSETR_UART5RST BIT(17)
+#define RCC_APB1RSTSETR_UART7RST BIT(18)
+#define RCC_APB1RSTSETR_UART8RST BIT(19)
+
+/* RCC_APB1RSTCLRR register fields */
+#define RCC_APB1RSTCLRR_USART2RST BIT(14)
+#define RCC_APB1RSTCLRR_USART3RST BIT(15)
+#define RCC_APB1RSTCLRR_UART4RST BIT(16)
+#define RCC_APB1RSTCLRR_UART5RST BIT(17)
+#define RCC_APB1RSTCLRR_UART7RST BIT(18)
+#define RCC_APB1RSTCLRR_UART8RST BIT(19)
+
/* RCC_USBCKSELR register fields */
#define RCC_USBCKSELR_USBPHYSRC_MASK GENMASK(1, 0)
#define RCC_USBCKSELR_USBPHYSRC_SHIFT 0
diff --git a/plat/st/common/stm32mp_crypto_lib.c b/plat/st/common/stm32mp_crypto_lib.c
index de9601d2b8..9582162813 100644
--- a/plat/st/common/stm32mp_crypto_lib.c
+++ b/plat/st/common/stm32mp_crypto_lib.c
@@ -40,6 +40,7 @@ static void crypto_lib_init(void)
{
boot_api_context_t *boot_context =
(boot_api_context_t *)stm32mp_get_boot_ctx_address();
+ int ret;
if (!stm32mp_is_auth_supported()) {
return;
@@ -48,7 +49,9 @@ static void crypto_lib_init(void)
auth_ops.verify_signature =
boot_context->bootrom_ecdsa_verify_signature;
- if (stm32_hash_register() != 0) {
+ ret = stm32_hash_register();
+ if (ret != 0) {
+ ERROR("HASH init (%d)\n", ret);
panic();
}
}
diff --git a/plat/st/stm32mp1/stm32mp1_def.h b/plat/st/stm32mp1/stm32mp1_def.h
index 027dba1bde..326b227842 100644
--- a/plat/st/stm32mp1/stm32mp1_def.h
+++ b/plat/st/stm32mp1/stm32mp1_def.h
@@ -433,6 +433,8 @@ enum ddr_type {
#define DEBUG_UART_TX_CLKSRC RCC_UART24CKSELR_HSI
#define DEBUG_UART_TX_EN_REG RCC_MP_APB1ENSETR
#define DEBUG_UART_TX_EN RCC_MP_APB1ENSETR_UART4EN
+#define DEBUG_UART_RST_REG RCC_APB1RSTSETR
+#define DEBUG_UART_RST_BIT RCC_APB1RSTSETR_UART4RST
/*******************************************************************************
* STM32MP1 ETZPC
diff --git a/plat/st/stm32mp1/stm32mp1_helper.S b/plat/st/stm32mp1/stm32mp1_helper.S
index bc2d73cebb..315a67f2cf 100644
--- a/plat/st/stm32mp1/stm32mp1_helper.S
+++ b/plat/st/stm32mp1/stm32mp1_helper.S
@@ -245,6 +245,19 @@ endfunc plat_my_core_pos
* ---------------------------------------------
*/
func plat_crash_console_init
+ /* Reset UART peripheral */
+ ldr r1, =(RCC_BASE + DEBUG_UART_RST_REG)
+ ldr r2, =DEBUG_UART_RST_BIT
+ str r2, [r1]
+1:
+ ldr r0, [r1]
+ ands r0, r2
+ beq 1b
+ str r2, [r1, #4] /* RSTCLR register */
+2:
+ ldr r0, [r1]
+ ands r0, r2
+ bne 2b
/* Enable GPIOs for UART TX */
ldr r1, =(RCC_BASE + DEBUG_UART_TX_GPIO_BANK_CLK_REG)
ldr r2, [r1]
--
2.17.1

File diff suppressed because it is too large Load Diff

View File

@ -14,11 +14,13 @@ SRCREV = "e2c509a39c6cc4dda8734e6509cdbe6e3603cdfc"
SRC_URI += " \
file://0001-st-update-v2.4-r1.0.0.patch \
file://0002-v2.4-stm32mp-r1.1-rc1.patch \
file://0003-v2.4-stm32mp-r2.patch \
"
TF_A_VERSION = "v2.4"
TF_A_SUBVERSION = "stm32mp"
TF_A_RELEASE = "r1"
TF_A_RELEASE = "r2"
PV = "${TF_A_VERSION}-${TF_A_SUBVERSION}-${TF_A_RELEASE}"
ARCHIVER_ST_BRANCH = "${TF_A_VERSION}-${TF_A_SUBVERSION}"
@ -28,10 +30,10 @@ ARCHIVER_COMMUNITY_REVISION = "${TF_A_VERSION}"
S = "${WORKDIR}/git"
# Configure stm32mp1 make settings
EXTRA_OEMAKE += "PLAT=stm32mp1"
EXTRA_OEMAKE += "ARCH=aarch32"
EXTRA_OEMAKE += "ARM_ARCH_MAJOR=7"
# Configure settings
TFA_PLATFORM = "stm32mp1"
TFA_ARM_MAJOR = "7"
TFA_ARM_ARCH = "aarch32"
# Enable the wrapper for debug
TF_A_ENABLE_DEBUG_WRAPPER ?= "1"
@ -47,7 +49,7 @@ include ${@oe.utils.ifelse(d.getVar('ST_ARCHIVER_ENABLE') == '1', 'tf-a-stm32mp-
BBCLASSEXTEND = "devupstream:target"
SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/arm-trusted-firmware.git;protocol=https;branch=${ARCHIVER_ST_BRANCH}"
SRCREV_class-devupstream = "40572e4067f205691a4dca3b5fdabe3a40c69594"
SRCREV_class-devupstream = "3e1e3f0a6149d04946ff5debcd871173e782111c"
# ---------------------------------
# Configure default preference to manage dynamic selection between tarball and github