2023-01-06 17:17:39

by Patrick Delaunay

[permalink] [raw]
Subject: [PATCH v5 0/3] nvmem: stm32: add OP-TEE support for STM32MP13x


The v5 patchset is rebased on next-20221226.

This serie update the NVMEM BSEC driver to be compatible with STM32MP13x
SoC and the trusted application STM32MP BSEC in OP-TEE

This serie solve issue in initial support of STM32MP131
(using BSEC STM32MP15 compatible) and so it break the STM32MP13x DTS
compatible.

I create this serie for more efficient review, including support for
STM32MP15x.

The first patches of the V1 series is already merged:
"dt-bindings: nvmem: add new stm32mp13 compatible for stm32-romem"

This STM32MP13x DTS break is acceptable as
- the STM32MP13x SoC is not yet available outside STMicroelectronics
(not official)
- the same patch is already integrated or modifications are in progress in
the other users (arm-trusted-firmware/TF-A, OP-TEE and U-Boot) of
stm32mp131 device tree.

It is the good time to correct this issue before the real availability of
the SoC and before full support of STM32MP13x SoC in Linux kernel.

Regards

Patrick

Changes in v5:
- minor changes after Etienne Carierre review (comments,
change %x to %#x, remove goto to out_tee_session)
- update the BSEC SMC detection logic in stm32_romem_probe()
after Etienne Carierre review to support NVMEM probe after OP-TEE probe

Changes in v4:
- fixe warning reported by kernel test robot for 64 bits support in
drivers/nvmem/stm32-bsec-optee-ta.c:260:18:
warning: format '%d' expects argument of type 'int',
but argument 4 has type 'size_t'

Changes in v3:
- add a separate file stm32-bsec-optee-ta.c with STM32MP BSEC TA
communication functions to avoid #if in romem driver.
- use of_find_compatible_node in optee_presence_check function
instead of of_find_node_by_path("/firmware/optee")

Changes in v2:
- rebase series on linux-next/master
- minor update after V1 revue

Changes in v1:
- update commit message to indicate DTS break reason.

Patrick Delaunay (3):
ARM: dts: stm32mp13: fix compatible for BSEC
nvmem: stm32: add OP-TEE support for STM32MP13x
nvmem: stm32: detect bsec pta presence for STM32MP15x

arch/arm/boot/dts/stm32mp131.dtsi | 2 +-
drivers/nvmem/Kconfig | 11 +
drivers/nvmem/Makefile | 1 +
drivers/nvmem/stm32-bsec-optee-ta.c | 298 ++++++++++++++++++++++++++++
drivers/nvmem/stm32-bsec-optee-ta.h | 80 ++++++++
drivers/nvmem/stm32-romem.c | 84 +++++++-
6 files changed, 472 insertions(+), 4 deletions(-)
create mode 100644 drivers/nvmem/stm32-bsec-optee-ta.c
create mode 100644 drivers/nvmem/stm32-bsec-optee-ta.h

base-commit: c76083fac3bae1a87ae3d005b5cb1cbc761e31d5
prerequisite-patch-id: 5aaa8fffbdd16871143808180b3932d80f4045d0
prerequisite-patch-id: ae711dc528e191e4751cbb7402041fc5f185d6b3
--
2.25.1


2023-01-06 17:17:57

by Patrick Delaunay

[permalink] [raw]
Subject: [PATCH v5 1/3] ARM: dts: stm32mp13: fix compatible for BSEC

Use the correct compatible for stm32mp13 support.

The BSEC driver for STM32MP15x is not compatible with STM32MP13x. For
example the proprietary's smc STM32_SMC_BSEC is not supported in
STM32MP13x OP-TEE, it is replaced by SM32MP BSEC Pseudo Trusted
Application in OP-TEE to access to the secured IP BSEC on STM32MP13X SoC.

The correct compatible is already used in U-Boot and in upstream is in
progress for OP-TEE device tree.

As the SoC STM32MP13X is not yet official and it is not available
outside STMicroelectronics, it is the good time to break the DTS
compatibility and to correct the error done in the introduction of
STM32MP131.

Signed-off-by: Patrick Delaunay <[email protected]>
---
This patch is already sent separately in:
https://lore.kernel.org/all/20221017134437.1.I167a5efc1f8777cce14518c6fa38400ac684de3e@changeid/
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=685815

I create a serie for more efficient review.

Patrick.

(no changes since v1)

Changes in v1:
- update commit message to indicate DTS break reason.

arch/arm/boot/dts/stm32mp131.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/stm32mp131.dtsi b/arch/arm/boot/dts/stm32mp131.dtsi
index accc3824f7e9..0b79380cc627 100644
--- a/arch/arm/boot/dts/stm32mp131.dtsi
+++ b/arch/arm/boot/dts/stm32mp131.dtsi
@@ -520,7 +520,7 @@ rtc: rtc@5c004000 {
};

bsec: efuse@5c005000 {
- compatible = "st,stm32mp15-bsec";
+ compatible = "st,stm32mp13-bsec";
reg = <0x5c005000 0x400>;
#address-cells = <1>;
#size-cells = <1>;
--
2.25.1