Re: [PATCH v8 06/11] lib: uuid: supporting building as part of host tools
Hi, This patch seens cause problemes for STM32MP1 platforms, AARCH32 For FIP UUID configuration. On 8/30/24 14:34, Caleb Connolly wrote: Adjust the UUID library code so that it can be compiled as part of a host tool. This removes the one redundant log_debug() call, as well as the incorrectly defined LOG_CATEGORY. In general this is a fairly trivial change, just adjusting includes and disabling list_guid. This will be used by a new genguid tool to generate v5 GUIDs that match those generated by U-Boot at runtime. Acked-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- include/uuid.h | 4 ++-- lib/uuid.c | 44 ++-- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index 1f4fa103b5e9..7f8414dc906c 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -69,10 +69,10 @@ struct uuid { } __packed; /* Bits of a bitmask specifying the output format for GUIDs */ #define UUID_STR_FORMAT_STD 0 -#define UUID_STR_FORMAT_GUID BIT(0) -#define UUID_STR_UPPER_CASEBIT(1) +#define UUID_STR_FORMAT_GUID 0x1 +#define UUID_STR_UPPER_CASE0x2 /* Use UUID_STR_LEN + 1 for string space */ #define UUID_STR_LEN 36 #define UUID_BIN_LEN sizeof(struct uuid) diff --git a/lib/uuid.c b/lib/uuid.c index c9dfdf007a18..6fdae7997702 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -6,25 +6,38 @@ * Authors: * Abdellatif El Khlifi */ -#define LOG_CATEGOT LOGC_CORE - +#ifndef USE_HOSTCC #include #include #include #include #include -#include -#include -#include #include #include #include #include #include +#include +#include +#else +#include +#include +#include +#include +#endif +#include +#include +#include +#include #include +#ifdef USE_HOSTCC +/* polyfill hextoul to avoid pulling in strto.c */ +#define hextoul(cp, endp) strtoul(cp, endp, 16) +#endif + int uuid_str_valid(const char *uuid) { int i, valid; @@ -51,8 +64,9 @@ int uuid_str_valid(const char *uuid) static const struct { const char *string; efi_guid_t guid; } list_guid[] = { +#ifndef USE_HOSTCC #ifdef CONFIG_PARTITION_TYPE_GUID {"system",PARTITION_SYSTEM_GUID}, {"mbr", LEGACY_MBR_PARTITION_GUID}, {"msft", PARTITION_MSFT_RESERVED_GUID}, @@ -231,8 +245,9 @@ static const struct { { "EFI_MEMORY_TYPE", EFI_MEMORY_TYPE }, { "EFI_MEM_STATUS_CODE_REC", EFI_MEM_STATUS_CODE_REC }, { "EFI_GUID_EFI_ACPI1", EFI_GUID_EFI_ACPI1 }, #endif +#endif /* !USE_HOSTCC */ }; int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) { @@ -266,9 +281,8 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, uint32_t tmp32; uint64_t tmp64; if (!uuid_str_valid(uuid_str)) { - log_debug("not valid\n"); #ifdef CONFIG_PARTITION_TYPE_GUID if (!uuid_guid_get_bin(uuid_str, uuid_bin)) return 0; #endif @@ -297,19 +311,19 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_be64(hextoul(uuid_str + 24, NULL)); memcpy(uuid_bin + 10, (char *)&tmp64 + 2, 6); return 0; } int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) { - u16 tmp16; - u32 tmp32; - u64 tmp64; + uint16_t tmp16; + uint32_t tmp32; + uint64_t tmp64; if (!uuid_str_valid(uuid_str) || !uuid_bin) return -EINVAL; @@ -324,22 +338,22 @@ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) tmp16 = cpu_to_le16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_le64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_le64(hextoul(uuid_str + 24, NULL)); Here you change simple_strtoull => return unsigned long long to hextoul => return unsigned long for 32bits system that can the cause of issue I think with UUID defined in stm32prog command, with use a gpt create command with UUID define in ./arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c /* FIP type partition UUID used by TF-A*/ #define FIP_TYPE_UUID "19D5DF83-11B0-457B-BE2C-7559C13142A5" /* unique partition guid (uuid) for FIP partitions A/B */ #define FIP_A_UUID \ EFI_GUID(0x4FD84C93, 0x54EF, 0x463F, \ 0xA7, 0xEF, 0xAE, 0x25, 0xFF, 0x88, 0x70, 0x87) with the patch the GPT partition is create with incorrect UUID (type and partion) with "" in last field. $> BAD Partition GUID code: 19D5DF83-11B0-457B-BE2C-C13142A5 Partition unique GUID: 4FD84C93-54EF-463F-A7EF-FF887087 before the patch $> OK Partition GUID code: 19D5DF83-11B0-457B-BE2C-7559C13
[PATCH] ARM: dts: stm32: remove unused include for dhcor
Remove device tree include files no more used with OF_UPSTREAM migration stm32mp135f-dhcor-dhsbc.dts Fixes: cccb29fc1270 ("ARM: dts: stm32: Switch to using upstream DT on DH STM32 DHSOM") Signed-off-by: Patrick Delaunay --- arch/arm/dts/stm32mp13xx-dhcor-som.dtsi | 308 1 file changed, 308 deletions(-) delete mode 100644 arch/arm/dts/stm32mp13xx-dhcor-som.dtsi diff --git a/arch/arm/dts/stm32mp13xx-dhcor-som.dtsi b/arch/arm/dts/stm32mp13xx-dhcor-som.dtsi deleted file mode 100644 index ddad6497775b.. --- a/arch/arm/dts/stm32mp13xx-dhcor-som.dtsi +++ /dev/null @@ -1,308 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) -/* - * Copyright (C) 2024 Marek Vasut - */ - -#include -#include -#include -#include -#include -#include "stm32mp13-pinctrl.dtsi" - -/ { - model = "DH electronics STM32MP13xx DHCOR SoM"; - compatible = "dh,stm32mp131a-dhcor-som", -"st,stm32mp131"; - - aliases { - mmc0 = &sdmmc2; - mmc1 = &sdmmc1; - serial0 = &uart4; - serial1 = &uart7; - rtc0 = &rv3032; - spi0 = &qspi; - }; - - memory@c000 { - device_type = "memory"; - reg = <0xc000 0x2000>; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - optee@dd00 { - reg = <0xdd00 0x300>; - no-map; - }; - }; - - sdio_pwrseq: sdio-pwrseq { - compatible = "mmc-pwrseq-simple"; - reset-gpios = <&gpiof 12 GPIO_ACTIVE_LOW>; - }; - - vin: vin { - compatible = "regulator-fixed"; - regulator-name = "vin"; - regulator-min-microvolt = <500>; - regulator-max-microvolt = <500>; - regulator-always-on; - }; -}; - -&i2c3 { - i2c-scl-rising-time-ns = <96>; - i2c-scl-falling-time-ns = <3>; - clock-frequency = <40>; - status = "okay"; - /* spare dmas for other usage */ - /delete-property/dmas; - /delete-property/dma-names; - - pmic: stpmic@33 { - compatible = "st,stpmic1"; - reg = <0x33>; - interrupts-extended = <&gpioi 3 IRQ_TYPE_EDGE_FALLING>; - interrupt-controller; - #interrupt-cells = <2>; - status = "okay"; - - regulators { - compatible = "st,stpmic1-regulators"; - - ldo1-supply = <&vin>; - ldo2-supply = <&vin>; - ldo3-supply = <&vin>; - ldo4-supply = <&vin>; - ldo5-supply = <&vin>; - ldo6-supply = <&vin>; - pwr_sw1-supply = <&bst_out>; - pwr_sw2-supply = <&bst_out>; - - vddcpu: buck1 { /* VDD_CPU_1V2 */ - regulator-name = "vddcpu"; - regulator-min-microvolt = <125>; - regulator-max-microvolt = <125>; - regulator-always-on; - regulator-initial-mode = <0>; - regulator-over-current-protection; - }; - - vdd_ddr: buck2 { /* VDD_DDR_1V35 */ - regulator-name = "vdd_ddr"; - regulator-min-microvolt = <135>; - regulator-max-microvolt = <135>; - regulator-always-on; - regulator-initial-mode = <0>; - regulator-over-current-protection; - }; - - vdd: buck3 { /* VDD_3V3_1V8 */ - regulator-name = "vdd"; - regulator-min-microvolt = <180>; - regulator-max-microvolt = <330>; - regulator-always-on; - regulator-initial-mode = <0>; - regulator-over-current-protection; - }; - - vddcore: buck4 { /* VDD_CORE_1V2 */ - regulator-name = "
Re: [PATCH 4/4] stm32mp: fix name of optee reserved memory node
Hi, On 10/11/24 17:31, Patrick Delaunay wrote: In OP-TEE, the "optee_core@" node is reserved, appended in non secure device tree (see mark_tzdram_as_reserved() function under CFG_DT) so this name must be checked in optee_get_reserved_memory(). We keep the check on /reserved-memory/optee@ node to have backward compatibility with STMT32Image booting, when the reserved node is already present in U-Boot or SPL device tree with name "optee@". This patch solves a boot issue on board with OP-TEE for U-Boot compiled with stm32mp15_defconfig and without secure configuration device tree (stm32mp157c-dk2.dts for example). Fixes: 5fe9e0deabb1 ("stm32mp: allow calling optee_get_reserved_memory() from U-Boot") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/dram_init.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH 3/4] doc: clarify scmi device tree for stm32mp15 boards
Hi, On 10/11/24 17:31, Patrick Delaunay wrote: Clarify the usage of SCMI specific device tree to use with stm32mp15_defconfig and with OP-TEE. Signed-off-by: Patrick Delaunay --- doc/board/st/stm32mp1.rst | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH 2/4] ARM: stm32mp: enable data cache after LMB configuration for STM32MP1
Hi, On 10/11/24 17:31, Patrick Delaunay wrote: Move the stm32mp1 data cache reconfiguration after the lmb init call board_r::initr_lmb to allow parsing of the reserved region with no-map tag. After this patch the DDR is not fully mapped up to arch_early_init_r() call, only the relocation region is mapped, but it is enough for the first board_r initialization phases; later, when arch_early_init_r() is called, the LMB is already initialized and the function lmb_is_reserved_flags() function is functional, this LMB function is called in the weak function dram_bank_mmu_setup() when dcache_enable() is executed. Without this change, as LMB is not initialized when it is used in dram_bank_mmu_setup, the OP-TEE region is mapped cache-able by U-Boot and we have some firewall violation since "LMB memory map global and persistent" series. Fixes: ed17a33fed29 ("lmb: make LMB memory map persistent and global") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Kconfig| 2 ++ arch/arm/mach-stm32mp/stm32mp1/cpu.c | 7 +++ 2 files changed, 9 insertions(+) Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH 1/4] stm32mp: compute ram_top based on the optee base address only for STM32MP1
Hi On 10/11/24 17:31, Patrick Delaunay wrote: Reserved memory for OP-TEE is located at end of DDR for STM32MP1 SoC only (STM32MP13 and STM32MP15) and the OP-TEE reserved memory is located at the beginning of DDR for STM32MP25 SoC, before CONFIG_TEXT_BASE and with reserved memory for companion coprocessor. So the ram_top is limited by OP-TEE reserved memory only for STM32MP1 SoC. This patch solves an issue for ram_top value on STM32MP25 SoC because the generic reserved memory management, based on LMB, is no more used before relocation. Fixes: 8242f14a3e6f ("stm32mp: compute ram_top based on the optee base address") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/dram_init.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH] stm32mp: cosmetic: remove empty comment block in configs file
Hi, On 10/16/24 19:54, Patrick Delaunay wrote: This is cosmetic change. Remove the empty comment blocks remaining after conversion to Kconfig of CONFIG_SYS_MAX_NAND_DEVICE and CONFIG_SERVERIP. Signed-off-by: Patrick Delaunay --- include/configs/stm32mp13_common.h | 2 -- include/configs/stm32mp15_common.h | 4 2 files changed, 6 deletions(-) diff --git a/include/configs/stm32mp13_common.h b/include/configs/stm32mp13_common.h index 5b0658ced927..3e3f49abae06 100644 --- a/include/configs/stm32mp13_common.h +++ b/include/configs/stm32mp13_common.h @@ -21,8 +21,6 @@ */ #define CFG_SYS_BOOTMAPSZ SZ_256M -/* NAND support */ - /*/ #ifdef CONFIG_DISTRO_DEFAULTS /*/ diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h index af6dd4a8095a..9cac31bcf472 100644 --- a/include/configs/stm32mp15_common.h +++ b/include/configs/stm32mp15_common.h @@ -21,10 +21,6 @@ */ #define CFG_SYS_BOOTMAPSZ SZ_256M -/* NAND support */ - -/* Ethernet need */ - #define STM32MP_FIP_IMAGE_GUID \ EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \ 0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5) minor cosmetic Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH v2] ARM: stm32: Add script to install U-Boot from SD/eMMC to SPI NOR on DH STM32MP15xx DHSOM
Hi, On 10/12/24 04:54, Marek Vasut wrote: Make the dh_update_sd_to_sf script generic, rename it to dh_update_block_to_sf and implement two specific dh_update_sd_to_sf and dh_update_emmc_to_sf scripts which load U-Boot from either SD or eMMC and install it into SPI NOR. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: Rename dh_update_sdmmc_to_sf to dh_update_block_to_sf --- include/configs/stm32mp15_dh_dhsom.h | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2 1/3] ARM: dts: stm32: Duplicate cpu0-opp-table node into stm32mp15-u-boot.dtsi
Hi, On 10/11/24 19:57, Patrick DELAUNAY wrote: Hi, On 10/5/24 03:15, Marek Vasut wrote: The cpu0-opp-table {} node does not exist in upstream Linux stm32mp151.dtsi file, in order to enable conversion to OF_UPSTREAM, duplicate the node from current U-Boot stm32mp151.dtsi into stm32mp15-u-boot.dtsi. This makes STM32 DTs buildable even with OF_UPSTREAM enabled. No functional change, since the current U-Boot stm32mp151.dtsi already contains the cpu0-opp-table {} node, stm32mp15-u-boot.dtsi is applied at the end, and does not bring in any new content. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: No change --- arch/arm/dts/stm32mp15-u-boot.dtsi | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) Sorry for previous message, Re: [PATCH 1/3] ARM: dts: stm32: Duplicate cpu0-opp-table node into stm32mp15-u-boot.dtsi I answered on V1 by error. Reviewed-by: Patrick Delaunay Thanks Patrick Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH v2 3/3] ARM: dts: stm32: Generate u-boot.itb using binman on DH STM32 DHSOM
Hi, On 10/11/24 20:15, Patrick DELAUNAY wrote: Hi, On 10/5/24 03:15, Marek Vasut wrote: Describe the u-boot.its generation in stm32mp15xx-dhsom-u-boot.dtsi binman {} DT node as a replacement for current CONFIG_SPL_FIT_SOURCE use, dispose of both u-boot-dhcom.its and u-boot-dhcor.its. Use fdt-SEQ/config-SEQ to generate a list of fdt-N fitImage images {} and matching configuration {} node entries. The configuration node entry names no longer encode _somrevN_boardrevN suffix, which was never really used, so drop this functionality by default. Rework board_fit_config_name_match() to match on the new configuration node entry names. Users who do need the match on _somrevN_boardrevN can either replace the fdt-SEQ/config-SEQ with fixed fdt-N/config-N nodes which each encode the matching 'description = "NAME_somrevN_boardrevN"' to restore the old behavior verbatim, or better use SPL DT overlays for U-Boot control DT the same way e.g. i.MX8MP DHCOM does to support multiple SoM and board variants. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: No change --- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 1 + arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 1 + arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi | 53 +++ board/dhelectronics/dh_stm32mp1/board.c | 19 +++- .../dh_stm32mp1/u-boot-dhcom.its | 91 --- .../dh_stm32mp1/u-boot-dhcor.its | 70 -- configs/stm32mp15_dhcom_basic_defconfig | 2 - configs/stm32mp15_dhcor_basic_defconfig | 2 - 8 files changed, 70 insertions(+), 169 deletions(-) create mode 100644 arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi delete mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its delete mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its Nice, I discover the binman FIT Substitutions with N / SEQ Reviewed-by: Patrick Delaunay Thanks Patrick Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH v2 2/3] ARM: dts: stm32: Switch to using upstream DT on DH STM32 DHSOM
Hi, On 10/11/24 19:54, Patrick DELAUNAY wrote: Hi, On 10/5/24 03:15, Marek Vasut wrote: Enable OF_UPSTREAM to use upstream DT and add st/ prefix to the DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/ including *-u-boot.dtsi from arch/$(ARCH)/dts/ directory. The previous setup used generic SoC prefix like stm32mp15xx-dhco* for generic DTs which could be used on any STM32MP15xx DHSOM variant. The new setup uses specific SoC prefix stm32mp157c-dhco* to match Linux DT names. Since the hardware present on STM32MP153 and STM32MP157 is not enabled in the board configuration and not supported by U-Boot except for the DSI host, using the existing Linux DTs poses no issue even on plain STM32MP151A based SoMs. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: - Drop arch/arm/dts/Makefile entries - Convert stm32mp135f-dhcom-dhsbc --- arch/arm/dts/Makefile | 9 +- arch/arm/dts/stm32mp135f-dhcor-dhsbc.dts | 383 ...> stm32mp151a-dhcor-testbench-u-boot.dtsi} | 0 ...si => stm32mp153c-dhcom-drc02-u-boot.dtsi} | 0 ...stm32mp153c-dhcor-drc-compact-u-boot.dtsi} | 0 ...> stm32mp157a-dhcor-avenger96-u-boot.dtsi} | 0 ...tsi => stm32mp157c-dhcom-pdk2-u-boot.dtsi} | 0 ... => stm32mp157c-dhcom-picoitx-u-boot.dtsi} | 0 arch/arm/dts/stm32mp15xx-dhcom-drc02.dts | 17 - arch/arm/dts/stm32mp15xx-dhcom-drc02.dtsi | 169 -- arch/arm/dts/stm32mp15xx-dhcom-pdk2.dts | 17 - arch/arm/dts/stm32mp15xx-dhcom-pdk2.dtsi | 329 --- arch/arm/dts/stm32mp15xx-dhcom-picoitx.dts | 17 - arch/arm/dts/stm32mp15xx-dhcom-picoitx.dtsi | 151 - arch/arm/dts/stm32mp15xx-dhcom-som.dtsi | 544 -- arch/arm/dts/stm32mp15xx-dhcor-avenger96.dts | 20 - arch/arm/dts/stm32mp15xx-dhcor-avenger96.dtsi | 437 -- .../arm/dts/stm32mp15xx-dhcor-drc-compact.dts | 18 - .../dts/stm32mp15xx-dhcor-drc-compact.dtsi | 326 --- arch/arm/dts/stm32mp15xx-dhcor-io1v8.dtsi | 28 - arch/arm/dts/stm32mp15xx-dhcor-som.dtsi | 221 --- arch/arm/dts/stm32mp15xx-dhcor-testbench.dts | 180 -- .../dh_stm32mp1/u-boot-dhcom.its | 18 +- .../dh_stm32mp1/u-boot-dhcor.its | 12 +- configs/stm32mp13_dhcor_defconfig | 3 +- configs/stm32mp15_dhcom_basic_defconfig | 5 +- configs/stm32mp15_dhcor_basic_defconfig | 5 +- 27 files changed, 24 insertions(+), 2885 deletions(-) delete mode 100644 arch/arm/dts/stm32mp135f-dhcor-dhsbc.dts rename arch/arm/dts/{stm32mp15xx-dhcor-testbench-u-boot.dtsi => stm32mp151a-dhcor-testbench-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-drc02-u-boot.dtsi => stm32mp153c-dhcom-drc02-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcor-drc-compact-u-boot.dtsi => stm32mp153c-dhcor-drc-compact-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcor-avenger96-u-boot.dtsi => stm32mp157a-dhcor-avenger96-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-pdk2-u-boot.dtsi => stm32mp157c-dhcom-pdk2-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-picoitx-u-boot.dtsi => stm32mp157c-dhcom-picoitx-u-boot.dtsi} (100%) delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-drc02.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-drc02.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-pdk2.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-pdk2.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-picoitx.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-picoitx.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-som.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-avenger96.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-avenger96.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-drc-compact.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-drc-compact.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-io1v8.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-som.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-testbench.dts Nice. Reviewed-by: Patrick Delaunay Thanks Patrick Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH v2] ARM: stm32: Update MAINTAINERS file globs for STM32MP DHSOM
Hi, On 10/5/24 01:56, Marek Vasut wrote: Update the MAINTAINERS file glob to cover all of STM32MP DHSOM related files. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: Use multiple N: instead of multiple F: --- board/dhelectronics/dh_stm32mp1/MAINTAINERS | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH] ARM: stm32: Add script to install U-Boot from SD/eMMC to SPI NOR on DH STM32MP15xx DHSOM
Hi, On 10/12/24 05:01, Marek Vasut wrote: On 10/11/24 5:30 PM, Patrick DELAUNAY wrote: Hi, Hi, On 9/30/24 21:23, Marek Vasut wrote: Make the dh_update_sd_to_sf script generic, rename it to dh_update_sdmmc_to_sf and implement two specific dh_update_sd_to_sf and dh_update_emmc_to_sf scripts which load U-Boot from either SD or eMMC and install it into SPI NOR. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- include/configs/stm32mp15_dh_dhsom.h | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/ stm32mp15_dh_dhsom.h index de39b19219d..fa759c938b3 100644 --- a/include/configs/stm32mp15_dh_dhsom.h +++ b/include/configs/stm32mp15_dh_dhsom.h @@ -38,16 +38,26 @@ "setenv loadaddr1 && " \ "setenv sblkcnt && " \ "setenv ublkcnt\0" \ - "dh_update_sd_to_sf=" /* Erase SPI NOR and install U-Boot from SD */ \ + "dh_update_sdmmc_to_sf=" /* Erase SPI NOR and install U-Boot from SD/eMMC */ \ "setexpr loadaddr1 ${loadaddr} + 0x100 && " \ - "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && " \ + "load ${dh_update_iface} ${dh_update_dev} " \ + "${loadaddr1} /boot/u-boot-spl.stm32 && " \ "env set filesize1 ${filesize} && " \ - "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && " \ + "load ${dh_update_iface} ${dh_update_dev} " \ + "${loadaddr} /boot/u-boot.itb && " \ "sf probe && sf erase 0 0x20 && " \ "sf update ${loadaddr1} 0 ${filesize1} && " \ "sf update ${loadaddr1} 0x4 ${filesize1} && " \ "sf update ${loadaddr} 0x8 ${filesize} && " \ "env set filesize1 && env set loadaddr1\0" \ + "dh_update_sd_to_sf=" /* Erase SPI NOR and install U-Boot from SD */ \ + "setenv dh_update_iface mmc && " \ + "setenv dh_update_dev 0:4 && " \ + "run dh_update_sdmmc_to_sf\0" \ + "dh_update_emmc_to_sf=" /* Erase SPI NOR and install U-Boot from eMMC */ \ + "setenv dh_update_iface mmc && " \ + "setenv dh_update_dev 1:4 && " \ + "run dh_update_sdmmc_to_sf\0" \ "stdin=serial\0" \ "stdout=serial\0" \ "stderr=serial\0" \ ok I will merge it as it with 2 minor question a) it is strange to define interface variable for macro but use only with "mmc" device with setenv dh_update_iface mmc it can be simplified with "load mmc ${dh_update_dev} or it is to prepare other device then "mmc" . The later, I now also renamed the script in V2 to make it more obvious. ok b) you are using "sf" command and not "mtd" to udpate SPI NOR ? the MTD command allows to use the MTD partition name, defined in DT, so no need to know offset in script (and avoid "sf probe") mtd erase fsbl1; mtd write fsbl1 ${loadaddr1} 0 ${filesize1} \ mtd erase fsbl2; mtd write fsbl2 ${loadaddr1} 0 ${filesize1} \ mtd erase uboot; mtd write uboot ${loadaddr} 0 ${filesize} Can you also do 'sf update' alike operation with 'mtd' command? I don't think you can. The 'sf update' often does significantly speed up the SPI NOR update process, because SPI NOR erase operation is very slow, while SPI NOR read operation is fast, so if the update can read and then skip many blocks which are already in the SPI NOR and erase and write only the changed blocks, the update is often very fast too. Good point an improve place for MTD command I will try to propose something for mtd command and for the patch Applied to u-boot-stm/master, thanks! Regards Patrick
[PATCH] stm32mp: cosmetic: remove empty comment block in configs file
This is cosmetic change. Remove the empty comment blocks remaining after conversion to Kconfig of CONFIG_SYS_MAX_NAND_DEVICE and CONFIG_SERVERIP. Signed-off-by: Patrick Delaunay --- include/configs/stm32mp13_common.h | 2 -- include/configs/stm32mp15_common.h | 4 2 files changed, 6 deletions(-) diff --git a/include/configs/stm32mp13_common.h b/include/configs/stm32mp13_common.h index 5b0658ced927..3e3f49abae06 100644 --- a/include/configs/stm32mp13_common.h +++ b/include/configs/stm32mp13_common.h @@ -21,8 +21,6 @@ */ #define CFG_SYS_BOOTMAPSZ SZ_256M -/* NAND support */ - /*/ #ifdef CONFIG_DISTRO_DEFAULTS /*/ diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h index af6dd4a8095a..9cac31bcf472 100644 --- a/include/configs/stm32mp15_common.h +++ b/include/configs/stm32mp15_common.h @@ -21,10 +21,6 @@ */ #define CFG_SYS_BOOTMAPSZ SZ_256M -/* NAND support */ - -/* Ethernet need */ - #define STM32MP_FIP_IMAGE_GUID \ EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \ 0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5) -- 2.25.1
Re: [PATCH v2 3/3] ARM: dts: stm32: Generate u-boot.itb using binman on DH STM32 DHSOM
Hi, On 10/5/24 03:15, Marek Vasut wrote: Describe the u-boot.its generation in stm32mp15xx-dhsom-u-boot.dtsi binman {} DT node as a replacement for current CONFIG_SPL_FIT_SOURCE use, dispose of both u-boot-dhcom.its and u-boot-dhcor.its. Use fdt-SEQ/config-SEQ to generate a list of fdt-N fitImage images {} and matching configuration {} node entries. The configuration node entry names no longer encode _somrevN_boardrevN suffix, which was never really used, so drop this functionality by default. Rework board_fit_config_name_match() to match on the new configuration node entry names. Users who do need the match on _somrevN_boardrevN can either replace the fdt-SEQ/config-SEQ with fixed fdt-N/config-N nodes which each encode the matching 'description = "NAME_somrevN_boardrevN"' to restore the old behavior verbatim, or better use SPL DT overlays for U-Boot control DT the same way e.g. i.MX8MP DHCOM does to support multiple SoM and board variants. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: No change --- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi| 1 + arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi| 1 + arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi| 53 +++ board/dhelectronics/dh_stm32mp1/board.c | 19 +++- .../dh_stm32mp1/u-boot-dhcom.its | 91 --- .../dh_stm32mp1/u-boot-dhcor.its | 70 -- configs/stm32mp15_dhcom_basic_defconfig | 2 - configs/stm32mp15_dhcor_basic_defconfig | 2 - 8 files changed, 70 insertions(+), 169 deletions(-) create mode 100644 arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi delete mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its delete mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its Nice, I discover the binman FIT Substitutions with N / SEQ Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2 1/3] ARM: dts: stm32: Duplicate cpu0-opp-table node into stm32mp15-u-boot.dtsi
Hi, On 10/5/24 03:15, Marek Vasut wrote: The cpu0-opp-table {} node does not exist in upstream Linux stm32mp151.dtsi file, in order to enable conversion to OF_UPSTREAM, duplicate the node from current U-Boot stm32mp151.dtsi into stm32mp15-u-boot.dtsi. This makes STM32 DTs buildable even with OF_UPSTREAM enabled. No functional change, since the current U-Boot stm32mp151.dtsi already contains the cpu0-opp-table {} node, stm32mp15-u-boot.dtsi is applied at the end, and does not bring in any new content. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: No change --- arch/arm/dts/stm32mp15-u-boot.dtsi | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) Sorry for previous message, Re: [PATCH 1/3] ARM: dts: stm32: Duplicate cpu0-opp-table node into stm32mp15-u-boot.dtsi I answered on V1 by error. Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2 2/3] ARM: dts: stm32: Switch to using upstream DT on DH STM32 DHSOM
Hi, On 10/5/24 03:15, Marek Vasut wrote: Enable OF_UPSTREAM to use upstream DT and add st/ prefix to the DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/ including *-u-boot.dtsi from arch/$(ARCH)/dts/ directory. The previous setup used generic SoC prefix like stm32mp15xx-dhco* for generic DTs which could be used on any STM32MP15xx DHSOM variant. The new setup uses specific SoC prefix stm32mp157c-dhco* to match Linux DT names. Since the hardware present on STM32MP153 and STM32MP157 is not enabled in the board configuration and not supported by U-Boot except for the DSI host, using the existing Linux DTs poses no issue even on plain STM32MP151A based SoMs. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: - Drop arch/arm/dts/Makefile entries - Convert stm32mp135f-dhcom-dhsbc --- arch/arm/dts/Makefile | 9 +- arch/arm/dts/stm32mp135f-dhcor-dhsbc.dts | 383 ...> stm32mp151a-dhcor-testbench-u-boot.dtsi} | 0 ...si => stm32mp153c-dhcom-drc02-u-boot.dtsi} | 0 ...stm32mp153c-dhcor-drc-compact-u-boot.dtsi} | 0 ...> stm32mp157a-dhcor-avenger96-u-boot.dtsi} | 0 ...tsi => stm32mp157c-dhcom-pdk2-u-boot.dtsi} | 0 ... => stm32mp157c-dhcom-picoitx-u-boot.dtsi} | 0 arch/arm/dts/stm32mp15xx-dhcom-drc02.dts | 17 - arch/arm/dts/stm32mp15xx-dhcom-drc02.dtsi | 169 -- arch/arm/dts/stm32mp15xx-dhcom-pdk2.dts | 17 - arch/arm/dts/stm32mp15xx-dhcom-pdk2.dtsi | 329 --- arch/arm/dts/stm32mp15xx-dhcom-picoitx.dts| 17 - arch/arm/dts/stm32mp15xx-dhcom-picoitx.dtsi | 151 - arch/arm/dts/stm32mp15xx-dhcom-som.dtsi | 544 -- arch/arm/dts/stm32mp15xx-dhcor-avenger96.dts | 20 - arch/arm/dts/stm32mp15xx-dhcor-avenger96.dtsi | 437 -- .../arm/dts/stm32mp15xx-dhcor-drc-compact.dts | 18 - .../dts/stm32mp15xx-dhcor-drc-compact.dtsi| 326 --- arch/arm/dts/stm32mp15xx-dhcor-io1v8.dtsi | 28 - arch/arm/dts/stm32mp15xx-dhcor-som.dtsi | 221 --- arch/arm/dts/stm32mp15xx-dhcor-testbench.dts | 180 -- .../dh_stm32mp1/u-boot-dhcom.its | 18 +- .../dh_stm32mp1/u-boot-dhcor.its | 12 +- configs/stm32mp13_dhcor_defconfig | 3 +- configs/stm32mp15_dhcom_basic_defconfig | 5 +- configs/stm32mp15_dhcor_basic_defconfig | 5 +- 27 files changed, 24 insertions(+), 2885 deletions(-) delete mode 100644 arch/arm/dts/stm32mp135f-dhcor-dhsbc.dts rename arch/arm/dts/{stm32mp15xx-dhcor-testbench-u-boot.dtsi => stm32mp151a-dhcor-testbench-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-drc02-u-boot.dtsi => stm32mp153c-dhcom-drc02-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcor-drc-compact-u-boot.dtsi => stm32mp153c-dhcor-drc-compact-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcor-avenger96-u-boot.dtsi => stm32mp157a-dhcor-avenger96-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-pdk2-u-boot.dtsi => stm32mp157c-dhcom-pdk2-u-boot.dtsi} (100%) rename arch/arm/dts/{stm32mp15xx-dhcom-picoitx-u-boot.dtsi => stm32mp157c-dhcom-picoitx-u-boot.dtsi} (100%) delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-drc02.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-drc02.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-pdk2.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-pdk2.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-picoitx.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-picoitx.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcom-som.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-avenger96.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-avenger96.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-drc-compact.dts delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-drc-compact.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-io1v8.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-som.dtsi delete mode 100644 arch/arm/dts/stm32mp15xx-dhcor-testbench.dts Nice. Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 1/3] ARM: dts: stm32: Duplicate cpu0-opp-table node into stm32mp15-u-boot.dtsi
Hi, On 10/5/24 00:57, Marek Vasut wrote: The cpu0-opp-table {} node does not exist in upstream Linux stm32mp151.dtsi file, in order to enable conversion to OF_UPSTREAM, duplicate the node from current U-Boot stm32mp151.dtsi into stm32mp15-u-boot.dtsi. This makes STM32 DTs buildable even with OF_UPSTREAM enabled. No functional change, since the current U-Boot stm32mp151.dtsi already contains the cpu0-opp-table {} node, stm32mp15-u-boot.dtsi is applied at the end, and does not bring in any new content. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- arch/arm/dts/stm32mp15-u-boot.dtsi | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/arm/dts/stm32mp15-u-boot.dtsi b/arch/arm/dts/stm32mp15-u-boot.dtsi index fe56f05616a..66d4c40c6a8 100644 --- a/arch/arm/dts/stm32mp15-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15-u-boot.dtsi @@ -56,6 +56,24 @@ status = "okay"; }; }; + + cpu0_opp_table: cpu0-opp-table { + compatible = "operating-points-v2"; + opp-shared; + bootph-pre-ram; + opp-65000 { + bootph-pre-ram; + opp-hz = /bits/ 64 <65000>; + opp-microvolt = <120>; + opp-supported-hw = <0x1>; + }; + opp-8 { + bootph-pre-ram; + opp-hz = /bits/ 64 <8>; + opp-microvolt = <135>; + opp-supported-hw = <0x2>; + }; + }; }; &bsec { @@ -82,14 +100,10 @@ bootph-all; }; -&cpu0_opp_table { - bootph-pre-ram; - opp-65000 { - bootph-pre-ram; - }; - opp-8 { - bootph-pre-ram; - }; +&cpu0 { + nvmem-cells = <&part_number_otp>; + nvmem-cell-names = "part_number"; + operating-points-v2 = <&cpu0_opp_table>; }; &gpioa { Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2] ARM: stm32: Update MAINTAINERS file globs for STM32MP DHSOM
On 10/5/24 01:56, Marek Vasut wrote: Update the MAINTAINERS file glob to cover all of STM32MP DHSOM related files. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: Use multiple N: instead of multiple F: --- board/dhelectronics/dh_stm32mp1/MAINTAINERS | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/board/dhelectronics/dh_stm32mp1/MAINTAINERS b/board/dhelectronics/dh_stm32mp1/MAINTAINERS index 865588f5b8b..fdd579013a0 100644 --- a/board/dhelectronics/dh_stm32mp1/MAINTAINERS +++ b/board/dhelectronics/dh_stm32mp1/MAINTAINERS @@ -2,8 +2,5 @@ DH_STM32MP1_PDK2 BOARD M:Marek Vasut L:u-b...@dh-electronics.com S:Maintained -F: arch/arm/dts/stm32mp15xx-dhcom* -F: board/dhelectronics/dh_stm32mp1/ -F: configs/stm32mp15_dhcom_basic_defconfig -F: configs/stm32mp15_dhcor_basic_defconfig -F: include/configs/stm32mp15_dh_dhsom.h +N: stm32mp.*dh[cs]o +N: dh_stm32 Reviewed-by: Patrick Delaunay Thanks Patrick
[PATCH 0/4] stm32mp: fix boot issue with OP-TEE
The series fix several issues for STM32MP15 boot with OP-TEE (data abort and ETZPC firewall exception) and regressions for STM32MP25 support. Patrick Delaunay (4): stm32mp: compute ram_top based on the optee base address only for STM32MP1 ARM: stm32mp: enable data cache after LMB configuration for STM32MP1 doc: clarify scmi device tree for stm32mp15 boards stm32mp: fix name of optee reserved memory node arch/arm/mach-stm32mp/Kconfig| 2 ++ arch/arm/mach-stm32mp/dram_init.c| 19 ++- arch/arm/mach-stm32mp/stm32mp1/cpu.c | 7 +++ doc/board/st/stm32mp1.rst| 25 ++--- 4 files changed, 45 insertions(+), 8 deletions(-) -- 2.25.1
[PATCH 2/4] ARM: stm32mp: enable data cache after LMB configuration for STM32MP1
Move the stm32mp1 data cache reconfiguration after the lmb init call board_r::initr_lmb to allow parsing of the reserved region with no-map tag. After this patch the DDR is not fully mapped up to arch_early_init_r() call, only the relocation region is mapped, but it is enough for the first board_r initialization phases; later, when arch_early_init_r() is called, the LMB is already initialized and the function lmb_is_reserved_flags() function is functional, this LMB function is called in the weak function dram_bank_mmu_setup() when dcache_enable() is executed. Without this change, as LMB is not initialized when it is used in dram_bank_mmu_setup, the OP-TEE region is mapped cache-able by U-Boot and we have some firewall violation since "LMB memory map global and persistent" series. Fixes: ed17a33fed29 ("lmb: make LMB memory map persistent and global") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Kconfig| 2 ++ arch/arm/mach-stm32mp/stm32mp1/cpu.c | 7 +++ 2 files changed, 9 insertions(+) diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index d5934a927717..25663a99464d 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -39,6 +39,7 @@ choice config STM32MP13X bool "Support STMicroelectronics STM32MP13x Soc" + select ARCH_EARLY_INIT_R select ARM_SMCCC select CPU_V7A select CPU_V7_HAS_NONSEC @@ -57,6 +58,7 @@ config STM32MP13X config STM32MP15X bool "Support STMicroelectronics STM32MP15x Soc" + select ARCH_EARLY_INIT_R select ARCH_SUPPORT_PSCI select BINMAN select CPU_V7A diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index 64480da9f8d8..0b60e27a804d 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -143,6 +143,11 @@ void enable_caches(void) { /* I-cache is already enabled in start.S: icache_enable() not needed */ + /* keep D-cache configuration done before relocation, wait arch_early_init_r*/ +} + +int arch_early_init_r(void) +{ /* deactivate the data cache, early enabled in arch_cpu_init() */ dcache_disable(); /* @@ -150,6 +155,8 @@ void enable_caches(void) * warning: the TLB location udpated in board_f.c::reserve_mmu */ dcache_enable(); + + return 0; } static void setup_boot_mode(void) -- 2.25.1
[PATCH 3/4] doc: clarify scmi device tree for stm32mp15 boards
Clarify the usage of SCMI specific device tree to use with stm32mp15_defconfig and with OP-TEE. Signed-off-by: Patrick Delaunay --- doc/board/st/stm32mp1.rst | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/board/st/stm32mp1.rst b/doc/board/st/stm32mp1.rst index 63b44776ffc1..8cf712992336 100644 --- a/doc/board/st/stm32mp1.rst +++ b/doc/board/st/stm32mp1.rst @@ -180,22 +180,41 @@ Each STMicroelectronics board is only configured with the associated device tree STM32MP15x device Tree Selection -The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig and stm32mp15_basic_defconfig) are: +The supported device trees for STM32MP15x (**stm32mp15_defconfig** for TF-A_ +with FIP support) are: + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1) + + **stm32mp157c-ev1-scmi** + stm32mp157c-ev1 + ed1: daughter board with pmic stpmic1 + + **stm32mp157c-ed1-scmi** + stm32mp157c-ed1 + dk1: Discovery board + + **stm32mp157a-dk1-scmi** + stm32mp157a-dk1 + dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel + + **stm32mp157c-dk2-scmi** + + stm32mp157c-dk2 + +The scmi variant of each device tree is only supported with OP-TEE as secure +monitor and it is the configuration **recommended** by STMicroelectronics for +product, with secured system resources (RCC_TZCR.TZEN=1). + +The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig +TF-A without FIP support and stm32mp15_basic_defconfig with SPL) are: + ++ the same STMicroelectronics boards with the no scmi device tree files: + + + stm32mp157c-ev1 + + stm32mp157c-ed1 + + stm32mp157a-dk1 + stm32mp157c-dk2 + avenger96: Avenger96 board from Arrow Electronics based on DH Elec. DHCOR SoM @@ -204,11 +223,11 @@ The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig and stm32 STM32MP13x device Tree Selection -The supported device trees for STM32MP13x (stm32mp13_defconfig) are: +The supported device trees for STM32MP13x (**stm32mp13_defconfig**) are: + dk: Discovery board - + stm32mp135f-dk + + **stm32mp135f-dk** Build Procedure -- 2.25.1
[PATCH 4/4] stm32mp: fix name of optee reserved memory node
In OP-TEE, the "optee_core@" node is reserved, appended in non secure device tree (see mark_tzdram_as_reserved() function under CFG_DT) so this name must be checked in optee_get_reserved_memory(). We keep the check on /reserved-memory/optee@ node to have backward compatibility with STMT32Image booting, when the reserved node is already present in U-Boot or SPL device tree with name "optee@". This patch solves a boot issue on board with OP-TEE for U-Boot compiled with stm32mp15_defconfig and without secure configuration device tree (stm32mp157c-dk2.dts for example). Fixes: 5fe9e0deabb1 ("stm32mp: allow calling optee_get_reserved_memory() from U-Boot") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/dram_init.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index 58290105d127..6a36aecf5cd3 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -25,8 +25,11 @@ int optee_get_reserved_memory(u32 *start, u32 *size) ofnode node; node = ofnode_path("/reserved-memory/optee"); - if (!ofnode_valid(node)) - return -ENOENT; + if (!ofnode_valid(node)) { + node = ofnode_path("/reserved-memory/optee_core"); + if (!ofnode_valid(node)) + return -ENOENT; + } fdt_start = ofnode_get_addr_size(node, "reg", &fdt_mem_size); *start = fdt_start; -- 2.25.1
[PATCH 1/4] stm32mp: compute ram_top based on the optee base address only for STM32MP1
Reserved memory for OP-TEE is located at end of DDR for STM32MP1 SoC only (STM32MP13 and STM32MP15) and the OP-TEE reserved memory is located at the beginning of DDR for STM32MP25 SoC, before CONFIG_TEXT_BASE and with reserved memory for companion coprocessor. So the ram_top is limited by OP-TEE reserved memory only for STM32MP1 SoC. This patch solves an issue for ram_top value on STM32MP25 SoC because the generic reserved memory management, based on LMB, is no more used before relocation. Fixes: 8242f14a3e6f ("stm32mp: compute ram_top based on the optee base address") Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/dram_init.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index 198785353f13..58290105d127 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -62,7 +62,6 @@ int dram_init(void) phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { - int ret; phys_size_t size; phys_addr_t reg; u32 optee_start, optee_size; @@ -75,10 +74,17 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) * if the effective available memory is bigger */ gd->ram_top = clamp_val(gd->ram_top, 0, SZ_4G - 1); + + /* add 8M for U-Boot reserved memory: display, fdt, gd,... */ size = ALIGN(SZ_8M + CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE); - ret = optee_get_reserved_memory(&optee_start, &optee_size); - reg = (!ret ? optee_start : gd->ram_top) - size; + reg = gd->ram_top - size; + + /* Reserved memory for OP-TEE at END of DDR for STM32MP1 SoC */ + if (IS_ENABLED(CONFIG_STM32MP13X) || IS_ENABLED(CONFIG_STM32MP15X)) { + if (!optee_get_reserved_memory(&optee_start, &optee_size)) + reg = ALIGN(optee_start - size, MMU_SECTION_SIZE); + } /* before relocation, mark the U-Boot memory as cacheable by default */ if (!(gd->flags & GD_FLG_RELOC)) -- 2.25.1
Re: [PATCH] ARM: stm32: Add script to install U-Boot from SD/eMMC to SPI NOR on DH STM32MP15xx DHSOM
Hi, On 9/30/24 21:23, Marek Vasut wrote: Make the dh_update_sd_to_sf script generic, rename it to dh_update_sdmmc_to_sf and implement two specific dh_update_sd_to_sf and dh_update_emmc_to_sf scripts which load U-Boot from either SD or eMMC and install it into SPI NOR. Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- include/configs/stm32mp15_dh_dhsom.h | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h index de39b19219d..fa759c938b3 100644 --- a/include/configs/stm32mp15_dh_dhsom.h +++ b/include/configs/stm32mp15_dh_dhsom.h @@ -38,16 +38,26 @@ "setenv loadaddr1 && "\ "setenv sblkcnt && " \ "setenv ublkcnt\0"\ - "dh_update_sd_to_sf=" /* Erase SPI NOR and install U-Boot from SD */ \ + "dh_update_sdmmc_to_sf=" /* Erase SPI NOR and install U-Boot from SD/eMMC */ \ "setexpr loadaddr1 ${loadaddr} + 0x100 && " \ - "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "\ + "load ${dh_update_iface} ${dh_update_dev} " \ + "${loadaddr1} /boot/u-boot-spl.stm32 && " \ "env set filesize1 ${filesize} && " \ - "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && " \ + "load ${dh_update_iface} ${dh_update_dev} " \ + "${loadaddr} /boot/u-boot.itb && "\ "sf probe && sf erase 0 0x20 && " \ "sf update ${loadaddr1} 0 ${filesize1} && " \ "sf update ${loadaddr1} 0x4 ${filesize1} && " \ "sf update ${loadaddr} 0x8 ${filesize} && " \ "env set filesize1 && env set loadaddr1\0"\ + "dh_update_sd_to_sf=" /* Erase SPI NOR and install U-Boot from SD */ \ + "setenv dh_update_iface mmc && " \ + "setenv dh_update_dev 0:4 && "\ + "run dh_update_sdmmc_to_sf\0" \ + "dh_update_emmc_to_sf=" /* Erase SPI NOR and install U-Boot from eMMC */ \ + "setenv dh_update_iface mmc && " \ + "setenv dh_update_dev 1:4 && "\ + "run dh_update_sdmmc_to_sf\0" \ "stdin=serial\0" \ "stdout=serial\0" \ "stderr=serial\0" \ ok I will merge it as it with 2 minor question a) it is strange to define interface variable for macro but use only with "mmc" device with setenv dh_update_iface mmc it can be simplified with "load mmc ${dh_update_dev} or it is to prepare other device then "mmc" . b) you are using "sf" command and not "mtd" to udpate SPI NOR ? the MTD command allows to use the MTD partition name, defined in DT, so no need to know offset in script (and avoid "sf probe") mtd erase fsbl1; mtd write fsbl1 ${loadaddr1} 0 ${filesize1} \ mtd erase fsbl2; mtd write fsbl2 ${loadaddr1} 0 ${filesize1} \ mtd erase uboot; mtd write uboot ${loadaddr} 0 ${filesize} Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH] ARM: stm32: Fix TAMP_SMCR BKP..PROT fields on STM32MP15xx
Hi, On 6/19/24 08:35, Patrice CHOTARD wrote: On 6/19/24 00:57, Marek Vasut wrote: Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS. Fixes: 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx") Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c index f096fe538d8..ca202bec8ee 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c @@ -148,8 +148,8 @@ static void security_init(void) */ clrsetbits_le32(TAMP_SMCR, TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT, - FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) | - FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20)); + FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) | + FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F)); /* GPIOZ: deactivate the security */ writel(BIT(0), RCC_MP_AHB5ENSETR); Reviewed-by: Patrice Chotard Thanks Patrice Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH] ARM: stm32: Fix secure_waitbits() mask check
On 9/25/24 19:37, Patrick DELAUNAY wrote: Hi Marek, On 7/8/24 13:43, Marek Vasut wrote: Do not apply bitwise AND to register value and expected value, only apply bitwise AND to register value and mask, and only then compare the result with expected value that the function polls for. Fixes: b49105320a5b ("stm32mp: psci: Implement PSCI system suspend and DRAM SSR") Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- arch/arm/mach-stm32mp/stm32mp1/psci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/psci.c b/arch/arm/mach-stm32mp/stm32mp1/psci.c index e99103910d9..ffdafea464d 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/psci.c +++ b/arch/arm/mach-stm32mp/stm32mp1/psci.c @@ -393,8 +393,7 @@ static int __secure secure_waitbits(u32 reg, u32 mask, u32 val) asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (start)); for (;;) { tmp = readl(reg); - tmp &= mask; - if ((tmp & val) == val) + if ((tmp & mask) == val) return 0; asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (end)); if ((end - start) > delay) Reviewed-by: Patrick Delaunay Thanks Patrick Applied to u-boot-stm/master, thanks! Regards Patrick
Re: [PATCH] ARM: stm32: Fix TAMP_SMCR BKP..PROT fields on STM32MP15xx
Hi Marek, On 9/25/24 19:04, Marek Vasut wrote: On 6/19/24 8:35 AM, Patrice CHOTARD wrote: On 6/19/24 00:57, Marek Vasut wrote: Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS. Fixes: 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx") Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c index f096fe538d8..ca202bec8ee 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c @@ -148,8 +148,8 @@ static void security_init(void) */ clrsetbits_le32(TAMP_SMCR, TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT, - FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) | - FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20)); + FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) | + FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F)); /* GPIOZ: deactivate the security */ writel(BIT(0), RCC_MP_AHB5ENSETR); Reviewed-by: Patrice Chotard I hope this bugfix will make it into 2024.10 , can you prepare a bugfix PR for 2024.10 ? Thanks for reminder, I miss it. And sorry for the delay, because a pull request was planned by Patrice after with summer holiday but unfortunately it can't do it now (he is out of the office for a few weeks after a small incident) so I will push a PR this week with your 2 bugfix patches. Regards Patrick
Re: [PATCH] ARM: stm32: Fix secure_waitbits() mask check
Hi Marek, On 7/8/24 13:43, Marek Vasut wrote: Do not apply bitwise AND to register value and expected value, only apply bitwise AND to register value and mask, and only then compare the result with expected value that the function polls for. Fixes: b49105320a5b ("stm32mp: psci: Implement PSCI system suspend and DRAM SSR") Signed-off-by: Marek Vasut --- Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Tom Rini Cc: u-boot@lists.denx.de Cc: uboot-st...@st-md-mailman.stormreply.com --- arch/arm/mach-stm32mp/stm32mp1/psci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/psci.c b/arch/arm/mach-stm32mp/stm32mp1/psci.c index e99103910d9..ffdafea464d 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/psci.c +++ b/arch/arm/mach-stm32mp/stm32mp1/psci.c @@ -393,8 +393,7 @@ static int __secure secure_waitbits(u32 reg, u32 mask, u32 val) asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (start)); for (;;) { tmp = readl(reg); - tmp &= mask; - if ((tmp & val) == val) + if ((tmp & mask) == val) return 0; asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (end)); if ((end - start) > delay) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2] stm32mp: Reserve OPTEE area in EFI memory map
Hi, On 4/22/24 17:06, Patrice Chotard wrote: Since commit 7b78d6438a2b3 ("efi_loader: Reserve unaccessible memory") memory region above ram_top is tagged in EFI memory map as EFI_BOOT_SERVICES_DATA. In case of STM32MP1/STM32MP13 platforms, above ram_top, there is one reserved-memory region tagged "no-map" dedicated to OP-TEE : _ addr=de00 size=200 for stm32mp157x-dkx and stm32mp135f-dk _ addr=fe00 size=200 for stm32mp157c-ev1 Before booting kernel, EFI memory map is first built, the OPTEE region is tagged as EFI_BOOT_SERVICES_DATA and when reserving LMB, the tag LMB_NONE is used. Then after, the LMB are completed by boot_fdt_add_mem_rsv_regions() which try to add again the same OPTEE region (addr=de00 size=200 in case of stm32mp157x-dkx / stm32mp135f-dk or addr=fe00 size=200 in case for stm2mp157c-ev1) but now with LMB_NOMAP tag which produces the following error message : _ for stm32mp157x-dkx / stm32mp135f-dk : "ERROR: reserving fdt memory region failed (addr=de00 size=200 flags=4)" _ for stm32mp157c-ev1 : "ERROR: reserving fdt memory region failed (addr=fe00 size=200 flags=4)" To avoid this, OPTEE area shouldn't be used by EFI, so we need to mark it as reserved. Signed-off-by: Patrice Chotard --- Changes in v2: _ update commit message by adding information about memory area dedicated for OPTEE for various STM32MP1/STM32MP13 boards. arch/arm/mach-stm32mp/dram_init.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index fb1208fc5d5..f67f54f2ae0 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -75,3 +76,14 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) return reg + size; } + +void efi_add_known_memory(void) +{ + if (IS_ENABLED(CONFIG_EFI_LOADER)) + /* +* Memory over ram_top is reserved to OPTEE. +* Declare to EFI only memory area below ram_top +*/ + efi_add_memory_map(gd->ram_base, gd->ram_top - gd->ram_base, + EFI_CONVENTIONAL_MEMORY); +} It seen like a temporary workaround after commit 7b78d6438a2b3 ("efi_loader: Reserve unaccessible memory") to avoid warnings. And it is working because in the default memory mapping OP-TEE base address == RAM_TOP and the rest of memory is used by OP-TEE tagged "no map" (protected by firewall) Reviewed-by: Patrick Delaunay FYI: workaround because the memory above ram_top is "already occupied by firmware" = and it is OP-TEE for STM32MP2 platform. For me the LMB type used by EFI in not correct for OP-TEE usage region with "no-map" tag in device tree= see boot_fdt_add_mem_rsv_regions() for linux DT parsing and we have no way to indicated this LMB tag= LMB_NOMAP with EFI stack (with enum efi_memory_type ?) EFI_BOOT_SERVICES_DATA => doesn't means NOMAP flag for LMB so something is missing in EFI side like EFI_BOOT_NOMAP to be used in board implementation of efi_add_known_memory() ? Thanks Patrick
Re: [PATCH 2/2] stm32mp1: spl: Update optee_get_reserved_memory() return value
Hi Patrice On 6/11/24 11:52, Patrice Chotard wrote: In case node "/reserved-memory/optee" is not found, return -ENOENT instead of 0. Signed-off-by: Patrice Chotard --- arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c index 10abbed87f0..beda69f3359 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c @@ -118,7 +118,7 @@ static int optee_get_reserved_memory(uint32_t *start, uint32_t *size) node = ofnode_path("/reserved-memory/optee"); if (!ofnode_valid(node)) - return 0; + return -ENOENT; fdt_start = ofnode_get_addr_size(node, "reg", &fdt_mem_size); *start = fdt_start; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 1/2] stm32mp1: spl: Fix compilation warnings
Hi Patrice, On 6/11/24 11:52, Patrice Chotard wrote: Fix the following compilation warnings : ../arch/arm/mach-stm32mp/stm32mp1/spl.c: In function 'stm32_init_tzc_for_optee': ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_size' may be used uninitialized [-Wmaybe-uninitialized] 148 | tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE; | ~~~^~~~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:30: note: 'optee_size' was declared here 137 | uint32_t optee_base, optee_size, tee_shmem_base; | ^~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_base' may be used uninitialized [-Wmaybe-uninitialized] 148 | tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE; | ~~~^~~~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:18: note: 'optee_base' was declared here 137 | uint32_t optee_base, optee_size, tee_shmem_base; | ^~ Fix also the following checkpatch "check" : CHECK: Prefer kernel type 'u32' over 'uint32_t' 37: FILE: arch/arm/mach-stm32mp/stm32mp1/spl.c:137: + uint32_t optee_base = 0, optee_size = 0, tee_shmem_base; Signed-off-by: Patrice Chotard --- arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c index 6c79259b2c8..10abbed87f0 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c @@ -134,7 +134,7 @@ void stm32_init_tzc_for_optee(void) { const uint32_t dram_size = stm32mp_get_dram_size(); const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1); - uint32_t optee_base, optee_size, tee_shmem_base; + u32 optee_base = 0, optee_size = 0, tee_shmem_base; const uintptr_t tzc = STM32_TZC_BASE; int ret; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2] ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx
Hi, On 4/15/24 14:55, Marek Vasut wrote: In case of an OTP-CLOSED STM32MP15xx system, the CPU core 1 cannot be released from endless loop in BootROM only by populating TAMP BKPxR 4 and 5 with magic and branch address and sending SGI0 interrupt from core 0 to core 1 twice. TAMP_SMCR BKP..PROT fields must be initialized as well to release the core 1 from endless loop during the second SGI0 handling on core 1. Initialize TAMP_SMCR to protect the first 16 backup registers, the ones which contain the core 1 magic, branch address and boot information. This requirement seems to be undocumented, therefore it was necessary to trace and analyze the STM32MP15xx BootROM using OpenOCD and objdump. Ultimately, it turns out that a certain BootROM function reads out the TAMP_SMCR register and tests whether the BKP..PROT fields are non-zero. If they are zero, the BootROM code again waits for SGI0 using WFI, else the execution moves forward until it reaches handoff to the TAMP BKPxR 5 branch address. These backup registers are documented in https://wiki.st.com/stm32mpu/wiki/STM32MP15_backup_registers This "security" configuration is done in STMicoelectronics delivery (OpenSTLinux) in OP-TEE. This fixes CPU core 1 release using U-Boot PSCI implementation on an OTP-CLOSED system, i.e. system with fuse 0 bit 6 set. A ROM code security check is done only for closed device to avoid malicious code execution: "unsecure" code on CPU2 during wake-up by changing BRANCH_ADDRESS => the STM32MP15 ROM check that only the secure world can update the TAMP_BKP5R = BRANCH_ADDRESS before to start the CPU2 and jump to this address. Sorry to inconvenient, we will improve this part on next release = OpenSTLinux V5.1 Reviewed-by: Patrick Delaunay Thanks Patrick Signed-off-by: Marek Vasut --- Cc: Igor Opaniuk Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Simon Glass Cc: Tom Rini Cc: u-b...@dh-electronics.com Cc: uboot-st...@st-md-mailman.stormreply.com --- V2: Fix up the BKPRWD/BKPWD mask typo --- arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 16 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c index dd99150fbc2..a2496361e01 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c @@ -14,6 +14,7 @@ #include #include #include +#include /* RCC register */ #define RCC_TZCR (STM32_RCC_BASE + 0x00) @@ -41,6 +42,9 @@ #define TZC_REGION_ID_ACCESS0 (STM32_TZC_BASE + 0x114) #define TAMP_CR1 (STM32_TAMP_BASE + 0x00) +#define TAMP_SMCR (STM32_TAMP_BASE + 0x20) +#define TAMP_SMCR_BKPRWDPROT GENMASK(7, 0) +#define TAMP_SMCR_BKPWDPROTGENMASK(23, 16) #define PWR_CR1 (STM32_PWR_BASE + 0x00) #define PWR_MCUCR (STM32_PWR_BASE + 0x14) @@ -136,6 +140,18 @@ static void security_init(void) */ writel(0x0, TAMP_CR1); + /* +* TAMP: Configure non-zero secure protection settings. This is +* checked by BootROM function 35ac on OTP-CLOSED device during +* CPU core 1 release from endless loop. If secure protection +* fields are zero, the core 1 is not released from endless +* loop on second SGI0. +*/ + clrsetbits_le32(TAMP_SMCR, + TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT, + FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x10) | + FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x10)); + /* GPIOZ: deactivate the security */ writel(BIT(0), RCC_MP_AHB5ENSETR); writel(0x0, GPIOZ_SECCFGR); The recommended mapping (the mapping done in OP-TEE for OpenSTLinux) is described in Wiki page - 10 backup register secure - 4 backup register secure write / non secure read - 17 backup register Non-secure It is done in https://github.com/STMicroelectronics/optee_os/blob/3.19.0-stm32mp/core/arch/arm/plat-stm32mp1/main.c with static TEE_Result stm32_configure_tamp(void) { TEE_Result res __maybe_unused = TEE_SUCCESS; struct stm32_bkpregs_conf bkpregs_conf = { .nb_zone1_regs = 10, /* 10 registers in zone 1 */ .nb_zone2_regs = 5 /* 5 registers in zone 2 */ /* Zone3 all remaining */ }; /* Enable BKP Register protection */ if (stm32_tamp_set_secure_bkpregs(&bkpregs_conf)) panic(); But when you are booting with SPL U-boot, all the boot chain and the Linux kernel is running in secure world So you have no reason to manage any limit for the access to backup register, you can allocate all the backup registers (the 32 one) to secure world See "Figure 552. Backup registers secure protections" in reference mnauel Protection zone 1 => x = 31 with BKPRWDPROT = 31 Protection zone 2 & 3 => empty + clrsetbits_le32(TAMP_SMCR, +
Re: [PATCH v1 25/25] ARM: dts: stm32: Add led-blue for stm32mp157c-ed1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: The blue led is used to indicate U-Boot entering / exit indication then Linux heartbeat. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-scmi-u-boot.dtsi | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 24/25] ARM: dts: stm32: Update red led node for stm32mp157c-ed1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use led node's name instead for u-boot,error-led property. Rename red led node's name to led-red. Remove status property which is useless. Add compatible = "gpio-leds"; which is not present in kernel DT. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-scmi-u-boot.dtsi | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 23/25] ARM: dts: stm32: Don't probe red led at boot for stm32mp157c-ed1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: red led and button dedicated to fastboot share the same gpio GPIOA13. Led driver is probed early so the corresponding gpio is taken and configured in output which forbid fastboot and stm32prog button usage. To avoid this, remove the "default-state" property from red led node. This will avoid to trigger the led driver probe() to configure the led default state during startup. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-scmi-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 22/25] ARM: dts: stm32: Add gpio-keys for stm32mp157c-ed1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: Add 2 gpio-keys : _ button-user-1 for stm32prog mode activation. _ button-user-2 for fastboot mode activation. Remove proprietary st,fastboot-gpios and st,stm32prog-gpios. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-scmi-u-boot.dtsi | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 21/25] ARM: dts: stm32: Add led-blue for stm32mp157c-ed1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: The blue led is used to indicate U-Boot entering / exit indication then Linux heartbeat. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 20/25] ARM: dts: stm32: Update red led node for stm32mp157c-ed1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use led node's name instead for u-boot,error-led property. Rename red led node's name to led-red. Remove status property which is useless. Add compatible = "gpio-leds" which is not present in kernel DT. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 19/25] ARM: dts: stm32: Don't probe red led at boot for stm32mp157c-ed1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: red led and button dedicated to fastboot share the same gpio GPIOA13. Led driver is probed early so the corresponding gpio is taken and configured in output which forbid fastboot and stm32prog button usage. To avoid this, remove the "default-state" property from red led node. This will avoid to trigger the led driver probe() to configure the led default state during startup. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 18/25] ARM: dts: stm32: Add gpio-keys for stm32mp157c-ed1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: Add 2 gpio-keys : _ button-user-1 for stm32prog mode activation. _ button-user-2 for fastboot mode activation. Remove proprietary st,fastboot-gpios and st,stm32prog-gpios. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 17/25] ARM: dts: stm32: Update u-boot,boot-led for stm32mp157a-dk1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use blue led node's name instead for u-boot,boot-led property. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 16/25] ARM: dts: stm32: Update red led node for stm32mp157a-dk1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use red led node's name instead for u-boot,error-led property. Rename red led node's name to led-red. Remove status property which is useless. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 15/25] ARM: dts: stm32: Don't probe red led at boot for stm32mp157a-dk1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: red led and button dedicated to fastboot share the same gpio GPIOA13. Led driver is probed early so the corresponding gpio is taken and configured in output which forbid fastboot and stm32prog button usage. To avoid this, remove the "default-state" property from red led node. This will avoid to trigger the led driver probe() to configure the led default state during startup. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 6bf6136c5fd..ee9b51d42b7 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -67,7 +67,6 @@ red { label = "error"; gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; - default-state = "off"; status = "okay"; }; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 14/25] ARM: dts: stm32: Add gpio-keys for stm32mp157a-dk1-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: Instead of using "st,fastboot-gpios" and "st,stm32prog-gpios", declare 2 gpio-keys. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 13/25] ARM: dts: stm32: Add led-blue for stm32mp157a-dk1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use blue led node's name instead for u-boot,boot-led property. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi index e61814fd66e..a5158fec7ef 100644 --- a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi @@ -13,7 +13,7 @@ }; config { - u-boot,boot-led = "heartbeat"; + u-boot,boot-led = "led-blue"; u-boot,error-led = "led-red"; u-boot,mmc-env-partition = "u-boot-env"; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; @@ -36,6 +36,10 @@ }; led { + led-blue { + /delete-property/label; + }; + led-red { gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 12/25] ARM: dts: stm32: Update red led node for stm32mp157a-dk1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: As indicated in kernel led dt-bindings, label is a deprecated property, so remove it and use red led node's name instead for u-boot,error-led property. Rename "red" led node's name to "led-red". Remove status property which is useless. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi index 8760d6c7d93..e61814fd66e 100644 --- a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi @@ -14,7 +14,7 @@ config { u-boot,boot-led = "heartbeat"; - u-boot,error-led = "error"; + u-boot,error-led = "led-red"; u-boot,mmc-env-partition = "u-boot-env"; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; }; @@ -36,10 +36,8 @@ }; led { - red { - label = "error"; + led-red { gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; - status = "okay"; }; }; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 10/25] ARM: dts: stm32: Add gpio-keys for stm32mp157a-dk1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: Instead of using "st,fastboot-gpios" and "st,stm32prog-gpios", declare 2 gpio-keys. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi index 20728f27ee1..5d49b09c35d 100644 --- a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi @@ -3,6 +3,7 @@ * Copyright : STMicroelectronics 2022 */ +#include #include "stm32mp15-scmi-u-boot.dtsi" / { @@ -16,8 +17,22 @@ u-boot,error-led = "error"; u-boot,mmc-env-partition = "u-boot-env"; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; - st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-user-1 { + label = "User-1"; + linux,code = ; + gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + button-user-2 { + label = "User-2"; + linux,code = ; + gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; }; led { Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 11/25] ARM: dts: stm32: Don't probe red led at boot for stm32mp157a-dk1-scmi-u-boot
Hi, On 4/9/24 17:02, Patrice Chotard wrote: red led and button dedicated to fastboot share the same gpio GPIOA13. Led driver is probed early so the corresponding gpio is taken and configured in output which forbid fastboot and stm32prog button usage. To avoid this, remove the "default-state" property from red led node. This will avoid to trigger the led driver probe() to configure the led default state during startup. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi index 5d49b09c35d..8760d6c7d93 100644 --- a/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-scmi-u-boot.dtsi @@ -39,7 +39,6 @@ red { label = "error"; gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; - default-state = "off"; status = "okay"; }; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 09/25] ARM: dts: stm32: Clean led-red node for stm32mp135f-dk-u-boot
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Remove "color" property from led-red node which is not supported by U-Boot. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp135f-dk-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/stm32mp135f-dk-u-boot.dtsi b/arch/arm/dts/stm32mp135f-dk-u-boot.dtsi index 8f42735609a..f004e9840a2 100644 --- a/arch/arm/dts/stm32mp135f-dk-u-boot.dtsi +++ b/arch/arm/dts/stm32mp135f-dk-u-boot.dtsi @@ -35,7 +35,6 @@ }; led-red { - color = ; gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; }; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 08/25] ARM: dts: stm32: Don't probe led-red/led-blue at boot for stm32mp135f-dk-u-boot
Hi, On 4/9/24 17:01, Patrice Chotard wrote: led-red and button dedicated to fastboot share the same gpio GPIOA13. led-blue and button dedicated to stm32prog share the same gpio GPIOA14. Led driver is probed early so the corresponding gpio is taken and configured in output which forbid fastboot and stm32prog button usage. To avoid this, remove the "default-state" property from led-red and led-blue led's node. This will avoid to trigger the led driver probe() to configure the led default state during startup. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp135f-dk-u-boot.dtsi | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 07/25] ARM: dts: stm32: Add gpio-keys for stm32mp135f-dk-u-boot
Hi On 4/9/24 17:01, Patrice Chotard wrote: Add 2 gpio-keys : _ button-user-1 for stm32prog mode activation. _ update button-user's label (defined in kernel DT) to match label requested in board_key_check() for fastboot mode activation. Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp135f-dk-u-boot.dtsi | 13 + 1 file changed, 13 insertions(+) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 06/25] board: st: stmp32mp1: Use BUTTON UCLASS in board_key_check()
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Instead of using gpio directly to detect key pressed on button dedicated for fastboot and stm32mprog, make usage of BUTTON UCLASS. Signed-off-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 68 +--- 1 file changed, 40 insertions(+), 28 deletions(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 05/25] configs: stm32mp1: Enable BUTTON_GPIO flag for stm32mp13_defconfig
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Enable BUTTON_GPIO flag for STM32MP15. Signed-off-by: Patrice Chotard --- configs/stm32mp13_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index db09e63100e..caaabf39ef3 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -52,6 +52,8 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=-1 CONFIG_ENV_MMC_USE_DT=y +CONFIG_BUTTON=y +CONFIG_BUTTON_GPIO=y CONFIG_CLK_SCMI=y CONFIG_SET_DFU_ALT_INFO=y CONFIG_USB_FUNCTION_FASTBOOT=y Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 04/25] configs: stm32mp1: Enable BUTTON_GPIO flag for stm32mp15_trusted_defconfig
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Enable BUTTON_GPIO flag for STM32MP15. Signed-off-by: Patrice Chotard --- configs/stm32mp15_trusted_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 84b0854b557..74deaaba2e4 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -70,6 +70,8 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_SERVERIP=y CONFIG_SERVERIP="192.168.1.1" CONFIG_STM32_ADC=y +CONFIG_BUTTON=y +CONFIG_BUTTON_GPIO=y CONFIG_CLK_SCMI=y CONFIG_SET_DFU_ALT_INFO=y CONFIG_USB_FUNCTION_FASTBOOT=y Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 03/25] configs: stm32mp1: Enable BUTTON_GPIO flag for stm32mp15_basic_defconfig
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Enable BUTTON_GPIO flag for STM32MP15. Signed-off-by: Patrice Chotard --- configs/stm32mp15_basic_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 005f1d55f80..2e22bf86000 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -97,6 +97,8 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_SERVERIP=y CONFIG_SERVERIP="192.168.1.1" CONFIG_STM32_ADC=y +CONFIG_BUTTON=y +CONFIG_BUTTON_GPIO=y CONFIG_SET_DFU_ALT_INFO=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0xC000 Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 02/25] configs: stm32mp1: Enable BUTTON_GPIO flag for stm32mp15_defconfig
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Enable BUTTON_GPIO flag for STM32MP15. Signed-off-by: Patrice Chotard --- configs/stm32mp15_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index 3302b306996..ffe7512650e 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -69,6 +69,8 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_SERVERIP=y CONFIG_SERVERIP="192.168.1.1" CONFIG_STM32_ADC=y +CONFIG_BUTTON=y +CONFIG_BUTTON_GPIO=y CONFIG_CLK_SCMI=y CONFIG_SET_DFU_ALT_INFO=y CONFIG_USB_FUNCTION_FASTBOOT=y Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v1 01/25] configs: stm32mp13: Enable FASTBOOT
Hi, On 4/9/24 17:01, Patrice Chotard wrote: Enable FASTBOOT relative flags for stm32mp13_defconfig. Signed-off-by: Patrice Chotard --- configs/stm32mp13_defconfig | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 2/2] mmc: stm32_sdmmc2: Fix AARCH64 compilation warnings
Hi, On 3/8/24 15:26, Patrice Chotard wrote: When building with AARCH64 defconfig, we got warnings, fix them. Signed-off-by: Patrice Chotard --- drivers/mmc/stm32_sdmmc2.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index d4982a14281..39ae79ba129 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -220,9 +220,9 @@ static void stm32_sdmmc2_start_data(struct udevice *dev, if (data->flags & MMC_DATA_READ) { data_ctrl |= SDMMC_DCTRL_DTDIR; - idmabase0 = (u32)data->dest; + idmabase0 = (u32)(long)data->dest; } else { - idmabase0 = (u32)data->src; + idmabase0 = (u32)(long)data->src; } /* Set the SDMMC DataLength value */ @@ -463,8 +463,8 @@ retry_cmd: stm32_sdmmc2_start_cmd(dev, cmd, cmdat, &ctx); - dev_dbg(dev, "send cmd %d data: 0x%x @ 0x%x\n", - cmd->cmdidx, data ? ctx.data_length : 0, (unsigned int)data); + dev_dbg(dev, "send cmd %d data: 0x%x @ 0x%p\n", + cmd->cmdidx, data ? ctx.data_length : 0, data); ret = stm32_sdmmc2_end_cmd(dev, cmd, &ctx); Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 1/2] mmc: stm32_sdmmc2: Add "st,stm32mp25-sdmmc2" compatible
Hi, On 3/8/24 15:26, Patrice Chotard wrote: From: Patrick Delaunay Add compatible used for STM32MP25 family. Signed-off-by: Patrick Delaunay Signed-off-by: Patrice Chotard --- drivers/mmc/stm32_sdmmc2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index a2b111a8435..d4982a14281 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -789,6 +789,7 @@ static int stm32_sdmmc2_bind(struct udevice *dev) static const struct udevice_id stm32_sdmmc2_ids[] = { { .compatible = "st,stm32-sdmmc2" }, + { .compatible = "st,stm32mp25-sdmmc2" }, { } }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 3/3] ARM: dts: stm32: Fix partition node name for stm32mp15xx-dhcom-u-boot
Hi, On 3/8/24 14:50, Patrice Chotard wrote: Fix flash@0 partition node name with correct offset. Fixes: 90f992e6a58c ("arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-dhcom/dhcor") Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index 2f70b0690d2..1b445619325 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -106,15 +106,15 @@ label = "fsbl2"; reg = <0x0004 0x0004>; }; - partition@50 { + partition@8 { label = "uboot"; reg = <0x0008 0x0016>; }; - partition@90 { + partition@1e { label = "env1"; reg = <0x001E 0x0001>; }; - partition@98 { + partition@1f { label = "env2"; reg = <0x001F 0x0001>; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 2/3] ARM: dts: stm32: Fix partition node name for stm32mp15xx-dhcor-u-boot
Hi On 3/8/24 14:50, Patrice Chotard wrote: Fix flash@0 partition node name with correct offset. Fixes: 90f992e6a58c ("arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-dhcom/dhcor") Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi index 552b35db3c7..ba84db679e1 100644 --- a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi @@ -42,15 +42,15 @@ label = "fsbl2"; reg = <0x0004 0x0004>; }; - partition@50 { + partition@8 { label = "uboot"; reg = <0x0008 0x0016>; }; - partition@90 { + partition@1e { label = "env1"; reg = <0x001E 0x0001>; }; - partition@98 { + partition@1f { label = "env2"; reg = <0x001F 0x0001>; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 1/3] ARM: dts: stm32: Fix partition node name for stm32mp157c-ev1-u-boot
Hi, On 3/8/24 14:50, Patrice Chotard wrote: Fix flash@0 and nand@0 partition node name with correct offset. Fixes: e91d3c61767b ("arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-ev1") Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi index 139940bd5d4..3515347e91d 100644 --- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi @@ -33,11 +33,11 @@ label = "fsbl1"; reg = <0x 0x0004>; }; - partition@8 { + partition@4 { label = "fsbl2"; reg = <0x0004 0x0004>; }; - partition@10 { + partition@8 { label = "ssbl"; reg = <0x0008 0x0020>; }; @@ -58,7 +58,7 @@ label = "fsbl2"; reg = <0x0004 0x0004>; }; - partition@10 { + partition@8 { label = "fip"; reg = <0x0008 0x0040>; }; @@ -112,7 +112,7 @@ label = "fip2"; reg = <0x0060 0x0040>; }; - partition@120 { + partition@a0 { label = "UBI"; reg = <0x00a0 0x3f60>; }; Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH] stm32mp: Reserve OPTEE area in EFI memory map
Hi, On 3/8/24 11:12, Patrice Chotard wrote: Since commit 7b78d6438a2b3 ("efi_loader: Reserve unaccessible memory") memory region above ram_top is tagged in EFI memory map as EFI_BOOT_SERVICES_DATA. In case of STM32MP1 platform, above ram_top, there is one reserved-memory region tagged "no-map" dedicated to OP-TEE (addr=de00 size=200). Before booting kernel, EFI memory map is first built, the OPTEE region is tagged as EFI_BOOT_SERVICES_DATA and when reserving LMB, the tag LMB_NONE is used. Then after, the LMB are completed by boot_fdt_add_mem_rsv_regions() which try to add again the same OPTEE region (addr=de00 size=200) but now with LMB_NOMAP tag which produces the following error message : "ERROR: reserving fdt memory region failed (addr=de00 size=200 flags=4)" To avoid this, OPTEE area shouldn't be used by EFI, so we need to mark it as reserved. Signed-off-by: Patrice Chotard --- arch/arm/mach-stm32mp/dram_init.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index fb1208fc5d5..f67f54f2ae0 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -75,3 +76,14 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) return reg + size; } + +void efi_add_known_memory(void) +{ + if (IS_ENABLED(CONFIG_EFI_LOADER)) + /* +* Memory over ram_top is reserved to OPTEE. +* Declare to EFI only memory area below ram_top +*/ + efi_add_memory_map(gd->ram_base, gd->ram_top - gd->ram_base, + EFI_CONVENTIONAL_MEMORY); +} Reviewed-by: Patrick Delaunay Thanks Patrick
[PATCH] stm32mp: cmd_stm32prog: add dependencies with USB_GADGET_DOWNLOAD
This patch avoids compilation issue when CONFIG_USB_GADGET is deactivated in defconfig, with undefined reference to run_usb_dnl_gadget and to g_dnl_set_product. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig index 8f91db4b46b9..589276282e44 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig @@ -17,6 +17,7 @@ config CMD_STM32PROG config CMD_STM32PROG_USB bool "support stm32prog over USB" depends on CMD_STM32PROG + depends on USB_GADGET_DOWNLOAD default y help activate the command "stm32prog usb" for STM32MP soc family -- 2.25.1
Re: [PATCH] stm32mp2: Fix CONFIG_STM32MP25X flag usage
Hi On 1/9/24 15:00, Patrice Chotard wrote: "#if" was used instead of "#ifdef" Fixes: 01a701994b05 ("stm32mp2: initial support") Signed-off-by: Patrice Chotard --- arch/arm/mach-stm32mp/include/mach/stm32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 46d469881b3..175f2a88490 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -157,7 +157,7 @@ enum forced_boot_mode { #endif /* __ASSEMBLY__ */ #endif /* CONFIG_STM32MP15X || CONFIG_STM32MP13X */ -#if CONFIG_STM32MP25X +#ifdef CONFIG_STM32MP25X #define STM32_RCC_BASE0x4420 #define STM32_TAMP_BASE 0x46010000 Reviewed-by: Patrick Delaunay Thanks Patrick
[PATCH v2 14/14] arm: Rename STM32MP15x
CONFIG options must not use lower-case letter. Convert this and related ones to upper case. Signed-off-by: Simon Glass --- See Simon's patch in serie "Clean up of bad Kconfig options" never merged https://patchwork.ozlabs.org/project/uboot/list/?series=339004&state=* https://patchwork.ozlabs.org/project/uboot/patch/20230129005903.74918-69-...@chromium.org/ Changes in v2: - add "arm: Rename STM32MP15x" arch/arm/dts/Makefile | 2 +- arch/arm/dts/stm32mp15-u-boot.dtsi | 2 +- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi| 4 ++-- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi| 4 ++-- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi| 4 ++-- arch/arm/mach-stm32mp/Kconfig | 6 +++--- arch/arm/mach-stm32mp/Kconfig.15x | 6 +++--- arch/arm/mach-stm32mp/Makefile | 2 +- arch/arm/mach-stm32mp/cmd_stm32key.c| 10 +- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 4 ++-- arch/arm/mach-stm32mp/include/mach/stm32.h | 12 ++-- arch/arm/mach-stm32mp/stm32mp1/Makefile | 2 +- arch/arm/mach-stm32mp/stm32mp1/fdt.c| 6 +++--- board/st/common/Kconfig | 2 +- board/st/stm32mp1/Kconfig | 2 +- board/st/stm32mp1/stm32mp1.c| 6 +++--- configs/stm32mp15_basic_defconfig | 2 +- configs/stm32mp15_defconfig | 2 +- configs/stm32mp15_trusted_defconfig | 4 ++-- drivers/clk/stm32/Kconfig | 2 +- 20 files changed, 42 insertions(+), 42 deletions(-) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 8dcf1f5717ce..02074440b55d 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1363,7 +1363,7 @@ dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb dtb-$(CONFIG_STM32MP13X) += \ stm32mp135f-dk.dtb -dtb-$(CONFIG_STM32MP15x) += \ +dtb-$(CONFIG_STM32MP15X) += \ stm32mp157a-dk1.dtb \ stm32mp157a-dk1-scmi.dtb \ stm32mp157a-icore-stm32mp1-ctouch2.dtb \ diff --git a/arch/arm/dts/stm32mp15-u-boot.dtsi b/arch/arm/dts/stm32mp15-u-boot.dtsi index 573dd4d3ed56..fe56f05616a0 100644 --- a/arch/arm/dts/stm32mp15-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15-u-boot.dtsi @@ -206,7 +206,7 @@ resets = <&rcc UART8_R>; }; -#if defined(CONFIG_STM32MP15x_STM32IMAGE) +#if defined(CONFIG_STM32MP15X_STM32IMAGE) &binman { u-boot-stm32 { filename = "u-boot.stm32"; diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 2623cebf21a4..a16358266a2d 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -22,13 +22,13 @@ st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; }; -#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL) +#if defined(CONFIG_STM32MP15X_STM32IMAGE) || defined(CONFIG_SPL) config { u-boot,mmc-env-partition = "ssbl"; }; #endif -#ifdef CONFIG_STM32MP15x_STM32IMAGE +#ifdef CONFIG_STM32MP15X_STM32IMAGE /* only needed for boot with TF-A, witout FIP support */ firmware { optee { diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi index b8288273ddb5..ef91088aa375 100644 --- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi @@ -20,13 +20,13 @@ st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; }; -#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL) +#if defined(CONFIG_STM32MP15X_STM32IMAGE) || defined(CONFIG_SPL) config { u-boot,mmc-env-partition = "ssbl"; }; #endif -#ifdef CONFIG_STM32MP15x_STM32IMAGE +#ifdef CONFIG_STM32MP15X_STM32IMAGE /* only needed for boot with TF-A, witout FIP support */ firmware { optee { diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi index eb283cacd27d..139940bd5d47 100644 --- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi @@ -28,7 +28,7 @@ #address-cells = <1>; #size-cells = <1>; -#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL) +#if defined(CONFIG_STM32MP15X_STM32IMAGE) || defined(CONFIG_SPL) partition@0 { label = "fsbl1"; reg = <0x 0x0004>; @@ -82,7 +82,7 @@ #address-cells = <1>; #size-cells = <1>; -#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL) +#if defined(CONFIG_STM32MP15X_STM32IMAGE) || defined(CONFIG_SPL) partition@0 { label = "fsbl";
[PATCH v2 13/14] arm: Rename STM32MP13x
CONFIG options must not use lower-case letter. Convert this and related ones to upper case. Signed-off-by: Simon Glass Signed-off-by: Patrick Delaunay --- See Simon's patch in serie "Clean up of bad Kconfig options" never merged https://patchwork.ozlabs.org/project/uboot/list/?series=339004&state=* https://patchwork.ozlabs.org/project/uboot/patch/20230129005903.74918-68-...@chromium.org/ Changes in v2: - add "arm: Rename STM32MP13x" arch/arm/dts/Makefile | 2 +- arch/arm/mach-stm32mp/Kconfig | 4 ++-- arch/arm/mach-stm32mp/Kconfig.13x | 4 ++-- arch/arm/mach-stm32mp/Makefile | 2 +- arch/arm/mach-stm32mp/cmd_stm32key.c| 10 +- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 2 +- arch/arm/mach-stm32mp/include/mach/stm32.h | 8 arch/arm/mach-stm32mp/stm32mp1/Makefile | 2 +- arch/arm/mach-stm32mp/stm32mp1/fdt.c| 4 ++-- board/st/common/Kconfig | 2 +- board/st/stm32mp1/Kconfig | 2 +- configs/stm32mp13_defconfig | 4 ++-- drivers/clk/stm32/Kconfig | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 773c2546131c..8dcf1f5717ce 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1360,7 +1360,7 @@ dtb-$(CONFIG_ASPEED_AST2600) += ast2600-evb.dtb dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb -dtb-$(CONFIG_STM32MP13x) += \ +dtb-$(CONFIG_STM32MP13X) += \ stm32mp135f-dk.dtb dtb-$(CONFIG_STM32MP15x) += \ diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index 5fc92d07fe6d..241fcf3e0d22 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -37,7 +37,7 @@ choice prompt "Select STMicroelectronics STM32MPxxx Soc" default STM32MP15x -config STM32MP13x +config STM32MP13X bool "Support STMicroelectronics STM32MP13x Soc" select ARM_SMCCC select CPU_V7A @@ -127,7 +127,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2 config STM32_ETZPC bool "STM32 Extended TrustZone Protection" - depends on STM32MP15x || STM32MP13x + depends on STM32MP15x || STM32MP13X default y imply BOOTP_SERVERIP help diff --git a/arch/arm/mach-stm32mp/Kconfig.13x b/arch/arm/mach-stm32mp/Kconfig.13x index acc02a5a1872..4d74b35055b8 100644 --- a/arch/arm/mach-stm32mp/Kconfig.13x +++ b/arch/arm/mach-stm32mp/Kconfig.13x @@ -1,10 +1,10 @@ -if STM32MP13x +if STM32MP13X choice prompt "STM32MP13x board select" optional -config TARGET_ST_STM32MP13x +config TARGET_ST_STM32MP13X bool "STMicroelectronics STM32MP13x boards" imply BOOTSTAGE imply CMD_BOOTSTAGE diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile index fdcbbf91dfd5..3d194de0631c 100644 --- a/arch/arm/mach-stm32mp/Makefile +++ b/arch/arm/mach-stm32mp/Makefile @@ -9,7 +9,7 @@ obj-y += bsec.o obj-y += soc.o obj-$(CONFIG_STM32MP15x) += stm32mp1/ -obj-$(CONFIG_STM32MP13x) += stm32mp1/ +obj-$(CONFIG_STM32MP13X) += stm32mp1/ obj-$(CONFIG_STM32MP25X) += stm32mp2/ obj-$(CONFIG_STM32_ECDSA_VERIFY) += ecdsa_romapi.o diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c index e16fcf4424dc..dcef6ac4fb82 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32key.c +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c @@ -19,7 +19,7 @@ * STM32MP13x: 0b11 = 0x3F for OTP_SECURED closed device */ #define STM32_OTP_CLOSE_ID 0 -#define STM32_OTP_STM32MP13x_CLOSE_MASK0x3F +#define STM32_OTP_STM32MP13X_CLOSE_MASK0x3F #define STM32_OTP_STM32MP15x_CLOSE_MASKBIT(6) /* PKH is the first element of the key list */ @@ -61,7 +61,7 @@ static u8 stm32key_index; static u8 get_key_nb(void) { - if (IS_ENABLED(CONFIG_STM32MP13x)) + if (IS_ENABLED(CONFIG_STM32MP13X)) return ARRAY_SIZE(stm32mp13_list); if (IS_ENABLED(CONFIG_STM32MP15x)) @@ -70,7 +70,7 @@ static u8 get_key_nb(void) static const struct stm32key *get_key(u8 index) { - if (IS_ENABLED(CONFIG_STM32MP13x)) + if (IS_ENABLED(CONFIG_STM32MP13X)) return &stm32mp13_list[index]; if (IS_ENABLED(CONFIG_STM32MP15x)) @@ -79,8 +79,8 @@ static const struct stm32key *get_key(u8 index) static u32 get_otp_close_mask(void) { - if (IS_ENABLED(CONFIG_STM32MP13x)) - return STM32_OTP_STM32MP13x_CLOSE_MASK; + if (IS_ENABLED(CONFIG_STM32MP13X)) + return STM32_OTP_STM32MP13X_CLOSE_MASK; if (IS_ENABLED(CONFIG_STM32MP15x)) return STM32_OTP_STM32MP15x_CLOSE_MASK; diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32p
[PATCH v2 12/14] board: st: stm32mp2: display the board identification
Add the display of the STMicroelectronics board identification saved in OTP in stm32mp2 checkboard function. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) board/st/stm32mp2/stm32mp2.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index 9a881583d904..aa7dd31996ea 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -9,9 +9,12 @@ #include #include #include +#include #include #include +#include #include +#include /* * Get a global data pointer @@ -20,6 +23,9 @@ DECLARE_GLOBAL_DATA_PTR; int checkboard(void) { + int ret; + u32 otp; + struct udevice *dev; const char *fdt_compat; int fdt_compat_len; @@ -27,6 +33,23 @@ int checkboard(void) log_info("Board: stm32mp2 (%s)\n", fdt_compat && fdt_compat_len ? fdt_compat : ""); + /* display the STMicroelectronics board identification */ + if (CONFIG_IS_ENABLED(CMD_STBOARD)) { + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (!ret) + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD), + &otp, sizeof(otp)); + if (ret > 0 && otp) + log_info("Board: MB%04x Var%d.%d Rev.%c-%02d\n", +otp >> 16, +(otp >> 12) & 0xF, +(otp >> 4) & 0xF, +((otp >> 8) & 0xF) - 1 + 'A', +otp & 0xF); + } + return 0; } -- 2.25.1
[PATCH v2 10/14] stm32mp: activate the command stboard for stm32mp25 boards
Activate the command stboard for stm32mp25 STMicroelectronics boards, add the default used OTP identifier and the associated board identifier: - stm32mp25xx-ev1 = MB1936 - stm32mp25xx-dk = MB1605 Signed-off-by: Patrick Delaunay --- Changes in v2: - fix CONFIG name with 'x': TARGET_ST_STM32MP15x TARGET_ST_STM32MP13x arch/arm/mach-stm32mp/include/mach/stm32.h | 1 + board/st/common/Kconfig| 2 +- board/st/common/cmd_stboard.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 45c929aa605d..726c390977e3 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -198,6 +198,7 @@ enum forced_boot_mode { #define BSEC_OTP_SERIAL5 #define BSEC_OTP_RPN 9 #define BSEC_OTP_PKG 122 +#define BSEC_OTP_BOARD 246 #define BSEC_OTP_MAC 247 #endif diff --git a/board/st/common/Kconfig b/board/st/common/Kconfig index c1c254d07354..f40d1a78ca36 100644 --- a/board/st/common/Kconfig +++ b/board/st/common/Kconfig @@ -1,7 +1,7 @@ config CMD_STBOARD bool "stboard - command for OTP board information" depends on ARCH_STM32MP - default y if TARGET_ST_STM32MP15x || TARGET_ST_STM32MP13x + default y if TARGET_ST_STM32MP25X || TARGET_ST_STM32MP15x || TARGET_ST_STM32MP13x help This compile the stboard command to read and write the board in the OTP. diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c index 853ab78bbf16..cb103e69b369 100644 --- a/board/st/common/cmd_stboard.c +++ b/board/st/common/cmd_stboard.c @@ -49,7 +49,9 @@ static bool check_stboard(u16 board) 0x1298, 0x1341, 0x1497, + 0x1605, /* stm32mp25xx-dk */ 0x1635, + 0x1936, /* stm32mp25xx-ev1 */ }; for (i = 0; i < ARRAY_SIZE(st_board_id); i++) -- 2.25.1
[PATCH v2 11/14] board: st: stm32mp2: add checkboard
Implement the weak function checkboard to identify the used board with compatible in device tree for the support of stm32mp2 STMicroelectronics boards. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) board/st/stm32mp2/stm32mp2.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index c97a7efff46e..9a881583d904 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -8,14 +8,28 @@ #include #include #include +#include #include #include +#include /* * Get a global data pointer */ DECLARE_GLOBAL_DATA_PTR; +int checkboard(void) +{ + const char *fdt_compat; + int fdt_compat_len; + + fdt_compat = ofnode_get_property(ofnode_root(), "compatible", &fdt_compat_len); + + log_info("Board: stm32mp2 (%s)\n", fdt_compat && fdt_compat_len ? fdt_compat : ""); + + return 0; +} + /* board dependent setup after realloc */ int board_init(void) { -- 2.25.1
[PATCH v2 07/14] stm32mp: add setup_serial_number for stm32mp25
From: Patrice Chotard Add support of serial number for stm32mp25, gets from OTP with BSEC driver. Reviewed-by: Patrice Chotard Signed-off-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) .../arm/mach-stm32mp/include/mach/sys_proto.h | 1 + arch/arm/mach-stm32mp/soc.c | 31 +++ arch/arm/mach-stm32mp/stm32mp1/cpu.c | 27 arch/arm/mach-stm32mp/stm32mp2/cpu.c | 2 ++ 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 83388fdb7371..2a65efc0a50a 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -97,6 +97,7 @@ u32 get_bootauth(void); int get_eth_nb(void); int setup_mac_address(void); +int setup_serial_number(void); /* board power management : configure vddcore according OPP */ void board_vddcore_init(u32 voltage_mv); diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c index 8d5fa474ccaf..ff70ebe97464 100644 --- a/arch/arm/mach-stm32mp/soc.c +++ b/arch/arm/mach-stm32mp/soc.c @@ -3,7 +3,11 @@ * Copyright (C) 2024, STMicroelectronics - All Rights Reserved */ +#include +#include #include +#include +#include /* used when CONFIG_DISPLAY_CPUINFO is activated */ int print_cpuinfo(void) @@ -15,3 +19,30 @@ int print_cpuinfo(void) return 0; } + +int setup_serial_number(void) +{ + char serial_string[25]; + u32 otp[3] = {0, 0, 0 }; + struct udevice *dev; + int ret; + + if (env_get("serial#")) + return 0; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL), + otp, sizeof(otp)); + if (ret < 0) + return ret; + + sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]); + env_set("serial#", serial_string); + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index 00fea7929b2f..f84cb26fa565 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -336,33 +336,6 @@ __weak int setup_mac_address(void) return 0; } -static int setup_serial_number(void) -{ - char serial_string[25]; - u32 otp[3] = {0, 0, 0 }; - struct udevice *dev; - int ret; - - if (env_get("serial#")) - return 0; - - ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL), - otp, sizeof(otp)); - if (ret < 0) - return ret; - - sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]); - env_set("serial#", serial_string); - - return 0; -} - __weak void stm32mp_misc_init(void) { } diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c b/arch/arm/mach-stm32mp/stm32mp2/cpu.c index c0f6519e8d7c..301e365cf4f4 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c @@ -69,6 +69,8 @@ void enable_caches(void) int arch_misc_init(void) { + setup_serial_number(); + return 0; } -- 2.25.1
[PATCH v2 08/14] smt32mp: add setup_mac_address for stm32mp25
Add a function setup_mac_address() to update the MAC address from the default location in OTP for stm32mp2 platform. The max number of OTP for MAC address is increased to 8 for STM32MP25, defined with get_eth_nb() and checked in setup_mac_address. The MAC address FF:FF:FF:FF:FF:FF, the broadcast ethaddr, is a invalid value used for unused MAC address slot in OTP, for example for board with STM32MP25x part number allows up to 5 ethernet ports but it is not supported by the hardware, without switch; the associated variable "enetaddr%d" is not created. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/soc.c | 70 arch/arm/mach-stm32mp/stm32mp1/cpu.c | 58 +-- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 1 + 3 files changed, 72 insertions(+), 57 deletions(-) diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c index ff70ebe97464..fa56b0d2e0f1 100644 --- a/arch/arm/mach-stm32mp/soc.c +++ b/arch/arm/mach-stm32mp/soc.c @@ -5,10 +5,14 @@ #include #include +#include #include #include #include +/* max: 8 OTP for 5 mac address on stm32mp2*/ +#define MAX_NB_OTP 8 + /* used when CONFIG_DISPLAY_CPUINFO is activated */ int print_cpuinfo(void) { @@ -46,3 +50,69 @@ int setup_serial_number(void) return 0; } + +/* + * If there is no MAC address in the environment, then it will be initialized + * (silently) from the value in the OTP. + */ +__weak int setup_mac_address(void) +{ + int ret; + int i; + u32 otp[MAX_NB_OTP]; + uchar enetaddr[ARP_HLEN]; + struct udevice *dev; + int nb_eth, nb_otp, index; + + if (!IS_ENABLED(CONFIG_NET)) + return 0; + + nb_eth = get_eth_nb(); + if (!nb_eth) + return 0; + + /* 6 bytes for each MAC addr and 4 bytes for each OTP */ + nb_otp = DIV_ROUND_UP(ARP_HLEN * nb_eth, 4); + if (nb_otp > MAX_NB_OTP) { + log_err("invalid number of OTP = %d, max = %d\n", nb_otp, MAX_NB_OTP); + return -EINVAL; + } + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp); + if (ret < 0) + return ret; + + for (index = 0; index < nb_eth; index++) { + /* MAC already in environment */ + if (eth_env_get_enetaddr_by_index("eth", index, enetaddr)) + continue; + + for (i = 0; i < ARP_HLEN; i++) + enetaddr[i] = ((uint8_t *)&otp)[i + ARP_HLEN * index]; + + /* skip FF:FF:FF:FF:FF:FF */ + if (is_broadcast_ethaddr(enetaddr)) + continue; + + if (!is_valid_ethaddr(enetaddr)) { + log_err("invalid MAC address %d in OTP %pM\n", + index, enetaddr); + return -EINVAL; + } + log_debug("OTP MAC address %d = %pM\n", index, enetaddr); + ret = eth_env_set_enetaddr_by_index("eth", index, enetaddr); + if (ret) { + log_err("Failed to set mac address %pM from OTP: %d\n", + enetaddr, ret); + return ret; + } + } + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index f84cb26fa565..524778f00c67 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -280,62 +280,6 @@ static void setup_boot_mode(void) clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL); } -/* - * If there is no MAC address in the environment, then it will be initialized - * (silently) from the value in the OTP. - */ -__weak int setup_mac_address(void) -{ - int ret; - int i; - u32 otp[3]; - uchar enetaddr[6]; - struct udevice *dev; - int nb_eth, nb_otp, index; - - if (!IS_ENABLED(CONFIG_NET)) - return 0; - - nb_eth = get_eth_nb(); - - /* 6 bytes for each MAC addr and 4 bytes for each OTP */ - nb_otp = DIV_ROUND_UP(6 * nb_eth, 4); - - ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp); -
[PATCH v2 09/14] stm32mp: stm32prog: add support of stm32mp25
Change OTP number to 364 for STM32MP25 as it is done in bsec driver. Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index ae4bd8842f53..eda98eb61d76 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -28,7 +28,15 @@ #else #define OTP_SIZE_SMC 0 #endif -#define OTP_SIZE_TA776 +/* size of the OTP struct in NVMEM PTA */ +#define _OTP_SIZE_TA(otp) (((otp) * 2 + 2) * 4) +#if defined(CONFIG_STM32MP13x) || defined(CONFIG_STM32MP15x) +/* STM32MP1 with BSEC2 */ +#define OTP_SIZE_TA_OTP_SIZE_TA(96) +#else +/* STM32MP2 with BSEC3 */ +#define OTP_SIZE_TA_OTP_SIZE_TA(368) +#endif #define PMIC_SIZE 8 enum stm32prog_target { -- 2.25.1
[PATCH v2 06/14] stm32mp: add soc.c file
Add a new file soc.c for common functions between stm32mp1 and stm32mp2 family and move print_cpuinfo() in this new file. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/Makefile | 1 + arch/arm/mach-stm32mp/soc.c | 17 + arch/arm/mach-stm32mp/stm32mp1/cpu.c | 11 --- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 11 --- 4 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 arch/arm/mach-stm32mp/soc.c diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile index 00dc25bb275c..fdcbbf91dfd5 100644 --- a/arch/arm/mach-stm32mp/Makefile +++ b/arch/arm/mach-stm32mp/Makefile @@ -6,6 +6,7 @@ obj-y += dram_init.o obj-y += syscon.o obj-y += bsec.o +obj-y += soc.o obj-$(CONFIG_STM32MP15x) += stm32mp1/ obj-$(CONFIG_STM32MP13x) += stm32mp1/ diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c new file mode 100644 index ..8d5fa474ccaf --- /dev/null +++ b/arch/arm/mach-stm32mp/soc.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause +/* + * Copyright (C) 2024, STMicroelectronics - All Rights Reserved + */ + +#include + +/* used when CONFIG_DISPLAY_CPUINFO is activated */ +int print_cpuinfo(void) +{ + char name[SOC_NAME_SIZE]; + + get_soc_name(name); + printf("CPU: %s\n", name); + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index 55574fd4bebf..00fea7929b2f 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -158,17 +158,6 @@ void enable_caches(void) dcache_enable(); } -/* used when CONFIG_DISPLAY_CPUINFO is activated */ -int print_cpuinfo(void) -{ - char name[SOC_NAME_SIZE]; - - get_soc_name(name); - printf("CPU: %s\n", name); - - return 0; -} - static void setup_boot_mode(void) { const u32 serial_addr[] = { diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c b/arch/arm/mach-stm32mp/stm32mp2/cpu.c index f43d1aaf72cc..c0f6519e8d7c 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c @@ -67,17 +67,6 @@ void enable_caches(void) dcache_enable(); } -/* used when CONFIG_DISPLAY_CPUINFO is activated */ -int print_cpuinfo(void) -{ - char name[SOC_NAME_SIZE]; - - get_soc_name(name); - printf("CPU: %s\n", name); - - return 0; -} - int arch_misc_init(void) { return 0; -- 2.25.1
[PATCH v2 05/14] configs: stm32mp25: add support of fuse command
Add support of the command fuse with CONFIG_CMD_FUSE to allow access on OTP with command line. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) configs/stm32mp25_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/stm32mp25_defconfig b/configs/stm32mp25_defconfig index 75f27c98b441..9fbd7eb15755 100644 --- a/configs/stm32mp25_defconfig +++ b/configs/stm32mp25_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_ADTIMG=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_CLK=y +CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADB is not set CONFIG_CMD_CACHE=y -- 2.25.1
[PATCH v2 00/14] stm32: add bsec and OTP support to stm32mp25
Add BSEC support to STM32MP25 SoC family with SoC information: - SERIAL number with UUID (BSEC_OTP_DATA5) - RPN = Device part number (BSEC_OTP_DATA9) - PKG = package data register (Bits 2:0 of BSEC_OTP_DATA122) and with board information for STMicroelectronics boards - BOARD identifier: OTP246 - MAC address: OTP247 and after Changes in v2: - fix CONFIG name with 'x': TARGET_ST_STM32MP15x TARGET_ST_STM32MP13x - add "arm: Rename STM32MP13x" - add "arm: Rename STM32MP15x" Patrice Chotard (1): stm32mp: add setup_serial_number for stm32mp25 Patrick Delaunay (12): arm64: dts: st: add bsec support to stm32mp25 stm32mp: bsec: add driver data stm32mp: bsec: add support of stm32mp25 configs: stm32mp25: add support of fuse command stm32mp: add soc.c file smt32mp: add setup_mac_address for stm32mp25 stm32mp: stm32prog: add support of stm32mp25 stm32mp: activate the command stboard for stm32mp25 boards board: st: stm32mp2: add checkboard board: st: stm32mp2: display the board identification arm: Rename STM32MP13x arm: Rename STM32MP15x Yann Gautier (1): arm: stm32mp: add Rev.B support for STM32MP25 arch/arm/dts/Makefile | 4 +- arch/arm/dts/stm32mp15-u-boot.dtsi| 2 +- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 +- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 +- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 4 +- arch/arm/dts/stm32mp25-u-boot.dtsi| 4 + arch/arm/dts/stm32mp251.dtsi | 16 +++ arch/arm/mach-stm32mp/Kconfig | 8 +- arch/arm/mach-stm32mp/Kconfig.13x | 4 +- arch/arm/mach-stm32mp/Kconfig.15x | 6 +- arch/arm/mach-stm32mp/Makefile| 5 +- arch/arm/mach-stm32mp/bsec.c | 45 +-- arch/arm/mach-stm32mp/cmd_stm32key.c | 20 +-- .../mach-stm32mp/cmd_stm32prog/stm32prog.h| 12 +- arch/arm/mach-stm32mp/include/mach/stm32.h| 22 ++-- .../arm/mach-stm32mp/include/mach/sys_proto.h | 1 + arch/arm/mach-stm32mp/soc.c | 118 ++ arch/arm/mach-stm32mp/stm32mp1/Makefile | 4 +- arch/arm/mach-stm32mp/stm32mp1/cpu.c | 96 +- arch/arm/mach-stm32mp/stm32mp1/fdt.c | 10 +- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 14 +-- arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c | 3 + board/st/common/Kconfig | 2 +- board/st/common/cmd_stboard.c | 2 + board/st/stm32mp1/Kconfig | 4 +- board/st/stm32mp1/stm32mp1.c | 6 +- board/st/stm32mp2/stm32mp2.c | 37 ++ configs/stm32mp13_defconfig | 4 +- configs/stm32mp15_basic_defconfig | 2 +- configs/stm32mp15_defconfig | 2 +- configs/stm32mp15_trusted_defconfig | 4 +- configs/stm32mp25_defconfig | 1 + drivers/clk/stm32/Kconfig | 4 +- 33 files changed, 297 insertions(+), 177 deletions(-) create mode 100644 arch/arm/mach-stm32mp/soc.c -- 2.25.1
[PATCH v2 04/14] stm32mp: bsec: add support of stm32mp25
Add support of BSEC for STM32MP25x family to access OTP. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/bsec.c | 7 +++ arch/arm/mach-stm32mp/include/mach/stm32.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 705c994d9307..5b869017ec1a 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -784,9 +784,16 @@ static const struct stm32mp_bsec_drvdata stm32mp15_data = { .size = 96, .ta = false, }; + +static const struct stm32mp_bsec_drvdata stm32mp25_data = { + .size = 368, /* 384 but no access to HWKEY and STM32PRVKEY */ + .ta = true, +}; + static const struct udevice_id stm32mp_bsec_ids[] = { { .compatible = "st,stm32mp13-bsec", .data = (ulong)&stm32mp13_data}, { .compatible = "st,stm32mp15-bsec", .data = (ulong)&stm32mp15_data}, + { .compatible = "st,stm32mp25-bsec", .data = (ulong)&stm32mp25_data}, {} }; diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 46d469881b32..45c929aa605d 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -197,7 +197,8 @@ enum forced_boot_mode { #ifdef CONFIG_STM32MP25X #define BSEC_OTP_SERIAL5 #define BSEC_OTP_RPN 9 -#define BSEC_OTP_PKG 246 +#define BSEC_OTP_PKG 122 +#define BSEC_OTP_MAC 247 #endif #ifndef __ASSEMBLY__ -- 2.25.1
[PATCH v2 03/14] stm32mp: bsec: add driver data
Add driver data in BSEC driver to test presence of OP-TEE TA, mandatory for STM32MP13 family and prepare the support of new device with more OTP than 95. Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/bsec.c | 38 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 28a8280b2804..705c994d9307 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -20,7 +20,6 @@ #include #include -#define BSEC_OTP_MAX_VALUE 95 #define BSEC_OTP_UPPER_START 32 #define BSEC_TIMEOUT_US1 @@ -400,6 +399,11 @@ struct stm32mp_bsec_priv { struct udevice *tee; }; +struct stm32mp_bsec_drvdata { + int size; + bool ta; +}; + static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp) { struct stm32mp_bsec_plat *plat; @@ -609,6 +613,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset, void *buf, int size) { struct stm32mp_bsec_priv *priv = dev_get_priv(dev); + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int ret; int i; bool shadow = true, lock = false; @@ -642,7 +647,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset, otp = offs / sizeof(u32); - for (i = otp; i < (otp + nb_otp) && i <= BSEC_OTP_MAX_VALUE; i++) { + for (i = otp; i < (otp + nb_otp) && i < data->size; i++) { u32 *addr = &((u32 *)buf)[i - otp]; if (lock) @@ -665,6 +670,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset, const void *buf, int size) { struct stm32mp_bsec_priv *priv = dev_get_priv(dev); + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int ret = 0; int i; bool shadow = true, lock = false; @@ -698,7 +704,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset, otp = offs / sizeof(u32); - for (i = otp; i < otp + nb_otp && i <= BSEC_OTP_MAX_VALUE; i++) { + for (i = otp; i < otp + nb_otp && i < data->size; i++) { u32 *val = &((u32 *)buf)[i - otp]; if (lock) @@ -732,6 +738,7 @@ static int stm32mp_bsec_of_to_plat(struct udevice *dev) static int stm32mp_bsec_probe(struct udevice *dev) { + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int otp; struct stm32mp_bsec_plat *plat; struct clk_bulk clk_bulk; @@ -745,16 +752,22 @@ static int stm32mp_bsec_probe(struct udevice *dev) } if (IS_ENABLED(CONFIG_OPTEE)) - bsec_optee_open(dev); + ret = bsec_optee_open(dev); + else + ret = -ENOTSUPP; + /* failed if OP-TEE TA is required */ + if (data->ta && !ret) + return ret; /* * update unlocked shadow for OTP cleared by the rom code * only executed in SPL, it is done in TF-A for TFABOOT */ - if (IS_ENABLED(CONFIG_SPL_BUILD)) { + if (IS_ENABLED(CONFIG_SPL_BUILD) && !data->ta) { plat = dev_get_plat(dev); - for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++) + /* here 57 is the value for STM32MP15x ROM code, only MPU with SPL support*/ + for (otp = 57; otp < data->size; otp++) if (!bsec_read_SR_lock(plat->base, otp)) bsec_shadow_register(dev, plat->base, otp); } @@ -762,9 +775,18 @@ static int stm32mp_bsec_probe(struct udevice *dev) return 0; } +static const struct stm32mp_bsec_drvdata stm32mp13_data = { + .size = 96, + .ta = true, +}; + +static const struct stm32mp_bsec_drvdata stm32mp15_data = { + .size = 96, + .ta = false, +}; static const struct udevice_id stm32mp_bsec_ids[] = { - { .compatible = "st,stm32mp13-bsec" }, - { .compatible = "st,stm32mp15-bsec" }, + { .compatible = "st,stm32mp13-bsec", .data = (ulong)&stm32mp13_data}, + { .compatible = "st,stm32mp15-bsec", .data = (ulong)&stm32mp15_data}, {} }; -- 2.25.1
[PATCH v2 02/14] arm: stm32mp: add Rev.B support for STM32MP25
From: Yann Gautier Add chip revision B support for STM32MP25, for displaying it in trace. Reviewed-by: Patrice Chotard Signed-off-by: Yann Gautier Signed-off-by: Patrick Delaunay --- (no changes since v1) arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c b/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c index 4b2f70af9cc6..7f896a0d65d2 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c +++ b/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c @@ -167,6 +167,9 @@ void get_soc_name(char name[SOC_NAME_SIZE]) case CPU_REV1: cpu_r = "A"; break; + case CPU_REV2: + cpu_r = "B"; + break; default: break; } -- 2.25.1
[PATCH v2 01/14] arm64: dts: st: add bsec support to stm32mp25
Add BSEC support to STM32MP25 SoC family with SoC information: - RPN = Device part number (BSEC_OTP_DATA9) - PKG = package data register (Bits 2:0 of BSEC_OTP_DATA122) Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay Signed-off-by: Alexandre Torgue --- (no changes since v1) arch/arm/dts/stm32mp25-u-boot.dtsi | 4 arch/arm/dts/stm32mp251.dtsi | 16 2 files changed, 20 insertions(+) diff --git a/arch/arm/dts/stm32mp25-u-boot.dtsi b/arch/arm/dts/stm32mp25-u-boot.dtsi index f4f26add2a41..0c8e95b34163 100644 --- a/arch/arm/dts/stm32mp25-u-boot.dtsi +++ b/arch/arm/dts/stm32mp25-u-boot.dtsi @@ -37,6 +37,10 @@ }; }; +&bsec { + bootph-all; +}; + &gpioa { bootph-all; }; diff --git a/arch/arm/dts/stm32mp251.dtsi b/arch/arm/dts/stm32mp251.dtsi index cf2f28dc1582..44eb664fb510 100644 --- a/arch/arm/dts/stm32mp251.dtsi +++ b/arch/arm/dts/stm32mp251.dtsi @@ -127,6 +127,22 @@ }; }; + bsec: efuse@4400 { + compatible = "st,stm32mp25-bsec"; + reg = <0x4400 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + part_number_otp@24 { + reg = <0x24 0x4>; + }; + + package_otp@1e8 { + reg = <0x1e8 0x1>; + bits = <0 3>; + }; + }; + syscfg: syscon@4423 { compatible = "st,stm32mp25-syscfg", "syscon"; reg = <0x4423 0x1>; -- 2.25.1
Re: [PATCH 10/12] stm32mp: activate the command stboard for stm32mp25 boards
Hi, On 1/15/24 14:03, Patrice CHOTARD wrote: On 1/15/24 13:46, Patrick Delaunay wrote: Activate the command stboard for stm32mp25 STMicroelectronics boards, add the default used OTP identifier and the associated board identifier: - stm32mp25xx-ev1 = MB1936 - stm32mp25xx-dk = MB1605 Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/include/mach/stm32.h | 1 + board/st/common/Kconfig| 2 +- board/st/common/cmd_stboard.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 45c929aa605d..726c390977e3 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -198,6 +198,7 @@ enum forced_boot_mode { #define BSEC_OTP_SERIAL 5 #define BSEC_OTP_RPN 9 #define BSEC_OTP_PKG 122 +#define BSEC_OTP_BOARD 246 #define BSEC_OTP_MAC 247 #endif diff --git a/board/st/common/Kconfig b/board/st/common/Kconfig index c1c254d07354..5efac658cf4d 100644 --- a/board/st/common/Kconfig +++ b/board/st/common/Kconfig @@ -1,7 +1,7 @@ config CMD_STBOARD bool "stboard - command for OTP board information" depends on ARCH_STM32MP - default y if TARGET_ST_STM32MP15x || TARGET_ST_STM32MP13x + default y if TARGET_ST_STM32MP25X || TARGET_ST_STM32MP15X || TARGET_ST_STM32MP13X TARGET_ST_STM32MP15x or TARGET_ST_STM32MP15X ? ;-) Internally, we use all our flags in uppercase, whereas at upstream there are some camelcase as TARGET_ST_STM32MP15x or TARGET_ST_STM32MP13x Thks, I don't see that the Simon patches was not merged. I will correct this part in V2 and also include the 2 Simon patches which rename the stm32mp config to avoid the same issue in futur. See series "Clean up of bad Kconfig options" https://patchwork.ozlabs.org/project/uboot/list/?series=339004&state=* => [v2,67/87] arm: Rename STM32MP13x https://patchwork.ozlabs.org/project/uboot/patch/20230129005903.74918-68-...@chromium.org/ => [v2,68/87] arm: Rename STM32MP15x https://patchwork.ozlabs.org/project/uboot/patch/20230129005903.74918-69-...@chromium.org/ help This compile the stboard command to read and write the board in the OTP. diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c index 853ab78bbf16..cb103e69b369 100644 --- a/board/st/common/cmd_stboard.c +++ b/board/st/common/cmd_stboard.c @@ -49,7 +49,9 @@ static bool check_stboard(u16 board) 0x1298, 0x1341, 0x1497, + 0x1605, /* stm32mp25xx-dk */ 0x1635, + 0x1936, /* stm32mp25xx-ev1 */ }; for (i = 0; i < ARRAY_SIZE(st_board_id); i++)
[PATCH] smt32mp: Add dependencies on CMDLINE for command stm32key
We cannot use stm32key commands without CONFIG_CMDLINE so add the required condition. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index 5fc92d07fe6d..c6c89883f2b0 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -144,6 +144,7 @@ config STM32_ECDSA_VERIFY config CMD_STM32KEY bool "command stm32key to fuse public key hash" + depends on CMDLINE help fuse public key hash in corresponding fuse used to authenticate binary. -- 2.25.1
[PATCH 12/12] board: st: stm32mp2: display the board identification
Add the display of the STMicroelectronics board identification saved in OTP in stm32mp2 checkboard function. Signed-off-by: Patrick Delaunay --- board/st/stm32mp2/stm32mp2.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index 9a881583d904..aa7dd31996ea 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -9,9 +9,12 @@ #include #include #include +#include #include #include +#include #include +#include /* * Get a global data pointer @@ -20,6 +23,9 @@ DECLARE_GLOBAL_DATA_PTR; int checkboard(void) { + int ret; + u32 otp; + struct udevice *dev; const char *fdt_compat; int fdt_compat_len; @@ -27,6 +33,23 @@ int checkboard(void) log_info("Board: stm32mp2 (%s)\n", fdt_compat && fdt_compat_len ? fdt_compat : ""); + /* display the STMicroelectronics board identification */ + if (CONFIG_IS_ENABLED(CMD_STBOARD)) { + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (!ret) + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD), + &otp, sizeof(otp)); + if (ret > 0 && otp) + log_info("Board: MB%04x Var%d.%d Rev.%c-%02d\n", +otp >> 16, +(otp >> 12) & 0xF, +(otp >> 4) & 0xF, +((otp >> 8) & 0xF) - 1 + 'A', +otp & 0xF); + } + return 0; } -- 2.25.1
[PATCH 10/12] stm32mp: activate the command stboard for stm32mp25 boards
Activate the command stboard for stm32mp25 STMicroelectronics boards, add the default used OTP identifier and the associated board identifier: - stm32mp25xx-ev1 = MB1936 - stm32mp25xx-dk = MB1605 Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/include/mach/stm32.h | 1 + board/st/common/Kconfig| 2 +- board/st/common/cmd_stboard.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 45c929aa605d..726c390977e3 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -198,6 +198,7 @@ enum forced_boot_mode { #define BSEC_OTP_SERIAL5 #define BSEC_OTP_RPN 9 #define BSEC_OTP_PKG 122 +#define BSEC_OTP_BOARD 246 #define BSEC_OTP_MAC 247 #endif diff --git a/board/st/common/Kconfig b/board/st/common/Kconfig index c1c254d07354..5efac658cf4d 100644 --- a/board/st/common/Kconfig +++ b/board/st/common/Kconfig @@ -1,7 +1,7 @@ config CMD_STBOARD bool "stboard - command for OTP board information" depends on ARCH_STM32MP - default y if TARGET_ST_STM32MP15x || TARGET_ST_STM32MP13x + default y if TARGET_ST_STM32MP25X || TARGET_ST_STM32MP15X || TARGET_ST_STM32MP13X help This compile the stboard command to read and write the board in the OTP. diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c index 853ab78bbf16..cb103e69b369 100644 --- a/board/st/common/cmd_stboard.c +++ b/board/st/common/cmd_stboard.c @@ -49,7 +49,9 @@ static bool check_stboard(u16 board) 0x1298, 0x1341, 0x1497, + 0x1605, /* stm32mp25xx-dk */ 0x1635, + 0x1936, /* stm32mp25xx-ev1 */ }; for (i = 0; i < ARRAY_SIZE(st_board_id); i++) -- 2.25.1
[PATCH 11/12] board: st: stm32mp2: add checkboard
Implement the weak function checkboard to identify the used board with compatible in device tree for the support of stm32mp2 STMicroelectronics boards. Signed-off-by: Patrick Delaunay --- board/st/stm32mp2/stm32mp2.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index c97a7efff46e..9a881583d904 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -8,14 +8,28 @@ #include #include #include +#include #include #include +#include /* * Get a global data pointer */ DECLARE_GLOBAL_DATA_PTR; +int checkboard(void) +{ + const char *fdt_compat; + int fdt_compat_len; + + fdt_compat = ofnode_get_property(ofnode_root(), "compatible", &fdt_compat_len); + + log_info("Board: stm32mp2 (%s)\n", fdt_compat && fdt_compat_len ? fdt_compat : ""); + + return 0; +} + /* board dependent setup after realloc */ int board_init(void) { -- 2.25.1
[PATCH 08/12] smt32mp: add setup_mac_address for stm32mp25
Add a function setup_mac_address() to update the MAC address from the default location in OTP for stm32mp2 platform. The max number of OTP for MAC address is increased to 8 for STM32MP25, defined with get_eth_nb() and checked in setup_mac_address. The MAC address FF:FF:FF:FF:FF:FF, the broadcast ethaddr, is a invalid value used for unused MAC address slot in OTP, for example for board with STM32MP25x part number allows up to 5 ethernet ports but it is not supported by the hardware, without switch; the associated variable "enetaddr%d" is not created. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/soc.c | 70 arch/arm/mach-stm32mp/stm32mp1/cpu.c | 58 +-- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 1 + 3 files changed, 72 insertions(+), 57 deletions(-) diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c index ff70ebe97464..fa56b0d2e0f1 100644 --- a/arch/arm/mach-stm32mp/soc.c +++ b/arch/arm/mach-stm32mp/soc.c @@ -5,10 +5,14 @@ #include #include +#include #include #include #include +/* max: 8 OTP for 5 mac address on stm32mp2*/ +#define MAX_NB_OTP 8 + /* used when CONFIG_DISPLAY_CPUINFO is activated */ int print_cpuinfo(void) { @@ -46,3 +50,69 @@ int setup_serial_number(void) return 0; } + +/* + * If there is no MAC address in the environment, then it will be initialized + * (silently) from the value in the OTP. + */ +__weak int setup_mac_address(void) +{ + int ret; + int i; + u32 otp[MAX_NB_OTP]; + uchar enetaddr[ARP_HLEN]; + struct udevice *dev; + int nb_eth, nb_otp, index; + + if (!IS_ENABLED(CONFIG_NET)) + return 0; + + nb_eth = get_eth_nb(); + if (!nb_eth) + return 0; + + /* 6 bytes for each MAC addr and 4 bytes for each OTP */ + nb_otp = DIV_ROUND_UP(ARP_HLEN * nb_eth, 4); + if (nb_otp > MAX_NB_OTP) { + log_err("invalid number of OTP = %d, max = %d\n", nb_otp, MAX_NB_OTP); + return -EINVAL; + } + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp); + if (ret < 0) + return ret; + + for (index = 0; index < nb_eth; index++) { + /* MAC already in environment */ + if (eth_env_get_enetaddr_by_index("eth", index, enetaddr)) + continue; + + for (i = 0; i < ARP_HLEN; i++) + enetaddr[i] = ((uint8_t *)&otp)[i + ARP_HLEN * index]; + + /* skip FF:FF:FF:FF:FF:FF */ + if (is_broadcast_ethaddr(enetaddr)) + continue; + + if (!is_valid_ethaddr(enetaddr)) { + log_err("invalid MAC address %d in OTP %pM\n", + index, enetaddr); + return -EINVAL; + } + log_debug("OTP MAC address %d = %pM\n", index, enetaddr); + ret = eth_env_set_enetaddr_by_index("eth", index, enetaddr); + if (ret) { + log_err("Failed to set mac address %pM from OTP: %d\n", + enetaddr, ret); + return ret; + } + } + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index f84cb26fa565..524778f00c67 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -280,62 +280,6 @@ static void setup_boot_mode(void) clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL); } -/* - * If there is no MAC address in the environment, then it will be initialized - * (silently) from the value in the OTP. - */ -__weak int setup_mac_address(void) -{ - int ret; - int i; - u32 otp[3]; - uchar enetaddr[6]; - struct udevice *dev; - int nb_eth, nb_otp, index; - - if (!IS_ENABLED(CONFIG_NET)) - return 0; - - nb_eth = get_eth_nb(); - - /* 6 bytes for each MAC addr and 4 bytes for each OTP */ - nb_otp = DIV_ROUND_UP(6 * nb_eth, 4); - - ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp); - if (ret < 0) - return ret; -
[PATCH 07/12] stm32mp: add setup_serial_number for stm32mp25
From: Patrice Chotard Add support of serial number for stm32mp25, gets from OTP with BSEC driver. Signed-off-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- .../arm/mach-stm32mp/include/mach/sys_proto.h | 1 + arch/arm/mach-stm32mp/soc.c | 31 +++ arch/arm/mach-stm32mp/stm32mp1/cpu.c | 27 arch/arm/mach-stm32mp/stm32mp2/cpu.c | 2 ++ 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 83388fdb7371..2a65efc0a50a 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -97,6 +97,7 @@ u32 get_bootauth(void); int get_eth_nb(void); int setup_mac_address(void); +int setup_serial_number(void); /* board power management : configure vddcore according OPP */ void board_vddcore_init(u32 voltage_mv); diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c index 8d5fa474ccaf..ff70ebe97464 100644 --- a/arch/arm/mach-stm32mp/soc.c +++ b/arch/arm/mach-stm32mp/soc.c @@ -3,7 +3,11 @@ * Copyright (C) 2024, STMicroelectronics - All Rights Reserved */ +#include +#include #include +#include +#include /* used when CONFIG_DISPLAY_CPUINFO is activated */ int print_cpuinfo(void) @@ -15,3 +19,30 @@ int print_cpuinfo(void) return 0; } + +int setup_serial_number(void) +{ + char serial_string[25]; + u32 otp[3] = {0, 0, 0 }; + struct udevice *dev; + int ret; + + if (env_get("serial#")) + return 0; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL), + otp, sizeof(otp)); + if (ret < 0) + return ret; + + sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]); + env_set("serial#", serial_string); + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index 00fea7929b2f..f84cb26fa565 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -336,33 +336,6 @@ __weak int setup_mac_address(void) return 0; } -static int setup_serial_number(void) -{ - char serial_string[25]; - u32 otp[3] = {0, 0, 0 }; - struct udevice *dev; - int ret; - - if (env_get("serial#")) - return 0; - - ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL), - otp, sizeof(otp)); - if (ret < 0) - return ret; - - sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]); - env_set("serial#", serial_string); - - return 0; -} - __weak void stm32mp_misc_init(void) { } diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c b/arch/arm/mach-stm32mp/stm32mp2/cpu.c index c0f6519e8d7c..301e365cf4f4 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c @@ -69,6 +69,8 @@ void enable_caches(void) int arch_misc_init(void) { + setup_serial_number(); + return 0; } -- 2.25.1
[PATCH 09/12] stm32mp: stm32prog: add support of stm32mp25
Change OTP number to 364 for STM32MP25 as it is done in bsec driver. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index ae4bd8842f53..eda98eb61d76 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -28,7 +28,15 @@ #else #define OTP_SIZE_SMC 0 #endif -#define OTP_SIZE_TA776 +/* size of the OTP struct in NVMEM PTA */ +#define _OTP_SIZE_TA(otp) (((otp) * 2 + 2) * 4) +#if defined(CONFIG_STM32MP13x) || defined(CONFIG_STM32MP15x) +/* STM32MP1 with BSEC2 */ +#define OTP_SIZE_TA_OTP_SIZE_TA(96) +#else +/* STM32MP2 with BSEC3 */ +#define OTP_SIZE_TA_OTP_SIZE_TA(368) +#endif #define PMIC_SIZE 8 enum stm32prog_target { -- 2.25.1
[PATCH 06/12] stm32mp: add soc.c file
Add a new file soc.c for common functions between stm32mp1 and stm32mp2 family and move print_cpuinfo() in this new file. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Makefile | 1 + arch/arm/mach-stm32mp/soc.c | 17 + arch/arm/mach-stm32mp/stm32mp1/cpu.c | 11 --- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 11 --- 4 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 arch/arm/mach-stm32mp/soc.c diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile index 00dc25bb275c..fdcbbf91dfd5 100644 --- a/arch/arm/mach-stm32mp/Makefile +++ b/arch/arm/mach-stm32mp/Makefile @@ -6,6 +6,7 @@ obj-y += dram_init.o obj-y += syscon.o obj-y += bsec.o +obj-y += soc.o obj-$(CONFIG_STM32MP15x) += stm32mp1/ obj-$(CONFIG_STM32MP13x) += stm32mp1/ diff --git a/arch/arm/mach-stm32mp/soc.c b/arch/arm/mach-stm32mp/soc.c new file mode 100644 index ..8d5fa474ccaf --- /dev/null +++ b/arch/arm/mach-stm32mp/soc.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause +/* + * Copyright (C) 2024, STMicroelectronics - All Rights Reserved + */ + +#include + +/* used when CONFIG_DISPLAY_CPUINFO is activated */ +int print_cpuinfo(void) +{ + char name[SOC_NAME_SIZE]; + + get_soc_name(name); + printf("CPU: %s\n", name); + + return 0; +} diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index 55574fd4bebf..00fea7929b2f 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -158,17 +158,6 @@ void enable_caches(void) dcache_enable(); } -/* used when CONFIG_DISPLAY_CPUINFO is activated */ -int print_cpuinfo(void) -{ - char name[SOC_NAME_SIZE]; - - get_soc_name(name); - printf("CPU: %s\n", name); - - return 0; -} - static void setup_boot_mode(void) { const u32 serial_addr[] = { diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c b/arch/arm/mach-stm32mp/stm32mp2/cpu.c index f43d1aaf72cc..c0f6519e8d7c 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c @@ -67,17 +67,6 @@ void enable_caches(void) dcache_enable(); } -/* used when CONFIG_DISPLAY_CPUINFO is activated */ -int print_cpuinfo(void) -{ - char name[SOC_NAME_SIZE]; - - get_soc_name(name); - printf("CPU: %s\n", name); - - return 0; -} - int arch_misc_init(void) { return 0; -- 2.25.1
[PATCH 05/12] configs: stm32mp25: add support of fuse command
Add support of the command fuse with CONFIG_CMD_FUSE to allow access on OTP with command line. Signed-off-by: Patrick Delaunay --- configs/stm32mp25_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/stm32mp25_defconfig b/configs/stm32mp25_defconfig index 75f27c98b441..9fbd7eb15755 100644 --- a/configs/stm32mp25_defconfig +++ b/configs/stm32mp25_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_ADTIMG=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_CLK=y +CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADB is not set CONFIG_CMD_CACHE=y -- 2.25.1
[PATCH 04/12] stm32mp: bsec: add support of stm32mp25
Add support of BSEC for STM32MP25x family to access OTP. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/bsec.c | 7 +++ arch/arm/mach-stm32mp/include/mach/stm32.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 705c994d9307..5b869017ec1a 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -784,9 +784,16 @@ static const struct stm32mp_bsec_drvdata stm32mp15_data = { .size = 96, .ta = false, }; + +static const struct stm32mp_bsec_drvdata stm32mp25_data = { + .size = 368, /* 384 but no access to HWKEY and STM32PRVKEY */ + .ta = true, +}; + static const struct udevice_id stm32mp_bsec_ids[] = { { .compatible = "st,stm32mp13-bsec", .data = (ulong)&stm32mp13_data}, { .compatible = "st,stm32mp15-bsec", .data = (ulong)&stm32mp15_data}, + { .compatible = "st,stm32mp25-bsec", .data = (ulong)&stm32mp25_data}, {} }; diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index 46d469881b32..45c929aa605d 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -197,7 +197,8 @@ enum forced_boot_mode { #ifdef CONFIG_STM32MP25X #define BSEC_OTP_SERIAL5 #define BSEC_OTP_RPN 9 -#define BSEC_OTP_PKG 246 +#define BSEC_OTP_PKG 122 +#define BSEC_OTP_MAC 247 #endif #ifndef __ASSEMBLY__ -- 2.25.1
[PATCH 00/12] stm32: add bsec and OTP support to stm32mp25
Add BSEC support to STM32MP25 SoC family with SoC information: - SERIAL number with UUID (BSEC_OTP_DATA5) - RPN = Device part number (BSEC_OTP_DATA9) - PKG = package data register (Bits 2:0 of BSEC_OTP_DATA122) and with board information for STMicroelectronics boards - BOARD identifier: OTP246 - MAC address: OTP247 and after Patrice Chotard (1): stm32mp: add setup_serial_number for stm32mp25 Patrick Delaunay (10): arm64: dts: st: add bsec support to stm32mp25 stm32mp: bsec: add driver data stm32mp: bsec: add support of stm32mp25 configs: stm32mp25: add support of fuse command stm32mp: add soc.c file smt32mp: add setup_mac_address for stm32mp25 stm32mp: stm32prog: add support of stm32mp25 stm32mp: activate the command stboard for stm32mp25 boards board: st: stm32mp2: add checkboard board: st: stm32mp2: display the board identification Yann Gautier (1): arm: stm32mp: add Rev.B support for STM32MP25 arch/arm/dts/stm32mp25-u-boot.dtsi| 4 + arch/arm/dts/stm32mp251.dtsi | 16 +++ arch/arm/mach-stm32mp/Makefile| 1 + arch/arm/mach-stm32mp/bsec.c | 45 +-- .../mach-stm32mp/cmd_stm32prog/stm32prog.h| 10 +- arch/arm/mach-stm32mp/include/mach/stm32.h| 4 +- .../arm/mach-stm32mp/include/mach/sys_proto.h | 1 + arch/arm/mach-stm32mp/soc.c | 118 ++ arch/arm/mach-stm32mp/stm32mp1/cpu.c | 96 +- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 14 +-- arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c | 3 + board/st/common/Kconfig | 2 +- board/st/common/cmd_stboard.c | 2 + board/st/stm32mp2/stm32mp2.c | 37 ++ configs/stm32mp25_defconfig | 1 + 15 files changed, 237 insertions(+), 117 deletions(-) create mode 100644 arch/arm/mach-stm32mp/soc.c -- 2.25.1
[PATCH 03/12] stm32mp: bsec: add driver data
Add driver data in BSEC driver to test presence of OP-TEE TA, mandatory for STM32MP13 family and prepare the support of new device with more OTP than 95. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/bsec.c | 38 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 28a8280b2804..705c994d9307 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -20,7 +20,6 @@ #include #include -#define BSEC_OTP_MAX_VALUE 95 #define BSEC_OTP_UPPER_START 32 #define BSEC_TIMEOUT_US1 @@ -400,6 +399,11 @@ struct stm32mp_bsec_priv { struct udevice *tee; }; +struct stm32mp_bsec_drvdata { + int size; + bool ta; +}; + static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp) { struct stm32mp_bsec_plat *plat; @@ -609,6 +613,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset, void *buf, int size) { struct stm32mp_bsec_priv *priv = dev_get_priv(dev); + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int ret; int i; bool shadow = true, lock = false; @@ -642,7 +647,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset, otp = offs / sizeof(u32); - for (i = otp; i < (otp + nb_otp) && i <= BSEC_OTP_MAX_VALUE; i++) { + for (i = otp; i < (otp + nb_otp) && i < data->size; i++) { u32 *addr = &((u32 *)buf)[i - otp]; if (lock) @@ -665,6 +670,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset, const void *buf, int size) { struct stm32mp_bsec_priv *priv = dev_get_priv(dev); + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int ret = 0; int i; bool shadow = true, lock = false; @@ -698,7 +704,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset, otp = offs / sizeof(u32); - for (i = otp; i < otp + nb_otp && i <= BSEC_OTP_MAX_VALUE; i++) { + for (i = otp; i < otp + nb_otp && i < data->size; i++) { u32 *val = &((u32 *)buf)[i - otp]; if (lock) @@ -732,6 +738,7 @@ static int stm32mp_bsec_of_to_plat(struct udevice *dev) static int stm32mp_bsec_probe(struct udevice *dev) { + struct stm32mp_bsec_drvdata *data = (struct stm32mp_bsec_drvdata *)dev_get_driver_data(dev); int otp; struct stm32mp_bsec_plat *plat; struct clk_bulk clk_bulk; @@ -745,16 +752,22 @@ static int stm32mp_bsec_probe(struct udevice *dev) } if (IS_ENABLED(CONFIG_OPTEE)) - bsec_optee_open(dev); + ret = bsec_optee_open(dev); + else + ret = -ENOTSUPP; + /* failed if OP-TEE TA is required */ + if (data->ta && !ret) + return ret; /* * update unlocked shadow for OTP cleared by the rom code * only executed in SPL, it is done in TF-A for TFABOOT */ - if (IS_ENABLED(CONFIG_SPL_BUILD)) { + if (IS_ENABLED(CONFIG_SPL_BUILD) && !data->ta) { plat = dev_get_plat(dev); - for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++) + /* here 57 is the value for STM32MP15x ROM code, only MPU with SPL support*/ + for (otp = 57; otp < data->size; otp++) if (!bsec_read_SR_lock(plat->base, otp)) bsec_shadow_register(dev, plat->base, otp); } @@ -762,9 +775,18 @@ static int stm32mp_bsec_probe(struct udevice *dev) return 0; } +static const struct stm32mp_bsec_drvdata stm32mp13_data = { + .size = 96, + .ta = true, +}; + +static const struct stm32mp_bsec_drvdata stm32mp15_data = { + .size = 96, + .ta = false, +}; static const struct udevice_id stm32mp_bsec_ids[] = { - { .compatible = "st,stm32mp13-bsec" }, - { .compatible = "st,stm32mp15-bsec" }, + { .compatible = "st,stm32mp13-bsec", .data = (ulong)&stm32mp13_data}, + { .compatible = "st,stm32mp15-bsec", .data = (ulong)&stm32mp15_data}, {} }; -- 2.25.1
[PATCH 02/12] arm: stm32mp: add Rev.B support for STM32MP25
From: Yann Gautier Add chip revision B support for STM32MP25, for displaying it in trace. Signed-off-by: Yann Gautier Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c b/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c index 4b2f70af9cc6..7f896a0d65d2 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c +++ b/arch/arm/mach-stm32mp/stm32mp2/stm32mp25x.c @@ -167,6 +167,9 @@ void get_soc_name(char name[SOC_NAME_SIZE]) case CPU_REV1: cpu_r = "A"; break; + case CPU_REV2: + cpu_r = "B"; + break; default: break; } -- 2.25.1
[PATCH 01/12] arm64: dts: st: add bsec support to stm32mp25
Add BSEC support to STM32MP25 SoC family with SoC information: - RPN = Device part number (BSEC_OTP_DATA9) - PKG = package data register (Bits 2:0 of BSEC_OTP_DATA122) Signed-off-by: Patrick Delaunay Signed-off-by: Alexandre Torgue --- arch/arm/dts/stm32mp25-u-boot.dtsi | 4 arch/arm/dts/stm32mp251.dtsi | 16 2 files changed, 20 insertions(+) diff --git a/arch/arm/dts/stm32mp25-u-boot.dtsi b/arch/arm/dts/stm32mp25-u-boot.dtsi index f4f26add2a41..0c8e95b34163 100644 --- a/arch/arm/dts/stm32mp25-u-boot.dtsi +++ b/arch/arm/dts/stm32mp25-u-boot.dtsi @@ -37,6 +37,10 @@ }; }; +&bsec { + bootph-all; +}; + &gpioa { bootph-all; }; diff --git a/arch/arm/dts/stm32mp251.dtsi b/arch/arm/dts/stm32mp251.dtsi index cf2f28dc1582..44eb664fb510 100644 --- a/arch/arm/dts/stm32mp251.dtsi +++ b/arch/arm/dts/stm32mp251.dtsi @@ -127,6 +127,22 @@ }; }; + bsec: efuse@4400 { + compatible = "st,stm32mp25-bsec"; + reg = <0x4400 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + part_number_otp@24 { + reg = <0x24 0x4>; + }; + + package_otp@1e8 { + reg = <0x1e8 0x1>; + bits = <0 3>; + }; + }; + syscfg: syscon@4423 { compatible = "st,stm32mp25-syscfg", "syscon"; reg = <0x4423 0x1>; -- 2.25.1
Re: [PATCH] ARM: dts: stm32: Fix reset for usart1 in scmi configuration
Hi, On 1/4/24 13:37, Patrice Chotard wrote: In SCMI configuration, usart1 is secure, so all its resources are secured (clock and reset) and can't be set/unset by non-secure world but by OP-TEE. Fixes: 68d396bf ("ARM: dts: stm32: add SCMI version of STM32 boards (DK1/DK2/ED1/EV1)") Signed-off-by: Patrice Chotard --- arch/arm/dts/stm32mp15-scmi-u-boot.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/stm32mp15-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp15-scmi-u-boot.dtsi index 7c8fec6cbfb..79494ecad90 100644 --- a/arch/arm/dts/stm32mp15-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15-scmi-u-boot.dtsi @@ -135,7 +135,7 @@ }; &usart1 { - resets = <&rcc USART1_R>; + resets = <&scmi_reset RST_SCMI_USART1>; }; &usart2 { Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2 20/21] stm32: Use bootm_run() and bootz_run()
Hi, On 12/14/23 17:50, Simon Glass wrote: Use the new bootm/z_run() functions to avoid having to create an argument list for the stm32prog code. Signed-off-by: Simon Glass --- (no changes since v1) .../cmd_stm32prog/cmd_stm32prog.c | 20 ++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 8670535844d3..3ed393b7199f 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -125,12 +126,10 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, char dtb_addr[20]; char initrd_addr[40]; char *fdt_arg, *initrd_arg; - char *bootm_argv[5] = { - "bootm", boot_addr_start, - }; const void *uimage = (void *)data->uimage; const void *dtb = (void *)data->dtb; const void *initrd = (void *)data->initrd; + struct bootm_info bmi; fdt_arg = dtb_addr; if (!dtb) @@ -141,7 +140,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, snprintf(boot_addr_start, sizeof(boot_addr_start) - 1, "0x%p", uimage); - initrd_arg = "-"; + initrd_arg = NULL; if (initrd) { snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%p:0x%zx", initrd, data->initrd_size); @@ -149,15 +148,18 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, } printf("Booting kernel at %s %s %s...\n\n\n", boot_addr_start, - initrd_arg, fdt_arg); - bootm_argv[2] = initrd_arg; - bootm_argv[3] = fdt_arg; + initrd_arg ?: "-", fdt_arg); + + bootm_init(&bmi); + bmi.addr_fit = boot_addr_start; + bmi.conf_ramdisk = initrd_arg; + bmi.conf_fdt = fdt_arg; /* Try bootm for legacy and FIT format image */ if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID) - do_bootm(cmdtp, 0, 4, bootm_argv); + bootm_run(&bmi); else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) - do_bootz(cmdtp, 0, 4, bootm_argv); + bootz_run(&bmi); } if (data->script) cmd_source_script(data->script, NULL, NULL); Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH v2 18/21] stm32: Use local vars in stm32prog for initrd and fdt
Hi, On 12/14/23 17:50, Simon Glass wrote: Rather than assigning to the bootm_argv[] array multiple times, use local variables for the two things that can change and assign them at the end. This makes it easier to drop the array eventually. Tidu up an overly short line while we are here. Signed-off-by: Simon Glass --- (no changes since v1) .../cmd_stm32prog/cmd_stm32prog.c | 23 +++ 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index 2411bcf06d8f..8670535844d3 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -124,30 +124,35 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, char boot_addr_start[20]; char dtb_addr[20]; char initrd_addr[40]; + char *fdt_arg, *initrd_arg; char *bootm_argv[5] = { - "bootm", boot_addr_start, "-", dtb_addr, NULL + "bootm", boot_addr_start, }; const void *uimage = (void *)data->uimage; const void *dtb = (void *)data->dtb; const void *initrd = (void *)data->initrd; + fdt_arg = dtb_addr; if (!dtb) - bootm_argv[3] = env_get("fdtcontroladdr"); + fdt_arg = env_get("fdtcontroladdr"); else - snprintf(dtb_addr, sizeof(dtb_addr) - 1, -"0x%p", dtb); + snprintf(dtb_addr, sizeof(dtb_addr) - 1, "0x%p", dtb); snprintf(boot_addr_start, sizeof(boot_addr_start) - 1, "0x%p", uimage); + initrd_arg = "-"; if (initrd) { - snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%p:0x%zx", -initrd, data->initrd_size); - bootm_argv[2] = initrd_addr; + snprintf(initrd_addr, sizeof(initrd_addr) - 1, +"0x%p:0x%zx", initrd, data->initrd_size); + initrd_arg = initrd_addr; } - printf("Booting kernel at %s %s %s...\n\n\n", - boot_addr_start, bootm_argv[2], bootm_argv[3]); + printf("Booting kernel at %s %s %s...\n\n\n", boot_addr_start, + initrd_arg, fdt_arg); + bootm_argv[2] = initrd_arg; + bootm_argv[3] = fdt_arg; + /* Try bootm for legacy and FIT format image */ if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID) do_bootm(cmdtp, 0, 4, bootm_argv); Reviewed-by: Patrick Delaunay Thanks Patrick
Re: [PATCH 2/2] board: st: common: simplify MTD device parsing
Hi, On 11/17/23 18:01, Patrice Chotard wrote: Simplify the way all MTD devices are parsed. Signed-off-by: Patrice Chotard --- board/st/common/stm32mp_dfu.c | 19 ++- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index ded3bf81961..77edb86e78c 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -123,24 +123,9 @@ void set_dfu_alt_info(char *interface, char *devstr) /* probe all MTD devices */ mtd_probe_devices(); - /* probe SPI flash device on a bus */ - if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) { - mtd = get_mtd_device_nm("nor0"); - if (!IS_ERR_OR_NULL(mtd)) + mtd_for_each_device(mtd) + if (!mtd_is_partition(mtd)) board_get_alt_info_mtd(mtd, buf); - - mtd = get_mtd_device_nm("nor1"); - if (!IS_ERR_OR_NULL(mtd)) - board_get_alt_info_mtd(mtd, buf); - } - - mtd = get_mtd_device_nm("nand0"); - if (!IS_ERR_OR_NULL(mtd)) - board_get_alt_info_mtd(mtd, buf); - - mtd = get_mtd_device_nm("spi-nand0"); - if (!IS_ERR_OR_NULL(mtd)) - board_get_alt_info_mtd(mtd, buf); } if (IS_ENABLED(CONFIG_DFU_VIRT)) { Reviewed-by: Patrick Delaunay Thanks Patrick