Skip to contentSkip to conversation

stm32mp: add STM32MP13x support

PATCH In review Patrick Delaunay 2 participants 21 messages May 20, 2022 – May 23, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover stm32mp: add STM32MP13x support

Add the minimal support of the new STM32MP13x in mach-stm32mp to allow boot from SD Card.

STM32MP13x is a single Cortex-A7 MPU aimed at various applications. The discovery board is supported with stm32mp13_defconfig and the device tree stm32mp135f-dk.dts.

The supported boot sequence is:
- TF-A BL2
- OP-TEE
- U-Boot
- Linux Kernel

The console over UART and boot from SD Card is functional with this serie.

The RCC driver, with support of reset and clock, is not yet provided today and the SCMI is not yet activated in device tree as in Linux kernel.

Changes in v2:
- fix commit message
- fix several typo issue in comments reported by Patrice and Marek
- fix typo in commit message
- fix typo error in commit message and in rst file

Patrick Delaunay (16):
ARM: dts: stm32: add STM32MP13 SoCs support
configs: stm32mp1: move SUPPORT_SPL in STM32MP15x
arm: stm32mp: move the get_otp helper function in bsec
arm: stm32mp: move code for STM32MP15x
arm: stm32mp: add choice for STM32MP SOC family
arm: stm32mp: add sub config Kconfig.15x
arm: stm32mp: add CONFIG_STM32MP15_PWR
arm: stm32mp: add support of STM32MP13x
arm: stm32mp: support 2 MAC address for STM32MP13
pinctrl: stm32: add support of STM32MP135
board: stm32pm1: add stm32mp13 board support
ram: stm32mp1: add support of STM32MP13x
mmc: stm32_sdmmc2: make reset property optional
arm: dts: stm32mp: add stm32mp13 device tree for U-Boot
configs: add stm32mp13 defconfig
doc: st: stm32mp1: add STM32MP13x support

 arch/arm/Kconfig                              |   1 -
 arch/arm/dts/Makefile                         |   3 +
 arch/arm/dts/stm32mp13-pinctrl.dtsi           | 123 ++++++
 arch/arm/dts/stm32mp13-u-boot.dtsi            |  91 ++++
 arch/arm/dts/stm32mp131.dtsi                  | 358 ++++++++++++++++
 arch/arm/dts/stm32mp133.dtsi                  |  37 ++
 arch/arm/dts/stm32mp135.dtsi                  |  12 +
 arch/arm/dts/stm32mp135f-dk-u-boot.dtsi       |  30 ++
 arch/arm/dts/stm32mp135f-dk.dts               |  57 +++
 arch/arm/dts/stm32mp13xc.dtsi                 |  17 +
 arch/arm/dts/stm32mp13xf.dtsi                 |  17 +
 arch/arm/mach-stm32mp/Kconfig                 | 146 ++-----
 arch/arm/mach-stm32mp/Kconfig.13x             |  57 +++
 arch/arm/mach-stm32mp/Kconfig.15x             | 135 ++++++
 arch/arm/mach-stm32mp/Makefile                |   5 +-
 arch/arm/mach-stm32mp/bsec.c                  |  17 +
 arch/arm/mach-stm32mp/cpu.c                   | 392 ++----------------
 arch/arm/mach-stm32mp/fdt.c                   |  11 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h    |  26 ++
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  34 +-
 arch/arm/mach-stm32mp/spl.c                   |   1 +
 arch/arm/mach-stm32mp/stm32mp13x.c            | 135 ++++++
 arch/arm/mach-stm32mp/stm32mp15x.c            | 350 ++++++++++++++++
 board/st/stm32mp1/Kconfig                     |  15 +
 board/st/stm32mp1/MAINTAINERS                 |   4 +
 board/st/stm32mp1/stm32mp1.c                  |  27 +-
 configs/stm32mp13_defconfig                   |  54 +++
 configs/stm32mp15_basic_defconfig             |   6 +-
 configs/stm32mp15_defconfig                   |   6 +-
 configs/stm32mp15_trusted_defconfig           |   8 +-
 doc/board/st/stm32mp1.rst                     | 183 +++++---
 .../memory-controllers/st,stm32mp1-ddr.txt    |  49 ++-
 drivers/mmc/stm32_sdmmc2.c                    |  14 +-
 drivers/pinctrl/pinctrl_stm32.c               |   1 +
 drivers/ram/stm32mp1/stm32mp1_ram.c           |  28 +-
 include/configs/stm32mp13_common.h            | 106 +++++
 include/configs/stm32mp13_st_common.h         |  17 +
 include/configs/stm32mp15_common.h            |   4 +-
 38 files changed, 1993 insertions(+), 584 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp13-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32mp13-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp131.dtsi
 create mode 100644 arch/arm/dts/stm32mp133.dtsi
 create mode 100644 arch/arm/dts/stm32mp135.dtsi
 create mode 100644 arch/arm/dts/stm32mp135f-dk-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp135f-dk.dts
 create mode 100644 arch/arm/dts/stm32mp13xc.dtsi
 create mode 100644 arch/arm/dts/stm32mp13xf.dtsi
 create mode 100644 arch/arm/mach-stm32mp/Kconfig.13x
 create mode 100644 arch/arm/mach-stm32mp/Kconfig.15x
 create mode 100644 arch/arm/mach-stm32mp/stm32mp13x.c
 create mode 100644 arch/arm/mach-stm32mp/stm32mp15x.c
 create mode 100644 configs/stm32mp13_defconfig
 create mode 100644 include/configs/stm32mp13_common.h
 create mode 100644 include/configs/stm32mp13_st_common.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/16 ARM: dts: stm32: add STM32MP13 SoCs support

Add initial support of STM32MP13 family based on v5.18-rc2

---

(no changes since v1)

 arch/arm/dts/stm32mp13-pinctrl.dtsi | 123 ++++++++++
 arch/arm/dts/stm32mp131.dtsi        | 358 ++++++++++++++++++++++++++++
 arch/arm/dts/stm32mp133.dtsi        |  37 +++
 arch/arm/dts/stm32mp135.dtsi        |  12 +
 arch/arm/dts/stm32mp135f-dk.dts     |  57 +++++
 arch/arm/dts/stm32mp13xc.dtsi       |  17 ++
 arch/arm/dts/stm32mp13xf.dtsi       |  17 ++
 board/st/stm32mp1/MAINTAINERS       |   1 +
 8 files changed, 622 insertions(+)
 create mode 100644 arch/arm/dts/stm32mp13-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32mp131.dtsi
 create mode 100644 arch/arm/dts/stm32mp133.dtsi
 create mode 100644 arch/arm/dts/stm32mp135.dtsi
 create mode 100644 arch/arm/dts/stm32mp135f-dk.dts
 create mode 100644 arch/arm/dts/stm32mp13xc.dtsi
 create mode 100644 arch/arm/dts/stm32mp13xf.dtsi
arch/arm/dts/stm32mp13-pinctrl.dtsi new file +123 -0
new file mode 100644
index 0000000000..d2472cd8f1
@@ -0,0 +1,123 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
+ * Author: Alexandre Torgue <[email protected]>
+ */
+#include <dt-bindings/pinctrl/stm32-pinfunc.h>
+
+&pinctrl {
+	sdmmc1_b4_pins_a: sdmmc1-b4-0 {
+		pins {
+			pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+				 <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+				 <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+				 <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
+				 <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-disable;
+		};
+	};
+
+	sdmmc1_b4_od_pins_a: sdmmc1-b4-od-0 {
+		pins1 {
+			pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+				 <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+				 <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+				 <STM32_PINMUX('C', 11, AF12)>; /* SDMMC1_D3 */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-disable;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+			slew-rate = <1>;
+			drive-open-drain;
+			bias-disable;
+		};
+	};
+
+	sdmmc1_b4_sleep_pins_a: sdmmc1-b4-sleep-0 {
+		pins {
+			pinmux = <STM32_PINMUX('C', 8, ANALOG)>, /* SDMMC1_D0 */
+				 <STM32_PINMUX('C', 9, ANALOG)>, /* SDMMC1_D1 */
+				 <STM32_PINMUX('C', 10, ANALOG)>, /* SDMMC1_D2 */
+				 <STM32_PINMUX('C', 11, ANALOG)>, /* SDMMC1_D3 */
+				 <STM32_PINMUX('C', 12, ANALOG)>, /* SDMMC1_CK */
+				 <STM32_PINMUX('D', 2, ANALOG)>; /* SDMMC1_CMD */
+		};
+	};
+
+	sdmmc1_clk_pins_a: sdmmc1-clk-0 {
+		pins {
+			pinmux = <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-disable;
+		};
+	};
+
+	sdmmc2_b4_pins_a: sdmmc2-b4-0 {
+		pins {
+			pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC2_D0 */
+				 <STM32_PINMUX('B', 15, AF10)>, /* SDMMC2_D1 */
+				 <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2_D2 */
+				 <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2_D3 */
+				 <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-pull-up;
+		};
+	};
+
+	sdmmc2_b4_od_pins_a: sdmmc2-b4-od-0 {
+		pins1 {
+			pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC2_D0 */
+				 <STM32_PINMUX('B', 15, AF10)>, /* SDMMC2_D1 */
+				 <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2_D2 */
+				 <STM32_PINMUX('B', 4, AF10)>; /* SDMMC2_D3 */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-pull-up;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
+			slew-rate = <1>;
+			drive-open-drain;
+			bias-pull-up;
+		};
+	};
+
+	sdmmc2_b4_sleep_pins_a: sdmmc2-b4-sleep-0 {
+		pins {
+			pinmux = <STM32_PINMUX('B', 14, ANALOG)>, /* SDMMC2_D0 */
+				 <STM32_PINMUX('B', 15, ANALOG)>, /* SDMMC2_D1 */
+				 <STM32_PINMUX('B', 3, ANALOG)>, /* SDMMC2_D2 */
+				 <STM32_PINMUX('B', 4, ANALOG)>, /* SDMMC2_D3 */
+				 <STM32_PINMUX('E', 3, ANALOG)>, /* SDMMC2_CK */
+				 <STM32_PINMUX('G', 6, ANALOG)>; /* SDMMC2_CMD */
+		};
+	};
+
+	sdmmc2_clk_pins_a: sdmmc2-clk-0 {
+		pins {
+			pinmux = <STM32_PINMUX('E', 3, AF10)>; /* SDMMC2_CK */
+			slew-rate = <1>;
+			drive-push-pull;
+			bias-pull-up;
+		};
+	};
+
+	uart4_pins_a: uart4-0 {
+		pins1 {
+			pinmux = <STM32_PINMUX('D', 6, AF8)>; /* UART4_TX */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <0>;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('D', 8, AF8)>; /* UART4_RX */
+			bias-disable;
+		};
+	};
+};
arch/arm/dts/stm32mp131.dtsi new file +358 -0

358 lines not on this page · raw message

arch/arm/dts/stm32mp133.dtsi new file +37 -0
new file mode 100644
index 0000000000..0fb1386257
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
+ * Author: Alexandre Torgue <[email protected]> for STMicroelectronics.
+ */
+
+#include "stm32mp131.dtsi"
+
+/ {
+	soc {
+		m_can1: can@4400e000 {
+			compatible = "bosch,m_can";
+			reg = <0x4400e000 0x400>, <0x44011000 0x1400>;
+			reg-names = "m_can", "message_ram";
+			interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "int0", "int1";
+			clocks = <&clk_hse>, <&clk_pll4_r>;
+			clock-names = "hclk", "cclk";
+			bosch,mram-cfg = <0x0 0 0 32 0 0 2 2>;
+			status = "disabled";
+		};
+
+		m_can2: can@4400f000 {
+			compatible = "bosch,m_can";
+			reg = <0x4400f000 0x400>, <0x44011000 0x2800>;
+			reg-names = "m_can", "message_ram";
+			interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "int0", "int1";
+			clocks = <&clk_hse>, <&clk_pll4_r>;
+			clock-names = "hclk", "cclk";
+			bosch,mram-cfg = <0x1400 0 0 32 0 0 2 2>;
+			status = "disabled";
+		};
+	};
+};
arch/arm/dts/stm32mp135.dtsi new file +12 -0
new file mode 100644
index 0000000000..abf2acd37b
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
+ * Author: Alexandre Torgue <[email protected]> for STMicroelectronics.
+ */
+
+#include "stm32mp133.dtsi"
+
+/ {
+	soc {
+	};
+};
arch/arm/dts/stm32mp135f-dk.dts new file +57 -0

57 lines not on this page · raw message

arch/arm/dts/stm32mp13xc.dtsi new file +17 -0
new file mode 100644
index 0000000000..fa6889e305
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
+ * Author: Alexandre Torgue <[email protected]> for STMicroelectronics.
+ */
+
+/ {
+	soc {
+		cryp: crypto@54002000 {
+			compatible = "st,stm32mp1-cryp";
+			reg = <0x54002000 0x400>;
+			interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk_axi>;
+			status = "disabled";
+		};
+	};
+};
arch/arm/dts/stm32mp13xf.dtsi new file +17 -0
new file mode 100644
index 0000000000..fa6889e305
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
+ * Author: Alexandre Torgue <[email protected]> for STMicroelectronics.
+ */
+
+/ {
+	soc {
+		cryp: crypto@54002000 {
+			compatible = "st,stm32mp1-cryp";
+			reg = <0x54002000 0x400>;
+			interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk_axi>;
+			status = "disabled";
+		};
+	};
+};
board/st/stm32mp1/MAINTAINERS +1 -0
index 6451195269..d57a49820e 100644
@@ -3,6 +3,7 @@ M:	Patrick Delaunay <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 T:	git https://source.denx.de/u-boot/custodians/u-boot-stm.git
 S:	Maintained
+F:	arch/arm/dts/stm32mp13*
 F:	arch/arm/dts/stm32mp15*
 F:	board/st/stm32mp1/
 F:	configs/stm32mp15_defconfig
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/16 configs: stm32mp1: move SUPPORT_SPL in STM32MP15x

In reply to Patrick Delaunay

The SPL is only supported by STM32MP15x not by all the SOC with STM32MP arch.
Only TFABOOT is supported in next products.

---

(no changes since v1)

 arch/arm/Kconfig              | 1 -
 arch/arm/mach-stm32mp/Kconfig | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +0 -1
index 9898c7d68e..5f24ffc0f3 100644
@@ -1951,7 +1951,6 @@ config ARCH_STM32MP
 	select OF_SYSTEM_SETUP
 	select PINCTRL
 	select REGMAP
-	select SUPPORT_SPL
 	select SYSCON
 	select SYSRESET
 	select SYS_THUMB_BUILD
arch/arm/mach-stm32mp/Kconfig +1 -0
index e48f98ba29..be0d74b4ac 100644
@@ -46,6 +46,7 @@ config STM32MP15x
 	select STM32_RCC
 	select STM32_RESET
 	select STM32_SERIAL
+	select SUPPORT_SPL
 	select SYS_ARCH_TIMER
 	imply CMD_NVEDIT_INFO
 	help
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/16 arm: stm32mp: move the get_otp helper function in bsec

In reply to Patrick Delaunay

As the get_otp() helper function in bsec are common for all STM32MP family, move this function in bsec driver

---

(no changes since v1)

 arch/arm/mach-stm32mp/bsec.c                   | 17 +++++++++++++++++
 arch/arm/mach-stm32mp/cpu.c                    | 17 -----------------
 arch/arm/mach-stm32mp/include/mach/sys_proto.h |  3 +++
 3 files changed, 20 insertions(+), 17 deletions(-)
arch/arm/mach-stm32mp/bsec.c +17 -0
index 506caa0a31..c00130b08b 100644
@@ -632,3 +632,20 @@ bool bsec_dbgswenable(void)
 
 	return false;
 }
+
+u32 get_otp(int index, int shift, int mask)
+{
+	int ret;
+	struct udevice *dev;
+	u32 otp = 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(stm32mp_bsec),
+					  &dev);
+
+	if (!ret)
+		ret = misc_read(dev, STM32_BSEC_SHADOW(index),
+				&otp, sizeof(otp));
+
+	return (otp >> shift) & mask;
+}
arch/arm/mach-stm32mp/cpu.c +0 -17
index 0ad5f307db..6f44c75515 100644
@@ -349,23 +349,6 @@ u32 get_cpu_rev(void)
 	return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
 }
 
-static u32 get_otp(int index, int shift, int mask)
-{
-	int ret;
-	struct udevice *dev;
-	u32 otp = 0;
-
-	ret = uclass_get_device_by_driver(UCLASS_MISC,
-					  DM_DRIVER_GET(stm32mp_bsec),
-					  &dev);
-
-	if (!ret)
-		ret = misc_read(dev, STM32_BSEC_SHADOW(index),
-				&otp, sizeof(otp));
-
-	return (otp >> shift) & mask;
-}
-
 /* Get Device Part Number (RPN) from OTP */
 static u32 get_cpu_rpn(void)
 {
arch/arm/mach-stm32mp/include/mach/sys_proto.h +3 -0
index b91f98eb45..dc98f0c5a4 100644
@@ -52,3 +52,6 @@ int setup_mac_address(void);
 
 /* board power management : configure vddcore according OPP */
 void board_vddcore_init(u32 voltage_mv);
+
+/* helper function: read data from OTP */
+u32 get_otp(int index, int shift, int mask);
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/16 arm: stm32mp: move code for STM32MP15x

In reply to Patrick Delaunay

Move code and defines only needed for CONFIG_STM32MP15x in stm32mp15x.c when low level init without TFABOOT is supported.

---

(no changes since v1)

 arch/arm/mach-stm32mp/Makefile                |   2 +
 arch/arm/mach-stm32mp/cpu.c                   | 331 +----------------
 arch/arm/mach-stm32mp/fdt.c                   |   8 +-
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  14 +-
 arch/arm/mach-stm32mp/spl.c                   |   1 +
 arch/arm/mach-stm32mp/stm32mp15x.c            | 345 ++++++++++++++++++
 6 files changed, 377 insertions(+), 324 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/stm32mp15x.c
arch/arm/mach-stm32mp/Makefile +2 -0
index 391b47cf13..d362104fee 100644
@@ -8,6 +8,8 @@ obj-y += dram_init.o
 obj-y += syscon.o
 obj-y += bsec.o
 
+obj-$(CONFIG_STM32MP15x) += stm32mp15x.o
+
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
 obj-y += tzc400.o
arch/arm/mach-stm32mp/cpu.c +15 -316

379 lines not on this page · raw message

arch/arm/mach-stm32mp/fdt.c +4 -4
index b1a4b76566..7412f0e029 100644
@@ -312,16 +312,16 @@ int ft_system_setup(void *blob, struct bd_info *bd)
 	}
 
 	switch (get_cpu_package()) {
-	case PKG_AA_LBGA448:
+	case STM32MP15_PKG_AA_LBGA448:
 		pkg = STM32MP_PKG_AA;
 		break;
-	case PKG_AB_LBGA354:
+	case STM32MP15_PKG_AB_LBGA354:
 		pkg = STM32MP_PKG_AB;
 		break;
-	case PKG_AC_TFBGA361:
+	case STM32MP15_PKG_AC_TFBGA361:
 		pkg = STM32MP_PKG_AC;
 		break;
-	case PKG_AD_TFBGA257:
+	case STM32MP15_PKG_AD_TFBGA257:
 		pkg = STM32MP_PKG_AD;
 		break;
 	default:
arch/arm/mach-stm32mp/include/mach/sys_proto.h +10 -4
index dc98f0c5a4..8b61135aeb 100644
@@ -36,10 +36,12 @@ u32 get_cpu_rev(void);
 /* Get Package options from OTP */
 u32 get_cpu_package(void);
 
-#define PKG_AA_LBGA448	4
-#define PKG_AB_LBGA354	3
-#define PKG_AC_TFBGA361	2
-#define PKG_AD_TFBGA257	1
+/* package used for STM32MP15x */
+#define STM32MP15_PKG_AA_LBGA448	4
+#define STM32MP15_PKG_AB_LBGA354	3
+#define STM32MP15_PKG_AC_TFBGA361	2
+#define STM32MP15_PKG_AD_TFBGA257	1
+#define STM32MP15_PKG_UNKNOWN		0
 
 /* Get SOC name */
 #define SOC_NAME_SIZE 20
@@ -53,5 +55,9 @@ int setup_mac_address(void);
 /* board power management : configure vddcore according OPP */
 void board_vddcore_init(u32 voltage_mv);
 
+/* weak function */
+void stm32mp_cpu_init(void);
+void stm32mp_misc_init(void);
+
 /* helper function: read data from OTP */
 u32 get_otp(int index, int shift, int mask);
arch/arm/mach-stm32mp/spl.c +1 -0
index 78fa9d7edd..19d9fe04e0 100644
@@ -190,6 +190,7 @@ void board_init_f(ulong dummy)
 	int ret;
 
 	arch_cpu_init();
+	mach_cpu_init();
 
 	ret = spl_early_init();
 	if (ret) {
arch/arm/mach-stm32mp/stm32mp15x.c new file +345 -0

345 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 5/16 arm: stm32mp: add choice for STM32MP SOC family

In reply to Patrick Delaunay

Add mandatory choice for SOC support in ARCH_STM32MP.

This patch is a preliminary step for new SOC introduction in STM32MP family.

---

(no changes since v1)

 arch/arm/mach-stm32mp/Kconfig       | 23 +++++++++++++----------
 configs/stm32mp15_basic_defconfig   |  4 ++--
 configs/stm32mp15_defconfig         |  4 ++--
 configs/stm32mp15_trusted_defconfig |  4 ++--
 4 files changed, 19 insertions(+), 16 deletions(-)
arch/arm/mach-stm32mp/Kconfig +13 -10
index be0d74b4ac..446d3258c9 100644
@@ -33,6 +33,10 @@ config SYS_MALLOC_LEN
 config ENV_SIZE
 	default 0x2000
 
+choice
+	prompt "Select STMicroelectronics STM32MPxxx Soc"
+	default STM32MP15x
+
 config STM32MP15x
 	bool "Support STMicroelectronics STM32MP15x Soc"
 	select ARCH_SUPPORT_PSCI
@@ -54,11 +58,13 @@ config STM32MP15x
 		STM32MP157, STM32MP153 or STM32MP151
 		STMicroelectronics MPU with core ARMv7
 		dual core A7 for STM32MP157/3, monocore for STM32MP151
-		target all the STMicroelectronics board with SOC STM32MP1 family
+endchoice
+
+if STM32MP15x
 
 config STM32MP15x_STM32IMAGE
 	bool "Support STM32 image for generated U-Boot image"
-	depends on STM32MP15x && TFABOOT
+	depends on TFABOOT
 	help
 		Support of STM32 image generation for SOC STM32MP15x
 		for TF-A boot when FIP container is not used
@@ -69,7 +75,6 @@ choice
 
 config TARGET_ST_STM32MP15x
 	bool "STMicroelectronics STM32MP15x boards"
-	select STM32MP15x
 	imply BOOTSTAGE
 	imply CMD_BOOTSTAGE
 	imply CMD_CLS if CMD_BMP
@@ -84,7 +89,6 @@ config TARGET_ST_STM32MP15x
 
 config TARGET_MICROGEA_STM32MP1
 	bool "Engicam MicroGEA STM32MP1 SOM"
-	select STM32MP15x
 	imply BOOTSTAGE
 	imply CMD_BOOTSTAGE
 	imply CMD_CLS if CMD_BMP
@@ -109,7 +113,6 @@ config TARGET_MICROGEA_STM32MP1
 
 config TARGET_ICORE_STM32MP1
 	bool "Engicam i.Core STM32MP1 SOM"
-	select STM32MP15x
 	imply BOOTSTAGE
 	imply CMD_BOOTSTAGE
 	imply CMD_CLS if CMD_BMP
@@ -131,12 +134,16 @@ config TARGET_ICORE_STM32MP1
 
 config TARGET_DH_STM32MP1_PDK2
 	bool "DH STM32MP1 PDK2"
-	select STM32MP15x
 	help
 		Target the DH PDK2 development kit with STM32MP15x SoM.
 
 endchoice
 
+source "board/st/stm32mp1/Kconfig"
+source "board/dhelectronics/dh_stm32mp1/Kconfig"
+source "board/engicam/stm32mp1/Kconfig"
+endif
+
 config SYS_TEXT_BASE
 	default 0xC0100000
 
@@ -221,8 +228,4 @@ config DEBUG_UART_CLOCK
 endif
 
 source "arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig"
-source "board/dhelectronics/dh_stm32mp1/Kconfig"
-source "board/engicam/stm32mp1/Kconfig"
-source "board/st/stm32mp1/Kconfig"
-
 endif
configs/stm32mp15_basic_defconfig +2 -2
index 1b1c255b98..2e2d127ab7 100644
@@ -9,10 +9,10 @@ CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SPL_MMC=y
 CONFIG_SPL=y
 CONFIG_TARGET_ST_STM32MP15x=y
+CONFIG_TYPEC_STUSB160X=y
+CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
-CONFIG_ENV_OFFSET_REDUND=0x2C0000
-CONFIG_TYPEC_STUSB160X=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 # CONFIG_ARMV7_VIRT is not set
configs/stm32mp15_defconfig +2 -2
index 02b37e14ea..8853c72c37 100644
@@ -6,11 +6,11 @@ CONFIG_ENV_OFFSET=0x480000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_TARGET_ST_STM32MP15x=y
+CONFIG_TYPEC_STUSB160X=y
+CONFIG_ENV_OFFSET_REDUND=0x4C0000
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
-CONFIG_ENV_OFFSET_REDUND=0x4C0000
-CONFIG_TYPEC_STUSB160X=y
 # CONFIG_ARMV7_NONSEC is not set
 CONFIG_SYS_LOAD_ADDR=0xc2000000
 CONFIG_SYS_MEMTEST_START=0xc0000000
configs/stm32mp15_trusted_defconfig +2 -2
index df31c0fbb1..e880dd3fcb 100644
@@ -7,11 +7,11 @@ CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_STM32MP15x_STM32IMAGE=y
 CONFIG_TARGET_ST_STM32MP15x=y
+CONFIG_TYPEC_STUSB160X=y
+CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
-CONFIG_ENV_OFFSET_REDUND=0x2C0000
-CONFIG_TYPEC_STUSB160X=y
 # CONFIG_ARMV7_NONSEC is not set
 CONFIG_SYS_LOAD_ADDR=0xc2000000
 CONFIG_SYS_MEMTEST_START=0xc0000000
Signature · 1 line
2.25.1
#6 lore raw

PATCH v2 6/16 arm: stm32mp: add sub config Kconfig.15x

In reply to Patrick Delaunay

Add sub Kconfig for each SOC in the STM32 CPU family.

It is a preliminary step to introduce a new SOC in the STM32MP family.

---

(no changes since v1)

 arch/arm/mach-stm32mp/Kconfig       | 119 +---------------------------
 arch/arm/mach-stm32mp/Kconfig.15x   | 119 ++++++++++++++++++++++++++++
 configs/stm32mp15_basic_defconfig   |   2 +-
 configs/stm32mp15_defconfig         |   4 +-
 configs/stm32mp15_trusted_defconfig |   4 +-
 5 files changed, 125 insertions(+), 123 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/Kconfig.15x
arch/arm/mach-stm32mp/Kconfig +1 -118
index 446d3258c9..3b4936c326 100644
@@ -60,93 +60,6 @@ config STM32MP15x
 		dual core A7 for STM32MP157/3, monocore for STM32MP151
 endchoice
 
-if STM32MP15x
-
-config STM32MP15x_STM32IMAGE
-	bool "Support STM32 image for generated U-Boot image"
-	depends on TFABOOT
-	help
-		Support of STM32 image generation for SOC STM32MP15x
-		for TF-A boot when FIP container is not used
-
-choice
-	prompt "STM32MP15x board select"
-	optional
-
-config TARGET_ST_STM32MP15x
-	bool "STMicroelectronics STM32MP15x boards"
-	imply BOOTSTAGE
-	imply CMD_BOOTSTAGE
-	imply CMD_CLS if CMD_BMP
-	imply DISABLE_CONSOLE
-	imply PRE_CONSOLE_BUFFER
-	imply SILENT_CONSOLE
-	help
-		target the STMicroelectronics board with SOC STM32MP15x
-		managed by board/st/stm32mp1:
-		Evalulation board (EV1) or Discovery board (DK1 and DK2).
-		The difference between board are managed with devicetree
-
-config TARGET_MICROGEA_STM32MP1
-	bool "Engicam MicroGEA STM32MP1 SOM"
-	imply BOOTSTAGE
-	imply CMD_BOOTSTAGE
-	imply CMD_CLS if CMD_BMP
-	imply DISABLE_CONSOLE
-	imply PRE_CONSOLE_BUFFER
-	imply SILENT_CONSOLE
-	help
-	  MicroGEA STM32MP1 is a STM32MP157A based Micro SOM.
-
-	  MicroGEA STM32MP1 MicroDev 2.0:
-	  * MicroDev 2.0 is a general purpose miniature carrier board with CAN,
-	    LTE and LVDS panel interfaces.
-	  * MicroGEA STM32MP1 needs to mount on top of this MicroDev 2.0 board
-	    for creating complete MicroGEA STM32MP1 MicroDev 2.0 Carrier board.
-
-	  MicroGEA STM32MP1 MicroDev 2.0 7" OF:
-	  * 7" OF is a capacitive touch 7" Open Frame panel solutions with LVDS
-	    panel and toucscreen.
-	  * MicroGEA STM32MP1 needs to mount on top of MicroDev 2.0 board with
-	    pluged 7" OF for creating complete MicroGEA STM32MP1 MicroDev 2.0 7"
-	    Open Frame Solution board.
-
-config TARGET_ICORE_STM32MP1
-	bool "Engicam i.Core STM32MP1 SOM"
-	imply BOOTSTAGE
-	imply CMD_BOOTSTAGE
-	imply CMD_CLS if CMD_BMP
-	imply DISABLE_CONSOLE
-	imply PRE_CONSOLE_BUFFER
-	imply SILENT_CONSOLE
-	help
-	  i.Core STM32MP1 is an EDIMM SOM based on STM32MP157A.
-
-	  i.Core STM32MP1 EDIMM2.2:
-	  * EDIMM2.2 is a Form Factor Capacitive Evaluation Board.
-	  * i.Core STM32MP1 needs to mount on top of EDIMM2.2 for
-	    creating complete i.Core STM32MP1 EDIMM2.2 Starter Kit.
-
-	  i.Core STM32MP1 C.TOUCH 2.0
-	  * C.TOUCH 2.0 is a general purpose Carrier board.
-	  * i.Core STM32MP1 needs to mount on top of this Carrier board
-	    for creating complete i.Core STM32MP1 C.TOUCH 2.0 board.
-
-config TARGET_DH_STM32MP1_PDK2
-	bool "DH STM32MP1 PDK2"
-	help
-		Target the DH PDK2 development kit with STM32MP15x SoM.
-
-endchoice
-
-source "board/st/stm32mp1/Kconfig"
-source "board/dhelectronics/dh_stm32mp1/Kconfig"
-source "board/engicam/stm32mp1/Kconfig"
-endif
-
-config SYS_TEXT_BASE
-	default 0xC0100000
-
 config NR_DRAM_BANKS
 	default 1
 
@@ -195,37 +108,7 @@ config CMD_STM32KEY
 		This command is used to evaluate the secure boot on stm32mp SOC,
 		it is deactivated by default in real products.
 
-config PRE_CON_BUF_ADDR
-	default 0xC02FF000
-
-config PRE_CON_BUF_SZ
-	default 4096
-
-config BOOTSTAGE_STASH_ADDR
-	default 0xC3000000
-
-if BOOTCOUNT_GENERIC
-config SYS_BOOTCOUNT_SINGLEWORD
-	default y
-
-# TAMP_BOOTCOUNT = TAMP_BACKUP_REGISTER(21)
-config SYS_BOOTCOUNT_ADDR
-	default 0x5C00A154
-endif
-
-if DEBUG_UART
-
-config DEBUG_UART_BOARD_INIT
-	default y
-
-# debug on UART4 by default
-config DEBUG_UART_BASE
-	default 0x40010000
-
-# clock source is HSI on reset
-config DEBUG_UART_CLOCK
-	default 64000000
-endif
+source "arch/arm/mach-stm32mp/Kconfig.15x"
 
 source "arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig"
 endif
arch/arm/mach-stm32mp/Kconfig.15x new file +119 -0

119 lines not on this page · raw message

configs/stm32mp15_basic_defconfig +1 -1
index 2e2d127ab7..c325e9c55b 100644
@@ -8,10 +8,10 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SPL_MMC=y
 CONFIG_SPL=y
+CONFIG_CMD_STM32KEY=y
 CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
-CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
configs/stm32mp15_defconfig +2 -2
index 8853c72c37..b25cb2725b 100644
@@ -5,11 +5,11 @@ CONFIG_SYS_MALLOC_F_LEN=0x3000
 CONFIG_ENV_OFFSET=0x480000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
+CONFIG_DDR_CACHEABLE_SIZE=0x10000000
+CONFIG_CMD_STM32KEY=y
 CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
 CONFIG_ENV_OFFSET_REDUND=0x4C0000
-CONFIG_DDR_CACHEABLE_SIZE=0x10000000
-CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
 CONFIG_SYS_LOAD_ADDR=0xc2000000
configs/stm32mp15_trusted_defconfig +2 -2
index e880dd3fcb..89e1b8ad86 100644
@@ -5,12 +5,12 @@ CONFIG_SYS_MALLOC_F_LEN=0x3000
 CONFIG_ENV_OFFSET=0x280000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
+CONFIG_DDR_CACHEABLE_SIZE=0x10000000
+CONFIG_CMD_STM32KEY=y
 CONFIG_STM32MP15x_STM32IMAGE=y
 CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
-CONFIG_DDR_CACHEABLE_SIZE=0x10000000
-CONFIG_CMD_STM32KEY=y
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
 CONFIG_SYS_LOAD_ADDR=0xc2000000
Signature · 1 line
2.25.1
#7 lore raw

PATCH v2 7/16 arm: stm32mp: add CONFIG_STM32MP15_PWR

In reply to Patrick Delaunay

Add config CONFIG_STM32MP15_PWR to handle the access to regulators managed by the PWR driver defined in pwr_regulator.c

This driver is only used in U-Boot by STM32MP15x family.

---

Changes in v2:
- fix commit message

 arch/arm/mach-stm32mp/Kconfig.15x | 16 ++++++++++++++++
 arch/arm/mach-stm32mp/Makefile    |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm/mach-stm32mp/Kconfig.15x +16 -0
index 19f161cf5c..d516270292 100644
@@ -77,6 +77,22 @@ config TARGET_ICORE_STM32MP1
 
 endchoice
 
+config STM32MP15_PWR
+	bool "Enable driver for STM32MP15x PWR"
+	depends on DM_REGULATOR && DM_PMIC
+	default y
+	help
+		This config enables implementation of driver-model pmic and
+		regulator uclass features for access to STM32MP15x PWR.
+
+config SPL_STM32MP15_PWR
+	bool "Enable driver for STM32MP15x PWR in SPL"
+	depends on SPL && SPL_DM_REGULATOR && SPL_DM_PMIC
+	default y
+	help
+		This config enables implementation of driver-model pmic and
+		regulator uclass features for access to STM32MP15x PWR in SPL.
+
 config SYS_TEXT_BASE
 	default 0xC0100000
 
arch/arm/mach-stm32mp/Makefile +1 -1
index d362104fee..0ffec6e02f 100644
@@ -21,5 +21,5 @@ obj-$(CONFIG_ARMV7_PSCI) += psci.o
 obj-$(CONFIG_TFABOOT) += boot_params.o
 endif
 
-obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
+obj-$(CONFIG_$(SPL_)STM32MP15_PWR) += pwr_regulator.o
 obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o
Signature · 1 line
2.25.1
Reviewed-by on v2 7/16
#8 lore raw

Re: [PATCH v2 07/16] arm: stm32mp: add CONFIG_STM32MP15_PWR

Hi Patrick

Quoted 48 lines · Patrick Delaunay

Add config CONFIG_STM32MP15_PWR to handle the access to regulators managed by the PWR driver defined in pwr_regulator.c

This driver is only used in U-Boot by STM32MP15x family.

---

Changes in v2:
- fix commit message

 arch/arm/mach-stm32mp/Kconfig.15x | 16 ++++++++++++++++
 arch/arm/mach-stm32mp/Makefile    |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/arm/mach-stm32mp/Kconfig.15x +16 -0
index 19f161cf5c..d516270292 100644
@@ -77,6 +77,22 @@ config TARGET_ICORE_STM32MP1
 
 endchoice
 
+config STM32MP15_PWR
+	bool "Enable driver for STM32MP15x PWR"
+	depends on DM_REGULATOR && DM_PMIC
+	default y
+	help
+		This config enables implementation of driver-model pmic and
+		regulator uclass features for access to STM32MP15x PWR.
+
+config SPL_STM32MP15_PWR
+	bool "Enable driver for STM32MP15x PWR in SPL"
+	depends on SPL && SPL_DM_REGULATOR && SPL_DM_PMIC
+	default y
+	help
+		This config enables implementation of driver-model pmic and
+		regulator uclass features for access to STM32MP15x PWR in SPL.
+
 config SYS_TEXT_BASE
 	default 0xC0100000
 
arch/arm/mach-stm32mp/Makefile +0 -0
index d362104fee..0ffec6e02f 100644

arch/arm/mach-stm32mp/Makefile obj-$(CONFIG_ARMV7_PSCI) += psci.o · line 25

Quoted 6 lines
arch/arm/mach-stm32mp/Makefile +1 -1
@@ -21,5 +21,5 @@ obj-$(CONFIG_ARMV7_PSCI) += psci.o
 obj-$(CONFIG_TFABOOT) += boot_params.o
 endif
 
-obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
+obj-$(CONFIG_$(SPL_)STM32MP15_PWR) += pwr_regulator.o
 obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o

Thanks
Patrice

#9 lore raw

PATCH v2 8/16 arm: stm32mp: add support of STM32MP13x

In reply to Patrick Delaunay

Introduce the code in mach-stm32mp and the configuration file stm32mp13_defconfig for the new STM32MP family.

---

Changes in v2:
- fix several typo issue in comments reported by Patrice and Marek

 arch/arm/mach-stm32mp/Kconfig                 |  21 +++-
 arch/arm/mach-stm32mp/Kconfig.13x             |  57 +++++++++
 arch/arm/mach-stm32mp/Makefile                |   1 +
 arch/arm/mach-stm32mp/cpu.c                   |   3 +
 arch/arm/mach-stm32mp/fdt.c                   |   3 +
 arch/arm/mach-stm32mp/include/mach/stm32.h    |  26 ++++
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  16 ++-
 arch/arm/mach-stm32mp/stm32mp13x.c            | 115 ++++++++++++++++++
 board/st/stm32mp1/Kconfig                     |  15 +++
 board/st/stm32mp1/MAINTAINERS                 |   2 +
 configs/stm32mp15_basic_defconfig             |   2 +-
 configs/stm32mp15_defconfig                   |   2 +-
 configs/stm32mp15_trusted_defconfig           |   2 +-
 include/configs/stm32mp13_common.h            | 106 ++++++++++++++++
 include/configs/stm32mp13_st_common.h         |  17 +++
 include/configs/stm32mp15_common.h            |   4 +-
 16 files changed, 385 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/Kconfig.13x
 create mode 100644 arch/arm/mach-stm32mp/stm32mp13x.c
 create mode 100644 include/configs/stm32mp13_common.h
 create mode 100644 include/configs/stm32mp13_st_common.h
arch/arm/mach-stm32mp/Kconfig +20 -1
index 3b4936c326..db47baba6d 100644
@@ -37,6 +37,24 @@ choice
 	prompt "Select STMicroelectronics STM32MPxxx Soc"
 	default STM32MP15x
 
+config STM32MP13x
+	bool "Support STMicroelectronics STM32MP13x Soc"
+	select ARM_SMCCC
+	select CPU_V7A
+	select CPU_V7_HAS_NONSEC
+	select CPU_V7_HAS_VIRT
+	select OF_BOARD
+	select OF_BOARD_SETUP
+	select PINCTRL_STM32
+	select STM32_RCC
+	select STM32_RESET
+	select STM32_SERIAL
+	select SYS_ARCH_TIMER
+	imply CMD_NVEDIT_INFO
+	help
+		support of STMicroelectronics SOC STM32MP13x family
+		STMicroelectronics MPU with core ARMv7
+
 config STM32MP15x
 	bool "Support STMicroelectronics STM32MP15x Soc"
 	select ARCH_SUPPORT_PSCI
@@ -85,7 +103,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
 
 config STM32_ETZPC
 	bool "STM32 Extended TrustZone Protection"
-	depends on STM32MP15x
+	depends on STM32MP15x || STM32MP13x
 	default y
 	imply BOOTP_SERVERIP
 	help
@@ -108,6 +126,7 @@ config CMD_STM32KEY
 		This command is used to evaluate the secure boot on stm32mp SOC,
 		it is deactivated by default in real products.
 
+source "arch/arm/mach-stm32mp/Kconfig.13x"
 source "arch/arm/mach-stm32mp/Kconfig.15x"
 
 source "arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig"
arch/arm/mach-stm32mp/Kconfig.13x new file +57 -0

57 lines not on this page · raw message

arch/arm/mach-stm32mp/Makefile +1 -0
index 0ffec6e02f..1db9057e04 100644
@@ -8,6 +8,7 @@ obj-y += dram_init.o
 obj-y += syscon.o
 obj-y += bsec.o
 
+obj-$(CONFIG_STM32MP13x) += stm32mp13x.o
 obj-$(CONFIG_STM32MP15x) += stm32mp15x.o
 
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-stm32mp/cpu.c +3 -0
index b808964d3e..240960ada4 100644
@@ -52,8 +52,11 @@ void dram_bank_mmu_setup(int bank)
 	enum dcache_option option;
 
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
+/* STM32_SYSRAM_BASE exist only when SPL is supported */
+#ifdef CONFIG_SPL
 		start = ALIGN_DOWN(STM32_SYSRAM_BASE, MMU_SECTION_SIZE);
 		size = ALIGN(STM32_SYSRAM_SIZE, MMU_SECTION_SIZE);
+#endif
 	} else if (gd->flags & GD_FLG_RELOC) {
 		/* bd->bi_dram is available only after relocation */
 		start = bd->bi_dram[bank].start;
arch/arm/mach-stm32mp/fdt.c +3 -0
index 7412f0e029..687543e712 100644
@@ -259,6 +259,9 @@ int ft_system_setup(void *blob, struct bd_info *bd)
 	u32 pkg, cpu;
 	char name[SOC_NAME_SIZE];
 
+	if (IS_ENABLED(CONFIG_STM32MP13x))
+		return 0;
+
 	soc = fdt_path_offset(blob, "/soc");
 	/* when absent, nothing to do */
 	if (soc == -FDT_ERR_NOTFOUND)
arch/arm/mach-stm32mp/include/mach/stm32.h +26 -0
index 47e88fc3dc..cdb58fd40e 100644
@@ -17,7 +17,9 @@
 #define STM32_RCC_BASE			0x50000000
 #define STM32_PWR_BASE			0x50001000
 #define STM32_SYSCFG_BASE		0x50020000
+#ifdef CONFIG_STM32MP15x
 #define STM32_DBGMCU_BASE		0x50081000
+#endif
 #define STM32_FMC2_BASE			0x58002000
 #define STM32_DDRCTRL_BASE		0x5A003000
 #define STM32_DDRPHYC_BASE		0x5A004000
@@ -26,8 +28,14 @@
 #define STM32_STGEN_BASE		0x5C008000
 #define STM32_TAMP_BASE			0x5C00A000
 
+#ifdef CONFIG_STM32MP15x
 #define STM32_USART1_BASE		0x5C000000
 #define STM32_USART2_BASE		0x4000E000
+#endif
+#ifdef CONFIG_STM32MP13x
+#define STM32_USART1_BASE		0x4c000000
+#define STM32_USART2_BASE		0x4c001000
+#endif
 #define STM32_USART3_BASE		0x4000F000
 #define STM32_UART4_BASE		0x40010000
 #define STM32_UART5_BASE		0x40011000
@@ -39,8 +47,10 @@
 #define STM32_SDMMC2_BASE		0x58007000
 #define STM32_SDMMC3_BASE		0x48004000
 
+#ifdef CONFIG_STM32MP15x
 #define STM32_SYSRAM_BASE		0x2FFC0000
 #define STM32_SYSRAM_SIZE		SZ_256K
+#endif
 
 #define STM32_DDR_BASE			0xC0000000
 #define STM32_DDR_SIZE			SZ_1G
@@ -98,6 +108,8 @@ enum boot_device {
 
 /* TAMP registers */
 #define TAMP_BACKUP_REGISTER(x)		(STM32_TAMP_BASE + 0x100 + 4 * x)
+
+#ifdef CONFIG_STM32MP15x
 #define TAMP_BACKUP_MAGIC_NUMBER	TAMP_BACKUP_REGISTER(4)
 #define TAMP_BACKUP_BRANCH_ADDRESS	TAMP_BACKUP_REGISTER(5)
 #define TAMP_COPRO_RSC_TBL_ADDRESS	TAMP_BACKUP_REGISTER(17)
@@ -111,6 +123,12 @@ enum boot_device {
 #define TAMP_COPRO_STATE_CSTOP		3
 #define TAMP_COPRO_STATE_STANDBY	4
 #define TAMP_COPRO_STATE_CRASH		5
+#endif
+
+#ifdef CONFIG_STM32MP13x
+#define TAMP_BOOTCOUNT			TAMP_BACKUP_REGISTER(31)
+#define TAMP_BOOT_CONTEXT		TAMP_BACKUP_REGISTER(30)
+#endif
 
 #define TAMP_BOOT_MODE_MASK		GENMASK(15, 8)
 #define TAMP_BOOT_MODE_SHIFT		8
@@ -138,11 +156,19 @@ enum forced_boot_mode {
 #define STM32_BSEC_LOCK(id)		(STM32_BSEC_LOCK_OFFSET + (id) * 4)
 
 /* BSEC OTP index */
+#ifdef CONFIG_STM32MP15x
 #define BSEC_OTP_RPN	1
 #define BSEC_OTP_SERIAL	13
 #define BSEC_OTP_PKG	16
 #define BSEC_OTP_MAC	57
 #define BSEC_OTP_BOARD	59
+#endif
+#ifdef CONFIG_STM32MP13x
+#define BSEC_OTP_RPN	1
+#define BSEC_OTP_SERIAL	13
+#define BSEC_OTP_MAC	57
+#define BSEC_OTP_BOARD	60
+#endif
 
 #endif /* __ASSEMBLY__ */
 #endif /* _MACH_STM32_H_ */
arch/arm/mach-stm32mp/include/mach/sys_proto.h +15 -1
index 8b61135aeb..829b3feebf 100644
@@ -3,7 +3,7 @@
  * Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
  */
 
-/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit7:0) */
+/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0) */
 #define CPU_STM32MP157Cxx	0x05000000
 #define CPU_STM32MP157Axx	0x05000001
 #define CPU_STM32MP153Cxx	0x05000024
@@ -17,10 +17,24 @@
 #define CPU_STM32MP151Fxx	0x050000AE
 #define CPU_STM32MP151Dxx	0x050000AF
 
+#define CPU_STM32MP135Cxx	0x05010000
+#define CPU_STM32MP135Axx	0x05010001
+#define CPU_STM32MP133Cxx	0x050100C0
+#define CPU_STM32MP133Axx	0x050100C1
+#define CPU_STM32MP131Cxx	0x050106C8
+#define CPU_STM32MP131Axx	0x050106C9
+#define CPU_STM32MP135Fxx	0x05010800
+#define CPU_STM32MP135Dxx	0x05010801
+#define CPU_STM32MP133Fxx	0x050108C0
+#define CPU_STM32MP133Dxx	0x050108C1
+#define CPU_STM32MP131Fxx	0x05010EC8
+#define CPU_STM32MP131Dxx	0x05010EC9
+
 /* return CPU_STMP32MP...Xxx constants */
 u32 get_cpu_type(void);
 
 #define CPU_DEV_STM32MP15	0x500
+#define CPU_DEV_STM32MP13	0x501
 
 /* return CPU_DEV constants */
 u32 get_cpu_dev(void);
arch/arm/mach-stm32mp/stm32mp13x.c new file +115 -0

115 lines not on this page · raw message

board/st/stm32mp1/Kconfig +15 -0
index 89e97aec2b..6ab8f80fa4 100644
@@ -11,3 +11,18 @@ config SYS_CONFIG_NAME
 
 source "board/st/common/Kconfig"
 endif
+
+if TARGET_ST_STM32MP13x
+
+config SYS_BOARD
+	default "stm32mp1"
+
+config SYS_VENDOR
+	default "st"
+
+config SYS_CONFIG_NAME
+	default "stm32mp13_st_common"
+
+source "board/st/common/Kconfig"
+
+endif
board/st/stm32mp1/MAINTAINERS +2 -0
index d57a49820e..c9252e90f4 100644
@@ -9,5 +9,7 @@ F:	board/st/stm32mp1/
 F:	configs/stm32mp15_defconfig
 F:	configs/stm32mp15_basic_defconfig
 F:	configs/stm32mp15_trusted_defconfig
+F:	include/configs/stm32mp13_common.h
+F:	include/configs/stm32mp13_st_common.h
 F:	include/configs/stm32mp15_common.h
 F:	include/configs/stm32mp15_st_common.h
configs/stm32mp15_basic_defconfig +1 -1
index c325e9c55b..8c3ad2d758 100644
@@ -9,8 +9,8 @@ CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SPL_MMC=y
 CONFIG_SPL=y
 CONFIG_CMD_STM32KEY=y
-CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
+CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_CMD_STM32PROG=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
configs/stm32mp15_defconfig +1 -1
index b25cb2725b..cf05155ec2 100644
@@ -7,8 +7,8 @@ CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
-CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
+CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_ENV_OFFSET_REDUND=0x4C0000
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
configs/stm32mp15_trusted_defconfig +1 -1
index 89e1b8ad86..db47d8b86b 100644
@@ -7,9 +7,9 @@ CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
+CONFIG_TYPEC_STUSB160X=y
 CONFIG_STM32MP15x_STM32IMAGE=y
 CONFIG_TARGET_ST_STM32MP15x=y
-CONFIG_TYPEC_STUSB160X=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
include/configs/stm32mp13_common.h new file +106 -0

106 lines not on this page · raw message

include/configs/stm32mp13_st_common.h new file +17 -0
new file mode 100644
index 0000000000..ec64b12f7a
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*
+ * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
+ *
+ * Configuration settings for the STMicroelectronics STM32MP13x boards
+ */
+
+#ifndef __CONFIG_STM32MP13_ST_COMMON_H__
+#define __CONFIG_STM32MP13_ST_COMMON_H__
+
+#define STM32MP_BOARD_EXTRA_ENV \
+	"usb_pgood_delay=1000\0" \
+	"console=ttySTM0\0"
+
+#include <configs/stm32mp13_common.h>
+
+#endif
include/configs/stm32mp15_common.h +2 -2
index 6b40cdb017..adfb2898b0 100644
@@ -14,7 +14,7 @@
  * Configuration of the external SRAM memory used by U-Boot
  */
 #define CONFIG_SYS_SDRAM_BASE			STM32_DDR_BASE
-#define CONFIG_SYS_INIT_SP_ADDR			CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_INIT_SP_ADDR		CONFIG_SYS_TEXT_BASE
 
 /*
  * Console I/O buffer size
@@ -97,7 +97,7 @@
 	BOOT_TARGET_PXE(func)
 
 /*
- * default bootcmd for stm32mp1:
+ * default bootcmd for stm32mp15:
  * for serial/usb: execute the stm32prog command
  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
  * for nand or spi-nand boot, distro boot with ubifs on UBI partition
Signature · 1 line
2.25.1
Reviewed-by on v2 8/16
#10 lore raw

Re: [PATCH v2 08/16] arm: stm32mp: add support of STM32MP13x

Hi Patrick

Quoted 650 lines · Patrick Delaunay

Introduce the code in mach-stm32mp and the configuration file stm32mp13_defconfig for the new STM32MP family.

---

Changes in v2:
- fix several typo issue in comments reported by Patrice and Marek

 arch/arm/mach-stm32mp/Kconfig                 |  21 +++-
 arch/arm/mach-stm32mp/Kconfig.13x             |  57 +++++++++
 arch/arm/mach-stm32mp/Makefile                |   1 +
 arch/arm/mach-stm32mp/cpu.c                   |   3 +
 arch/arm/mach-stm32mp/fdt.c                   |   3 +
 arch/arm/mach-stm32mp/include/mach/stm32.h    |  26 ++++
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  16 ++-
 arch/arm/mach-stm32mp/stm32mp13x.c            | 115 ++++++++++++++++++
 board/st/stm32mp1/Kconfig                     |  15 +++
 board/st/stm32mp1/MAINTAINERS                 |   2 +
 configs/stm32mp15_basic_defconfig             |   2 +-
 configs/stm32mp15_defconfig                   |   2 +-
 configs/stm32mp15_trusted_defconfig           |   2 +-
 include/configs/stm32mp13_common.h            | 106 ++++++++++++++++
 include/configs/stm32mp13_st_common.h         |  17 +++
 include/configs/stm32mp15_common.h            |   4 +-
 16 files changed, 385 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/Kconfig.13x
 create mode 100644 arch/arm/mach-stm32mp/stm32mp13x.c
 create mode 100644 include/configs/stm32mp13_common.h
 create mode 100644 include/configs/stm32mp13_st_common.h
arch/arm/mach-stm32mp/Kconfig +20 -1
index 3b4936c326..db47baba6d 100644
@@ -37,6 +37,24 @@ choice
 	prompt "Select STMicroelectronics STM32MPxxx Soc"
 	default STM32MP15x
 
+config STM32MP13x
+	bool "Support STMicroelectronics STM32MP13x Soc"
+	select ARM_SMCCC
+	select CPU_V7A
+	select CPU_V7_HAS_NONSEC
+	select CPU_V7_HAS_VIRT
+	select OF_BOARD
+	select OF_BOARD_SETUP
+	select PINCTRL_STM32
+	select STM32_RCC
+	select STM32_RESET
+	select STM32_SERIAL
+	select SYS_ARCH_TIMER
+	imply CMD_NVEDIT_INFO
+	help
+		support of STMicroelectronics SOC STM32MP13x family
+		STMicroelectronics MPU with core ARMv7
+
 config STM32MP15x
 	bool "Support STMicroelectronics STM32MP15x Soc"
 	select ARCH_SUPPORT_PSCI
@@ -85,7 +103,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
 
 config STM32_ETZPC
 	bool "STM32 Extended TrustZone Protection"
-	depends on STM32MP15x
+	depends on STM32MP15x || STM32MP13x
 	default y
 	imply BOOTP_SERVERIP
 	help
@@ -108,6 +126,7 @@ config CMD_STM32KEY
 		This command is used to evaluate the secure boot on stm32mp SOC,
 		it is deactivated by default in real products.
 
+source "arch/arm/mach-stm32mp/Kconfig.13x"
 source "arch/arm/mach-stm32mp/Kconfig.15x"
 
 source "arch/arm/mach-stm32mp/cmd_stm32prog/Kconfig"
arch/arm/mach-stm32mp/Kconfig.13x new file +57 -0
new file mode 100644
index 0000000000..5fc000986e
@@ -0,0 +1,57 @@
+if STM32MP13x
+
+choice
+	prompt "STM32MP13x board select"
+	optional
+
+config TARGET_ST_STM32MP13x
+	bool "STMicroelectronics STM32MP13x boards"
+	imply BOOTSTAGE
+	imply CMD_BOOTSTAGE
+	imply CMD_CLS if CMD_BMP
+	imply DISABLE_CONSOLE
+	imply PRE_CONSOLE_BUFFER
+	imply SILENT_CONSOLE
+	help
+		target the STMicroelectronics board with SOC STM32MP13x
+		managed by board/st/stm32mp1.
+		The difference between board are managed with devicetree
+
+endchoice
+
+config SYS_TEXT_BASE
+	default 0xC0000000
+
+config PRE_CON_BUF_ADDR
+	default 0xC0800000
+
+config PRE_CON_BUF_SZ
+	default 4096
+
+config BOOTSTAGE_STASH_ADDR
+	default 0xC3000000
+
+if BOOTCOUNT_GENERIC
+config SYS_BOOTCOUNT_SINGLEWORD
+	default y
+
+# TAMP_BOOTCOUNT = TAMP_BACKUP_REGISTER(31)
+config SYS_BOOTCOUNT_ADDR
+	default 0x5C00A17C
+endif
+
+if DEBUG_UART
+
+# debug on UART4 by default
+config DEBUG_UART_BASE
+	default 0x40010000
+
+# clock source is HSI on reset
+config DEBUG_UART_CLOCK
+	default 48000000 if STM32_FPGA
+	default 64000000
+endif
+
+source "board/st/stm32mp1/Kconfig"
+
+endif
arch/arm/mach-stm32mp/Makefile +1 -0
index 0ffec6e02f..1db9057e04 100644
@@ -8,6 +8,7 @@ obj-y += dram_init.o
 obj-y += syscon.o
 obj-y += bsec.o
 
+obj-$(CONFIG_STM32MP13x) += stm32mp13x.o
 obj-$(CONFIG_STM32MP15x) += stm32mp15x.o
 
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-stm32mp/cpu.c +3 -0
index b808964d3e..240960ada4 100644
@@ -52,8 +52,11 @@ void dram_bank_mmu_setup(int bank)
 	enum dcache_option option;
 
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
+/* STM32_SYSRAM_BASE exist only when SPL is supported */
+#ifdef CONFIG_SPL
 		start = ALIGN_DOWN(STM32_SYSRAM_BASE, MMU_SECTION_SIZE);
 		size = ALIGN(STM32_SYSRAM_SIZE, MMU_SECTION_SIZE);
+#endif
 	} else if (gd->flags & GD_FLG_RELOC) {
 		/* bd->bi_dram is available only after relocation */
 		start = bd->bi_dram[bank].start;
arch/arm/mach-stm32mp/fdt.c +3 -0
index 7412f0e029..687543e712 100644
@@ -259,6 +259,9 @@ int ft_system_setup(void *blob, struct bd_info *bd)
 	u32 pkg, cpu;
 	char name[SOC_NAME_SIZE];
 
+	if (IS_ENABLED(CONFIG_STM32MP13x))
+		return 0;
+
 	soc = fdt_path_offset(blob, "/soc");
 	/* when absent, nothing to do */
 	if (soc == -FDT_ERR_NOTFOUND)
arch/arm/mach-stm32mp/include/mach/stm32.h +26 -0
index 47e88fc3dc..cdb58fd40e 100644
@@ -17,7 +17,9 @@
 #define STM32_RCC_BASE			0x50000000
 #define STM32_PWR_BASE			0x50001000
 #define STM32_SYSCFG_BASE		0x50020000
+#ifdef CONFIG_STM32MP15x
 #define STM32_DBGMCU_BASE		0x50081000
+#endif
 #define STM32_FMC2_BASE			0x58002000
 #define STM32_DDRCTRL_BASE		0x5A003000
 #define STM32_DDRPHYC_BASE		0x5A004000
@@ -26,8 +28,14 @@
 #define STM32_STGEN_BASE		0x5C008000
 #define STM32_TAMP_BASE			0x5C00A000
 
+#ifdef CONFIG_STM32MP15x
 #define STM32_USART1_BASE		0x5C000000
 #define STM32_USART2_BASE		0x4000E000
+#endif
+#ifdef CONFIG_STM32MP13x
+#define STM32_USART1_BASE		0x4c000000
+#define STM32_USART2_BASE		0x4c001000
+#endif
 #define STM32_USART3_BASE		0x4000F000
 #define STM32_UART4_BASE		0x40010000
 #define STM32_UART5_BASE		0x40011000
@@ -39,8 +47,10 @@
 #define STM32_SDMMC2_BASE		0x58007000
 #define STM32_SDMMC3_BASE		0x48004000
 
+#ifdef CONFIG_STM32MP15x
 #define STM32_SYSRAM_BASE		0x2FFC0000
 #define STM32_SYSRAM_SIZE		SZ_256K
+#endif
 
 #define STM32_DDR_BASE			0xC0000000
 #define STM32_DDR_SIZE			SZ_1G
@@ -98,6 +108,8 @@ enum boot_device {
 
 /* TAMP registers */
 #define TAMP_BACKUP_REGISTER(x)		(STM32_TAMP_BASE + 0x100 + 4 * x)
+
+#ifdef CONFIG_STM32MP15x
 #define TAMP_BACKUP_MAGIC_NUMBER	TAMP_BACKUP_REGISTER(4)
 #define TAMP_BACKUP_BRANCH_ADDRESS	TAMP_BACKUP_REGISTER(5)
 #define TAMP_COPRO_RSC_TBL_ADDRESS	TAMP_BACKUP_REGISTER(17)
@@ -111,6 +123,12 @@ enum boot_device {
 #define TAMP_COPRO_STATE_CSTOP		3
 #define TAMP_COPRO_STATE_STANDBY	4
 #define TAMP_COPRO_STATE_CRASH		5
+#endif
+
+#ifdef CONFIG_STM32MP13x
+#define TAMP_BOOTCOUNT			TAMP_BACKUP_REGISTER(31)
+#define TAMP_BOOT_CONTEXT		TAMP_BACKUP_REGISTER(30)
+#endif
 
 #define TAMP_BOOT_MODE_MASK		GENMASK(15, 8)
 #define TAMP_BOOT_MODE_SHIFT		8
@@ -138,11 +156,19 @@ enum forced_boot_mode {
 #define STM32_BSEC_LOCK(id)		(STM32_BSEC_LOCK_OFFSET + (id) * 4)
 
 /* BSEC OTP index */
+#ifdef CONFIG_STM32MP15x
 #define BSEC_OTP_RPN	1
 #define BSEC_OTP_SERIAL	13
 #define BSEC_OTP_PKG	16
 #define BSEC_OTP_MAC	57
 #define BSEC_OTP_BOARD	59
+#endif
+#ifdef CONFIG_STM32MP13x
+#define BSEC_OTP_RPN	1
+#define BSEC_OTP_SERIAL	13
+#define BSEC_OTP_MAC	57
+#define BSEC_OTP_BOARD	60
+#endif
 
 #endif /* __ASSEMBLY__ */
 #endif /* _MACH_STM32_H_ */
arch/arm/mach-stm32mp/include/mach/sys_proto.h +15 -1
index 8b61135aeb..829b3feebf 100644
@@ -3,7 +3,7 @@
  * Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
  */
 
-/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit7:0) */
+/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0) */
 #define CPU_STM32MP157Cxx	0x05000000
 #define CPU_STM32MP157Axx	0x05000001
 #define CPU_STM32MP153Cxx	0x05000024
@@ -17,10 +17,24 @@
 #define CPU_STM32MP151Fxx	0x050000AE
 #define CPU_STM32MP151Dxx	0x050000AF
 
+#define CPU_STM32MP135Cxx	0x05010000
+#define CPU_STM32MP135Axx	0x05010001
+#define CPU_STM32MP133Cxx	0x050100C0
+#define CPU_STM32MP133Axx	0x050100C1
+#define CPU_STM32MP131Cxx	0x050106C8
+#define CPU_STM32MP131Axx	0x050106C9
+#define CPU_STM32MP135Fxx	0x05010800
+#define CPU_STM32MP135Dxx	0x05010801
+#define CPU_STM32MP133Fxx	0x050108C0
+#define CPU_STM32MP133Dxx	0x050108C1
+#define CPU_STM32MP131Fxx	0x05010EC8
+#define CPU_STM32MP131Dxx	0x05010EC9
+
 /* return CPU_STMP32MP...Xxx constants */
 u32 get_cpu_type(void);
 
 #define CPU_DEV_STM32MP15	0x500
+#define CPU_DEV_STM32MP13	0x501
 
 /* return CPU_DEV constants */
 u32 get_cpu_dev(void);
arch/arm/mach-stm32mp/stm32mp13x.c new file +115 -0
new file mode 100644
index 0000000000..d5e3a787c2
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
+/*
+ * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
+ */
+
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <common.h>
+#include <log.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/arch/stm32.h>
+#include <asm/arch/sys_proto.h>
+
+/* SYSCFG register */
+#define SYSCFG_IDC_OFFSET	0x380
+#define SYSCFG_IDC_DEV_ID_MASK	GENMASK(11, 0)
+#define SYSCFG_IDC_DEV_ID_SHIFT	0
+#define SYSCFG_IDC_REV_ID_MASK	GENMASK(31, 16)
+#define SYSCFG_IDC_REV_ID_SHIFT	16
+
+/* Device Part Number (RPN) = OTP_DATA1 lower 11 bits */
+#define RPN_SHIFT	0
+#define RPN_MASK	GENMASK(11, 0)
+
+static u32 read_idc(void)
+{
+	void *syscfg = syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
+
+	return readl(syscfg + SYSCFG_IDC_OFFSET);
+}
+
+u32 get_cpu_dev(void)
+{
+	return (read_idc() & SYSCFG_IDC_DEV_ID_MASK) >> SYSCFG_IDC_DEV_ID_SHIFT;
+}
+
+u32 get_cpu_rev(void)
+{
+	return (read_idc() & SYSCFG_IDC_REV_ID_MASK) >> SYSCFG_IDC_REV_ID_SHIFT;
+}
+
+/* Get Device Part Number (RPN) from OTP */
+static u32 get_cpu_rpn(void)
+{
+	return get_otp(BSEC_OTP_RPN, RPN_SHIFT, RPN_MASK);
+}
+
+u32 get_cpu_type(void)
+{
+	return (get_cpu_dev() << 16) | get_cpu_rpn();
+}
+
+void get_soc_name(char name[SOC_NAME_SIZE])
+{
+	char *cpu_s, *cpu_r;
+
+	/* MPUs Part Numbers */
+	switch (get_cpu_type()) {
+	case CPU_STM32MP135Fxx:
+		cpu_s = "135F";
+		break;
+	case CPU_STM32MP135Dxx:
+		cpu_s = "135D";
+		break;
+	case CPU_STM32MP135Cxx:
+		cpu_s = "135C";
+		break;
+	case CPU_STM32MP135Axx:
+		cpu_s = "135A";
+		break;
+	case CPU_STM32MP133Fxx:
+		cpu_s = "133F";
+		break;
+	case CPU_STM32MP133Dxx:
+		cpu_s = "133D";
+		break;
+	case CPU_STM32MP133Cxx:
+		cpu_s = "133C";
+		break;
+	case CPU_STM32MP133Axx:
+		cpu_s = "133A";
+		break;
+	case CPU_STM32MP131Fxx:
+		cpu_s = "131F";
+		break;
+	case CPU_STM32MP131Dxx:
+		cpu_s = "131D";
+		break;
+	case CPU_STM32MP131Cxx:
+		cpu_s = "131C";
+		break;
+	case CPU_STM32MP131Axx:
+		cpu_s = "131A";
+		break;
+	default:
+		cpu_s = "????";
+		break;
+	}
+
+	/* REVISION */
+	switch (get_cpu_rev()) {
+	case CPU_REV1:
+		cpu_r = "A";
+		break;
+	case CPU_REV1_1:
+		cpu_r = "Z";
+		break;
+	default:
+		cpu_r = "?";
+		break;
+	}
+
+	snprintf(name, SOC_NAME_SIZE, "STM32MP%s Rev.%s", cpu_s, cpu_r);
+}
board/st/stm32mp1/Kconfig +15 -0
index 89e97aec2b..6ab8f80fa4 100644
@@ -11,3 +11,18 @@ config SYS_CONFIG_NAME
 
 source "board/st/common/Kconfig"
 endif
+
+if TARGET_ST_STM32MP13x
+
+config SYS_BOARD
+	default "stm32mp1"
+
+config SYS_VENDOR
+	default "st"
+
+config SYS_CONFIG_NAME
+	default "stm32mp13_st_common"
+
+source "board/st/common/Kconfig"
+
+endif
board/st/stm32mp1/MAINTAINERS +2 -0
index d57a49820e..c9252e90f4 100644
@@ -9,5 +9,7 @@ F:	board/st/stm32mp1/
 F:	configs/stm32mp15_defconfig
 F:	configs/stm32mp15_basic_defconfig
 F:	configs/stm32mp15_trusted_defconfig
+F:	include/configs/stm32mp13_common.h
+F:	include/configs/stm32mp13_st_common.h
 F:	include/configs/stm32mp15_common.h
 F:	include/configs/stm32mp15_st_common.h
configs/stm32mp15_basic_defconfig +1 -1
index c325e9c55b..8c3ad2d758 100644
@@ -9,8 +9,8 @@ CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SPL_MMC=y
 CONFIG_SPL=y
 CONFIG_CMD_STM32KEY=y
-CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
+CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_CMD_STM32PROG=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
configs/stm32mp15_defconfig +1 -1
index b25cb2725b..cf05155ec2 100644
@@ -7,8 +7,8 @@ CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
-CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_TYPEC_STUSB160X=y
+CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_ENV_OFFSET_REDUND=0x4C0000
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
configs/stm32mp15_trusted_defconfig +1 -1
index 89e1b8ad86..db47d8b86b 100644
@@ -7,9 +7,9 @@ CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
+CONFIG_TYPEC_STUSB160X=y
 CONFIG_STM32MP15x_STM32IMAGE=y
 CONFIG_TARGET_ST_STM32MP15x=y
-CONFIG_TYPEC_STUSB160X=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
include/configs/stm32mp13_common.h new file +106 -0
new file mode 100644
index 0000000000..acc19f496a
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*
+ * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
+ *
+ * Configuration settings for the STM32MP13x CPU
+ */
+
+#ifndef __CONFIG_STM32MP13_COMMMON_H
+#define __CONFIG_STM32MP13_COMMMON_H
+#include <linux/sizes.h>
+#include <asm/arch/stm32.h>
+
+/*
+ * Configuration of the external SRAM memory used by U-Boot
+ */
+#define CONFIG_SYS_SDRAM_BASE		STM32_DDR_BASE
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_TEXT_BASE + SZ_4M)
+
+/*
+ * Console I/O buffer size
+ */
+#define CONFIG_SYS_CBSIZE		SZ_1K
+
+/*
+ * For booting Linux, use the first 256 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+#define CONFIG_SYS_BOOTMAPSZ		SZ_256M
+
+/* Extend size of kernel image for uncompression */
+#define CONFIG_SYS_BOOTM_LEN		SZ_32M
+
+/*MMC SD*/
+#define CONFIG_SYS_MMC_MAX_DEVICE	2
+
+/* NAND support */
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+
+/*****************************************************************************/
+#ifdef CONFIG_DISTRO_DEFAULTS
+/*****************************************************************************/
+
+#ifdef CONFIG_CMD_MMC
+#define BOOT_TARGET_MMC0(func)	func(MMC, mmc, 0)
+#define BOOT_TARGET_MMC1(func)	func(MMC, mmc, 1)
+#else
+#define BOOT_TARGET_MMC0(func)
+#define BOOT_TARGET_MMC1(func)
+#endif
+
+#define BOOT_TARGET_DEVICES(func)	\
+	BOOT_TARGET_MMC1(func)		\
+	BOOT_TARGET_MMC0(func)
+
+/*
+ * default bootcmd for stm32mp13:
+ * for mmc boot (eMMC, SD card), distro boot on the same mmc device
+ */
+#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
+	"echo \"Boot over ${boot_device}${boot_instance}!\";" \
+		"run env_check;" \
+		"if test ${boot_device} = mmc;" \
+		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
+		"run distro_bootcmd;" \
+	"fi;\0"
+
+#define STM32MP_EXTRA \
+	"env_check=if env info -p -d -q; then env save; fi\0" \
+	"boot_net_usb_start=true\0"
+
+#ifndef STM32MP_BOARD_EXTRA_ENV
+#define STM32MP_BOARD_EXTRA_ENV
+#endif
+
+#include <config_distro_bootcmd.h>
+
+/*
+ * memory layout for 32M uncompressed/compressed kernel,
+ * 1M fdt, 1M script, 1M pxe and 1M for overlay
+ * and the ramdisk at the end.
+ */
+#define __KERNEL_ADDR_R     __stringify(0xc2000000)
+#define __FDT_ADDR_R        __stringify(0xc4000000)
+#define __SCRIPT_ADDR_R     __stringify(0xc4100000)
+#define __PXEFILE_ADDR_R    __stringify(0xc4200000)
+#define __FDTOVERLAY_ADDR_R __stringify(0xc4300000)
+#define __RAMDISK_ADDR_R    __stringify(0xc4400000)
+
+#define STM32MP_MEM_LAYOUT \
+	"kernel_addr_r=" __KERNEL_ADDR_R "\0" \
+	"fdt_addr_r=" __FDT_ADDR_R "\0" \
+	"scriptaddr=" __SCRIPT_ADDR_R "\0" \
+	"pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \
+	"fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \
+	"ramdisk_addr_r=" __RAMDISK_ADDR_R "\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	STM32MP_MEM_LAYOUT \
+	STM32MP_BOOTCMD \
+	BOOTENV \
+	STM32MP_EXTRA \
+	STM32MP_BOARD_EXTRA_ENV
+
+#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
+
+#endif /* __CONFIG_STM32MP13_COMMMON_H */
include/configs/stm32mp13_st_common.h new file +17 -0
new file mode 100644
index 0000000000..ec64b12f7a
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*
+ * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
+ *
+ * Configuration settings for the STMicroelectronics STM32MP13x boards
+ */
+
+#ifndef __CONFIG_STM32MP13_ST_COMMON_H__
+#define __CONFIG_STM32MP13_ST_COMMON_H__
+
+#define STM32MP_BOARD_EXTRA_ENV \
+	"usb_pgood_delay=1000\0" \
+	"console=ttySTM0\0"
+
+#include <configs/stm32mp13_common.h>
+
+#endif
include/configs/stm32mp15_common.h +1 -1
index 6b40cdb017..adfb2898b0 100644
@@ -14,7 +14,7 @@
  * Configuration of the external SRAM memory used by U-Boot
  */
 #define CONFIG_SYS_SDRAM_BASE			STM32_DDR_BASE
-#define CONFIG_SYS_INIT_SP_ADDR			CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_INIT_SP_ADDR		CONFIG_SYS_TEXT_BASE
 
 /*
  * Console I/O buffer size

include/configs/stm32mp15_common.h line 103

Quoted 8 lines
include/configs/stm32mp15_common.h +1 -1
@@ -97,7 +97,7 @@
 	BOOT_TARGET_PXE(func)
 
 /*
- * default bootcmd for stm32mp1:
+ * default bootcmd for stm32mp15:
  * for serial/usb: execute the stm32prog command
  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
  * for nand or spi-nand boot, distro boot with ubifs on UBI partition

Thanks
Patrice

#11 lore raw

PATCH v2 9/16 arm: stm32mp: support 2 MAC address for STM32MP13

In reply to Patrick Delaunay

Add support of several MAC address in OTP (3 32bits OTP word for 2 MAC address) for SOCs in STM32MP13x family: STM32MP133 and STM32MP135.

---

(no changes since v1)

 arch/arm/mach-stm32mp/cpu.c                   | 41 ++++++++++++-------
 .../arm/mach-stm32mp/include/mach/sys_proto.h |  1 +
 arch/arm/mach-stm32mp/stm32mp13x.c            | 20 +++++++++
 arch/arm/mach-stm32mp/stm32mp15x.c            |  5 +++
 4 files changed, 52 insertions(+), 15 deletions(-)
arch/arm/mach-stm32mp/cpu.c +26 -15
index 240960ada4..855fc755fe 100644
@@ -290,16 +290,18 @@ __weak int setup_mac_address(void)
 {
 	int ret;
 	int i;
-	u32 otp[2];
+	u32 otp[3];
 	uchar enetaddr[6];
 	struct udevice *dev;
+	int nb_eth, nb_otp, index;
 
 	if (!IS_ENABLED(CONFIG_NET))
 		return 0;
 
-	/* MAC already in environment */
-	if (eth_env_get_enetaddr("ethaddr", enetaddr))
-		return 0;
+	nb_eth = get_eth_nb();
+
+	/* 6 bytes for each MAC addr and 4 bytes for each OTP */
+	nb_otp = DIV_ROUND_UP(6 * nb_eth, 4);
 
 	ret = uclass_get_device_by_driver(UCLASS_MISC,
 					  DM_DRIVER_GET(stm32mp_bsec),
@@ -307,22 +309,31 @@ __weak int setup_mac_address(void)
 	if (ret)
 		return ret;
 
-	ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC),
-			otp, sizeof(otp));
+	ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp);
 	if (ret < 0)
 		return ret;
 
-	for (i = 0; i < 6; i++)
-		enetaddr[i] = ((uint8_t *)&otp)[i];
+	for (index = 0; index < nb_eth; index++) {
+		/* MAC already in environment */
+		if (eth_env_get_enetaddr_by_index("eth", index, enetaddr))
+			continue;
+
+		for (i = 0; i < 6; i++)
+			enetaddr[i] = ((uint8_t *)&otp)[i + 6 * index];
 
-	if (!is_valid_ethaddr(enetaddr)) {
-		log_err("invalid MAC address in OTP %pM\n", enetaddr);
-		return -EINVAL;
+		if (!is_valid_ethaddr(enetaddr)) {
+			log_err("invalid MAC address %d in OTP %pM\n",
+				index, enetaddr);
+			return -EINVAL;
+		}
+		log_debug("OTP MAC address %d = %pM\n", index, enetaddr);
+		ret = eth_env_set_enetaddr_by_index("eth", index, enetaddr);
+		if (ret) {
+			log_err("Failed to set mac address %pM from OTP: %d\n",
+				enetaddr, ret);
+			return ret;
+		}
 	}
-	log_debug("OTP MAC address = %pM\n", enetaddr);
-	ret = eth_env_set_enetaddr("ethaddr", enetaddr);
-	if (ret)
-		log_err("Failed to set mac address %pM from OTP: %d\n", enetaddr, ret);
 
 	return 0;
 }
arch/arm/mach-stm32mp/include/mach/sys_proto.h +1 -0
index 829b3feebf..4b564e86dc 100644
@@ -64,6 +64,7 @@ void get_soc_name(char name[SOC_NAME_SIZE]);
 /* return boot mode */
 u32 get_bootmode(void);
 
+int get_eth_nb(void);
 int setup_mac_address(void);
 
 /* board power management : configure vddcore according OPP */
arch/arm/mach-stm32mp/stm32mp13x.c +20 -0
index d5e3a787c2..bd3f24c349 100644
@@ -51,6 +51,26 @@ u32 get_cpu_type(void)
 	return (get_cpu_dev() << 16) | get_cpu_rpn();
 }
 
+int get_eth_nb(void)
+{
+	int nb_eth = 2;
+
+	switch (get_cpu_type()) {
+	case CPU_STM32MP131Dxx:
+		fallthrough;
+	case CPU_STM32MP131Cxx:
+		fallthrough;
+	case CPU_STM32MP131Axx:
+		nb_eth = 1;
+		break;
+	default:
+		nb_eth = 2;
+		break;
+	}
+
+	return nb_eth;
+}
+
 void get_soc_name(char name[SOC_NAME_SIZE])
 {
 	char *cpu_s, *cpu_r;
arch/arm/mach-stm32mp/stm32mp15x.c +5 -0
index 800fad2f43..a093e6163e 100644
@@ -247,6 +247,11 @@ u32 get_cpu_type(void)
 	return (get_cpu_dev() << 16) | get_cpu_rpn();
 }
 
+int get_eth_nb(void)
+{
+	return 1;
+}
+
 /* Get Package options from OTP */
 u32 get_cpu_package(void)
 {
Signature · 1 line
2.25.1
#12 lore raw

PATCH v2 10/16 pinctrl: stm32: add support of STM32MP135

In reply to Patrick Delaunay

Add support for "st,stm32mp135-pinctrl" for STM32MP13x

---

(no changes since v1)

 drivers/pinctrl/pinctrl_stm32.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl_stm32.c +1 -0
index 56a20e8bd2..990cd19286 100644
@@ -488,6 +488,7 @@ static const struct udevice_id stm32_pinctrl_ids[] = {
 	{ .compatible = "st,stm32h743-pinctrl" },
 	{ .compatible = "st,stm32mp157-pinctrl" },
 	{ .compatible = "st,stm32mp157-z-pinctrl" },
+	{ .compatible = "st,stm32mp135-pinctrl" },
 	{ }
 };
 
Signature · 1 line
2.25.1
#13 lore raw

PATCH v2 11/16 board: stm32pm1: add stm32mp13 board support

In reply to Patrick Delaunay

Add stm32mp15x prefix to all STM32MP15x board specific functions, this patch is a preliminary step for STM32MP13x support.

This patch also adds the RCC probe to avoid circular access with usbphyc probe as clk provider.

---

Changes in v2:
- fix typo in commit message

 board/st/stm32mp1/stm32mp1.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
board/st/stm32mp1/stm32mp1.c +18 -9
index 07b1a63db7..6f5ff423fe 100644
@@ -554,8 +554,7 @@ static void sysconf_init(void)
 	clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
 }
 
-/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
-static int dk2_i2c1_fix(void)
+static int board_stm32mp15x_dk2_init(void)
 {
 	ofnode node;
 	struct gpio_desc hdmi, audio;
@@ -564,6 +563,7 @@ static int dk2_i2c1_fix(void)
 	if (!IS_ENABLED(CONFIG_DM_REGULATOR))
 		return -ENODEV;
 
+	/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
 	node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
 	if (!ofnode_valid(node)) {
 		log_debug("no hdmi-transmitter@39 ?\n");
@@ -611,7 +611,7 @@ error:
 	return ret;
 }
 
-static bool board_is_dk2(void)
+static bool board_is_stm32mp15x_dk2(void)
 {
 	if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
 	    of_machine_is_compatible("st,stm32mp157c-dk2"))
@@ -620,7 +620,7 @@ static bool board_is_dk2(void)
 	return false;
 }
 
-static bool board_is_ev1(void)
+static bool board_is_stm32mp15x_ev1(void)
 {
 	if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
 	    (of_machine_is_compatible("st,stm32mp157a-ev1") ||
@@ -644,7 +644,7 @@ U_BOOT_DRIVER(goodix) = {
 	.of_match	= goodix_ids,
 };
 
-static void board_ev1_init(void)
+static void board_stm32mp15x_ev1_init(void)
 {
 	struct udevice *dev;
 
@@ -655,13 +655,22 @@ static void board_ev1_init(void)
 /* board dependent setup after realloc */
 int board_init(void)
 {
+	struct udevice *dev;
+	int ret;
+
+	/* probe RCC to avoid circular access with usbphyc probe as clk provider */
+	if (IS_ENABLED(CONFIG_CLK_STM32MP13)) {
+		ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(stm32mp1_clock), &dev);
+		log_debug("Clock init failed: %d\n", ret);
+	}
+
 	board_key_check();
 
-	if (board_is_ev1())
-		board_ev1_init();
+	if (board_is_stm32mp15x_ev1())
+		board_stm32mp15x_ev1_init();
 
-	if (board_is_dk2())
-		dk2_i2c1_fix();
+	if (board_is_stm32mp15x_dk2())
+		board_stm32mp15x_dk2_init();
 
 	if (IS_ENABLED(CONFIG_DM_REGULATOR))
 		regulators_enable_boot_on(_DEBUG);
Signature · 1 line
2.25.1
Reviewed-by on v2 11/16
#14 lore raw

Re: [PATCH v2 11/16] board: stm32pm1: add stm32mp13 board support

Hi Patrick

Quoted 81 lines · Patrick Delaunay

Add stm32mp15x prefix to all STM32MP15x board specific functions, this patch is a preliminary step for STM32MP13x support.

This patch also adds the RCC probe to avoid circular access with usbphyc probe as clk provider.

---

Changes in v2:
- fix typo in commit message

 board/st/stm32mp1/stm32mp1.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
board/st/stm32mp1/stm32mp1.c +14 -7
index 07b1a63db7..6f5ff423fe 100644
@@ -554,8 +554,7 @@ static void sysconf_init(void)
 	clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
 }
 
-/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
-static int dk2_i2c1_fix(void)
+static int board_stm32mp15x_dk2_init(void)
 {
 	ofnode node;
 	struct gpio_desc hdmi, audio;
@@ -564,6 +563,7 @@ static int dk2_i2c1_fix(void)
 	if (!IS_ENABLED(CONFIG_DM_REGULATOR))
 		return -ENODEV;
 
+	/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
 	node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
 	if (!ofnode_valid(node)) {
 		log_debug("no hdmi-transmitter@39 ?\n");
@@ -611,7 +611,7 @@ error:
 	return ret;
 }
 
-static bool board_is_dk2(void)
+static bool board_is_stm32mp15x_dk2(void)
 {
 	if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
 	    of_machine_is_compatible("st,stm32mp157c-dk2"))
@@ -620,7 +620,7 @@ static bool board_is_dk2(void)
 	return false;
 }
 
-static bool board_is_ev1(void)
+static bool board_is_stm32mp15x_ev1(void)
 {
 	if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
 	    (of_machine_is_compatible("st,stm32mp157a-ev1") ||
@@ -644,7 +644,7 @@ U_BOOT_DRIVER(goodix) = {
 	.of_match	= goodix_ids,
 };
 
-static void board_ev1_init(void)
+static void board_stm32mp15x_ev1_init(void)
 {
 	struct udevice *dev;
 
@@ -655,13 +655,22 @@ static void board_ev1_init(void)
 /* board dependent setup after realloc */
 int board_init(void)
 {
+	struct udevice *dev;
+	int ret;
+
+	/* probe RCC to avoid circular access with usbphyc probe as clk provider */
+	if (IS_ENABLED(CONFIG_CLK_STM32MP13)) {
+		ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(stm32mp1_clock), &dev);
+		log_debug("Clock init failed: %d\n", ret);
+	}
+
 	board_key_check();
 
-	if (board_is_ev1())
-		board_ev1_init();

board/st/stm32mp1/stm32mp1.c static void board_ev1_init(void) · line 676

Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +4 -2
+	if (board_is_stm32mp15x_ev1())
+		board_stm32mp15x_ev1_init();
 
-	if (board_is_dk2())
-		dk2_i2c1_fix();
+	if (board_is_stm32mp15x_dk2())
+		board_stm32mp15x_dk2_init();
 
 	if (IS_ENABLED(CONFIG_DM_REGULATOR))
 		regulators_enable_boot_on(_DEBUG);

Thanks
Patrice

#15 lore raw

PATCH v2 12/16 ram: stm32mp1: add support of STM32MP13x

In reply to Patrick Delaunay

Add support for new compatible "st,stm32mp13-ddr" to manage the DDR sub system (Controller and PHY) in STM32MP13x SOC:
- only one AXI port
- support of 16 port output (MEMC_DRAM_DATA_WIDTH = 2)

The STM32MP15x SOC have 2 AXI ports and 32 bits support.

---

(no changes since v1)

 .../memory-controllers/st,stm32mp1-ddr.txt    | 49 +++++++++++++++----
 drivers/ram/stm32mp1/stm32mp1_ram.c           | 28 +++++++----
 2 files changed, 57 insertions(+), 20 deletions(-)
doc/device-tree-bindings/memory-controllers/st,stm32mp1-ddr.txt +39 -10
index 926e3e83b3..e6ea8d0ef5 100644
@@ -3,7 +3,8 @@ ST,stm32mp1 DDR3/LPDDR2/LPDDR3 Controller (DDRCTRL and DDRPHYC)
 --------------------
 Required properties:
 --------------------
-- compatible	: Should be "st,stm32mp1-ddr"
+- compatible	: Should be "st,stm32mp1-ddr" for STM32MP15x
+		  Should be "st,stm32mp13-ddr" for STM32MP13x
 - reg		: controleur (DDRCTRL) and phy (DDRPHYC) base address
 - clocks	: controller clocks handle
 - clock-names	: associated controller clock names
@@ -13,6 +14,8 @@ Required properties:
 the next attributes are DDR parameters, they are generated by DDR tools
 included in STM32 Cube tool
 
+They are required only in SPL, when TFABOOT is not activated.
+
 info attributes:
 ----------------
 - st,mem-name	: name for DDR configuration, simple string for information
@@ -24,7 +27,7 @@ controlleur attributes:
 -----------------------
 - st,ctl-reg	: controleur values depending of the DDR type
 		  (DDR3/LPDDR2/LPDDR3)
-	for STM32MP15x: 25 values are requested in this order
+	for STM32MP15x and STM32MP13x: 25 values are requested in this order
 		MSTR
 		MRCTRL0
 		MRCTRL1
@@ -53,7 +56,7 @@ controlleur attributes:
 
 - st,ctl-timing	: controleur values depending of frequency and timing parameter
 		  of DDR
-	for STM32MP15x: 12 values are requested in this order
+	for STM32MP15x and STM32MP13x: 12 values are requested in this order
 		RFSHTMG
 		DRAMTMG0
 		DRAMTMG1
@@ -68,7 +71,7 @@ controlleur attributes:
 		ODTCFG
 
 - st,ctl-map	: controleur values depending of address mapping
-	for STM32MP15x: 9 values are requested in this order
+	for STM32MP15x and STM32MP13x: 9 values are requested in this order
 		ADDRMAP1
 		ADDRMAP2
 		ADDRMAP3
@@ -99,6 +102,19 @@ controlleur attributes:
 		PCFGWQOS0_1
 		PCFGWQOS1_1
 
+	for STM32MP13x: 11 values are requested in this order
+		SCHED
+		SCHED1
+		PERFHPR1
+		PERFLPR1
+		PERFWR1
+		PCFGR_0
+		PCFGW_0
+		PCFGQOS0_0
+		PCFGQOS1_0
+		PCFGWQOS0_0
+		PCFGWQOS1_0
+
 phyc attributes:
 ----------------
 - st,phy-reg	: phy values depending of the DDR type (DDR3/LPDDR2/LPDDR3)
@@ -115,8 +131,19 @@ phyc attributes:
 		DX2GCR
 		DX3GCR
 
+	for STM32MP13x: 9 values are requested in this order
+		PGCR
+		ACIOCR
+		DXCCR
+		DSGCR
+		DCR
+		ODTCR
+		ZQ0CR1
+		DX0GCR
+		DX1GCR
+
 - st,phy-timing	: phy values depending of frequency and timing parameter of DDR
-	for STM32MP15x: 10 values are requested in this order
+	for STM32MP15x and STM32MP13x: 10 values are requested in this order
 		PTR0
 		PTR1
 		PTR2
@@ -128,16 +155,18 @@ phyc attributes:
 		MR2
 		MR3
 
+	for STM32MP13x: 6 values are requested in this order
+		DX0DLLCR
+		DX0DQTR
+		DX0DQSTR
+		DX1DLLCR
+		DX1DQTR
+		DX1DQSTR
 Example:
 
 / {
 	soc {
-		u-boot,dm-spl;
-
 		ddr: ddr@0x5A003000{
-			u-boot,dm-spl;
-			u-boot,dm-pre-reloc;
-
 			compatible = "st,stm32mp1-ddr";
 
 			reg = <0x5A003000 0x550
drivers/ram/stm32mp1/stm32mp1_ram.c +18 -10
index 49b1262461..a6c19af972 100644
@@ -230,29 +230,29 @@ static u8 get_nb_col(struct stm32mp1_ddrctl *ctl, u8 data_bus_width)
 
 	reg = readl(&ctl->addrmap3);
 	/* addrmap3.addrmap_col_b6 */
-	val = (reg & GENMASK(3, 0)) >> 0;
+	val = (reg & GENMASK(4, 0)) >> 0;
 	if (val <= 7)
 		bits++;
 	/* addrmap3.addrmap_col_b7 */
-	val = (reg & GENMASK(11, 8)) >> 8;
+	val = (reg & GENMASK(12, 8)) >> 8;
 	if (val <= 7)
 		bits++;
 	/* addrmap3.addrmap_col_b8 */
-	val = (reg & GENMASK(19, 16)) >> 16;
+	val = (reg & GENMASK(20, 16)) >> 16;
 	if (val <= 7)
 		bits++;
 	/* addrmap3.addrmap_col_b9 */
-	val = (reg & GENMASK(27, 24)) >> 24;
+	val = (reg & GENMASK(28, 24)) >> 24;
 	if (val <= 7)
 		bits++;
 
 	reg = readl(&ctl->addrmap4);
 	/* addrmap4.addrmap_col_b10 */
-	val = (reg & GENMASK(3, 0)) >> 0;
+	val = (reg & GENMASK(4, 0)) >> 0;
 	if (val <= 7)
 		bits++;
 	/* addrmap4.addrmap_col_b11 */
-	val = (reg & GENMASK(11, 8)) >> 8;
+	val = (reg & GENMASK(12, 8)) >> 8;
 	if (val <= 7)
 		bits++;
 
@@ -296,21 +296,24 @@ static u8 get_nb_row(struct stm32mp1_ddrctl *ctl)
 	reg = readl(&ctl->addrmap6);
 	/* addrmap6.addrmap_row_b12 */
 	val = (reg & GENMASK(3, 0)) >> 0;
-	if (val <= 7)
+	if (val <= 11)
 		bits++;
 	/* addrmap6.addrmap_row_b13 */
 	val = (reg & GENMASK(11, 8)) >> 8;
-	if (val <= 7)
+	if (val <= 11)
 		bits++;
 	/* addrmap6.addrmap_row_b14 */
 	val = (reg & GENMASK(19, 16)) >> 16;
-	if (val <= 7)
+	if (val <= 11)
 		bits++;
 	/* addrmap6.addrmap_row_b15 */
 	val = (reg & GENMASK(27, 24)) >> 24;
-	if (val <= 7)
+	if (val <= 11)
 		bits++;
 
+	if (reg & BIT(31))
+		printf("warning: LPDDR3_6GB_12GB is not supported\n");
+
 	return bits;
 }
 
@@ -392,12 +395,17 @@ static struct ram_ops stm32mp1_ddr_ops = {
 	.get_info = stm32mp1_ddr_get_info,
 };
 
+static const struct stm32mp1_ddr_cfg stm32mp13x_ddr_cfg = {
+	.nb_bytes = 2,
+};
+
 static const struct stm32mp1_ddr_cfg stm32mp15x_ddr_cfg = {
 	.nb_bytes = 4,
 };
 
 static const struct udevice_id stm32mp1_ddr_ids[] = {
 	{ .compatible = "st,stm32mp1-ddr", .data = (ulong)&stm32mp15x_ddr_cfg},
+	{ .compatible = "st,stm32mp13-ddr", .data = (ulong)&stm32mp13x_ddr_cfg},
 	{ }
 };
 
Signature · 1 line
2.25.1
#16 lore raw

PATCH v2 13/16 mmc: stm32_sdmmc2: make reset property optional

In reply to Patrick Delaunay

Although not recommended, the reset property could be made optional. This way the driver will probe even if no reset property is provided in an sdmmc node in DT. This reset is already optional in Linux.

---

(no changes since v1)

 drivers/mmc/stm32_sdmmc2.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/mmc/stm32_sdmmc2.c +7 -7
index 44bfc911af..81b07609a9 100644
@@ -514,10 +514,12 @@ retry_cmd:
  */
 static void stm32_sdmmc2_reset(struct stm32_sdmmc2_priv *priv)
 {
-	/* Reset */
-	reset_assert(&priv->reset_ctl);
-	udelay(2);
-	reset_deassert(&priv->reset_ctl);
+	if (reset_valid(&priv->reset_ctl)) {
+		/* Reset */
+		reset_assert(&priv->reset_ctl);
+		udelay(2);
+		reset_deassert(&priv->reset_ctl);
+	}
 
 	/* init the needed SDMMC register after reset */
 	writel(priv->pwr_reg_msk, priv->base + SDMMC_POWER);
@@ -735,7 +737,7 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
 
 	ret = reset_get_by_index(dev, 0, &priv->reset_ctl);
 	if (ret)
-		goto clk_disable;
+		dev_dbg(dev, "No reset provided\n");
 
 	gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio,
 			     GPIOD_IS_IN);
@@ -755,8 +757,6 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
 	stm32_sdmmc2_reset(priv);
 	return 0;
 
-clk_disable:
-	clk_disable(&priv->clk);
 clk_free:
 	clk_free(&priv->clk);
 
Signature · 1 line
2.25.1
#17 lore raw

PATCH v2 14/16 arm: dts: stm32mp: add stm32mp13 device tree for U-Boot

In reply to Patrick Delaunay

Compile the device tree of STM32MP13x boards and add the needed U-Boot add-on.

---

(no changes since v1)

 arch/arm/dts/Makefile                   |  3 +
 arch/arm/dts/stm32mp13-u-boot.dtsi      | 91 +++++++++++++++++++++++++
 arch/arm/dts/stm32mp135f-dk-u-boot.dtsi | 30 ++++++++
 3 files changed, 124 insertions(+)
 create mode 100644 arch/arm/dts/stm32mp13-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp135f-dk-u-boot.dtsi
arch/arm/dts/Makefile +3 -0
index 83630af4f6..6dd87ee663 100644
@@ -1137,6 +1137,9 @@ dtb-$(CONFIG_ASPEED_AST2600) += ast2600-evb.dtb
 
 dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
 
+dtb-$(CONFIG_STM32MP13x) += \
+	stm32mp135f-dk.dtb
+
 dtb-$(CONFIG_STM32MP15x) += \
 	stm32mp157a-dk1.dtb \
 	stm32mp157a-icore-stm32mp1-ctouch2.dtb \
arch/arm/dts/stm32mp13-u-boot.dtsi new file +91 -0

91 lines not on this page · raw message

arch/arm/dts/stm32mp135f-dk-u-boot.dtsi new file +30 -0
new file mode 100644
index 0000000000..dfe5bbb2e3
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
+/*
+ * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
+ */
+
+#include "stm32mp13-u-boot.dtsi"
+
+/ {
+	aliases {
+		mmc0 = &sdmmc1;
+	};
+
+	config {
+		u-boot,mmc-env-partition = "u-boot-env";
+	};
+};
+
+&uart4 {
+	u-boot,dm-pre-reloc;
+};
+
+&uart4_pins_a {
+	u-boot,dm-pre-reloc;
+	pins1 {
+		u-boot,dm-pre-reloc;
+	};
+	pins2 {
+		u-boot,dm-pre-reloc;
+	};
+};
Signature · 1 line
2.25.1
#18 lore raw

PATCH v2 15/16 configs: add stm32mp13 defconfig

In reply to Patrick Delaunay

Add a initial config for STM32M13x SOC family, using the stm32mp135f-dk device tree.

---

(no changes since v1)

 board/st/stm32mp1/MAINTAINERS |  1 +
 configs/stm32mp13_defconfig   | 54 +++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 configs/stm32mp13_defconfig
board/st/stm32mp1/MAINTAINERS +1 -0
index c9252e90f4..d5a09cdc39 100644
@@ -6,6 +6,7 @@ S:	Maintained
 F:	arch/arm/dts/stm32mp13*
 F:	arch/arm/dts/stm32mp15*
 F:	board/st/stm32mp1/
+F:	configs/stm32mp13_defconfig
 F:	configs/stm32mp15_defconfig
 F:	configs/stm32mp15_basic_defconfig
 F:	configs/stm32mp15_trusted_defconfig
configs/stm32mp13_defconfig new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
2.25.1
#19 lore raw

PATCH v2 16/16 doc: st: stm32mp1: add STM32MP13x support

In reply to Patrick Delaunay

Add in U-Boot documentation the quick instruction to setup the STMicroelectronics STM32MP13x boards.

---

Changes in v2:
- fix typo error in commit message and in rst file

 doc/board/st/stm32mp1.rst | 183 ++++++++++++++++++++++++++------------
 1 file changed, 126 insertions(+), 57 deletions(-)
doc/board/st/stm32mp1.rst +126 -57
index 0c5d3a90f0..00f9b45442 100644
@@ -1,41 +1,31 @@
 .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
 .. sectionauthor:: Patrick Delaunay <[email protected]>
 
-STM32MP15x boards
+STM32MP1xx boards
 =================
 
-This is a quick instruction for setup STM32MP15x boards.
+This is a quick instruction for setup STMicroelectronics STM32MP1xx boards.
 
-Futher information can be found in STMicrolectronics STM32 WIKI_.
+Further information can be found in STMicroelectronics STM32 WIKI_.
 
 Supported devices
 -----------------
 
-U-Boot supports STMP32MP15x SoCs:
+U-Boot supports all the STMicroelectronics MPU with the associated boards
 
- - STM32MP157
- - STM32MP153
- - STM32MP151
+ - STMP32MP15x SoCs:
 
-The STM32MP15x is a Cortex-A MPU aimed at various applications.
+  - STM32MP157
+  - STM32MP153
+  - STM32MP151
 
-It features:
-
- - Dual core Cortex-A7 application core (Single on STM32MP151)
- - 2D/3D image composition with GPU (only on STM32MP157)
- - Standard memories interface support
- - Standard connectivity, widely inherited from the STM32 MCU family
- - Comprehensive security support
+ - STMP32MP13x SoCs:
 
-Each line comes with a security option (cryptography & secure boot) and
-a Cortex-A frequency option:
-
- - A : Cortex-A7 @ 650 MHz
- - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
- - D : Cortex-A7 @ 800 MHz
- - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
+  - STM32MP135
+  - STM32MP133
+  - STM32MP131
 
-Everything is supported in Linux but U-Boot is limited to:
+Everything is supported in Linux but U-Boot is limited to the boot device:
 
  1. UART
  2. SD card/MMC controller (SDMMC)
@@ -49,7 +39,35 @@ And the necessary drivers
  1. I2C
  2. STPMIC1 (PMIC and regulator)
  3. Clock, Reset, Sysreset
- 4. Fuse
+ 4. Fuse (BSEC)
+ 5. OP-TEE
+ 6. ETH
+ 7. USB host
+ 8. WATCHDOG
+ 9. RNG
+ 10. RTC
+
+STM32MP15x
+``````````
+
+The STM32MP15x is a Cortex-A7 MPU aimed at various applications.
+
+It features:
+
+ - Dual core Cortex-A7 application core (Single on STM32MP151)
+ - 2D/3D image composition with GPU (only on STM32MP157)
+ - Standard memories interface support
+ - Standard connectivity, widely inherited from the STM32 MCU family
+ - Comprehensive security support
+ - Cortex M4 coprocessor
+
+Each line comes with a security option (cryptography & secure boot) and
+a Cortex-A frequency option:
+
+ - A : Cortex-A7 @ 650 MHz
+ - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
+ - D : Cortex-A7 @ 800 MHz
+ - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
 
 Currently the following boards are supported:
 
@@ -59,6 +77,16 @@ Currently the following boards are supported:
  + stm32mp157c-ev1.dts
  + stm32mp15xx-dhcor-avenger96.dts
 
+STM32MP13x
+``````````
+
+The STM32MP13x is a single Cortex-A7 MPU aimed at various applications.
+
+Currently the following boards are supported:
+
+ + stm32mp135f-dk.dts
+
+
 Boot Sequences
 --------------
 
@@ -71,12 +99,22 @@ Boot Sequences
 +          +------------------------+-------------------------+--------------+
 |          | embedded RAM           | DDR                                    |
 +----------+------------------------+-------------------------+--------------+
+| TrustZone|                         secure monitor                          |
++----------+------------------------+-------------------------+--------------+
+
+The trusted boot chain is recommended with:
+
+- FSBL = **TF-A BL2**
+- Secure monitor = **OP-TEE**
+- SSBL = **U-Boot**
+
+It is the only supported boot chain for STM32MP13x family.
 
 The **Trusted** boot chain with TF-A_
 `````````````````````````````````````
 
 defconfig_file :
-   + **stm32mp15_defconfig** (for TF-A_ with FIP support)
+   + **stm32mp15_defconfig**  and **stm32mp13_defconfig** (for TF-A_ with FIP support)
    + **stm32mp15_trusted_defconfig** (for TF-A_ without FIP support)
 
     +-------------+--------------------------+------------+-------+
@@ -98,8 +136,8 @@ TF-A_ (BL2) initialize the DDR and loads the next stage binaries from a FIP file
      the secure monitor to access to secure resources.
    + HW_CONFIG: The hardware configuration file = the U-Boot device tree
 
-The **Basic** boot chain with SPL
-`````````````````````````````````
+The **Basic** boot chain with SPL (for STM32MP15x)
+``````````````````````````````````````````````````
 
 defconfig_file :
    + **stm32mp15_basic_defconfig**
@@ -117,16 +155,19 @@ SPL has limited security initialization.
 U-Boot is running in secure mode and provide a secure monitor to the kernel
 with only PSCI support (Power State Coordination Interface defined by ARM).
 
-All the STM32MP15x boards supported by U-Boot use the same generic board
-stm32mp1 which support all the bootable devices.
+.. warning:: This alternate **basic** boot chain with SPL is not supported/promoted by STMicroelectronics to make product.
+
+Device Tree
+-----------
 
-Each board is configured only with the associated device tree.
+All the STM32MP15x and STM32MP13x boards supported by U-Boot use the same generic board
+stm32mp1 which supports all the bootable devices.
 
-Device Tree Selection
----------------------
+Each STMicroelectronics board is only configured with the associated device tree.
 
-You need to select the appropriate device tree for your board,
-the supported device trees for STM32MP15x are:
+STM32MP15x device Tree Selection
+````````````````````````````````
+The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig and stm32mp15_basic_defconfig) are:
 
 + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
 
@@ -148,6 +189,15 @@ the supported device trees for STM32MP15x are:
 
    + stm32mp15xx-dhcor-avenger96
 
+STM32MP13x device Tree Selection
+````````````````````````````````
+The supported device trees for STM32MP13x (stm32mp13_defconfig) are:
+
++ dk: Discovery board
+
+   + stm32mp135f-dk
+
+
 Build Procedure
 ---------------
 
@@ -170,6 +220,7 @@ Build Procedure
 
    for example: use one output directory for each configuration::
 
+   # export KBUILD_OUTPUT=stm32mp13
    # export KBUILD_OUTPUT=stm32mp15
    # export KBUILD_OUTPUT=stm32mp15_trusted
    # export KBUILD_OUTPUT=stm32mp15_basic
@@ -184,9 +235,10 @@ Build Procedure
 
    with <defconfig_file>:
 
-   - For **trusted** boot mode : **stm32mp15_defconfig** or
-     stm32mp15_trusted_defconfig
-   - For basic boot mode: stm32mp15_basic_defconfig
+   - For **trusted** boot mode :
+     - For STM32MP13x: **stm32mp13_defconfig**
+     - For STM32MP15x: **stm32mp15_defconfig** or stm32mp15_trusted_defconfig
+   - For STM32MP15x basic boot mode: stm32mp15_basic_defconfig
 
 5. Configure the device-tree and build the U-Boot image::
 
@@ -194,37 +246,42 @@ Build Procedure
 
    Examples:
 
-  a) trusted boot with FIP on ev1::
+  a) trusted boot with FIP on STM32MP15x ev1::
 
      # export KBUILD_OUTPUT=stm32mp15
      # make stm32mp15_defconfig
      # make DEVICE_TREE=stm32mp157c-ev1 all
 
-  b) trusted boot without FIP on dk2::
+  b) trusted boot on STM32MP13x discovery board::
 
-      # export KBUILD_OUTPUT=stm32mp15_trusted
-      # make stm32mp15_trusted_defconfig
-      # make DEVICE_TREE=stm32mp157c-dk2 all
+     # export KBUILD_OUTPUT=stm32mp13
+     # make stm32mp13_defconfig
+     # make DEVICE_TREE=stm32mp135f-dk all
 
-  c) basic boot on ev1::
+    DEVICE_TEE selection is optional as stm32mp135f-dk is the default board of the defconfig::
+
+     # make stm32mp13_defconfig
+     # make all
+
+  c) basic boot on STM32MP15x ev1::
 
       # export KBUILD_OUTPUT=stm32mp15_basic
       # make stm32mp15_basic_defconfig
       # make DEVICE_TREE=stm32mp157c-ev1 all
 
-  d) basic boot on ed1::
+  d) basic boot on STM32MP15x ed1::
 
       # export KBUILD_OUTPUT=stm32mp15_basic
       # make stm32mp15_basic_defconfig
       # make DEVICE_TREE=stm32mp157c-ed1 all
 
-  e) basic boot on dk1::
+  e) basic boot on STM32MP15x dk1::
 
      # export KBUILD_OUTPUT=stm32mp15_basic
      # make stm32mp15_basic_defconfig
      # make DEVICE_TREE=stm32mp157a-dk1 all
 
-  f) basic boot on avenger96::
+  f) basic boot on STM32MP15x avenger96::
 
      # export KBUILD_OUTPUT=stm32mp15_basic
      # make stm32mp15_basic_defconfig
@@ -235,6 +292,7 @@ Build Procedure
    So in the output directory (selected by KBUILD_OUTPUT),
    you can found the needed U-Boot files:
 
+     - stm32mp13_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb**
      - stm32mp15_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb**
 
      - stm32mp15_trusted_defconfig = u-boot.stm32
@@ -325,9 +383,9 @@ the boot pin values = BOOT0, BOOT1, BOOT2
   | SPI-NAND    |  1      |  1      |  1      |
   +-------------+---------+---------+---------+
 
-- on the **daugther board ed1 = MB1263** with the switch SW1
-- on **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
-- on board **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
+- on the STM32MP15x **daughter board ed1 = MB1263** with the switch SW1
+- on STM32MP15x **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
+- on board STM32MP15x **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
   with only 2 pins available (BOOT1 is forced to 0 and NOR not supported),
   the possible value becomes:
 
@@ -355,7 +413,7 @@ The communication between HOST and board is based on
 Prepare an SD card
 ------------------
 
-The minimal requirements for STMP32MP15x boot up to U-Boot are:
+The minimal requirements for STMP32MP15x and STM32MP13x boot up to U-Boot are:
 
 - GPT partitioning (with gdisk or with sgdisk)
 - 2 fsbl partitions, named "fsbl1" and "fsbl2", size at least 256KiB
@@ -511,14 +569,25 @@ MAC Address
 Please read doc/README.enetaddr for the implementation guidelines for mac id
 usage. Basically, environment has precedence over board specific storage.
 
-For STMicroelectonics board, it is retrieved in STM32MP15x OTP :
+For STMicroelectronics board, it is retrieved in:
+
+ - STM32MP15x OTP:
 
- - OTP_57[31:0] = MAC_ADDR[31:0]
- - OTP_58[15:0] = MAC_ADDR[47:32]
+   - OTP_57[31:0] = MAC_ADDR[31:0]
+   - OTP_58[15:0] = MAC_ADDR[47:32]
 
-To program a MAC address on virgin OTP words above, you can use the fuse command
+ - STM32MP13x OTP:
+
+  - OTP_57[31:0]  = MAC_ADDR0[31:0]
+  - OTP_58[15:0]  = MAC_ADDR0[47:32]
+  - OTP_58[31:16] = MAC_ADDR1[15:0]
+  - OTP_59[31:0]  = MAC_ADDR1[47:16]
+
+To program a MAC address on virgin STM32MP15x OTP words above, you can use the fuse command
 on bank 0 to access to internal OTP and lock them:
 
+In the next example we are using the 2 OTPs used on STM32MP15x.
+
 Prerequisite: check if a MAC address isn't yet programmed in OTP
 
 1) check OTP: their value must be equal to 0::
@@ -571,8 +640,8 @@ Example to set mac address "12:34:56:78:9a:bc"
              OTP are protected. It is already done for the board
              provided by STMicroelectronics.
 
-Coprocessor firmware
---------------------
+Coprocessor firmware on STM32MP15x
+----------------------------------
 
 U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
 
@@ -678,7 +747,7 @@ All the supported device are exported for dfu-util tool::
 
 You can update the boot device:
 
-- SD card (mmc0) ::
+- SD card (mmc0)::
 
   $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1.stm32
   $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1.stm32
Signature · 1 line
2.25.1
Reviewed-by on v2 16/16
#20 lore raw

Re: [PATCH v2 16/16] doc: st: stm32mp1: add STM32MP13x support

Hi Patrick

Quoted 349 lines · Patrick Delaunay

Add in U-Boot documentation the quick instruction to setup the STMicroelectronics STM32MP13x boards.

---

Changes in v2:
- fix typo error in commit message and in rst file

 doc/board/st/stm32mp1.rst | 183 ++++++++++++++++++++++++++------------
 1 file changed, 126 insertions(+), 57 deletions(-)
doc/board/st/stm32mp1.rst +125 -56
index 0c5d3a90f0..00f9b45442 100644
@@ -1,41 +1,31 @@
 .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
 .. sectionauthor:: Patrick Delaunay <[email protected]>
 
-STM32MP15x boards
+STM32MP1xx boards
 =================
 
-This is a quick instruction for setup STM32MP15x boards.
+This is a quick instruction for setup STMicroelectronics STM32MP1xx boards.
 
-Futher information can be found in STMicrolectronics STM32 WIKI_.
+Further information can be found in STMicroelectronics STM32 WIKI_.
 
 Supported devices
 -----------------
 
-U-Boot supports STMP32MP15x SoCs:
+U-Boot supports all the STMicroelectronics MPU with the associated boards
 
- - STM32MP157
- - STM32MP153
- - STM32MP151
+ - STMP32MP15x SoCs:
 
-The STM32MP15x is a Cortex-A MPU aimed at various applications.
+  - STM32MP157
+  - STM32MP153
+  - STM32MP151
 
-It features:
-
- - Dual core Cortex-A7 application core (Single on STM32MP151)
- - 2D/3D image composition with GPU (only on STM32MP157)
- - Standard memories interface support
- - Standard connectivity, widely inherited from the STM32 MCU family
- - Comprehensive security support
+ - STMP32MP13x SoCs:
 
-Each line comes with a security option (cryptography & secure boot) and
-a Cortex-A frequency option:
-
- - A : Cortex-A7 @ 650 MHz
- - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
- - D : Cortex-A7 @ 800 MHz
- - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
+  - STM32MP135
+  - STM32MP133
+  - STM32MP131
 
-Everything is supported in Linux but U-Boot is limited to:
+Everything is supported in Linux but U-Boot is limited to the boot device:
 
  1. UART
  2. SD card/MMC controller (SDMMC)
@@ -49,7 +39,35 @@ And the necessary drivers
  1. I2C
  2. STPMIC1 (PMIC and regulator)
  3. Clock, Reset, Sysreset
- 4. Fuse
+ 4. Fuse (BSEC)
+ 5. OP-TEE
+ 6. ETH
+ 7. USB host
+ 8. WATCHDOG
+ 9. RNG
+ 10. RTC
+
+STM32MP15x
+``````````
+
+The STM32MP15x is a Cortex-A7 MPU aimed at various applications.
+
+It features:
+
+ - Dual core Cortex-A7 application core (Single on STM32MP151)
+ - 2D/3D image composition with GPU (only on STM32MP157)
+ - Standard memories interface support
+ - Standard connectivity, widely inherited from the STM32 MCU family
+ - Comprehensive security support
+ - Cortex M4 coprocessor
+
+Each line comes with a security option (cryptography & secure boot) and
+a Cortex-A frequency option:
+
+ - A : Cortex-A7 @ 650 MHz
+ - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
+ - D : Cortex-A7 @ 800 MHz
+ - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
 
 Currently the following boards are supported:
 
@@ -59,6 +77,16 @@ Currently the following boards are supported:
  + stm32mp157c-ev1.dts
  + stm32mp15xx-dhcor-avenger96.dts
 
+STM32MP13x
+``````````
+
+The STM32MP13x is a single Cortex-A7 MPU aimed at various applications.
+
+Currently the following boards are supported:
+
+ + stm32mp135f-dk.dts
+
+
 Boot Sequences
 --------------
 
@@ -71,12 +99,22 @@ Boot Sequences
 +          +------------------------+-------------------------+--------------+
 |          | embedded RAM           | DDR                                    |
 +----------+------------------------+-------------------------+--------------+
+| TrustZone|                         secure monitor                          |
++----------+------------------------+-------------------------+--------------+
+
+The trusted boot chain is recommended with:
+
+- FSBL = **TF-A BL2**
+- Secure monitor = **OP-TEE**
+- SSBL = **U-Boot**
+
+It is the only supported boot chain for STM32MP13x family.
 
 The **Trusted** boot chain with TF-A_
 `````````````````````````````````````
 
 defconfig_file :
-   + **stm32mp15_defconfig** (for TF-A_ with FIP support)
+   + **stm32mp15_defconfig**  and **stm32mp13_defconfig** (for TF-A_ with FIP support)
    + **stm32mp15_trusted_defconfig** (for TF-A_ without FIP support)
 
     +-------------+--------------------------+------------+-------+
@@ -98,8 +136,8 @@ TF-A_ (BL2) initialize the DDR and loads the next stage binaries from a FIP file
      the secure monitor to access to secure resources.
    + HW_CONFIG: The hardware configuration file = the U-Boot device tree
 
-The **Basic** boot chain with SPL
-`````````````````````````````````
+The **Basic** boot chain with SPL (for STM32MP15x)
+``````````````````````````````````````````````````
 
 defconfig_file :
    + **stm32mp15_basic_defconfig**
@@ -117,16 +155,19 @@ SPL has limited security initialization.
 U-Boot is running in secure mode and provide a secure monitor to the kernel
 with only PSCI support (Power State Coordination Interface defined by ARM).
 
-All the STM32MP15x boards supported by U-Boot use the same generic board
-stm32mp1 which support all the bootable devices.
+.. warning:: This alternate **basic** boot chain with SPL is not supported/promoted by STMicroelectronics to make product.
+
+Device Tree
+-----------
 
-Each board is configured only with the associated device tree.
+All the STM32MP15x and STM32MP13x boards supported by U-Boot use the same generic board
+stm32mp1 which supports all the bootable devices.
 
-Device Tree Selection
----------------------
+Each STMicroelectronics board is only configured with the associated device tree.
 
-You need to select the appropriate device tree for your board,
-the supported device trees for STM32MP15x are:
+STM32MP15x device Tree Selection
+````````````````````````````````
+The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig and stm32mp15_basic_defconfig) are:
 
 + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
 
@@ -148,6 +189,15 @@ the supported device trees for STM32MP15x are:
 
    + stm32mp15xx-dhcor-avenger96
 
+STM32MP13x device Tree Selection
+````````````````````````````````
+The supported device trees for STM32MP13x (stm32mp13_defconfig) are:
+
++ dk: Discovery board
+
+   + stm32mp135f-dk
+
+
 Build Procedure
 ---------------
 
@@ -170,6 +220,7 @@ Build Procedure
 
    for example: use one output directory for each configuration::
 
+   # export KBUILD_OUTPUT=stm32mp13
    # export KBUILD_OUTPUT=stm32mp15
    # export KBUILD_OUTPUT=stm32mp15_trusted
    # export KBUILD_OUTPUT=stm32mp15_basic
@@ -184,9 +235,10 @@ Build Procedure
 
    with <defconfig_file>:
 
-   - For **trusted** boot mode : **stm32mp15_defconfig** or
-     stm32mp15_trusted_defconfig
-   - For basic boot mode: stm32mp15_basic_defconfig
+   - For **trusted** boot mode :
+     - For STM32MP13x: **stm32mp13_defconfig**
+     - For STM32MP15x: **stm32mp15_defconfig** or stm32mp15_trusted_defconfig
+   - For STM32MP15x basic boot mode: stm32mp15_basic_defconfig
 
 5. Configure the device-tree and build the U-Boot image::
 
@@ -194,37 +246,42 @@ Build Procedure
 
    Examples:
 
-  a) trusted boot with FIP on ev1::
+  a) trusted boot with FIP on STM32MP15x ev1::
 
      # export KBUILD_OUTPUT=stm32mp15
      # make stm32mp15_defconfig
      # make DEVICE_TREE=stm32mp157c-ev1 all
 
-  b) trusted boot without FIP on dk2::
+  b) trusted boot on STM32MP13x discovery board::
 
-      # export KBUILD_OUTPUT=stm32mp15_trusted
-      # make stm32mp15_trusted_defconfig
-      # make DEVICE_TREE=stm32mp157c-dk2 all
+     # export KBUILD_OUTPUT=stm32mp13
+     # make stm32mp13_defconfig
+     # make DEVICE_TREE=stm32mp135f-dk all
 
-  c) basic boot on ev1::
+    DEVICE_TEE selection is optional as stm32mp135f-dk is the default board of the defconfig::
+
+     # make stm32mp13_defconfig
+     # make all
+
+  c) basic boot on STM32MP15x ev1::
 
       # export KBUILD_OUTPUT=stm32mp15_basic
       # make stm32mp15_basic_defconfig
       # make DEVICE_TREE=stm32mp157c-ev1 all
 
-  d) basic boot on ed1::
+  d) basic boot on STM32MP15x ed1::
 
       # export KBUILD_OUTPUT=stm32mp15_basic
       # make stm32mp15_basic_defconfig
       # make DEVICE_TREE=stm32mp157c-ed1 all
 
-  e) basic boot on dk1::
+  e) basic boot on STM32MP15x dk1::
 
      # export KBUILD_OUTPUT=stm32mp15_basic
      # make stm32mp15_basic_defconfig
      # make DEVICE_TREE=stm32mp157a-dk1 all
 
-  f) basic boot on avenger96::
+  f) basic boot on STM32MP15x avenger96::
 
      # export KBUILD_OUTPUT=stm32mp15_basic
      # make stm32mp15_basic_defconfig
@@ -235,6 +292,7 @@ Build Procedure
    So in the output directory (selected by KBUILD_OUTPUT),
    you can found the needed U-Boot files:
 
+     - stm32mp13_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb**
      - stm32mp15_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb**
 
      - stm32mp15_trusted_defconfig = u-boot.stm32
@@ -325,9 +383,9 @@ the boot pin values = BOOT0, BOOT1, BOOT2
   | SPI-NAND    |  1      |  1      |  1      |
   +-------------+---------+---------+---------+
 
-- on the **daugther board ed1 = MB1263** with the switch SW1
-- on **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
-- on board **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
+- on the STM32MP15x **daughter board ed1 = MB1263** with the switch SW1
+- on STM32MP15x **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
+- on board STM32MP15x **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
   with only 2 pins available (BOOT1 is forced to 0 and NOR not supported),
   the possible value becomes:
 
@@ -355,7 +413,7 @@ The communication between HOST and board is based on
 Prepare an SD card
 ------------------
 
-The minimal requirements for STMP32MP15x boot up to U-Boot are:
+The minimal requirements for STMP32MP15x and STM32MP13x boot up to U-Boot are:
 
 - GPT partitioning (with gdisk or with sgdisk)
 - 2 fsbl partitions, named "fsbl1" and "fsbl2", size at least 256KiB
@@ -511,14 +569,25 @@ MAC Address
 Please read doc/README.enetaddr for the implementation guidelines for mac id
 usage. Basically, environment has precedence over board specific storage.
 
-For STMicroelectonics board, it is retrieved in STM32MP15x OTP :
+For STMicroelectronics board, it is retrieved in:
+
+ - STM32MP15x OTP:
 
- - OTP_57[31:0] = MAC_ADDR[31:0]
- - OTP_58[15:0] = MAC_ADDR[47:32]
+   - OTP_57[31:0] = MAC_ADDR[31:0]
+   - OTP_58[15:0] = MAC_ADDR[47:32]
 
-To program a MAC address on virgin OTP words above, you can use the fuse command
+ - STM32MP13x OTP:
+
+  - OTP_57[31:0]  = MAC_ADDR0[31:0]
+  - OTP_58[15:0]  = MAC_ADDR0[47:32]
+  - OTP_58[31:16] = MAC_ADDR1[15:0]
+  - OTP_59[31:0]  = MAC_ADDR1[47:16]
+
+To program a MAC address on virgin STM32MP15x OTP words above, you can use the fuse command
 on bank 0 to access to internal OTP and lock them:
 
+In the next example we are using the 2 OTPs used on STM32MP15x.
+
 Prerequisite: check if a MAC address isn't yet programmed in OTP
 
 1) check OTP: their value must be equal to 0::
@@ -571,8 +640,8 @@ Example to set mac address "12:34:56:78:9a:bc"
              OTP are protected. It is already done for the board
              provided by STMicroelectronics.
 
-Coprocessor firmware
---------------------
+Coprocessor firmware on STM32MP15x
+----------------------------------
 
 U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
 

doc/board/st/stm32mp1.rst All the supported device are exported for dfu-util tool:: · line 753

Quoted 8 lines
doc/board/st/stm32mp1.rst +1 -1
@@ -678,7 +747,7 @@ All the supported device are exported for dfu-util tool::
 
 You can update the boot device:
 
-- SD card (mmc0) ::
+- SD card (mmc0)::
 
   $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1.stm32
   $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1.stm32

Thanks
Patrice