Skip to contentSkip to conversation

ARM: stm32: Add STM32MP13xx SPL and OpTee-OS start support

PATCH Superseded Marek Vasut 3 participants 35 messages May 12, 2025 – Jul 29, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: stm32: Add STM32MP13xx SPL and OpTee-OS start support

Add SPL support to STM32MP13xx, so U-Boot SPL can initialize the hardware without depending on any out-of-tree blobs. Enable the ability to start OpTee-OS as a fitImage loadable, which allows booting the Linux kernel, DT and OpTee-OS blob together from a single fitImage container file. This avoids any ABI compatibility problems between OpTee-OS SCMI provider ABI and the Linux kernel SCMI consumer ABI expectations, which led to unbootable and irrecoverable systems after updates due to incompatible ABI changes.

Marek Vasut (10):
ARM: stm32: Add STM32MP13xx SPL Kconfig options
ARM: stm32: Add STM32MP13xx SPL hardware initialization
ARM: stm32: Limit early cache enablement in SPL to STM32MP15xx
ARM: stm32: Add STM32MP13xx PMIC initialization for DDR3 DRAM type
ARM: stm32: Add STM32MP13xx debug UART initialization
ARM: dts: stm32: Add stm32mp13-ddr.dtsi template
ARM: dts: stm32: Add 512 MiB DRAM settings for DH STM32MP13xx DHCOR
DHSBC
ARM: dts: stm32: Add STM32MP13x SPL specific DT additions
ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC
ARM: dts: stm32: Switch defconfig to SPL for DH STM32MP13xx DHCOR
DHSBC

 arch/arm/dts/stm32mp1-ddr.dtsi                | 187 ++++++++++++++++
 arch/arm/dts/stm32mp13-ddr.dtsi               |  49 +++++
 .../stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi | 100 +++++++++
 arch/arm/dts/stm32mp13-u-boot.dtsi            |  89 ++++++++
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi    | 156 +++++++++++++-
 arch/arm/dts/stm32mp15-ddr.dtsi               | 170 +--------------
 arch/arm/mach-stm32mp/Kconfig                 |   7 +-
 arch/arm/mach-stm32mp/Kconfig.13x             |   3 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h    |   2 +
 arch/arm/mach-stm32mp/stm32mp1/cpu.c          |   9 +-
 arch/arm/mach-stm32mp/stm32mp1/spl.c          |   3 +-
 arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c   | 204 ++++++++++++++++++
 board/st/common/stpmic1.c                     |  51 +++--
 board/st/stm32mp1/debug_uart.c                |  21 +-
 configs/stm32mp13_dhcor_defconfig             |  30 ++-
 configs/stm32mp15_dhsom.config                |  48 +----
 configs/stm32mp_dhsom.config                  |  35 ++-
 17 files changed, 914 insertions(+), 250 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp1-ddr.dtsi
 create mode 100644 arch/arm/dts/stm32mp13-ddr.dtsi
 create mode 100644 arch/arm/dts/stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Signature · 1 line
2.47.2
#1 lore raw

PATCH 1/10 ARM: stm32: Add STM32MP13xx SPL Kconfig options

Introduce Kconfig options used by SPL on STM32MP13xx and isolate the Kconfig options only used in case TFA BL2 is used as a SPL behind CONFIG_TFABOOT dependency.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
 arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-stm32mp/Kconfig +5 -2
index 58250901101..3a0ca50e9d6 100644
@@ -40,16 +40,19 @@ choice
 config STM32MP13X
 	bool "Support STMicroelectronics STM32MP13x Soc"
 	select ARCH_EARLY_INIT_R
-	select ARM_SMCCC
+	select ARM_SMCCC if TFABOOT
+	select ARCH_SUPPORT_PSCI if !TFABOOT
+	select BINMAN if !TFABOOT
 	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
-	select OF_BOARD
+	select OF_BOARD if TFABOOT
 	select OF_BOARD_SETUP
 	select PINCTRL_STM32
 	select STM32_RCC
 	select STM32_RESET
 	select STM32_SERIAL
+	select SUPPORT_SPL if !TFABOOT
 	select SYS_ARCH_TIMER
 	imply CMD_NVEDIT_INFO
 	imply OF_UPSTREAM
arch/arm/mach-stm32mp/Kconfig.13x +2 -1
index bc8b3f8cf77..cecf9e3b8c7 100644
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X
 endchoice
 
 config TEXT_BASE
-	default 0xC0000000
+	default 0xC0000000 if TFABOOT
+	default 0xC0100000 if !TFABOOT
 
 config PRE_CON_BUF_ADDR
 	default 0xC0800000
Signature · 1 line
2.47.2
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

Quoted 55 lines · Marek Vasut

Introduce Kconfig options used by SPL on STM32MP13xx and isolate the Kconfig options only used in case TFA BL2 is used as a SPL behind CONFIG_TFABOOT dependency.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
 arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-stm32mp/Kconfig +5 -2
index 58250901101..3a0ca50e9d6 100644
@@ -40,16 +40,19 @@ choice
 config STM32MP13X
 	bool "Support STMicroelectronics STM32MP13x Soc"
 	select ARCH_EARLY_INIT_R
-	select ARM_SMCCC
+	select ARM_SMCCC if TFABOOT
+	select ARCH_SUPPORT_PSCI if !TFABOOT
+	select BINMAN if !TFABOOT
 	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
-	select OF_BOARD
+	select OF_BOARD if TFABOOT
 	select OF_BOARD_SETUP
 	select PINCTRL_STM32
 	select STM32_RCC
 	select STM32_RESET
 	select STM32_SERIAL
+	select SUPPORT_SPL if !TFABOOT
 	select SYS_ARCH_TIMER
 	imply CMD_NVEDIT_INFO
 	imply OF_UPSTREAM
arch/arm/mach-stm32mp/Kconfig.13x +0 -0
index bc8b3f8cf77..cecf9e3b8c7 100644

arch/arm/mach-stm32mp/Kconfig.13x config TARGET_ST_STM32MP13X · line 27

Quoted 9 lines
arch/arm/mach-stm32mp/Kconfig.13x +2 -1
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X
 endchoice
 
 config TEXT_BASE
-	default 0xC0000000
+	default 0xC0000000 if TFABOOT
+	default 0xC0100000 if !TFABOOT
 
 config PRE_CON_BUF_ADDR
 	default 0xC0800000

Thanks
Patrice

#3 lore raw

Re: [PATCH 01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

In reply to Marek Vasut

Hi,

Quoted 55 lines · Marek Vasut

Introduce Kconfig options used by SPL on STM32MP13xx and isolate the Kconfig options only used in case TFA BL2 is used as a SPL behind CONFIG_TFABOOT dependency.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
  arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
  2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-stm32mp/Kconfig +5 -2
index 58250901101..3a0ca50e9d6 100644
@@ -40,16 +40,19 @@ choice
  config STM32MP13X
  	bool "Support STMicroelectronics STM32MP13x Soc"
  	select ARCH_EARLY_INIT_R
-	select ARM_SMCCC
+	select ARM_SMCCC if TFABOOT
+	select ARCH_SUPPORT_PSCI if !TFABOOT
+	select BINMAN if !TFABOOT
  	select CPU_V7A
  	select CPU_V7_HAS_NONSEC
  	select CPU_V7_HAS_VIRT
-	select OF_BOARD
+	select OF_BOARD if TFABOOT
  	select OF_BOARD_SETUP
  	select PINCTRL_STM32
  	select STM32_RCC
  	select STM32_RESET
  	select STM32_SERIAL
+	select SUPPORT_SPL if !TFABOOT
  	select SYS_ARCH_TIMER
  	imply CMD_NVEDIT_INFO
  	imply OF_UPSTREAM
arch/arm/mach-stm32mp/Kconfig.13x +0 -0
index bc8b3f8cf77..cecf9e3b8c7 100644

arch/arm/mach-stm32mp/Kconfig.13x config TARGET_ST_STM32MP13X · line 27

Quoted 9 lines
arch/arm/mach-stm32mp/Kconfig.13x +2 -1
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X
  endchoice
 
  config TEXT_BASE
-	default 0xC0000000
+	default 0xC0000000 if TFABOOT
+	default 0xC0100000 if !TFABOOT
 
  config PRE_CON_BUF_ADDR
  	default 0xC0800000

I don't understood  why you modify TEXT_BASE here.

I expect to have the same base address for SPL or for TF-A boot even if we decide to change this address between STM32MP13 and STM32MP15.

the new address avoid potential issue on initial stack size as see on STM32MP15 (limited at 0x100000) and because we have no more issue with STM32CubeProgrammer (previously the flash-layout file was loaded by TF-A at 0xC0000000).

We don't change STM32MP15 just to avoid to break the compatibility...

The default memory is fully described here:

https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#Before_relocation

For STM32MP13 the default value are

1/ CONFIG_TEXT_BASE = 0xC0000000 (begin of DDR)

2/ CONFIG_CUSTOM_SYS_INIT_SP_ADDR = C0400000

You change the default STM32MP13 base address to keep the SAME description for you board ?

	CONFIG_SPL_LOAD_FIT=y
	CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000

So FIT is loaded at the same address than U-Boot ?

FIT for STM32MP15 was managed with binman config in arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi

			images {
				uboot {
					arch = "arm";
					compression = "none";
					description = "U-Boot (32-bit)";
					entry = <CONFIG_TEXT_BASE>;
					load = <CONFIG_TEXT_BASE>;
					type = "standalone";

					uboot-blob {
						filename = "u-boot-nodtb.bin";
						type = "blob-ext";
					};
				};

I don't sure it is the same for STM32MP13 after after your serie.....

Anyway I think the better solution to avoid a extra copy is to load FIT after final U-Boot location in DDR

CONFIG_SPL_LOAD_FIT_ADDRESS=0xc4000000

=> this address can be identical for STM32MP13 and STM32MP15

and to keep the the default value for CONFIG_TEXT_BASE
- 0xC0000000 for STM32MP13
- 0xC0100000 for STM32MP15

Regards

Patrick

#4 lore raw

Re: [PATCH 01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

On 6/3/25 3:26 PM, Patrick DELAUNAY wrote:

Hi,

Quoted 7 lines
Quoted 7 lines
arch/arm/mach-stm32mp/Kconfig.13x +0 -0
index bc8b3f8cf77..cecf9e3b8c7 100644
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X

  endchoice
  config TEXT_BASE

Quoted 8 lines
Quoted 5 lines

-    default 0xC0000000
+    default 0xC0000000 if TFABOOT
+    default 0xC0100000 if !TFABOOT
  config PRE_CON_BUF_ADDR
      default 0xC0800000

I don't understood  why you modify TEXT_BASE here.

Loading of data to the very beginning of DRAM may fail in case the data are wrapped in various container image types, because the image loader in SPL may use the area before the data load address to load for example image header(s) in there. This is one example of such header loading, which is triggered on STM32MP13xx in SPL:

https://source.denx.de/u-boot/u-boot/-/blob/master/include/spl_load.h#L18

"
18 struct legacy_img_hdr *header =
19 spl_get_load_buffer(-sizeof(*header), sizeof(*header));
20 ulong base_offset, image_offset, overhead;
21 int read, ret;
22
23 log_debug("\nloading hdr from %lx to %p\n", (ulong)offset,
header);
24 read = info->read(info, offset, ALIGN(sizeof(*header),
25
spl_get_bl_len(info)), header);
"

The header is loaded at CONFIG_TEXT_BASE - sizeof(*header). If CONFIG_TEXT_BASE is start of DRAM with no usable memory right below it AND sizeof(*header) is non-zero, then this loading will fail.

That's why the TEXT_BASE is shifted a bit higher in this patch.

#5 lore raw

Re: [PATCH 01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

On 6/29/25 9:08 PM, Marek Vasut wrote:

Hi,

Quoted 32 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-stm32mp/Kconfig.13x +0 -0
index bc8b3f8cf77..cecf9e3b8c7 100644
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X

  endchoice
  config TEXT_BASE

Quoted 8 lines
Quoted 5 lines

-    default 0xC0000000
+    default 0xC0000000 if TFABOOT
+    default 0xC0100000 if !TFABOOT
  config PRE_CON_BUF_ADDR
      default 0xC0800000

I don't understood  why you modify TEXT_BASE here.

Loading of data to the very beginning of DRAM may fail in case the data are wrapped in various container image types, because the image loader in SPL may use the area before the data load address to load for example image header(s) in there. This is one example of such header loading, which is triggered on STM32MP13xx in SPL:

https://source.denx.de/u-boot/u-boot/-/blob/master/include/spl_load.h#L18

"
 18         struct legacy_img_hdr *header =
 19                 spl_get_load_buffer(-sizeof(*header),
sizeof(*header));
 20         ulong base_offset, image_offset, overhead;
 21         int read, ret;
 22
 23         log_debug("\nloading hdr from %lx to %p\n", (ulong)offset,
header);
 24         read = info->read(info, offset, ALIGN(sizeof(*header), 25 spl_get_bl_len(info)), header);
"

Quoted 3 lines

The header is loaded at CONFIG_TEXT_BASE - sizeof(*header). If CONFIG_TEXT_BASE is start of DRAM with no usable memory right below it AND sizeof(*header) is non-zero, then this loading will fail.

That's why the TEXT_BASE is shifted a bit higher in this patch.

Any news on this series ? It would be good to move this along.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

Re: [PATCH 01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

Quoted 34 lines · Marek Vasut

On 6/29/25 9:08 PM, Marek Vasut wrote:

Hi,

Quoted 30 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-stm32mp/Kconfig.13x +0 -0
index bc8b3f8cf77..cecf9e3b8c7 100644
@@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X

  endchoice
  config TEXT_BASE

Quoted 8 lines
Quoted 5 lines

-    default 0xC0000000
+    default 0xC0000000 if TFABOOT
+    default 0xC0100000 if !TFABOOT
  config PRE_CON_BUF_ADDR
      default 0xC0800000

I don't understood  why you modify TEXT_BASE here.

Loading of data to the very beginning of DRAM may fail in case the data are wrapped in various container image types, because the image loader in SPL may use the area before the data load address to load for example image header(s) in there. This is one example of such header loading, which is triggered on STM32MP13xx in SPL:

https://source.denx.de/u-boot/u-boot/-/blob/master/include/spl_load.h#L18

"
  18         struct legacy_img_hdr *header =
  19                 spl_get_load_buffer(-sizeof(*header), sizeof(*header)); 20         ulong base_offset, image_offset, overhead;
  21         int read, ret;
  22
  23         log_debug("\nloading hdr from %lx to %p\n", (ulong)offset, header); 24         read = info->read(info, offset, ALIGN(sizeof(*header), 25 spl_get_bl_len(info)), header);
"

Quoted 6 lines
Quoted 3 lines

The header is loaded at CONFIG_TEXT_BASE - sizeof(*header). If CONFIG_TEXT_BASE is start of DRAM with no usable memory right below it AND sizeof(*header) is non-zero, then this loading will fail.

That's why the TEXT_BASE is shifted a bit higher in this patch.

Any news on this series ? It would be good to move this along.

Hi Marek

Sorry for the delay, i am back from vacation. I will prepare pull request soon.

Thanks
Patrice

#7 lore raw

PATCH 2/10 ARM: stm32: Add STM32MP13xx SPL hardware initialization

In reply to Marek Vasut

Add hardware initialization for the STM32MP13xx in SPL. This is similar to STM32MP15xx except the code has to enable MCE to bring DRAM controller up later.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/include/mach/stm32.h  |   2 +
 arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c | 204 ++++++++++++++++++++
 2 files changed, 206 insertions(+)
arch/arm/mach-stm32mp/include/mach/stm32.h +2 -0
index dfba57e7dc4..37f3e8595b2 100644
@@ -156,6 +156,8 @@ enum forced_boot_mode {
 #endif
 
 #ifdef CONFIG_STM32MP13X
+#define TAMP_BACKUP_MAGIC_NUMBER	TAMP_BACKUP_REGISTER(4)
+#define TAMP_BACKUP_BRANCH_ADDRESS	TAMP_BACKUP_REGISTER(5)
 #define TAMP_BOOTCOUNT			TAMP_BACKUP_REGISTER(31)
 #define TAMP_BOOT_CONTEXT		TAMP_BACKUP_REGISTER(30)
 #endif
arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c +204 -0

221 lines not on this page · raw message

Signature · 1 line
2.47.2
Reviewed-by on v1 2/10
#8 lore raw

Re: [PATCH 02/10] ARM: stm32: Add STM32MP13xx SPL hardware initialization

Quoted 5 lines · Marek Vasut

Add hardware initialization for the STM32MP13xx in SPL. This is similar to STM32MP15xx except the code has to enable MCE to bring DRAM controller up later.

Thanks
Patrice

Quoted 259 lines

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/include/mach/stm32.h  |   2 +
 arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c | 204 ++++++++++++++++++++
 2 files changed, 206 insertions(+)
arch/arm/mach-stm32mp/include/mach/stm32.h +2 -0
index dfba57e7dc4..37f3e8595b2 100644
@@ -156,6 +156,8 @@ enum forced_boot_mode {
 #endif
 
 #ifdef CONFIG_STM32MP13X
+#define TAMP_BACKUP_MAGIC_NUMBER	TAMP_BACKUP_REGISTER(4)
+#define TAMP_BACKUP_BRANCH_ADDRESS	TAMP_BACKUP_REGISTER(5)
 #define TAMP_BOOTCOUNT			TAMP_BACKUP_REGISTER(31)
 #define TAMP_BOOT_CONTEXT		TAMP_BACKUP_REGISTER(30)
 #endif
arch/arm/mach-stm32mp/stm32mp1/stm32mp13x.c +204 -0
index 4a811065fc3..79b2f2d0bba 100644
@@ -6,11 +6,59 @@
 #define LOG_CATEGORY LOGC_ARCH
 
 #include <config.h>
+#include <cpu_func.h>
 #include <log.h>
 #include <syscon.h>
 #include <asm/io.h>
+#include <asm/system.h>
+#include <asm/arch/bsec.h>
 #include <asm/arch/stm32.h>
 #include <asm/arch/sys_proto.h>
+#include <dm/device.h>
+#include <dm/uclass.h>
+#include <linux/bitfield.h>
+#include <malloc.h>
+
+/* RCC register */
+#define RCC_TZCR		(STM32_RCC_BASE + 0x00)
+#define RCC_BDCR		(STM32_RCC_BASE + 0x400)
+#define RCC_DBGCFGR		(STM32_RCC_BASE + 0x468)
+#define RCC_MP_APB5ENSETR	(STM32_RCC_BASE + 0x740)
+#define RCC_MP_AHB6ENSETR	(STM32_RCC_BASE + 0x780)
+
+#define RCC_BDCR_VSWRST		BIT(31)
+#define RCC_BDCR_RTCSRC		GENMASK(17, 16)
+
+#define RCC_DBGCFGR_DBGCKEN	BIT(8)
+
+/* DBGMCU register */
+#define DBGMCU_APB4FZ1		(STM32_DBGMCU_BASE + 0x2c)
+#define DBGMCU_APB4FZ1_IWDG2	BIT(2)
+
+/* Security register */
+#define ETZPC_TZMA1_SIZE	(STM32_ETZPC_BASE + 0x04)
+#define ETZPC_DECPROT0		(STM32_ETZPC_BASE + 0x10)
+
+#define TZC_ACTION		(STM32_TZC_BASE + 0x004)
+#define TZC_GATE_KEEPER		(STM32_TZC_BASE + 0x008)
+#define TZC_REGION_BASE(n)	(STM32_TZC_BASE + 0x100 + (0x20 * (n)))
+#define TZC_REGION_TOP(n)	(STM32_TZC_BASE + 0x108 + (0x20 * (n)))
+#define TZC_REGION_ATTRIBUTE(n)	(STM32_TZC_BASE + 0x110 + (0x20 * (n)))
+#define TZC_REGION_ID_ACCESS(n)	(STM32_TZC_BASE + 0x114 + (0x20 * (n)))
+
+#define TAMP_CR1		(STM32_TAMP_BASE + 0x00)
+
+#define PWR_CR1			(STM32_PWR_BASE + 0x00)
+#define PWR_CR1_DBP		BIT(8)
+
+/* boot interface from Bootrom
+ * - boot instance = bit 31:16
+ * - boot device = bit 15:0
+ */
+#define BOOTROM_MODE_MASK	GENMASK(15, 0)
+#define BOOTROM_MODE_SHIFT	0
+#define BOOTROM_INSTANCE_MASK	GENMASK(31, 16)
+#define BOOTROM_INSTANCE_SHIFT	16
 
 /* SYSCFG register */
 #define SYSCFG_IDC_OFFSET	0x380
@@ -23,6 +71,162 @@
 #define RPN_SHIFT	0
 #define RPN_MASK	GENMASK(11, 0)
 
+static void security_init(void)
+{
+	/* Disable the backup domain write protection */
+	/* the protection is enable at each reset by hardware */
+	/* And must be disable by software */
+	setbits_le32(PWR_CR1, PWR_CR1_DBP);
+
+	while (!(readl(PWR_CR1) & PWR_CR1_DBP))
+		;
+
+	/* If RTC clock isn't enable so this is a cold boot then we need
+	 * to reset the backup domain
+	 */
+	if (!(readl(RCC_BDCR) & RCC_BDCR_RTCSRC)) {
+		setbits_le32(RCC_BDCR, RCC_BDCR_VSWRST);
+		while (!(readl(RCC_BDCR) & RCC_BDCR_VSWRST))
+			;
+		clrbits_le32(RCC_BDCR, RCC_BDCR_VSWRST);
+	}
+
+	/* allow non secure access in Write/Read for all peripheral */
+	writel(0, ETZPC_DECPROT0);
+
+	/* Open SYSRAM for no secure access */
+	writel(0x0, ETZPC_TZMA1_SIZE);
+
+	/* enable MCE clock */
+	writel(BIT(1), RCC_MP_AHB6ENSETR);
+
+	/* enable TZC clock */
+	writel(BIT(11), RCC_MP_APB5ENSETR);
+
+	/* Disable Filter 0 */
+	writel(0, TZC_GATE_KEEPER);
+
+	/* Region 0 set to no access by default */
+	/* bit 0 / 16 => nsaid0 read/write Enable
+	 * bit 1 / 17 => nsaid1 read/write Enable
+	 * ...
+	 * bit 15 / 31 => nsaid15 read/write Enable
+	 */
+	writel(0xFFFFFFFF, TZC_REGION_ID_ACCESS(0));
+
+	/* bit 30 / 31 => Secure Global Enable : write/read */
+	writel(BIT(0) | BIT(30) | BIT(31), TZC_REGION_ATTRIBUTE(0));
+
+	writel(0xFFFFFFFF, TZC_REGION_ID_ACCESS(1));
+	writel(0xC0000000, TZC_REGION_BASE(1));
+	writel(0xDDFFFFFF, TZC_REGION_TOP(1));
+	writel(BIT(0) | BIT(30) | BIT(31), TZC_REGION_ATTRIBUTE(1));
+
+	writel(0x00000000, TZC_REGION_ID_ACCESS(2));
+	writel(0xDE000000, TZC_REGION_BASE(2));
+	writel(0xDFFFFFFF, TZC_REGION_TOP(2));
+	writel(BIT(0) | BIT(30) | BIT(31), TZC_REGION_ATTRIBUTE(2));
+
+	writel(0xFFFFFFFF, TZC_REGION_ID_ACCESS(3));
+	writel(0x00000000, TZC_REGION_BASE(3));
+	writel(0xBFFFFFFF, TZC_REGION_TOP(3));
+	writel(BIT(0) | BIT(30) | BIT(31), TZC_REGION_ATTRIBUTE(3));
+
+	/* Set Action */
+	writel(BIT(0), TZC_ACTION);
+
+	/* Enable Filter 0 */
+	writel(BIT(0), TZC_GATE_KEEPER);
+
+	/* RCC trust zone deactivated */
+	writel(0x0, RCC_TZCR);
+
+	/* TAMP: deactivate the internal tamper
+	 * Bit 23 ITAMP8E: monotonic counter overflow
+	 * Bit 20 ITAMP5E: RTC calendar overflow
+	 * Bit 19 ITAMP4E: HSE monitoring
+	 * Bit 18 ITAMP3E: LSE monitoring
+	 * Bit 16 ITAMP1E: RTC power domain supply monitoring
+	 */
+	writel(0x0, TAMP_CR1);
+}
+
+/*
+ * Debug init
+ */
+void dbgmcu_init(void)
+{
+	/*
+	 * Freeze IWDG2 if Cortex-A7 is in debug mode
+	 * done in TF-A for TRUSTED boot and
+	 * DBGMCU access is controlled by BSEC_DENABLE.DBGSWENABLE
+	 */
+	if (bsec_dbgswenable()) {
+		setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
+		setbits_le32(DBGMCU_APB4FZ1, DBGMCU_APB4FZ1_IWDG2);
+	}
+}
+
+void spl_board_init(void)
+{
+	struct udevice *dev;
+	u8 *tlb;
+	int ret;
+
+	dbgmcu_init();
+
+	/* force probe of BSEC driver to shadow the upper OTP */
+	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stm32mp_bsec), &dev);
+	if (ret)
+		log_warning("BSEC probe failed: %d\n", ret);
+
+	/* Enable Dcache here, now that DRAM is available */
+	if (IS_ENABLED(CONFIG_XPL_BUILD) && IS_ENABLED(CONFIG_STM32MP13X)) {
+		tlb = memalign(0x4000, PGTABLE_SIZE);
+		if (!tlb)
+			return;
+
+		gd->arch.tlb_size = PGTABLE_SIZE;
+		gd->arch.tlb_addr = (unsigned long)tlb;
+		dcache_enable();
+	}
+}
+
+/* get bootmode from ROM code boot context: saved in TAMP register */
+static void update_bootmode(void)
+{
+	u32 boot_mode;
+	u32 bootrom_itf = readl(get_stm32mp_rom_api_table());
+	u32 bootrom_device, bootrom_instance;
+
+	/* enable TAMP clock = RTCAPBEN */
+	writel(BIT(8), RCC_MP_APB5ENSETR);
+
+	/* read bootrom context */
+	bootrom_device =
+		(bootrom_itf & BOOTROM_MODE_MASK) >> BOOTROM_MODE_SHIFT;
+	bootrom_instance =
+		(bootrom_itf & BOOTROM_INSTANCE_MASK) >> BOOTROM_INSTANCE_SHIFT;
+	boot_mode =
+		((bootrom_device << BOOT_TYPE_SHIFT) & BOOT_TYPE_MASK) |
+		((bootrom_instance << BOOT_INSTANCE_SHIFT) &
+		 BOOT_INSTANCE_MASK);
+
+	/* save the boot mode in TAMP backup register */
+	clrsetbits_le32(TAMP_BOOT_CONTEXT,
+			TAMP_BOOT_MODE_MASK,
+			boot_mode << TAMP_BOOT_MODE_SHIFT);
+}
+
+/* weak function: STM32MP15x mach init for boot without TFA */
+void stm32mp_cpu_init(void)
+{
+	if (IS_ENABLED(CONFIG_XPL_BUILD)) {
+		security_init();
+		update_bootmode();
+	}
+}
+
 static u32 read_idc(void)
 {
 	void *syscfg = syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
#9 lore raw

PATCH 3/10 ARM: stm32: Limit early cache enablement in SPL to STM32MP15xx

In reply to Marek Vasut

The STM32MP13xx SRAM size is half that the SRAM size on STM32MP15xx, disable early dcache start on STM32MP13xx as the TLB itself takes about a quarter of the SPL size. The dcache will be enabled later, once DRAM is available and TLB can be placed in DRAM.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/stm32mp1/cpu.c | 9 ++++++---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/cpu.c +6 -3
index 9ab5a3ede52..1ae82489a4b 100644
@@ -28,7 +28,9 @@
  * early TLB into the .data section so that it not get cleared
  * with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
  */
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
 u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
+#endif
 
 u32 get_bootmode(void)
 {
@@ -95,18 +97,19 @@ void dram_bank_mmu_setup(int bank)
  */
 static void early_enable_caches(void)
 {
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
 	/* I-cache is already enabled in start.S: cpu_init_cp15 */
-
 	if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
 		return;
 
 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-		gd->arch.tlb_size = PGTABLE_SIZE;
-		gd->arch.tlb_addr = (unsigned long)&early_tlb;
+	gd->arch.tlb_size = PGTABLE_SIZE;
+	gd->arch.tlb_addr = (unsigned long)&early_tlb;
 #endif
 
 	/* enable MMU (default configuration) */
 	dcache_enable();
+#endif
 }
 
 /*
arch/arm/mach-stm32mp/stm32mp1/spl.c +2 -1
index 9c4fafbf478..e63bdaaf42f 100644
@@ -220,10 +220,11 @@ void board_init_f(ulong dummy)
 	 * activate cache on DDR only when DDR is fully initialized
 	 * to avoid speculative access and issue in get_ram_size()
 	 */
-	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !IS_ENABLED(CONFIG_STM32MP13X)) {
 		mmu_set_region_dcache_behaviour(STM32_DDR_BASE,
 						CONFIG_DDR_CACHEABLE_SIZE,
 						DCACHE_DEFAULT_OPTION);
+	}
 }
 
 void spl_board_prepare_for_boot(void)
Signature · 1 line
2.47.2
Reviewed-by on v1 3/10
#10 lore raw

Re: [PATCH 03/10] ARM: stm32: Limit early cache enablement in SPL to STM32MP15xx

Quoted 69 lines · Marek Vasut

The STM32MP13xx SRAM size is half that the SRAM size on STM32MP15xx, disable early dcache start on STM32MP13xx as the TLB itself takes about a quarter of the SPL size. The dcache will be enabled later, once DRAM is available and TLB can be placed in DRAM.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/stm32mp1/cpu.c | 9 ++++++---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/cpu.c +6 -3
index 9ab5a3ede52..1ae82489a4b 100644
@@ -28,7 +28,9 @@
  * early TLB into the .data section so that it not get cleared
  * with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
  */
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
 u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
+#endif
 
 u32 get_bootmode(void)
 {
@@ -95,18 +97,19 @@ void dram_bank_mmu_setup(int bank)
  */
 static void early_enable_caches(void)
 {
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
 	/* I-cache is already enabled in start.S: cpu_init_cp15 */
-
 	if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
 		return;
 
 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-		gd->arch.tlb_size = PGTABLE_SIZE;
-		gd->arch.tlb_addr = (unsigned long)&early_tlb;
+	gd->arch.tlb_size = PGTABLE_SIZE;
+	gd->arch.tlb_addr = (unsigned long)&early_tlb;
 #endif
 
 	/* enable MMU (default configuration) */
 	dcache_enable();
+#endif
 }
 
 /*
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -0
index 9c4fafbf478..e63bdaaf42f 100644
@@ -220,10 +220,11 @@ void board_init_f(ulong dummy)
 	 * activate cache on DDR only when DDR is fully initialized
 	 * to avoid speculative access and issue in get_ram_size()

arch/arm/mach-stm32mp/stm32mp1/spl.c void board_init_f(ulong dummy) · line 230

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/spl.c +2 -1
 	 */
-	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !IS_ENABLED(CONFIG_STM32MP13X)) {
 		mmu_set_region_dcache_behaviour(STM32_DDR_BASE,
 						CONFIG_DDR_CACHEABLE_SIZE,
 						DCACHE_DEFAULT_OPTION);
+	}
 }
 
 void spl_board_prepare_for_boot(void)

Thanks
Patrice

#11 lore raw

Re: [PATCH 03/10] ARM: stm32: Limit early cache enablement in SPL to STM32MP15xx

In reply to Marek Vasut
Quoted 40 lines · Marek Vasut

The STM32MP13xx SRAM size is half that the SRAM size on STM32MP15xx, disable early dcache start on STM32MP13xx as the TLB itself takes about a quarter of the SPL size. The dcache will be enabled later, once DRAM is available and TLB can be placed in DRAM.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/mach-stm32mp/stm32mp1/cpu.c | 9 ++++++---
  arch/arm/mach-stm32mp/stm32mp1/spl.c | 3 ++-
  2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/cpu.c +2 -0
index 9ab5a3ede52..1ae82489a4b 100644
@@ -28,7 +28,9 @@
   * early TLB into the .data section so that it not get cleared
   * with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
   */
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
  u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
+#endif
 
  u32 get_bootmode(void)
  {

arch/arm/mach-stm32mp/stm32mp1/cpu.c void dram_bank_mmu_setup(int bank) · line 100

Quoted 4 lines
arch/arm/mach-stm32mp/stm32mp1/cpu.c +1 -0
@@ -95,18 +97,19 @@ void dram_bank_mmu_setup(int bank)
   */
  static void early_enable_caches(void)
  {
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))

can you replace #if, if it possible?

if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))

	return;
Quoted 35 lines
arch/arm/mach-stm32mp/stm32mp1/cpu.c +3 -3
  	/* I-cache is already enabled in start.S: cpu_init_cp15 */
-
  	if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
  		return;
 
  #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-		gd->arch.tlb_size = PGTABLE_SIZE;
-		gd->arch.tlb_addr = (unsigned long)&early_tlb;
+	gd->arch.tlb_size = PGTABLE_SIZE;
+	gd->arch.tlb_addr = (unsigned long)&early_tlb;
  #endif
 
  	/* enable MMU (default configuration) */
  	dcache_enable();
+#endif
  }
 
  /*
arch/arm/mach-stm32mp/stm32mp1/spl.c +2 -1
index 9c4fafbf478..e63bdaaf42f 100644
@@ -220,10 +220,11 @@ void board_init_f(ulong dummy)
  	 * activate cache on DDR only when DDR is fully initialized
  	 * to avoid speculative access and issue in get_ram_size()
  	 */
-	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+	if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !IS_ENABLED(CONFIG_STM32MP13X)) {
  		mmu_set_region_dcache_behaviour(STM32_DDR_BASE,
  						CONFIG_DDR_CACHEABLE_SIZE,
  						DCACHE_DEFAULT_OPTION);
+	}
  }
 
  void spl_board_prepare_for_boot(void)
#12 lore raw

Re: [PATCH 03/10] ARM: stm32: Limit early cache enablement in SPL to STM32MP15xx

On 6/3/25 3:37 PM, Patrick DELAUNAY wrote:

Hi,

Quoted 23 lines
Quoted 14 lines
arch/arm/mach-stm32mp/stm32mp1/cpu.c +2 -0
index 9ab5a3ede52..1ae82489a4b 100644
@@ -28,7 +28,9 @@
    * early TLB into the .data section so that it not get cleared
    * with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
    */
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))
   u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
+#endif
   u32 get_bootmode(void)
   {

arch/arm/mach-stm32mp/stm32mp1/cpu.c void dram_bank_mmu_setup(int bank) · line 100

Quoted 4 lines
arch/arm/mach-stm32mp/stm32mp1/cpu.c +1 -0
@@ -95,18 +97,19 @@ void dram_bank_mmu_setup(int bank)
    */
   static void early_enable_caches(void)
   {
+#if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))

can you replace #if, if it possible?

Quoted 3 lines

if (!IS_ENABLED(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_STM32MP13X))

    return;

No, because of the "u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);" dependency which really must be compiled out using #if ... #endif. If the early_tlb is unreachable due to preprocessor macros, then early_enable_caches() cannot reference it, hence the #if ... in it.

#13 lore raw

PATCH 4/10 ARM: stm32: Add STM32MP13xx PMIC initialization for DDR3 DRAM type

In reply to Marek Vasut

The STM32MP13xx PMIC initialization for DDR3 DRAM type is similar to the STM32MP15xx PMIC initialization, except the VTT rail is not enabled. Fill in the STM32MP13xx support.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 board/st/common/stpmic1.c | 51 ++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 17 deletions(-)
board/st/common/stpmic1.c +34 -17
index 45c2bb5bcea..b46f89dacb9 100644
@@ -14,8 +14,19 @@
 #include <power/pmic.h>
 #include <power/stpmic1.h>
 
+static bool is_stm32mp13xx(void)
+{
+	if (!IS_ENABLED(CONFIG_STM32MP13X))
+		return false;
+
+	return of_machine_is_compatible("st,stm32mp131") ||
+	       of_machine_is_compatible("st,stm32mp133") ||
+	       of_machine_is_compatible("st,stm32mp135");
+}
+
 int board_ddr_power_init(enum ddr_type ddr_type)
 {
+	bool is_mp13 = is_stm32mp13xx();
 	struct udevice *dev;
 	bool buck3_at_1800000v = false;
 	int ret;
@@ -30,18 +41,21 @@ int board_ddr_power_init(enum ddr_type ddr_type)
 	switch (ddr_type) {
 	case STM32MP_DDR3:
 		/* VTT = Set LDO3 to sync mode */
-		ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
-		if (ret < 0)
-			return ret;
-
-		ret &= ~STPMIC1_LDO3_MODE;
-		ret &= ~STPMIC1_LDO12356_VOUT_MASK;
-		ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
-
-		ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				     ret);
-		if (ret < 0)
-			return ret;
+		if (!is_mp13) {
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
+			if (ret < 0)
+				return ret;
+
+			ret &= ~STPMIC1_LDO3_MODE;
+			ret &= ~STPMIC1_LDO12356_VOUT_MASK;
+			ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
+
+			ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					     ret);
+			if (ret < 0)
+				return ret;
+		}
 
 		/* VDD_DDR = Set BUCK2 to 1.35V */
 		ret = pmic_clrsetbits(dev,
@@ -69,11 +83,14 @@ int board_ddr_power_init(enum ddr_type ddr_type)
 		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
 
 		/* Enable VTT = LDO3 */
-		ret = pmic_clrsetbits(dev,
-				      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
-		if (ret < 0)
-			return ret;
+		if (!is_mp13) {
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_clrsetbits(dev,
+					      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
+			if (ret < 0)
+				return ret;
+		}
 
 		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
 
Signature · 1 line
2.47.2
Reviewed-by on v1 4/10
#14 lore raw

Re: [PATCH 04/10] ARM: stm32: Add STM32MP13xx PMIC initialization for DDR3 DRAM type

Quoted 91 lines · Marek Vasut

The STM32MP13xx PMIC initialization for DDR3 DRAM type is similar to the STM32MP15xx PMIC initialization, except the VTT rail is not enabled. Fill in the STM32MP13xx support.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 board/st/common/stpmic1.c | 51 ++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 17 deletions(-)
board/st/common/stpmic1.c +27 -17
index 45c2bb5bcea..b46f89dacb9 100644
@@ -14,8 +14,19 @@
 #include <power/pmic.h>
 #include <power/stpmic1.h>
 
+static bool is_stm32mp13xx(void)
+{
+	if (!IS_ENABLED(CONFIG_STM32MP13X))
+		return false;
+
+	return of_machine_is_compatible("st,stm32mp131") ||
+	       of_machine_is_compatible("st,stm32mp133") ||
+	       of_machine_is_compatible("st,stm32mp135");
+}
+
 int board_ddr_power_init(enum ddr_type ddr_type)
 {
+	bool is_mp13 = is_stm32mp13xx();
 	struct udevice *dev;
 	bool buck3_at_1800000v = false;
 	int ret;
@@ -30,18 +41,21 @@ int board_ddr_power_init(enum ddr_type ddr_type)
 	switch (ddr_type) {
 	case STM32MP_DDR3:
 		/* VTT = Set LDO3 to sync mode */
-		ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
-		if (ret < 0)
-			return ret;
-
-		ret &= ~STPMIC1_LDO3_MODE;
-		ret &= ~STPMIC1_LDO12356_VOUT_MASK;
-		ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
-
-		ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				     ret);
-		if (ret < 0)
-			return ret;
+		if (!is_mp13) {
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
+			if (ret < 0)
+				return ret;
+
+			ret &= ~STPMIC1_LDO3_MODE;
+			ret &= ~STPMIC1_LDO12356_VOUT_MASK;
+			ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
+
+			ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					     ret);
+			if (ret < 0)
+				return ret;
+		}
 
 		/* VDD_DDR = Set BUCK2 to 1.35V */
 		ret = pmic_clrsetbits(dev,
@@ -69,11 +83,14 @@ int board_ddr_power_init(enum ddr_type ddr_type)
 		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
 
 		/* Enable VTT = LDO3 */
-		ret = pmic_clrsetbits(dev,
-				      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
-		if (ret < 0)
-			return ret;
+		if (!is_mp13) {

board/st/common/stpmic1.c int board_ddr_power_init(enum ddr_type ddr_type) · line 96

Quoted 10 lines
board/st/common/stpmic1.c +7 -0
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_clrsetbits(dev,
+					      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
+			if (ret < 0)
+				return ret;
+		}
 
 		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
 

Thanks
Patrice

#15 lore raw

Re: [PATCH 04/10] ARM: stm32: Add STM32MP13xx PMIC initialization for DDR3 DRAM type

In reply to Marek Vasut

Hi,

Quoted 29 lines · Marek Vasut

The STM32MP13xx PMIC initialization for DDR3 DRAM type is similar to the STM32MP15xx PMIC initialization, except the VTT rail is not enabled. Fill in the STM32MP13xx support.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
  board/st/common/stpmic1.c | 51 ++++++++++++++++++++++++++-------------
  1 file changed, 34 insertions(+), 17 deletions(-)
board/st/common/stpmic1.c +0 -0
index 45c2bb5bcea..b46f89dacb9 100644
@@ -14,8 +14,19 @@
  #include <power/pmic.h>

board/st/common/stpmic1.c line 24

Quoted 10 lines
board/st/common/stpmic1.c +8 -0
  #include <power/stpmic1.h>
 
+static bool is_stm32mp13xx(void)
+{
+	if (!IS_ENABLED(CONFIG_STM32MP13X))
+		return false;
+
+	return of_machine_is_compatible("st,stm32mp131") ||
+	       of_machine_is_compatible("st,stm32mp133") ||
+	       of_machine_is_compatible("st,stm32mp135");

return true;  ?

no need to check compatible if U-Boot is compiled for STM32MP13x..

Quoted 51 lines
board/st/common/stpmic1.c +18 -17
+}
+
  int board_ddr_power_init(enum ddr_type ddr_type)
  {
+	bool is_mp13 = is_stm32mp13xx();
  	struct udevice *dev;
  	bool buck3_at_1800000v = false;
  	int ret;
@@ -30,18 +41,21 @@ int board_ddr_power_init(enum ddr_type ddr_type)
  	switch (ddr_type) {
  	case STM32MP_DDR3:
  		/* VTT = Set LDO3 to sync mode */
-		ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
-		if (ret < 0)
-			return ret;
-
-		ret &= ~STPMIC1_LDO3_MODE;
-		ret &= ~STPMIC1_LDO12356_VOUT_MASK;
-		ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
-
-		ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				     ret);
-		if (ret < 0)
-			return ret;
+		if (!is_mp13) {
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
+			if (ret < 0)
+				return ret;
+
+			ret &= ~STPMIC1_LDO3_MODE;
+			ret &= ~STPMIC1_LDO12356_VOUT_MASK;
+			ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
+
+			ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					     ret);
+			if (ret < 0)
+				return ret;
+		}
 
  		/* VDD_DDR = Set BUCK2 to 1.35V */
  		ret = pmic_clrsetbits(dev,
@@ -69,11 +83,14 @@ int board_ddr_power_init(enum ddr_type ddr_type)
  		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
 
  		/* Enable VTT = LDO3 */
-		ret = pmic_clrsetbits(dev,
-				      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-				      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
-		if (ret < 0)
-			return ret;

board/st/common/stpmic1.c int board_ddr_power_init(enum ddr_type ddr_type) · line 95

Quoted 10 lines
board/st/common/stpmic1.c +8 -0
+		if (!is_mp13) {
+			/* Enable VTT only on STM32MP15xx */
+			ret = pmic_clrsetbits(dev,
+					      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+					      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
+			if (ret < 0)
+				return ret;
+		}
 
  		mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);

Support of VTT is not linked to SoC but to board design...

I think all this part should be reworked / based on TF-A binding to have information in device tree (link between regulators and DDR supply)

in TF-A we manage this part as a generic way to prepare STPMIC1L introduction,

based on information found on device tree when we introduce STM32MP13 and STM32MP25 in TF-A

see binding for compatible = "st,stm32mp1-ddr";

docs/devicetree/bindings/memory-controllers/st,stm32mp1-ddr.txt

Quoted 11 lines

And the supply attributes depending on the DDR type (DDR3/LPDDR2/LPDDR3).

For DDR3:
- vdd-supply    : phandle to the VDD/VDDQ regulator device tree node.
- vref-supply    : phandle to the VREFCA/VREFDQ regulator device tree node.
- vtt-supply    : phandle to the VTT regulator device tree node.

For LPDDR2/LPDDR3:
- vdd1-supply    : phandle to the VDD1 regulator device tree node.
- vdd2-supply    : phandle to the VDD2/VDDCA regulator device tree node.
- vddq-supply    : phandle to the VDDQ regulator device tree node.

the sequence are generic and some supply are optional

For example:

    pmic: stpmic@33 {
        compatible = "st,stpmic1";
        reg = <0x33>;
        interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>; interrupt-controller;
        #interrupt-cells = <2>;
        status = "okay";

        regulators {
            compatible = "st,stpmic1-regulators"; ldo1-supply = <&v3v3>; ldo2-supply = <&v3v3>; ldo3-supply = <&vdd_ddr>; ldo5-supply = <&v3v3>; ldo6-supply = <&v3v3>; pwr_sw1-supply = <&bst_out>; pwr_sw2-supply = <&bst_out>;
...
            vdd_ddr: buck2 {
                regulator-name = "vdd_ddr"; regulator-min-microvolt = <1350000>; regulator-max-microvolt = <1350000>; regulator-always-on; regulator-initial-mode = <0>; regulator-over-current-protection; };
...
            vtt_ddr: ldo3 {
                regulator-name = "vtt_ddr"; regulator-always-on; regulator-over-current-protection; st,regulator-sink-source;
            };
...

            vref_ddr: vref_ddr {
                regulator-name = "vref_ddr";
                regulator-always-on;
            };
...

&ddr {
    vdd-supply = <&vdd_ddr>;
    vtt-supply = <&vtt_ddr>;
    vref-supply = <&vref_ddr>;
};

And it is managed in TF-A code
=> ./plat/st/stm32mp1/plat_ddr.c

anyway for a first implementation it is OK with my remark on comaptible....

Regards

Patrick

Quoted 1 line
#16 lore raw

Re: [PATCH 04/10] ARM: stm32: Add STM32MP13xx PMIC initialization for DDR3 DRAM type

On 6/3/25 4:00 PM, Patrick DELAUNAY wrote:

Hi,

Quoted 20 lines
Quoted 5 lines
board/st/common/stpmic1.c +0 -0
index 45c2bb5bcea..b46f89dacb9 100644

board/st/common/stpmic1.c line 23

Quoted 10 lines
board/st/common/stpmic1.c +8 -0
@@ -14,8 +14,19 @@
   #include <power/pmic.h>
   #include <power/stpmic1.h>
+static bool is_stm32mp13xx(void)
+{
+    if (!IS_ENABLED(CONFIG_STM32MP13X))
+        return false;
+
+    return of_machine_is_compatible("st,stm32mp131") ||
+           of_machine_is_compatible("st,stm32mp133") ||
+           of_machine_is_compatible("st,stm32mp135");

return true;  ?

Quoted 1 line

no need to check compatible if U-Boot is compiled for STM32MP13x..

The compatible check is placed in here deliberately, in case U-Boot gets compiled with support for both MP15 and MP13 .

Quoted 64 lines
Quoted 50 lines
board/st/common/stpmic1.c +3 -0
+}
+
   int board_ddr_power_init(enum ddr_type ddr_type)
   {
+    bool is_mp13 = is_stm32mp13xx();
       struct udevice *dev;
       bool buck3_at_1800000v = false;
       int ret;
@@ -30,18 +41,21 @@ int board_ddr_power_init(enum ddr_type ddr_type)
       switch (ddr_type) {

      case STM32MP_DDR3:
          /* VTT = Set LDO3 to sync mode */
-        ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3)); -        if (ret < 0)
-            return ret;

board/st/common/stpmic1.c +3 -9
-
-        ret &= ~STPMIC1_LDO3_MODE;
-        ret &= ~STPMIC1_LDO12356_VOUT_MASK;
-        ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
-
-        ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-                     ret);
-        if (ret < 0)
-            return ret;
+        if (!is_mp13) {
+            /* Enable VTT only on STM32MP15xx */
+            ret = pmic_reg_read(dev, 

STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
+            if (ret < 0)
+                return ret;

board/st/common/stpmic1.c +6 -0
+
+            ret &= ~STPMIC1_LDO3_MODE;
+            ret &= ~STPMIC1_LDO12356_VOUT_MASK;
+            ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
+
+            ret = pmic_reg_write(dev, 

STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+                         ret);
+            if (ret < 0)
+                return ret;
+        }
          /* VDD_DDR = Set BUCK2 to 1.35V */
          ret = pmic_clrsetbits(dev,

board/st/common/stpmic1.c +0 -4
@@ -69,11 +83,14 @@ int board_ddr_power_init(enum ddr_type ddr_type)
           mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
           /* Enable VTT = LDO3 */
-        ret = pmic_clrsetbits(dev,
-                      STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
-                      STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
-        if (ret < 0)

board/st/common/stpmic1.c int board_ddr_power_init(enum ddr_type ddr_type) · line 93

Quoted 10 lines
board/st/common/stpmic1.c +8 -1
-            return ret;
+        if (!is_mp13) {
+            /* Enable VTT only on STM32MP15xx */
+            ret = pmic_clrsetbits(dev,
+                          STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
+                          STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
+            if (ret < 0)
+                return ret;
+        }
           mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);

Support of VTT is not linked to SoC but to board design...

Quoted 1 line

I think all this part should be reworked / based on TF-A binding

Sorry, no. TFA is not an authoritative source for DT bindings, so I don't want to add such bindings into U-Boot and support them for all eternity. Get those bindings upstream and then this can be reworked.

In the meantime, how do you propose VTT can be enabled/disabled per board ?

#17 lore raw

PATCH 5/10 ARM: stm32: Add STM32MP13xx debug UART initialization

In reply to Marek Vasut

Add default STM32MP13xx debug UART initialization. This is similar to STM32MP15xx debug UART initialization, except the RCC registers are at different offsets and the UART pinmux pins are different.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 board/st/stm32mp1/debug_uart.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
board/st/stm32mp1/debug_uart.c +18 -3
index 24e3f9f2201..4c2149e0480 100644
@@ -9,17 +9,32 @@
 #include <asm/arch/stm32.h>
 #include <linux/bitops.h>
 
+#if IS_ENABLED(CONFIG_STM32MP13X)
+#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0700)
+#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0768)
+#elif IS_ENABLED(CONFIG_STM32MP15X)
 #define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
 #define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
+#endif
 
+#define GPIOA_BASE 0x50002000
 #define GPIOG_BASE 0x50008000
 
 void board_debug_uart_init(void)
 {
-	if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE) {
-		/* UART4 clock enable */
-		setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+	if (CONFIG_DEBUG_UART_BASE != STM32_UART4_BASE)
+		return;
 
+	/* UART4 clock enable */
+	setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+
+	if (IS_ENABLED(CONFIG_STM32MP13X)) {
+		/* GPIOA clock enable */
+		writel(BIT(0), RCC_MP_AHB4ENSETR);
+		/* GPIO configuration for DH boards: Uart4 TX = A9 */
+		writel(0xfffbffff, GPIOA_BASE + 0x00);
+		writel(0x00000080, GPIOA_BASE + 0x24);
+	} else if (IS_ENABLED(CONFIG_STM32MP15X)) {
 		/* GPIOG clock enable */
 		writel(BIT(6), RCC_MP_AHB4ENSETR);
 		/* GPIO configuration for ST boards: Uart4 TX = G11 */
Signature · 1 line
2.47.2
Reviewed-by on v1 5/10
#18 lore raw

Re: [PATCH 05/10] ARM: stm32: Add STM32MP13xx debug UART initialization

Quoted 53 lines · Marek Vasut

Add default STM32MP13xx debug UART initialization. This is similar to STM32MP15xx debug UART initialization, except the RCC registers are at different offsets and the UART pinmux pins are different.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 board/st/stm32mp1/debug_uart.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
board/st/stm32mp1/debug_uart.c +11 -3
index 24e3f9f2201..4c2149e0480 100644
@@ -9,17 +9,32 @@
 #include <asm/arch/stm32.h>
 #include <linux/bitops.h>
 
+#if IS_ENABLED(CONFIG_STM32MP13X)
+#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0700)
+#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0768)
+#elif IS_ENABLED(CONFIG_STM32MP15X)
 #define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
 #define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
+#endif
 
+#define GPIOA_BASE 0x50002000
 #define GPIOG_BASE 0x50008000
 
 void board_debug_uart_init(void)
 {
-	if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE) {
-		/* UART4 clock enable */
-		setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+	if (CONFIG_DEBUG_UART_BASE != STM32_UART4_BASE)
+		return;
 
+	/* UART4 clock enable */
+	setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+

board/st/stm32mp1/debug_uart.c line 40

Quoted 10 lines
board/st/stm32mp1/debug_uart.c +7 -0
+	if (IS_ENABLED(CONFIG_STM32MP13X)) {
+		/* GPIOA clock enable */
+		writel(BIT(0), RCC_MP_AHB4ENSETR);
+		/* GPIO configuration for DH boards: Uart4 TX = A9 */
+		writel(0xfffbffff, GPIOA_BASE + 0x00);
+		writel(0x00000080, GPIOA_BASE + 0x24);
+	} else if (IS_ENABLED(CONFIG_STM32MP15X)) {
 		/* GPIOG clock enable */
 		writel(BIT(6), RCC_MP_AHB4ENSETR);
 		/* GPIO configuration for ST boards: Uart4 TX = G11 */

Thanks
Patrice

Reviewed-by on v1 5/10
#19 lore raw

Re: [PATCH 05/10] ARM: stm32: Add STM32MP13xx debug UART initialization

In reply to Marek Vasut
Quoted 19 lines · Marek Vasut

Add default STM32MP13xx debug UART initialization. This is similar to STM32MP15xx debug UART initialization, except the RCC registers are at different offsets and the UART pinmux pins are different.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Quoted 4 lines
---
  board/st/stm32mp1/debug_uart.c | 21 ++++++++++++++++++---
  1 file changed, 18 insertions(+), 3 deletions(-)

Thanks
Patrick

#20 lore raw

PATCH 6/10 ARM: dts: stm32: Add stm32mp13-ddr.dtsi template

In reply to Marek Vasut

Factor out common parts of STM32MP15xx DRAM controller configuration DT description into stm32mp1-ddr.dtsi and introduce stm32mp13-ddr.dtsi which describes STM32MP13xx DRAM controller configuration in DT.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp1-ddr.dtsi  | 187 ++++++++++++++++++++++++++++++++
 arch/arm/dts/stm32mp13-ddr.dtsi |  49 +++++++++
 arch/arm/dts/stm32mp15-ddr.dtsi | 170 +----------------------------
 3 files changed, 237 insertions(+), 169 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp1-ddr.dtsi
 create mode 100644 arch/arm/dts/stm32mp13-ddr.dtsi
arch/arm/dts/stm32mp1-ddr.dtsi new file +187 -0
new file mode 100644
index 00000000000..da9f9fac4b8
@@ -0,0 +1,187 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright : STMicroelectronics 2018
+ */
+#include <linux/stringify.h>
+
+#ifdef CONFIG_SPL
+&ddr {
+	config-DDR_MEM_COMPATIBLE {
+		bootph-all;
+
+		compatible = __stringify(st,DDR_MEM_COMPATIBLE);
+
+		st,mem-name = DDR_MEM_NAME;
+		st,mem-speed = <DDR_MEM_SPEED>;
+		st,mem-size = <DDR_MEM_SIZE>;
+
+		st,ctl-reg = <
+			DDR_MSTR
+			DDR_MRCTRL0
+			DDR_MRCTRL1
+			DDR_DERATEEN
+			DDR_DERATEINT
+			DDR_PWRCTL
+			DDR_PWRTMG
+			DDR_HWLPCTL
+			DDR_RFSHCTL0
+			DDR_RFSHCTL3
+			DDR_CRCPARCTL0
+			DDR_ZQCTL0
+			DDR_DFITMG0
+			DDR_DFITMG1
+			DDR_DFILPCFG0
+			DDR_DFIUPD0
+			DDR_DFIUPD1
+			DDR_DFIUPD2
+			DDR_DFIPHYMSTR
+			DDR_ODTMAP
+			DDR_DBG0
+			DDR_DBG1
+			DDR_DBGCMD
+			DDR_POISONCFG
+			DDR_PCCFG
+		>;
+
+		st,ctl-timing = <
+			DDR_RFSHTMG
+			DDR_DRAMTMG0
+			DDR_DRAMTMG1
+			DDR_DRAMTMG2
+			DDR_DRAMTMG3
+			DDR_DRAMTMG4
+			DDR_DRAMTMG5
+			DDR_DRAMTMG6
+			DDR_DRAMTMG7
+			DDR_DRAMTMG8
+			DDR_DRAMTMG14
+			DDR_ODTCFG
+		>;
+
+		st,ctl-map = <
+			DDR_ADDRMAP1
+			DDR_ADDRMAP2
+			DDR_ADDRMAP3
+			DDR_ADDRMAP4
+			DDR_ADDRMAP5
+			DDR_ADDRMAP6
+			DDR_ADDRMAP9
+			DDR_ADDRMAP10
+			DDR_ADDRMAP11
+		>;
+
+
+		/*
+		 * Both st,ctl-perf and st,phy-reg differ
+		 * between STM32MP13xx and STM32MP15xx due
+		 * to 16bit and 32bit DRAM bus respectively
+		 * on these SoCs.
+		 */
+
+		st,phy-timing = <
+			DDR_PTR0
+			DDR_PTR1
+			DDR_PTR2
+			DDR_DTPR0
+			DDR_DTPR1
+			DDR_DTPR2
+			DDR_MR0
+			DDR_MR1
+			DDR_MR2
+			DDR_MR3
+		>;
+
+		status = "okay";
+	};
+};
+#endif
+
+#undef DDR_MEM_COMPATIBLE
+#undef DDR_MEM_NAME
+#undef DDR_MEM_SPEED
+#undef DDR_MEM_SIZE
+
+#undef DDR_MSTR
+#undef DDR_MRCTRL0
+#undef DDR_MRCTRL1
+#undef DDR_DERATEEN
+#undef DDR_DERATEINT
+#undef DDR_PWRCTL
+#undef DDR_PWRTMG
+#undef DDR_HWLPCTL
+#undef DDR_RFSHCTL0
+#undef DDR_RFSHCTL3
+#undef DDR_RFSHTMG
+#undef DDR_CRCPARCTL0
+#undef DDR_DRAMTMG0
+#undef DDR_DRAMTMG1
+#undef DDR_DRAMTMG2
+#undef DDR_DRAMTMG3
+#undef DDR_DRAMTMG4
+#undef DDR_DRAMTMG5
+#undef DDR_DRAMTMG6
+#undef DDR_DRAMTMG7
+#undef DDR_DRAMTMG8
+#undef DDR_DRAMTMG14
+#undef DDR_ZQCTL0
+#undef DDR_DFITMG0
+#undef DDR_DFITMG1
+#undef DDR_DFILPCFG0
+#undef DDR_DFIUPD0
+#undef DDR_DFIUPD1
+#undef DDR_DFIUPD2
+#undef DDR_DFIPHYMSTR
+#undef DDR_ADDRMAP1
+#undef DDR_ADDRMAP2
+#undef DDR_ADDRMAP3
+#undef DDR_ADDRMAP4
+#undef DDR_ADDRMAP5
+#undef DDR_ADDRMAP6
+#undef DDR_ADDRMAP9
+#undef DDR_ADDRMAP10
+#undef DDR_ADDRMAP11
+#undef DDR_ODTCFG
+#undef DDR_ODTMAP
+#undef DDR_SCHED
+#undef DDR_SCHED1
+#undef DDR_PERFHPR1
+#undef DDR_PERFLPR1
+#undef DDR_PERFWR1
+#undef DDR_DBG0
+#undef DDR_DBG1
+#undef DDR_DBGCMD
+#undef DDR_POISONCFG
+#undef DDR_PCCFG
+#undef DDR_PCFGR_0
+#undef DDR_PCFGW_0
+#undef DDR_PCFGQOS0_0
+#undef DDR_PCFGQOS1_0
+#undef DDR_PCFGWQOS0_0
+#undef DDR_PCFGWQOS1_0
+#undef DDR_PCFGR_1
+#undef DDR_PCFGW_1
+#undef DDR_PCFGQOS0_1
+#undef DDR_PCFGQOS1_1
+#undef DDR_PCFGWQOS0_1
+#undef DDR_PCFGWQOS1_1
+#undef DDR_PGCR
+#undef DDR_PTR0
+#undef DDR_PTR1
+#undef DDR_PTR2
+#undef DDR_ACIOCR
+#undef DDR_DXCCR
+#undef DDR_DSGCR
+#undef DDR_DCR
+#undef DDR_DTPR0
+#undef DDR_DTPR1
+#undef DDR_DTPR2
+#undef DDR_MR0
+#undef DDR_MR1
+#undef DDR_MR2
+#undef DDR_MR3
+#undef DDR_ODTCR
+#undef DDR_ZQ0CR1
+#undef DDR_DX0GCR
+#undef DDR_DX1GCR
+#undef DDR_DX2GCR
+#undef DDR_DX3GCR
arch/arm/dts/stm32mp13-ddr.dtsi new file +49 -0

49 lines not on this page · raw message

arch/arm/dts/stm32mp15-ddr.dtsi +1 -169

189 lines not on this page · raw message

Signature · 1 line
2.47.2
Reviewed-by on v1 6/10
#21 lore raw

Re: [PATCH 06/10] ARM: dts: stm32: Add stm32mp13-ddr.dtsi template

Quoted 461 lines · Marek Vasut

Factor out common parts of STM32MP15xx DRAM controller configuration DT description into stm32mp1-ddr.dtsi and introduce stm32mp13-ddr.dtsi which describes STM32MP13xx DRAM controller configuration in DT.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp1-ddr.dtsi  | 187 ++++++++++++++++++++++++++++++++
 arch/arm/dts/stm32mp13-ddr.dtsi |  49 +++++++++
 arch/arm/dts/stm32mp15-ddr.dtsi | 170 +----------------------------
 3 files changed, 237 insertions(+), 169 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp1-ddr.dtsi
 create mode 100644 arch/arm/dts/stm32mp13-ddr.dtsi
arch/arm/dts/stm32mp1-ddr.dtsi new file +187 -0
new file mode 100644
index 00000000000..da9f9fac4b8
@@ -0,0 +1,187 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright : STMicroelectronics 2018
+ */
+#include <linux/stringify.h>
+
+#ifdef CONFIG_SPL
+&ddr {
+	config-DDR_MEM_COMPATIBLE {
+		bootph-all;
+
+		compatible = __stringify(st,DDR_MEM_COMPATIBLE);
+
+		st,mem-name = DDR_MEM_NAME;
+		st,mem-speed = <DDR_MEM_SPEED>;
+		st,mem-size = <DDR_MEM_SIZE>;
+
+		st,ctl-reg = <
+			DDR_MSTR
+			DDR_MRCTRL0
+			DDR_MRCTRL1
+			DDR_DERATEEN
+			DDR_DERATEINT
+			DDR_PWRCTL
+			DDR_PWRTMG
+			DDR_HWLPCTL
+			DDR_RFSHCTL0
+			DDR_RFSHCTL3
+			DDR_CRCPARCTL0
+			DDR_ZQCTL0
+			DDR_DFITMG0
+			DDR_DFITMG1
+			DDR_DFILPCFG0
+			DDR_DFIUPD0
+			DDR_DFIUPD1
+			DDR_DFIUPD2
+			DDR_DFIPHYMSTR
+			DDR_ODTMAP
+			DDR_DBG0
+			DDR_DBG1
+			DDR_DBGCMD
+			DDR_POISONCFG
+			DDR_PCCFG
+		>;
+
+		st,ctl-timing = <
+			DDR_RFSHTMG
+			DDR_DRAMTMG0
+			DDR_DRAMTMG1
+			DDR_DRAMTMG2
+			DDR_DRAMTMG3
+			DDR_DRAMTMG4
+			DDR_DRAMTMG5
+			DDR_DRAMTMG6
+			DDR_DRAMTMG7
+			DDR_DRAMTMG8
+			DDR_DRAMTMG14
+			DDR_ODTCFG
+		>;
+
+		st,ctl-map = <
+			DDR_ADDRMAP1
+			DDR_ADDRMAP2
+			DDR_ADDRMAP3
+			DDR_ADDRMAP4
+			DDR_ADDRMAP5
+			DDR_ADDRMAP6
+			DDR_ADDRMAP9
+			DDR_ADDRMAP10
+			DDR_ADDRMAP11
+		>;
+
+
+		/*
+		 * Both st,ctl-perf and st,phy-reg differ
+		 * between STM32MP13xx and STM32MP15xx due
+		 * to 16bit and 32bit DRAM bus respectively
+		 * on these SoCs.
+		 */
+
+		st,phy-timing = <
+			DDR_PTR0
+			DDR_PTR1
+			DDR_PTR2
+			DDR_DTPR0
+			DDR_DTPR1
+			DDR_DTPR2
+			DDR_MR0
+			DDR_MR1
+			DDR_MR2
+			DDR_MR3
+		>;
+
+		status = "okay";
+	};
+};
+#endif
+
+#undef DDR_MEM_COMPATIBLE
+#undef DDR_MEM_NAME
+#undef DDR_MEM_SPEED
+#undef DDR_MEM_SIZE
+
+#undef DDR_MSTR
+#undef DDR_MRCTRL0
+#undef DDR_MRCTRL1
+#undef DDR_DERATEEN
+#undef DDR_DERATEINT
+#undef DDR_PWRCTL
+#undef DDR_PWRTMG
+#undef DDR_HWLPCTL
+#undef DDR_RFSHCTL0
+#undef DDR_RFSHCTL3
+#undef DDR_RFSHTMG
+#undef DDR_CRCPARCTL0
+#undef DDR_DRAMTMG0
+#undef DDR_DRAMTMG1
+#undef DDR_DRAMTMG2
+#undef DDR_DRAMTMG3
+#undef DDR_DRAMTMG4
+#undef DDR_DRAMTMG5
+#undef DDR_DRAMTMG6
+#undef DDR_DRAMTMG7
+#undef DDR_DRAMTMG8
+#undef DDR_DRAMTMG14
+#undef DDR_ZQCTL0
+#undef DDR_DFITMG0
+#undef DDR_DFITMG1
+#undef DDR_DFILPCFG0
+#undef DDR_DFIUPD0
+#undef DDR_DFIUPD1
+#undef DDR_DFIUPD2
+#undef DDR_DFIPHYMSTR
+#undef DDR_ADDRMAP1
+#undef DDR_ADDRMAP2
+#undef DDR_ADDRMAP3
+#undef DDR_ADDRMAP4
+#undef DDR_ADDRMAP5
+#undef DDR_ADDRMAP6
+#undef DDR_ADDRMAP9
+#undef DDR_ADDRMAP10
+#undef DDR_ADDRMAP11
+#undef DDR_ODTCFG
+#undef DDR_ODTMAP
+#undef DDR_SCHED
+#undef DDR_SCHED1
+#undef DDR_PERFHPR1
+#undef DDR_PERFLPR1
+#undef DDR_PERFWR1
+#undef DDR_DBG0
+#undef DDR_DBG1
+#undef DDR_DBGCMD
+#undef DDR_POISONCFG
+#undef DDR_PCCFG
+#undef DDR_PCFGR_0
+#undef DDR_PCFGW_0
+#undef DDR_PCFGQOS0_0
+#undef DDR_PCFGQOS1_0
+#undef DDR_PCFGWQOS0_0
+#undef DDR_PCFGWQOS1_0
+#undef DDR_PCFGR_1
+#undef DDR_PCFGW_1
+#undef DDR_PCFGQOS0_1
+#undef DDR_PCFGQOS1_1
+#undef DDR_PCFGWQOS0_1
+#undef DDR_PCFGWQOS1_1
+#undef DDR_PGCR
+#undef DDR_PTR0
+#undef DDR_PTR1
+#undef DDR_PTR2
+#undef DDR_ACIOCR
+#undef DDR_DXCCR
+#undef DDR_DSGCR
+#undef DDR_DCR
+#undef DDR_DTPR0
+#undef DDR_DTPR1
+#undef DDR_DTPR2
+#undef DDR_MR0
+#undef DDR_MR1
+#undef DDR_MR2
+#undef DDR_MR3
+#undef DDR_ODTCR
+#undef DDR_ZQ0CR1
+#undef DDR_DX0GCR
+#undef DDR_DX1GCR
+#undef DDR_DX2GCR
+#undef DDR_DX3GCR
arch/arm/dts/stm32mp13-ddr.dtsi new file +49 -0
new file mode 100644
index 00000000000..30d8c5014e0
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright : STMicroelectronics 2018
+ */
+#ifdef CONFIG_SPL
+&ddr {
+	clocks = <&rcc AXIDCG>,
+		 <&rcc DDRC1>,
+		 <&rcc DDRPHYC>,
+		 <&rcc DDRCAPB>,
+		 <&rcc DDRPHYCAPB>;
+
+	clock-names = "axidcg",
+		      "ddrc1",
+		      "ddrphyc",
+		      "ddrcapb",
+		      "ddrphycapb";
+
+	config-DDR_MEM_COMPATIBLE {
+		st,ctl-perf = <
+			DDR_SCHED
+			DDR_SCHED1
+			DDR_PERFHPR1
+			DDR_PERFLPR1
+			DDR_PERFWR1
+			DDR_PCFGR_0
+			DDR_PCFGW_0
+			DDR_PCFGQOS0_0
+			DDR_PCFGQOS1_0
+			DDR_PCFGWQOS0_0
+			DDR_PCFGWQOS1_0
+		>;
+
+		st,phy-reg = <
+			DDR_PGCR
+			DDR_ACIOCR
+			DDR_DXCCR
+			DDR_DSGCR
+			DDR_DCR
+			DDR_ODTCR
+			DDR_ZQ0CR1
+			DDR_DX0GCR
+			DDR_DX1GCR
+		>;
+	};
+};
+#endif
+
+#include "stm32mp1-ddr.dtsi"
arch/arm/dts/stm32mp15-ddr.dtsi +0 -160
index 48b0828828f..f18fdaeab68 100644
@@ -2,8 +2,6 @@
 /*
  * Copyright : STMicroelectronics 2018
  */
-#include <linux/stringify.h>
-
 #ifdef CONFIG_SPL
 &ddr {
 	clocks = <&rcc AXIDCG>,
@@ -21,69 +19,6 @@
 		      "ddrphycapb";
 
 	config-DDR_MEM_COMPATIBLE {
-		bootph-all;
-
-		compatible = __stringify(st,DDR_MEM_COMPATIBLE);
-
-		st,mem-name = DDR_MEM_NAME;
-		st,mem-speed = <DDR_MEM_SPEED>;
-		st,mem-size = <DDR_MEM_SIZE>;
-
-		st,ctl-reg = <
-			DDR_MSTR
-			DDR_MRCTRL0
-			DDR_MRCTRL1
-			DDR_DERATEEN
-			DDR_DERATEINT
-			DDR_PWRCTL
-			DDR_PWRTMG
-			DDR_HWLPCTL
-			DDR_RFSHCTL0
-			DDR_RFSHCTL3
-			DDR_CRCPARCTL0
-			DDR_ZQCTL0
-			DDR_DFITMG0
-			DDR_DFITMG1
-			DDR_DFILPCFG0
-			DDR_DFIUPD0
-			DDR_DFIUPD1
-			DDR_DFIUPD2
-			DDR_DFIPHYMSTR
-			DDR_ODTMAP
-			DDR_DBG0
-			DDR_DBG1
-			DDR_DBGCMD
-			DDR_POISONCFG
-			DDR_PCCFG
-		>;
-
-		st,ctl-timing = <
-			DDR_RFSHTMG
-			DDR_DRAMTMG0
-			DDR_DRAMTMG1
-			DDR_DRAMTMG2
-			DDR_DRAMTMG3
-			DDR_DRAMTMG4
-			DDR_DRAMTMG5
-			DDR_DRAMTMG6
-			DDR_DRAMTMG7
-			DDR_DRAMTMG8
-			DDR_DRAMTMG14
-			DDR_ODTCFG
-		>;
-
-		st,ctl-map = <
-			DDR_ADDRMAP1
-			DDR_ADDRMAP2
-			DDR_ADDRMAP3
-			DDR_ADDRMAP4
-			DDR_ADDRMAP5
-			DDR_ADDRMAP6
-			DDR_ADDRMAP9
-			DDR_ADDRMAP10
-			DDR_ADDRMAP11
-		>;
-
 		st,ctl-perf = <
 			DDR_SCHED
 			DDR_SCHED1
@@ -117,111 +52,8 @@
 			DDR_DX2GCR
 			DDR_DX3GCR
 		>;
-
-		st,phy-timing = <
-			DDR_PTR0
-			DDR_PTR1
-			DDR_PTR2
-			DDR_DTPR0
-			DDR_DTPR1
-			DDR_DTPR2
-			DDR_MR0
-			DDR_MR1
-			DDR_MR2
-			DDR_MR3
-		>;
-
-		status = "okay";
 	};
 };
 #endif
 
-#undef DDR_MEM_COMPATIBLE
-#undef DDR_MEM_NAME
-#undef DDR_MEM_SPEED
-#undef DDR_MEM_SIZE
-
-#undef DDR_MSTR
-#undef DDR_MRCTRL0
-#undef DDR_MRCTRL1
-#undef DDR_DERATEEN
-#undef DDR_DERATEINT
-#undef DDR_PWRCTL
-#undef DDR_PWRTMG
-#undef DDR_HWLPCTL
-#undef DDR_RFSHCTL0
-#undef DDR_RFSHCTL3
-#undef DDR_RFSHTMG
-#undef DDR_CRCPARCTL0
-#undef DDR_DRAMTMG0
-#undef DDR_DRAMTMG1
-#undef DDR_DRAMTMG2
-#undef DDR_DRAMTMG3
-#undef DDR_DRAMTMG4
-#undef DDR_DRAMTMG5
-#undef DDR_DRAMTMG6
-#undef DDR_DRAMTMG7
-#undef DDR_DRAMTMG8
-#undef DDR_DRAMTMG14
-#undef DDR_ZQCTL0
-#undef DDR_DFITMG0
-#undef DDR_DFITMG1
-#undef DDR_DFILPCFG0
-#undef DDR_DFIUPD0
-#undef DDR_DFIUPD1
-#undef DDR_DFIUPD2
-#undef DDR_DFIPHYMSTR
-#undef DDR_ADDRMAP1
-#undef DDR_ADDRMAP2
-#undef DDR_ADDRMAP3
-#undef DDR_ADDRMAP4
-#undef DDR_ADDRMAP5
-#undef DDR_ADDRMAP6
-#undef DDR_ADDRMAP9
-#undef DDR_ADDRMAP10
-#undef DDR_ADDRMAP11
-#undef DDR_ODTCFG
-#undef DDR_ODTMAP
-#undef DDR_SCHED
-#undef DDR_SCHED1
-#undef DDR_PERFHPR1
-#undef DDR_PERFLPR1
-#undef DDR_PERFWR1
-#undef DDR_DBG0
-#undef DDR_DBG1
-#undef DDR_DBGCMD
-#undef DDR_POISONCFG
-#undef DDR_PCCFG
-#undef DDR_PCFGR_0
-#undef DDR_PCFGW_0
-#undef DDR_PCFGQOS0_0
-#undef DDR_PCFGQOS1_0
-#undef DDR_PCFGWQOS0_0
-#undef DDR_PCFGWQOS1_0
-#undef DDR_PCFGR_1
-#undef DDR_PCFGW_1
-#undef DDR_PCFGQOS0_1
-#undef DDR_PCFGQOS1_1
-#undef DDR_PCFGWQOS0_1
-#undef DDR_PCFGWQOS1_1
-#undef DDR_PGCR
-#undef DDR_PTR0
-#undef DDR_PTR1
-#undef DDR_PTR2
-#undef DDR_ACIOCR
-#undef DDR_DXCCR
-#undef DDR_DSGCR
-#undef DDR_DCR
-#undef DDR_DTPR0
-#undef DDR_DTPR1
-#undef DDR_DTPR2
-#undef DDR_MR0

arch/arm/dts/stm32mp15-ddr.dtsi line 59

Quoted 10 lines
arch/arm/dts/stm32mp15-ddr.dtsi +1 -9
-#undef DDR_MR1
-#undef DDR_MR2
-#undef DDR_MR3
-#undef DDR_ODTCR
-#undef DDR_ZQ0CR1
-#undef DDR_DX0GCR
-#undef DDR_DX1GCR
-#undef DDR_DX2GCR
-#undef DDR_DX3GCR
+#include "stm32mp1-ddr.dtsi"

Thanks
Patrice

Reviewed-by on v1 6/10
#22 lore raw

Re: [PATCH 06/10] ARM: dts: stm32: Add stm32mp13-ddr.dtsi template

In reply to Marek Vasut

Hi,

Quoted 27 lines · Marek Vasut

Factor out common parts of STM32MP15xx DRAM controller configuration DT description into stm32mp1-ddr.dtsi and introduce stm32mp13-ddr.dtsi which describes STM32MP13xx DRAM controller configuration in DT.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/dts/stm32mp1-ddr.dtsi  | 187 ++++++++++++++++++++++++++++++++
  arch/arm/dts/stm32mp13-ddr.dtsi |  49 +++++++++
  arch/arm/dts/stm32mp15-ddr.dtsi | 170 +----------------------------
  3 files changed, 237 insertions(+), 169 deletions(-)

create mode 100644 arch/arm/dts/stm32mp1-ddr.dtsi create mode 100644 arch/arm/dts/stm32mp13-ddr.dtsi

....

arch/arm/dts/stm32mp13-ddr.dtsi line 1

Quoted 7 lines
arch/arm/dts/stm32mp13-ddr.dtsi new file +1 -0
new file mode 100644
index 00000000000..30d8c5014e0
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

For new STM32MP file avoids to use the Deprecated License Identifiers (GPL-2.0+ / GPL-2.0)

reference=

+https://spdx.dev/learn/handling-license-info/

+ https://spdx.org/licenses/

=>

SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause

arch/arm/dts/stm32mp13-ddr.dtsi line 3

Quoted 2 lines
arch/arm/dts/stm32mp13-ddr.dtsi new file +2 -0
+/*
+ * Copyright : STMicroelectronics 2018

This copyright, with year 2018 is strange this file is copied for TF-A file, I think = ./fdts/stm32mp13-ddr.dtsi

Copyright (C) 2022, STMicroelectronics - All Rights Reserved

Quoted 36 lines
arch/arm/dts/stm32mp13-ddr.dtsi new file +36 -0
+ */
+#ifdef CONFIG_SPL
+&ddr {
+	clocks = <&rcc AXIDCG>,
+		 <&rcc DDRC1>,
+		 <&rcc DDRPHYC>,
+		 <&rcc DDRCAPB>,
+		 <&rcc DDRPHYCAPB>;
+
+	clock-names = "axidcg",
+		      "ddrc1",
+		      "ddrphyc",
+		      "ddrcapb",
+		      "ddrphycapb";
+
+	config-DDR_MEM_COMPATIBLE {
+		st,ctl-perf = <
+			DDR_SCHED
+			DDR_SCHED1
+			DDR_PERFHPR1
+			DDR_PERFLPR1
+			DDR_PERFWR1
+			DDR_PCFGR_0
+			DDR_PCFGW_0
+			DDR_PCFGQOS0_0
+			DDR_PCFGQOS1_0
+			DDR_PCFGWQOS0_0
+			DDR_PCFGWQOS1_0
+		>;
+
+		st,phy-reg = <
+			DDR_PGCR
+			DDR_ACIOCR
+			DDR_DXCCR
+			DDR_DSGCR
+			DDR_DCR

arch/arm/dts/stm32mp13-ddr.dtsi line 49

Quoted 10 lines
arch/arm/dts/stm32mp13-ddr.dtsi new file +10 -0
+			DDR_ODTCR
+			DDR_ZQ0CR1
+			DDR_DX0GCR
+			DDR_DX1GCR
+		>;
+	};
+};
+#endif
+
+#include "stm32mp1-ddr.dtsi"

...

Witth the minor updates

Thanks
Patrick

#23 lore raw

Re: [PATCH 06/10] ARM: dts: stm32: Add stm32mp13-ddr.dtsi template

On 6/3/25 4:22 PM, Patrick DELAUNAY wrote:

Hi,

Quoted 16 lines

Review line 1

Quoted 3 lines

+++ b/arch/arm/dts/stm32mp13-ddr.dtsi

(quoted diff) +1 -0
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

For new STM32MP file avoids to use the Deprecated License Identifiers (GPL-2.0+ / GPL-2.0)

reference=

+https://spdx.dev/learn/handling-license-info/

+ https://spdx.org/licenses/

=>

Quoted 8 lines

SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause

Review line 3

Quoted 2 lines
(quoted diff) +2 -0
+/*
+ * Copyright : STMicroelectronics 2018

This copyright, with year 2018 is strange this file is copied for TF-A file, I think = ./fdts/stm32mp13-ddr.dtsi

How did you arrive at this conclusion ? The content of these two files is nothing alike , see e.g. diff output. The stm32mp13-ddr.dtsi is derived from stm32mp15-ddr.dtsi, which is where the copyright stems from, I can update it to 2018-2025 ?

#24 lore raw

PATCH 7/10 ARM: dts: stm32: Add 512 MiB DRAM settings for DH STM32MP13xx DHCOR DHSBC

In reply to Marek Vasut

Add DRAM settings for 512 MiB of DRAM variant of DH STM32MP13xx DHCOR DHSBC.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 .../stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi | 100 ++++++++++++++++++
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi    |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 arch/arm/dts/stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi
arch/arm/dts/stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi new file +100 -0
new file mode 100644
index 00000000000..7b344541c3e
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2025, DH electronics - All Rights Reserved
+ *
+ * STM32MP13xx DHSOM configuration
+ * 1x DDR3L 1Gb, 16-bit, 533MHz, Single Die Package in flyby topology.
+ * Reference used W631GU6MB15I from Winbond
+ *
+ * DDR type / Platform	DDR3/3L
+ * freq		533MHz
+ * width	16
+ * datasheet	0  = W631GU6MB15I / DDR3-1333
+ * DDR density	2
+ * timing mode	optimized
+ * address mapping : RBC
+ * Tc > + 85C : J
+ */
+#define DDR_MEM_COMPATIBLE ddr3l-dhsom-1066-888-bin-g-1x2gb-533mhz
+#define DDR_MEM_NAME	"DDR3-DDR3L 16bits 533000kHz"
+#define DDR_MEM_SPEED	533000
+#define DDR_MEM_SIZE	0x20000000
+
+#define DDR_MSTR 0x00040401
+#define DDR_MRCTRL0 0x00000010
+#define DDR_MRCTRL1 0x00000000
+#define DDR_DERATEEN 0x00000000
+#define DDR_DERATEINT 0x00800000
+#define DDR_PWRCTL 0x00000000
+#define DDR_PWRTMG 0x00400010
+#define DDR_HWLPCTL 0x00000000
+#define DDR_RFSHCTL0 0x00210000
+#define DDR_RFSHCTL3 0x00000000
+#define DDR_RFSHTMG 0x0081008B
+#define DDR_CRCPARCTL0 0x00000000
+#define DDR_DRAMTMG0 0x121B2414
+#define DDR_DRAMTMG1 0x000A041B
+#define DDR_DRAMTMG2 0x0607080F
+#define DDR_DRAMTMG3 0x0050400C
+#define DDR_DRAMTMG4 0x07040607
+#define DDR_DRAMTMG5 0x06060403
+#define DDR_DRAMTMG6 0x02020002
+#define DDR_DRAMTMG7 0x00000202
+#define DDR_DRAMTMG8 0x00001005
+#define DDR_DRAMTMG14 0x000000A0
+#define DDR_ZQCTL0 0xC2000040
+#define DDR_DFITMG0 0x02050105
+#define DDR_DFITMG1 0x00000202
+#define DDR_DFILPCFG0 0x07000000
+#define DDR_DFIUPD0 0xC0400003
+#define DDR_DFIUPD1 0x00000000
+#define DDR_DFIUPD2 0x00000000
+#define DDR_DFIPHYMSTR 0x00000000
+#define DDR_ADDRMAP1 0x00080808
+#define DDR_ADDRMAP2 0x00000000
+#define DDR_ADDRMAP3 0x00000000
+#define DDR_ADDRMAP4 0x00001F1F
+#define DDR_ADDRMAP5 0x07070707
+#define DDR_ADDRMAP6 0x0F070707
+#define DDR_ADDRMAP9 0x00000000
+#define DDR_ADDRMAP10 0x00000000
+#define DDR_ADDRMAP11 0x00000000
+#define DDR_ODTCFG 0x06000600
+#define DDR_ODTMAP 0x00000001
+#define DDR_SCHED 0x00000F01
+#define DDR_SCHED1 0x00000000
+#define DDR_PERFHPR1 0x00000001
+#define DDR_PERFLPR1 0x04000200
+#define DDR_PERFWR1 0x08000400
+#define DDR_DBG0 0x00000000
+#define DDR_DBG1 0x00000000
+#define DDR_DBGCMD 0x00000000
+#define DDR_POISONCFG 0x00000000
+#define DDR_PCCFG 0x00000010
+#define DDR_PCFGR_0 0x00000000
+#define DDR_PCFGW_0 0x00000000
+#define DDR_PCFGQOS0_0 0x00100009
+#define DDR_PCFGQOS1_0 0x00000020
+#define DDR_PCFGWQOS0_0 0x01100B03
+#define DDR_PCFGWQOS1_0 0x01000200
+#define DDR_PGCR 0x01442E02
+#define DDR_PTR0 0x0022AA5B
+#define DDR_PTR1 0x04841104
+#define DDR_PTR2 0x042DA068
+#define DDR_ACIOCR 0x10400812
+#define DDR_DXCCR 0x00000C40
+#define DDR_DSGCR 0xF200011F
+#define DDR_DCR 0x0000000B
+#define DDR_DTPR0 0x36D477D0
+#define DDR_DTPR1 0x098B00D8
+#define DDR_DTPR2 0x10023600
+#define DDR_MR0 0x00000830
+#define DDR_MR1 0x00000000
+#define DDR_MR2 0x00000208
+#define DDR_MR3 0x00000000
+#define DDR_ODTCR 0x00010000
+#define DDR_ZQ0CR1 0x00000038
+#define DDR_DX0GCR 0x0000CE81
+#define DDR_DX1GCR 0x0000CE81
+
+#include "stm32mp13-ddr.dtsi"
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +1 -0
index 9ff42ab8248..6117da10bbf 100644
@@ -4,6 +4,7 @@
  */
 
 #include "stm32mp13-u-boot.dtsi"
+#include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 
 / {
 	aliases {
Signature · 1 line
2.47.2
Reviewed-by on v1 7/10
#25 lore raw

Re: [PATCH 07/10] ARM: dts: stm32: Add 512 MiB DRAM settings for DH STM32MP13xx DHCOR DHSBC

Quoted 134 lines · Marek Vasut

Add DRAM settings for 512 MiB of DRAM variant of DH STM32MP13xx DHCOR DHSBC.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 .../stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi | 100 ++++++++++++++++++
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi    |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 arch/arm/dts/stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi
arch/arm/dts/stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi new file +100 -0
new file mode 100644
index 00000000000..7b344541c3e
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2025, DH electronics - All Rights Reserved
+ *
+ * STM32MP13xx DHSOM configuration
+ * 1x DDR3L 1Gb, 16-bit, 533MHz, Single Die Package in flyby topology.
+ * Reference used W631GU6MB15I from Winbond
+ *
+ * DDR type / Platform	DDR3/3L
+ * freq		533MHz
+ * width	16
+ * datasheet	0  = W631GU6MB15I / DDR3-1333
+ * DDR density	2
+ * timing mode	optimized
+ * address mapping : RBC
+ * Tc > + 85C : J
+ */
+#define DDR_MEM_COMPATIBLE ddr3l-dhsom-1066-888-bin-g-1x2gb-533mhz
+#define DDR_MEM_NAME	"DDR3-DDR3L 16bits 533000kHz"
+#define DDR_MEM_SPEED	533000
+#define DDR_MEM_SIZE	0x20000000
+
+#define DDR_MSTR 0x00040401
+#define DDR_MRCTRL0 0x00000010
+#define DDR_MRCTRL1 0x00000000
+#define DDR_DERATEEN 0x00000000
+#define DDR_DERATEINT 0x00800000
+#define DDR_PWRCTL 0x00000000
+#define DDR_PWRTMG 0x00400010
+#define DDR_HWLPCTL 0x00000000
+#define DDR_RFSHCTL0 0x00210000
+#define DDR_RFSHCTL3 0x00000000
+#define DDR_RFSHTMG 0x0081008B
+#define DDR_CRCPARCTL0 0x00000000
+#define DDR_DRAMTMG0 0x121B2414
+#define DDR_DRAMTMG1 0x000A041B
+#define DDR_DRAMTMG2 0x0607080F
+#define DDR_DRAMTMG3 0x0050400C
+#define DDR_DRAMTMG4 0x07040607
+#define DDR_DRAMTMG5 0x06060403
+#define DDR_DRAMTMG6 0x02020002
+#define DDR_DRAMTMG7 0x00000202
+#define DDR_DRAMTMG8 0x00001005
+#define DDR_DRAMTMG14 0x000000A0
+#define DDR_ZQCTL0 0xC2000040
+#define DDR_DFITMG0 0x02050105
+#define DDR_DFITMG1 0x00000202
+#define DDR_DFILPCFG0 0x07000000
+#define DDR_DFIUPD0 0xC0400003
+#define DDR_DFIUPD1 0x00000000
+#define DDR_DFIUPD2 0x00000000
+#define DDR_DFIPHYMSTR 0x00000000
+#define DDR_ADDRMAP1 0x00080808
+#define DDR_ADDRMAP2 0x00000000
+#define DDR_ADDRMAP3 0x00000000
+#define DDR_ADDRMAP4 0x00001F1F
+#define DDR_ADDRMAP5 0x07070707
+#define DDR_ADDRMAP6 0x0F070707
+#define DDR_ADDRMAP9 0x00000000
+#define DDR_ADDRMAP10 0x00000000
+#define DDR_ADDRMAP11 0x00000000
+#define DDR_ODTCFG 0x06000600
+#define DDR_ODTMAP 0x00000001
+#define DDR_SCHED 0x00000F01
+#define DDR_SCHED1 0x00000000
+#define DDR_PERFHPR1 0x00000001
+#define DDR_PERFLPR1 0x04000200
+#define DDR_PERFWR1 0x08000400
+#define DDR_DBG0 0x00000000
+#define DDR_DBG1 0x00000000
+#define DDR_DBGCMD 0x00000000
+#define DDR_POISONCFG 0x00000000
+#define DDR_PCCFG 0x00000010
+#define DDR_PCFGR_0 0x00000000
+#define DDR_PCFGW_0 0x00000000
+#define DDR_PCFGQOS0_0 0x00100009
+#define DDR_PCFGQOS1_0 0x00000020
+#define DDR_PCFGWQOS0_0 0x01100B03
+#define DDR_PCFGWQOS1_0 0x01000200
+#define DDR_PGCR 0x01442E02
+#define DDR_PTR0 0x0022AA5B
+#define DDR_PTR1 0x04841104
+#define DDR_PTR2 0x042DA068
+#define DDR_ACIOCR 0x10400812
+#define DDR_DXCCR 0x00000C40
+#define DDR_DSGCR 0xF200011F
+#define DDR_DCR 0x0000000B
+#define DDR_DTPR0 0x36D477D0
+#define DDR_DTPR1 0x098B00D8
+#define DDR_DTPR2 0x10023600
+#define DDR_MR0 0x00000830
+#define DDR_MR1 0x00000000
+#define DDR_MR2 0x00000208
+#define DDR_MR3 0x00000000
+#define DDR_ODTCR 0x00010000
+#define DDR_ZQ0CR1 0x00000038
+#define DDR_DX0GCR 0x0000CE81
+#define DDR_DX1GCR 0x0000CE81
+
+#include "stm32mp13-ddr.dtsi"
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +0 -0
index 9ff42ab8248..6117da10bbf 100644

arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi line 10

Quoted 7 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +1 -0
@@ -4,6 +4,7 @@
  */
 
 #include "stm32mp13-u-boot.dtsi"
+#include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 
 / {
 	aliases {

Thanks
Patrice

#26 lore raw

PATCH 8/10 ARM: dts: stm32: Add STM32MP13x SPL specific DT additions

In reply to Marek Vasut

Add DT additions required by U-Boot SPL to bring up the hardware. This includes binman node to generate STM32 Image v2.0 which can be booted by the BootROM, clock entries used by the SPL clock driver during clock tree initialization, and syscon-reboot node so U-Boot can reset the system without having to rely on PSCI call.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp13-u-boot.dtsi | 89 ++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
arch/arm/dts/stm32mp13-u-boot.dtsi +89 -0
index 1fe6966781c..ad63d5027b2 100644
@@ -17,6 +17,7 @@
 		pinctrl0 = &pinctrl;
 	};
 
+#if defined(CONFIG_TFABOOT)
 	firmware {
 		optee {
 			bootph-all;
@@ -27,6 +28,86 @@
 	psci {
 		bootph-some-ram;
 	};
+#else
+	binman: binman {
+		multiple-images;
+
+		spl-stm32 {
+			filename = "u-boot-spl.stm32";
+			mkimage {
+				args = "-T stm32imagev2 -a 0x2ffe0000 -e 0x2ffe0000";
+				u-boot-spl {
+					no-write-symbols;
+				};
+			};
+		};
+	};
+
+	clocks {
+		bootph-all;
+
+		clk_hse: ck_hse {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <24000000>;
+		};
+
+		clk_hsi: ck_hsi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <64000000>;
+		};
+
+		clk_lse: ck_lse {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+		};
+
+		clk_lsi: ck_lsi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32000>;
+		};
+
+		clk_csi: ck_csi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <4000000>;
+		};
+	};
+
+	cpu0_opp_table: cpu0-opp-table {
+		compatible = "operating-points-v2";
+		opp-shared;
+		bootph-pre-ram;
+		opp-650000000 {
+			bootph-pre-ram;
+			opp-hz = /bits/ 64 <650000000>;
+			opp-microvolt = <1200000>;
+			opp-supported-hw = <0x1>;
+		};
+		opp-1000000000 {
+			bootph-pre-ram;
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt = <1350000>;
+			opp-supported-hw = <0x2>;
+		};
+	};
+
+	reboot {
+		bootph-all;
+		compatible = "syscon-reboot";
+		regmap = <&rcc>;
+		offset = <0x114>;
+		mask = <0x1>;
+	};
+#endif
 
 	soc {
 		bootph-all;
@@ -52,6 +133,14 @@
 	bootph-all;
 };
 
+#if !defined(CONFIG_TFABOOT)
+&cpu0 {
+	nvmem-cells = <&part_number_otp>;
+	nvmem-cell-names = "part_number";
+	operating-points-v2 = <&cpu0_opp_table>;
+};
+#endif
+
 &gpioa {
 	bootph-all;
 };
Signature · 1 line
2.47.2
Reviewed-by on v1 8/10
#27 lore raw

Re: [PATCH 08/10] ARM: dts: stm32: Add STM32MP13x SPL specific DT additions

Quoted 129 lines · Marek Vasut

Add DT additions required by U-Boot SPL to bring up the hardware. This includes binman node to generate STM32 Image v2.0 which can be booted by the BootROM, clock entries used by the SPL clock driver during clock tree initialization, and syscon-reboot node so U-Boot can reset the system without having to rely on PSCI call.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp13-u-boot.dtsi | 89 ++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
arch/arm/dts/stm32mp13-u-boot.dtsi +82 -0
index 1fe6966781c..ad63d5027b2 100644
@@ -17,6 +17,7 @@
 		pinctrl0 = &pinctrl;
 	};
 
+#if defined(CONFIG_TFABOOT)
 	firmware {
 		optee {
 			bootph-all;
@@ -27,6 +28,86 @@
 	psci {
 		bootph-some-ram;
 	};
+#else
+	binman: binman {
+		multiple-images;
+
+		spl-stm32 {
+			filename = "u-boot-spl.stm32";
+			mkimage {
+				args = "-T stm32imagev2 -a 0x2ffe0000 -e 0x2ffe0000";
+				u-boot-spl {
+					no-write-symbols;
+				};
+			};
+		};
+	};
+
+	clocks {
+		bootph-all;
+
+		clk_hse: ck_hse {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <24000000>;
+		};
+
+		clk_hsi: ck_hsi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <64000000>;
+		};
+
+		clk_lse: ck_lse {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+		};
+
+		clk_lsi: ck_lsi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32000>;
+		};
+
+		clk_csi: ck_csi {
+			bootph-all;
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <4000000>;
+		};
+	};
+
+	cpu0_opp_table: cpu0-opp-table {
+		compatible = "operating-points-v2";
+		opp-shared;
+		bootph-pre-ram;
+		opp-650000000 {
+			bootph-pre-ram;
+			opp-hz = /bits/ 64 <650000000>;
+			opp-microvolt = <1200000>;
+			opp-supported-hw = <0x1>;
+		};
+		opp-1000000000 {
+			bootph-pre-ram;
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt = <1350000>;
+			opp-supported-hw = <0x2>;
+		};
+	};
+
+	reboot {
+		bootph-all;
+		compatible = "syscon-reboot";
+		regmap = <&rcc>;
+		offset = <0x114>;
+		mask = <0x1>;
+	};
+#endif
 
 	soc {
 		bootph-all;
@@ -52,6 +133,14 @@
 	bootph-all;
 };
 
+#if !defined(CONFIG_TFABOOT)

arch/arm/dts/stm32mp13-u-boot.dtsi line 146

Quoted 10 lines
arch/arm/dts/stm32mp13-u-boot.dtsi +7 -0
+&cpu0 {
+	nvmem-cells = <&part_number_otp>;
+	nvmem-cell-names = "part_number";
+	operating-points-v2 = <&cpu0_opp_table>;
+};
+#endif
+
 &gpioa {
 	bootph-all;
 };

Thanks
Patrice

#28 lore raw

PATCH 9/10 ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC

In reply to Marek Vasut

Add SPL specific DT additions to DH STM32MP13xx DHCOR DHSBC . These include I2C3 configuration which is required to access the PMIC, PMIC regulator and QSPI NOR bootph-all properties to allow SPL to configure PMIC buck regulators and load from QSPI NOR respectively, etzpc bus switch to simple-bus to prevent interference from TFABOOT specific configuration, and RCC configuration to define clock tree configuration used by this platform.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi | 155 ++++++++++++++++++++-
 1 file changed, 154 insertions(+), 1 deletion(-)
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +154 -1
index 6117da10bbf..b5952637442 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2024 Marek Vasut <[email protected]>
  */
 
+#include <dt-bindings/clock/stm32mp13-clksrc.h>
 #include "stm32mp13-u-boot.dtsi"
 #include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 
@@ -19,8 +20,12 @@
 	};
 };
 
+&etzpc {
+	compatible = "simple-bus";
+};
+
 &flash0 {
-	bootph-pre-ram;
+	bootph-all;
 
 	partitions {
 		compatible = "fixed-partitions";
@@ -49,6 +54,134 @@
 	};
 };
 
+&i2c3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c3_pins_a>;
+};
+
+&qspi {
+	bootph-all;
+};
+
+&qspi_clk_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_bk1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_cs1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&pinctrl {
+	bootph-all;
+	i2c3_pins_a: i2c3-0 {
+	        bootph-all;
+		pins {
+			bootph-all;
+			pinmux = <STM32_PINMUX('B', 8, AF5)>, /* I2C3_SCL */
+				 <STM32_PINMUX('H', 14, AF4)>; /* I2C3_SDA */
+			bias-disable;
+			drive-open-drain;
+			slew-rate = <0>;
+		};
+	};
+};
+
+&rcc {
+	clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, <&clk_lse>, <&clk_lsi>;
+
+	st,clksrc = <
+		CLK_MPU_PLL1P
+		CLK_AXI_PLL2P
+		CLK_MLAHBS_PLL3
+		CLK_PLL12_HSE
+		CLK_PLL3_HSE
+		CLK_PLL4_HSE
+		CLK_CKPER_HSE
+		CLK_RTC_LSE
+		CLK_MCO1_LSI
+		CLK_MCO2_HSI
+	>;
+
+	st,clkdiv = <
+		0 /*AXI*/
+		0 /*MLHAB*/
+		1 /*APB1*/
+		1 /*APB2*/
+		1 /*APB3*/
+		1 /*APB4*/
+		2 /*APB5*/
+		1 /*APB6*/
+		0 /*RTC*/
+	>;
+
+	st,pkcs = <
+		CLK_I2C12_HSI
+		CLK_I2C3_HSI
+		CLK_QSPI_PLL3R
+		CLK_SAES_AXI
+		CLK_SDMMC1_PLL3R
+		CLK_SDMMC2_PLL3R
+		CLK_STGEN_HSE
+		CLK_UART2_HSI
+		CLK_UART4_HSI
+		CLK_USBO_USBPHY
+		CLK_USBPHY_HSE
+	>;
+
+	/*
+	 * cfg = < DIVM1 DIVN P Q R PQR(p,q,r) >;
+	 * frac = < f >;
+	 *
+	 * PRQ(p,q,r) ... for p,q,r: 0-output disabled / 1-output enabled
+	 * DIVN ... actually multiplier, but RCC_PLL1CFGR1 calls the field DIVN
+	 * m ... for PLL1,2: m=2 ; for PLL3,4: m=1
+	 * XTAL = 24 MHz
+	 *
+	 * VCO = ( XTAL / (DIVM1 + 1) ) * m * ( DIVN + 1 + ( f / 8192 ) )
+	 *   P = VCO / (P + 1)
+	 *   Q = VCO / (Q + 1)
+	 *   R = VCO / (R + 1)
+	 */
+
+	/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 266, R = 533 (DDR) */
+	pll2: st,pll@1 {
+		compatible = "st,stm32mp1-pll";
+		reg = <1>;
+		cfg = < 2 65 1 1 0 PQR(1,1,1) >;
+		frac = < 0x1400 >;
+		bootph-all;
+	};
+
+	/* VCO = 600 MHz => P = 200, Q = 150, R = 200 */
+	pll3: st,pll@2 {
+		compatible = "st,stm32mp1-pll";
+		reg = <2>;
+		cfg = < 2 74 2 3 2 PQR(1,1,1) >;
+		bootph-all;
+	};
+
+	/* VCO = 750.0 MHz => P = 125, Q = 83, R = 75 */
+	pll4: st,pll@3 {
+		compatible = "st,stm32mp1-pll";
+		reg = <3>;
+		cfg = < 3 124 5 8 9 PQR(1,1,1) >;
+		bootph-all;
+	};
+};
+
 &sdmmc1 {
 	status = "disabled";
 };
@@ -56,3 +189,23 @@
 &usbotg_hs {
 	u-boot,force-b-session-valid;
 };
+
+&vddcpu {
+	bootph-all;
+};
+
+&vdd_ddr {
+	bootph-all;
+};
+
+&vdd {
+	bootph-all;
+};
+
+&vddcore {
+	bootph-all;
+};
+
+&vref_ddr {
+	bootph-all;
+};
Signature · 1 line
2.47.2
Reviewed-by on v1 9/10
#29 lore raw

Re: [PATCH 09/10] ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC

Quoted 202 lines · Marek Vasut

Add SPL specific DT additions to DH STM32MP13xx DHCOR DHSBC . These include I2C3 configuration which is required to access the PMIC, PMIC regulator and QSPI NOR bootph-all properties to allow SPL to configure PMIC buck regulators and load from QSPI NOR respectively, etzpc bus switch to simple-bus to prevent interference from TFABOOT specific configuration, and RCC configuration to define clock tree configuration used by this platform.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi | 155 ++++++++++++++++++++-
 1 file changed, 154 insertions(+), 1 deletion(-)
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +144 -1
index 6117da10bbf..b5952637442 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2024 Marek Vasut <[email protected]>
  */
 
+#include <dt-bindings/clock/stm32mp13-clksrc.h>
 #include "stm32mp13-u-boot.dtsi"
 #include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 
@@ -19,8 +20,12 @@
 	};
 };
 
+&etzpc {
+	compatible = "simple-bus";
+};
+
 &flash0 {
-	bootph-pre-ram;
+	bootph-all;
 
 	partitions {
 		compatible = "fixed-partitions";
@@ -49,6 +54,134 @@
 	};
 };
 
+&i2c3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c3_pins_a>;
+};
+
+&qspi {
+	bootph-all;
+};
+
+&qspi_clk_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_bk1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_cs1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&pinctrl {
+	bootph-all;
+	i2c3_pins_a: i2c3-0 {
+	        bootph-all;
+		pins {
+			bootph-all;
+			pinmux = <STM32_PINMUX('B', 8, AF5)>, /* I2C3_SCL */
+				 <STM32_PINMUX('H', 14, AF4)>; /* I2C3_SDA */
+			bias-disable;
+			drive-open-drain;
+			slew-rate = <0>;
+		};
+	};
+};
+
+&rcc {
+	clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, <&clk_lse>, <&clk_lsi>;
+
+	st,clksrc = <
+		CLK_MPU_PLL1P
+		CLK_AXI_PLL2P
+		CLK_MLAHBS_PLL3
+		CLK_PLL12_HSE
+		CLK_PLL3_HSE
+		CLK_PLL4_HSE
+		CLK_CKPER_HSE
+		CLK_RTC_LSE
+		CLK_MCO1_LSI
+		CLK_MCO2_HSI
+	>;
+
+	st,clkdiv = <
+		0 /*AXI*/
+		0 /*MLHAB*/
+		1 /*APB1*/
+		1 /*APB2*/
+		1 /*APB3*/
+		1 /*APB4*/
+		2 /*APB5*/
+		1 /*APB6*/
+		0 /*RTC*/
+	>;
+
+	st,pkcs = <
+		CLK_I2C12_HSI
+		CLK_I2C3_HSI
+		CLK_QSPI_PLL3R
+		CLK_SAES_AXI
+		CLK_SDMMC1_PLL3R
+		CLK_SDMMC2_PLL3R
+		CLK_STGEN_HSE
+		CLK_UART2_HSI
+		CLK_UART4_HSI
+		CLK_USBO_USBPHY
+		CLK_USBPHY_HSE
+	>;
+
+	/*
+	 * cfg = < DIVM1 DIVN P Q R PQR(p,q,r) >;
+	 * frac = < f >;
+	 *
+	 * PRQ(p,q,r) ... for p,q,r: 0-output disabled / 1-output enabled
+	 * DIVN ... actually multiplier, but RCC_PLL1CFGR1 calls the field DIVN
+	 * m ... for PLL1,2: m=2 ; for PLL3,4: m=1
+	 * XTAL = 24 MHz
+	 *
+	 * VCO = ( XTAL / (DIVM1 + 1) ) * m * ( DIVN + 1 + ( f / 8192 ) )
+	 *   P = VCO / (P + 1)
+	 *   Q = VCO / (Q + 1)
+	 *   R = VCO / (R + 1)
+	 */
+
+	/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 266, R = 533 (DDR) */
+	pll2: st,pll@1 {
+		compatible = "st,stm32mp1-pll";
+		reg = <1>;
+		cfg = < 2 65 1 1 0 PQR(1,1,1) >;
+		frac = < 0x1400 >;
+		bootph-all;
+	};
+
+	/* VCO = 600 MHz => P = 200, Q = 150, R = 200 */
+	pll3: st,pll@2 {
+		compatible = "st,stm32mp1-pll";
+		reg = <2>;
+		cfg = < 2 74 2 3 2 PQR(1,1,1) >;
+		bootph-all;
+	};
+
+	/* VCO = 750.0 MHz => P = 125, Q = 83, R = 75 */
+	pll4: st,pll@3 {
+		compatible = "st,stm32mp1-pll";
+		reg = <3>;
+		cfg = < 3 124 5 8 9 PQR(1,1,1) >;
+		bootph-all;
+	};
+};
+
 &sdmmc1 {
 	status = "disabled";
 };
@@ -56,3 +189,23 @@
 &usbotg_hs {
 	u-boot,force-b-session-valid;
 };
+
+&vddcpu {
+	bootph-all;
+};
+
+&vdd_ddr {
+	bootph-all;
+};
+
+&vdd {

arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi line 211

Quoted 10 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +10 -0
+	bootph-all;
+};
+
+&vddcore {
+	bootph-all;
+};
+
+&vref_ddr {
+	bootph-all;
+};

Thanks
Patrice

#30 lore raw

Re: [PATCH 09/10] ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

Add SPL specific DT additions to DH STM32MP13xx DHCOR DHSBC . These include I2C3 configuration which is required to access the PMIC, PMIC regulator and QSPI NOR bootph-all properties to allow SPL to configure PMIC buck regulators and load from QSPI NOR respectively, etzpc bus switch to simple-bus to prevent interference from TFABOOT specific configuration, and RCC configuration to define clock tree configuration used by this platform.

Hi Marek

This patch is causing DT compilation errors when using stm32mp15_defconfig and stm32mp15_trusted_defconfig, see below:

./tools/buildman/buildman -j16 -e -d -V -v -E -m stm32mp

Generating board list...Processing #include to produce configs/lager_defconfig Processing #include to produce configs/imx8mp_dhcom_pdk3_defconfig Processing #include to produce configs/j784s4_evm_a72_defconfig Processing #include to produce configs/stout_defconfig

[...]

Processing #include to produce configs/am62ax_evm_a53_defconfig Processing #include to produce configs/r8a779g0_whitehawk_defconfig Processing #include to produce configs/silk_defconfig Processing #include to produce configs/r8a77995_draak_defconfig Building current source for 19 boards (8 threads, 16 jobs per thread)

       arm:  +   stm32mp15                                                            

+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_hse" +
+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_hsi" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_csi" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_lse" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_lsi" +ERROR: Input tree has errors, aborting (use -f to force output)
+make[3]: *** [scripts/Makefile.lib:396: dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb] Error 1
+make[2]: *** [dts/Makefile:60: arch-dtbs] Error 2
+make[1]: *** [Makefile:1168: dts/dt.dtb] Error 2
+make: *** [Makefile:177: sub-make] Error 2

       arm:  w+   stm32mp13_dhcor                     

w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@1:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@2:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@3:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #size-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #size-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #size-cells value

       arm:  +   stm32mp15_trusted                            

+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_hse" +
+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_hsi" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_csi" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_lse" +dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: ERROR (phandle_references): /soc/rcc@50000000: Reference to non-existent node or label "clk_lsi" +ERROR: Input tree has errors, aborting (use -f to force output)
+make[3]: *** [scripts/Makefile.lib:396: dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb] Error 1
+make[2]: *** [dts/Makefile:60: arch-dtbs] Error 2
+make[1]: *** [Makefile:1168: dts/dt.dtb] Error 2
+make: *** [Makefile:177: sub-make] Error 2

       arm:  w+   stm32mp15_basic                             

w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@1:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@2:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@3:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #size-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #size-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #address-cells value w+dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #size-cells value
15 2 2 /19 stm32mp15_basic
Completed: 19 total built, 19 newly), duration 0:07:48, rate 0.04

Thanks
Patrice

Quoted 203 lines

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi | 155 ++++++++++++++++++++-
 1 file changed, 154 insertions(+), 1 deletion(-)
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +154 -1
index 6117da10bbf..b5952637442 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2024 Marek Vasut <[email protected]>
  */
 
+#include <dt-bindings/clock/stm32mp13-clksrc.h>
 #include "stm32mp13-u-boot.dtsi"
 #include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 
@@ -19,8 +20,12 @@
 	};
 };
 
+&etzpc {
+	compatible = "simple-bus";
+};
+
 &flash0 {
-	bootph-pre-ram;
+	bootph-all;
 
 	partitions {
 		compatible = "fixed-partitions";
@@ -49,6 +54,134 @@
 	};
 };
 
+&i2c3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c3_pins_a>;
+};
+
+&qspi {
+	bootph-all;
+};
+
+&qspi_clk_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_bk1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_cs1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&pinctrl {
+	bootph-all;
+	i2c3_pins_a: i2c3-0 {
+	        bootph-all;
+		pins {
+			bootph-all;
+			pinmux = <STM32_PINMUX('B', 8, AF5)>, /* I2C3_SCL */
+				 <STM32_PINMUX('H', 14, AF4)>; /* I2C3_SDA */
+			bias-disable;
+			drive-open-drain;
+			slew-rate = <0>;
+		};
+	};
+};
+
+&rcc {
+	clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, <&clk_lse>, <&clk_lsi>;
+
+	st,clksrc = <
+		CLK_MPU_PLL1P
+		CLK_AXI_PLL2P
+		CLK_MLAHBS_PLL3
+		CLK_PLL12_HSE
+		CLK_PLL3_HSE
+		CLK_PLL4_HSE
+		CLK_CKPER_HSE
+		CLK_RTC_LSE
+		CLK_MCO1_LSI
+		CLK_MCO2_HSI
+	>;
+
+	st,clkdiv = <
+		0 /*AXI*/
+		0 /*MLHAB*/
+		1 /*APB1*/
+		1 /*APB2*/
+		1 /*APB3*/
+		1 /*APB4*/
+		2 /*APB5*/
+		1 /*APB6*/
+		0 /*RTC*/
+	>;
+
+	st,pkcs = <
+		CLK_I2C12_HSI
+		CLK_I2C3_HSI
+		CLK_QSPI_PLL3R
+		CLK_SAES_AXI
+		CLK_SDMMC1_PLL3R
+		CLK_SDMMC2_PLL3R
+		CLK_STGEN_HSE
+		CLK_UART2_HSI
+		CLK_UART4_HSI
+		CLK_USBO_USBPHY
+		CLK_USBPHY_HSE
+	>;
+
+	/*
+	 * cfg = < DIVM1 DIVN P Q R PQR(p,q,r) >;
+	 * frac = < f >;
+	 *
+	 * PRQ(p,q,r) ... for p,q,r: 0-output disabled / 1-output enabled
+	 * DIVN ... actually multiplier, but RCC_PLL1CFGR1 calls the field DIVN
+	 * m ... for PLL1,2: m=2 ; for PLL3,4: m=1
+	 * XTAL = 24 MHz
+	 *
+	 * VCO = ( XTAL / (DIVM1 + 1) ) * m * ( DIVN + 1 + ( f / 8192 ) )
+	 *   P = VCO / (P + 1)
+	 *   Q = VCO / (Q + 1)
+	 *   R = VCO / (R + 1)
+	 */
+
+	/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 266, R = 533 (DDR) */
+	pll2: st,pll@1 {
+		compatible = "st,stm32mp1-pll";
+		reg = <1>;
+		cfg = < 2 65 1 1 0 PQR(1,1,1) >;
+		frac = < 0x1400 >;
+		bootph-all;
+	};
+
+	/* VCO = 600 MHz => P = 200, Q = 150, R = 200 */
+	pll3: st,pll@2 {
+		compatible = "st,stm32mp1-pll";
+		reg = <2>;
+		cfg = < 2 74 2 3 2 PQR(1,1,1) >;
+		bootph-all;
+	};
+
+	/* VCO = 750.0 MHz => P = 125, Q = 83, R = 75 */
+	pll4: st,pll@3 {
+		compatible = "st,stm32mp1-pll";
+		reg = <3>;
+		cfg = < 3 124 5 8 9 PQR(1,1,1) >;
+		bootph-all;
+	};
+};
+
 &sdmmc1 {
 	status = "disabled";
 };
@@ -56,3 +189,23 @@
 &usbotg_hs {
 	u-boot,force-b-session-valid;
 };
+
+&vddcpu {
+	bootph-all;
+};
+
+&vdd_ddr {
+	bootph-all;
+};
+
+&vdd {
+	bootph-all;
+};
+
+&vddcore {
+	bootph-all;
+};
+
+&vref_ddr {
+	bootph-all;
+};
#31 lore raw

Re: [PATCH 09/10] ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC

In reply to Marek Vasut

Hi,

Quoted 40 lines · Marek Vasut

Add SPL specific DT additions to DH STM32MP13xx DHCOR DHSBC . These include I2C3 configuration which is required to access the PMIC, PMIC regulator and QSPI NOR bootph-all properties to allow SPL to configure PMIC buck regulators and load from QSPI NOR respectively, etzpc bus switch to simple-bus to prevent interference from TFABOOT specific configuration, and RCC configuration to define clock tree configuration used by this platform.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi | 155 ++++++++++++++++++++-
  1 file changed, 154 insertions(+), 1 deletion(-)
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +1 -0
index 6117da10bbf..b5952637442 100644
@@ -3,6 +3,7 @@
   * Copyright (C) 2024 Marek Vasut <[email protected]>
   */
 
+#include <dt-bindings/clock/stm32mp13-clksrc.h>
  #include "stm32mp13-u-boot.dtsi"
  #include "stm32mp13-ddr3-dhsom-1x2Gb-1066-binG.dtsi"
 

arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi line 26

Quoted 7 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +4 -0
@@ -19,8 +20,12 @@
  	};
  };
 
+&etzpc {
+	compatible = "simple-bus";
+};
+

change the compatible is not not needed I think

if the ETZPC driver was not compiled for SPL

today it is compiled

 ./arch/arm/mach-stm32mp/stm32mp1/etzpc.c

./arch/arm/mach-stm32mp/stm32mp1/Makefile:7:obj-y += etzpc.o

ifdef CONFIG_XPL_BUILD
obj-y += spl.o
obj-y += tzc400.o
obj-y += etzpc.o
else

Quoted 128 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +119 -1
  &flash0 {
-	bootph-pre-ram;
+	bootph-all;
 
  	partitions {
  		compatible = "fixed-partitions";
@@ -49,6 +54,134 @@
  	};
  };
 
+&i2c3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c3_pins_a>;
+};
+
+&qspi {
+	bootph-all;
+};
+
+&qspi_clk_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_bk1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&qspi_cs1_pins_a {
+	bootph-all;
+	pins {
+		bootph-all;
+	};
+};
+
+&pinctrl {
+	bootph-all;
+	i2c3_pins_a: i2c3-0 {
+	        bootph-all;
+		pins {
+			bootph-all;
+			pinmux = <STM32_PINMUX('B', 8, AF5)>, /* I2C3_SCL */
+				 <STM32_PINMUX('H', 14, AF4)>; /* I2C3_SDA */
+			bias-disable;
+			drive-open-drain;
+			slew-rate = <0>;
+		};
+	};
+};
+
+&rcc {
+	clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, <&clk_lse>, <&clk_lsi>;
+
+	st,clksrc = <
+		CLK_MPU_PLL1P
+		CLK_AXI_PLL2P
+		CLK_MLAHBS_PLL3
+		CLK_PLL12_HSE
+		CLK_PLL3_HSE
+		CLK_PLL4_HSE
+		CLK_CKPER_HSE
+		CLK_RTC_LSE
+		CLK_MCO1_LSI
+		CLK_MCO2_HSI
+	>;
+
+	st,clkdiv = <
+		0 /*AXI*/
+		0 /*MLHAB*/
+		1 /*APB1*/
+		1 /*APB2*/
+		1 /*APB3*/
+		1 /*APB4*/
+		2 /*APB5*/
+		1 /*APB6*/
+		0 /*RTC*/
+	>;
+
+	st,pkcs = <
+		CLK_I2C12_HSI
+		CLK_I2C3_HSI
+		CLK_QSPI_PLL3R
+		CLK_SAES_AXI
+		CLK_SDMMC1_PLL3R
+		CLK_SDMMC2_PLL3R
+		CLK_STGEN_HSE
+		CLK_UART2_HSI
+		CLK_UART4_HSI
+		CLK_USBO_USBPHY
+		CLK_USBPHY_HSE
+	>;
+
+	/*
+	 * cfg = < DIVM1 DIVN P Q R PQR(p,q,r) >;
+	 * frac = < f >;
+	 *
+	 * PRQ(p,q,r) ... for p,q,r: 0-output disabled / 1-output enabled
+	 * DIVN ... actually multiplier, but RCC_PLL1CFGR1 calls the field DIVN
+	 * m ... for PLL1,2: m=2 ; for PLL3,4: m=1
+	 * XTAL = 24 MHz
+	 *
+	 * VCO = ( XTAL / (DIVM1 + 1) ) * m * ( DIVN + 1 + ( f / 8192 ) )
+	 *   P = VCO / (P + 1)
+	 *   Q = VCO / (Q + 1)
+	 *   R = VCO / (R + 1)
+	 */
+
+	/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 266, R = 533 (DDR) */
+	pll2: st,pll@1 {
+		compatible = "st,stm32mp1-pll";
+		reg = <1>;
+		cfg = < 2 65 1 1 0 PQR(1,1,1) >;
+		frac = < 0x1400 >;
+		bootph-all;
+	};
+
+	/* VCO = 600 MHz => P = 200, Q = 150, R = 200 */
+	pll3: st,pll@2 {
+		compatible = "st,stm32mp1-pll";
+		reg = <2>;
+		cfg = < 2 74 2 3 2 PQR(1,1,1) >;
+		bootph-all;
+	};

arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi line 184

Quoted 10 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +10 -0
+
+	/* VCO = 750.0 MHz => P = 125, Q = 83, R = 75 */
+	pll4: st,pll@3 {
+		compatible = "st,stm32mp1-pll";
+		reg = <3>;
+		cfg = < 3 124 5 8 9 PQR(1,1,1) >;
+		bootph-all;
+	};
+};
+

&rcc {
    #address-cells = <1>;
    #size-cells = <0>;
};

to avoid warnings:

dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@1:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@2:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (reg_format): /soc/rcc@50000000/st,pll@3:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #address-cells value dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@1: Relying on default #size-cells value dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #address-cells value dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@2: Relying on default #size-cells value dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #address-cells value dts/upstream/src/arm/st/stm32mp135f-dhcor-dhsbc.dtb: Warning (avoid_default_addr_size): /soc/rcc@50000000/st,pll@3: Relying on default #size-cells value

Quoted 27 lines
arch/arm/dts/stm32mp13xx-dhcor-u-boot.dtsi +20 -0
  &sdmmc1 {
  	status = "disabled";
  };
@@ -56,3 +189,23 @@
  &usbotg_hs {
  	u-boot,force-b-session-valid;
  };
+
+&vddcpu {
+	bootph-all;
+};
+
+&vdd_ddr {
+	bootph-all;
+};
+
+&vdd {
+	bootph-all;
+};
+
+&vddcore {
+	bootph-all;
+};
+
+&vref_ddr {
+	bootph-all;
+};
#32 lore raw

Re: [PATCH 09/10] ARM: dts: stm32: Add SPL specifics for DH STM32MP13xx DHCOR DHSBC

On 6/3/25 4:36 PM, Patrick DELAUNAY wrote:

Hi,

Quoted 7 lines

Review

Quoted 4 lines

+&etzpc {
+    compatible = "simple-bus";

(quoted diff) +2 -0
+};
+

change the compatible is not not needed I think

Quoted 7 lines

if the ETZPC driver was not compiled for SPL

today it is compiled

 ./arch/arm/mach-stm32mp/stm32mp1/etzpc.c

./arch/arm/mach-stm32mp/stm32mp1/Makefile:7:obj-y += etzpc.o

I need to be able to bind devices on the etzpc bus, so it really has to be a simple-bus .

#33 lore raw

PATCH 10/10 ARM: dts: stm32: Switch defconfig to SPL for DH STM32MP13xx DHCOR DHSBC

In reply to Marek Vasut

Update defconfig to make use of U-Boot SPL to initialize DH STM32MP13xx DHCOM DHSBC SoM and board. This is largely a move of SPL enablement from DH STM32MP15xx DHSOM defconfigs into generic DH STM32MP1xx defconfig . Support for SPI NOR chips which are not used on STM32MP13xx DHCOR are moved into STM32MP15xx DHSOM defconfigs. Changes to STM32MP13xx DHCOR defconfig then enable SPL support, CCF in SPL to configure clock, pin configuration support in SPL, and OpTee OS start support in U-Boot.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 configs/stm32mp13_dhcor_defconfig | 30 +++++++++++++------
 configs/stm32mp15_dhsom.config    | 48 +++++--------------------------
 configs/stm32mp_dhsom.config      | 35 ++++++++++++++++++++--
 3 files changed, 60 insertions(+), 53 deletions(-)
configs/stm32mp13_dhcor_defconfig +21 -9
index 2da9287ea7b..0d70aab5e8f 100644
@@ -2,7 +2,6 @@
 
 CONFIG_ARM=y
 CONFIG_ARCH_STM32MP=y
-CONFIG_TFABOOT=y
 CONFIG_SYS_MALLOC_F_LEN=0x1c0000
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0400000
 CONFIG_ENV_OFFSET=0x3E0000
@@ -12,11 +11,16 @@ CONFIG_DDR_CACHEABLE_SIZE=0x8000000
 CONFIG_TARGET_ST_STM32MP13X=y
 CONFIG_ENV_OFFSET_REDUND=0x3F0000
 CONFIG_STM32MP15_PWR=y
-# CONFIG_ARMV7_NONSEC is not set
+CONFIG_ARMV7_NONSEC=y
+CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
+CONFIG_ARMV7_PSCI_NR_CPUS=2
+# CONFIG_ARMV7_LPAE is not set
 CONFIG_SYS_MEMTEST_START=0xc0000000
 CONFIG_SYS_MEMTEST_END=0xc4000000
+CONFIG_SYS_MEM_TOP_HIDE=0x2000000
 CONFIG_BOOTSTAGE_RECORD_COUNT=100
 CONFIG_BOOTDELAY=3
+CONFIG_BOOTM_OPTEE=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_ERASEENV=y
@@ -31,20 +35,28 @@ CONFIG_ENV_IS_NOWHERE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_MMC_USE_DT=y
 CONFIG_ENV_SPI_MAX_HZ=50000000
-CONFIG_CLK_SCMI=y
 CONFIG_SET_DFU_ALT_INFO=y
 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_SYS_MMC_ENV_DEV=0
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_PHY_REALTEK=y
-CONFIG_DM_REGULATOR_SCMI=y
-CONFIG_RESET_SCMI=y
 CONFIG_DM_RNG=y
 CONFIG_RNG_STM32=y
-CONFIG_SYSRESET_PSCI=y
-CONFIG_TEE=y
-CONFIG_OPTEE=y
-# CONFIG_OPTEE_TA_AVB is not set
 CONFIG_USB_ONBOARD_HUB=y
 CONFIG_USB_HUB_DEBOUNCE_TIMEOUT=2000
 CONFIG_ERRNO_STR=y
+CONFIG_OPTEE_LIB=y
+CONFIG_OPTEE_IMAGE=y
+CONFIG_OPTEE_TZDRAM_SIZE=0x02000000
+CONFIG_SPL_TEXT_BASE=0x2FFE0000
+CONFIG_SPL_CLK_CCF=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
+# CONFIG_SPL_SHA1 is not set
+# CONFIG_SPL_SHA256 is not set
+CONFIG_SPL_HAVE_INIT_STACK=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_PINCTRL_GENERIC=y
+CONFIG_SPL_PINMUX=y
+CONFIG_SPL_PINCONF=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
configs/stm32mp15_dhsom.config +7 -41

71 lines not on this page · raw message

configs/stm32mp_dhsom.config +32 -3
index 01d65cfd893..13f9186b1cf 100644
@@ -2,6 +2,10 @@
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_EFI_LOADER is not set
 # CONFIG_ISO_PARTITION is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_PARTITION_UUIDS is not set
+# CONFIG_SPL_PINCTRL_FULL is not set
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_CMD_BOOTCOUNT=y
@@ -38,6 +42,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STPMIC1=y
+CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_RTC=y
 CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
@@ -49,6 +54,7 @@ CONFIG_ENV_SIZE=0x4000
 CONFIG_FAT_WRITE=y
 CONFIG_FIT=y
 CONFIG_GPIO_HOG=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_I2C_EEPROM=y
 CONFIG_IPV6=y
 CONFIG_IP_DEFRAG=y
@@ -58,6 +64,7 @@ CONFIG_MTD=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_OF_LIVE=y
 CONFIG_OF_UPSTREAM=y
+CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks"
 CONFIG_PHY=y
 CONFIG_PHY_STM32_USBPHYC=y
 CONFIG_PINCONF=y
@@ -66,17 +73,39 @@ CONFIG_PROT_TCP_SACK=y
 CONFIG_RTC_STM32=y
 CONFIG_SERIAL_RX_BUFFER=y
 CONFIG_SPI=y
-CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_MTD=y
 CONFIG_SPI_FLASH_SFDP_SUPPORT=y
-CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPL=y
+CONFIG_SPL_BOOTCOUNT_LIMIT=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_DFU=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_ENV_IS_NOWHERE=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FOOTPRINT_LIMIT=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_I2C=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
+CONFIG_SPL_MAX_FOOTPRINT=0x3db00
+CONFIG_SPL_MTD=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_POWER=y
+CONFIG_SPL_RAM_DEVICE=y
+CONFIG_SPL_SPI=y
+CONFIG_SPL_SPI_FLASH_MTD=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_STACK=0x30000000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_STM32_FMC2_EBI=y
 CONFIG_STM32_QSPI=y
 CONFIG_STM32_SDMMC2=y
 CONFIG_STM32_SPI=y
 CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_SYSRESET_SYSCON=y
 CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C40000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_DISABLE_AUTOLOAD=y
Signature · 1 line
2.47.2
Reviewed-by on v1 10/10
#34 lore raw

Re: [PATCH 10/10] ARM: dts: stm32: Switch defconfig to SPL for DH STM32MP13xx DHCOR DHSBC

Quoted 246 lines · Marek Vasut

Update defconfig to make use of U-Boot SPL to initialize DH STM32MP13xx DHCOM DHSBC SoM and board. This is largely a move of SPL enablement from DH STM32MP15xx DHSOM defconfigs into generic DH STM32MP1xx defconfig . Support for SPI NOR chips which are not used on STM32MP13xx DHCOR are moved into STM32MP15xx DHSOM defconfigs. Changes to STM32MP13xx DHCOR defconfig then enable SPL support, CCF in SPL to configure clock, pin configuration support in SPL, and OpTee OS start support in U-Boot.

---
Cc: Cheick Traore <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Lionel Debieve <[email protected]>
Cc: Pascal Zimmermann <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 configs/stm32mp13_dhcor_defconfig | 30 +++++++++++++------
 configs/stm32mp15_dhsom.config    | 48 +++++--------------------------
 configs/stm32mp_dhsom.config      | 35 ++++++++++++++++++++--
 3 files changed, 60 insertions(+), 53 deletions(-)
configs/stm32mp13_dhcor_defconfig +21 -9
index 2da9287ea7b..0d70aab5e8f 100644
@@ -2,7 +2,6 @@
 
 CONFIG_ARM=y
 CONFIG_ARCH_STM32MP=y
-CONFIG_TFABOOT=y
 CONFIG_SYS_MALLOC_F_LEN=0x1c0000
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0400000
 CONFIG_ENV_OFFSET=0x3E0000
@@ -12,11 +11,16 @@ CONFIG_DDR_CACHEABLE_SIZE=0x8000000
 CONFIG_TARGET_ST_STM32MP13X=y
 CONFIG_ENV_OFFSET_REDUND=0x3F0000
 CONFIG_STM32MP15_PWR=y
-# CONFIG_ARMV7_NONSEC is not set
+CONFIG_ARMV7_NONSEC=y
+CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
+CONFIG_ARMV7_PSCI_NR_CPUS=2
+# CONFIG_ARMV7_LPAE is not set
 CONFIG_SYS_MEMTEST_START=0xc0000000
 CONFIG_SYS_MEMTEST_END=0xc4000000
+CONFIG_SYS_MEM_TOP_HIDE=0x2000000
 CONFIG_BOOTSTAGE_RECORD_COUNT=100
 CONFIG_BOOTDELAY=3
+CONFIG_BOOTM_OPTEE=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_ERASEENV=y
@@ -31,20 +35,28 @@ CONFIG_ENV_IS_NOWHERE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_MMC_USE_DT=y
 CONFIG_ENV_SPI_MAX_HZ=50000000
-CONFIG_CLK_SCMI=y
 CONFIG_SET_DFU_ALT_INFO=y
 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_SYS_MMC_ENV_DEV=0
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_PHY_REALTEK=y
-CONFIG_DM_REGULATOR_SCMI=y
-CONFIG_RESET_SCMI=y
 CONFIG_DM_RNG=y
 CONFIG_RNG_STM32=y
-CONFIG_SYSRESET_PSCI=y
-CONFIG_TEE=y
-CONFIG_OPTEE=y
-# CONFIG_OPTEE_TA_AVB is not set
 CONFIG_USB_ONBOARD_HUB=y
 CONFIG_USB_HUB_DEBOUNCE_TIMEOUT=2000
 CONFIG_ERRNO_STR=y
+CONFIG_OPTEE_LIB=y
+CONFIG_OPTEE_IMAGE=y
+CONFIG_OPTEE_TZDRAM_SIZE=0x02000000
+CONFIG_SPL_TEXT_BASE=0x2FFE0000
+CONFIG_SPL_CLK_CCF=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
+# CONFIG_SPL_SHA1 is not set
+# CONFIG_SPL_SHA256 is not set
+CONFIG_SPL_HAVE_INIT_STACK=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_PINCTRL_GENERIC=y
+CONFIG_SPL_PINMUX=y
+CONFIG_SPL_PINCONF=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
configs/stm32mp15_dhsom.config +7 -41
index c84116482f6..f7ff5db5943 100644
@@ -2,10 +2,6 @@
 
 # CONFIG_ARMV7_VIRT is not set
 # CONFIG_BINMAN_FDT is not set
-# CONFIG_SPL_DOS_PARTITION is not set
-# CONFIG_SPL_PARTITION_UUIDS is not set
-# CONFIG_SPL_PINCTRL_FULL is not set
-# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_SIZE_LIMIT=1441792
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
@@ -20,9 +16,7 @@ CONFIG_CMD_STM32PROG_OTP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0100000
 CONFIG_DM_HWSPINLOCK=y
-CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_HAS_BOARD_SIZE_LIMIT=y
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_HWSPINLOCK_STM32=y
 CONFIG_KS8851_MLL=y
 CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks access-controllers"
@@ -31,42 +25,7 @@ CONFIG_PINCTRL_STMFX=y
 CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_SERVERIP="192.168.1.1"
 CONFIG_SF_DEFAULT_SPEED=50000000
-CONFIG_SPL=y
-CONFIG_SPL_BLOCK_CACHE=y
-CONFIG_SPL_BOOTCOUNT_LIMIT=y
-CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
-CONFIG_SPL_DFU=y
-CONFIG_SPL_DM_REGULATOR=y
-CONFIG_SPL_DM_REGULATOR_STPMIC1=y
-CONFIG_SPL_DM_SPI=y
-CONFIG_SPL_DM_SPI_FLASH=y
-CONFIG_SPL_DM_USB_GADGET=y
-CONFIG_SPL_ENV_IS_NOWHERE=y
-CONFIG_SPL_ENV_SUPPORT=y
-CONFIG_SPL_FOOTPRINT_LIMIT=y
-CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
-CONFIG_SPL_I2C=y
-CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
-CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
-CONFIG_SPL_MAX_FOOTPRINT=0x3db00
-CONFIG_SPL_MMC=y
-CONFIG_SPL_MTD=y
-CONFIG_SPL_PHY=y
-CONFIG_SPL_POWER=y
-CONFIG_SPL_RAM_DEVICE=y
-CONFIG_SPL_SPI=y
-CONFIG_SPL_SPI_FLASH_MTD=y
-CONFIG_SPL_SPI_FLASH_SUPPORT=y
-CONFIG_SPL_HAVE_INIT_STACK=y
-CONFIG_SPL_STACK=0x30000000
-CONFIG_SPL_SYS_MALLOC=y
-CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
-CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
-CONFIG_SPL_TEXT_BASE=0x2FFC2500
-CONFIG_SPL_USB_GADGET=y
 CONFIG_STM32_ADC=y
-CONFIG_SYSRESET_SYSCON=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0x5C00A14C
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x3
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
@@ -76,3 +35,10 @@ CONFIG_PREBOOT="run dh_preboot"
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
 CONFIG_TARGET_DH_STM32MP1_PDK2=y
 CONFIG_USE_SERVERIP=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPL_LEGACY_IMAGE_FORMAT=y
+CONFIG_SPL_TEXT_BASE=0x2FFC2500
+CONFIG_SPL_BLOCK_CACHE=y
+CONFIG_SPL_MMC=y
configs/stm32mp_dhsom.config +30 -3
index 01d65cfd893..13f9186b1cf 100644
@@ -2,6 +2,10 @@
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_EFI_LOADER is not set
 # CONFIG_ISO_PARTITION is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_PARTITION_UUIDS is not set
+# CONFIG_SPL_PINCTRL_FULL is not set
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_CMD_BOOTCOUNT=y
@@ -38,6 +42,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STPMIC1=y
+CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_RTC=y
 CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
@@ -49,6 +54,7 @@ CONFIG_ENV_SIZE=0x4000
 CONFIG_FAT_WRITE=y
 CONFIG_FIT=y
 CONFIG_GPIO_HOG=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_I2C_EEPROM=y
 CONFIG_IPV6=y
 CONFIG_IP_DEFRAG=y
@@ -58,6 +64,7 @@ CONFIG_MTD=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_OF_LIVE=y
 CONFIG_OF_UPSTREAM=y
+CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks"
 CONFIG_PHY=y
 CONFIG_PHY_STM32_USBPHYC=y
 CONFIG_PINCONF=y
@@ -66,17 +73,39 @@ CONFIG_PROT_TCP_SACK=y
 CONFIG_RTC_STM32=y
 CONFIG_SERIAL_RX_BUFFER=y
 CONFIG_SPI=y
-CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_MTD=y
 CONFIG_SPI_FLASH_SFDP_SUPPORT=y
-CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPL=y
+CONFIG_SPL_BOOTCOUNT_LIMIT=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0300000
+CONFIG_SPL_DFU=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_ENV_IS_NOWHERE=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FOOTPRINT_LIMIT=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_I2C=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
+CONFIG_SPL_MAX_FOOTPRINT=0x3db00
+CONFIG_SPL_MTD=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_POWER=y
+CONFIG_SPL_RAM_DEVICE=y
+CONFIG_SPL_SPI=y
+CONFIG_SPL_SPI_FLASH_MTD=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_STACK=0x30000000
+CONFIG_SPL_SYS_MALLOC=y

configs/stm32mp_dhsom.config CONFIG_PROT_TCP_SACK=y · line 111

Quoted 10 lines
configs/stm32mp_dhsom.config +2 -0
+CONFIG_SPL_SYS_MALLOC_SIZE=0x1d00000
 CONFIG_STM32_FMC2_EBI=y
 CONFIG_STM32_QSPI=y
 CONFIG_STM32_SDMMC2=y
 CONFIG_STM32_SPI=y
 CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_SYSRESET_SYSCON=y
 CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C40000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_DISABLE_AUTOLOAD=y

Thanks
Patrice