ODYSSEY STM32MP157C ARM Trusted Firmware support?

I am on 69cc28c5a from https://github.com/STMicroelectronics/arm-trusted-firmware.git

It is an old version I have worked with before. Below is the patch of what got me going.

I have not tried to boot a kernel of any sorts. I will move to U-boot from the ATF and validate hardware. It will be a while before I move to a kernel.

diff --git a/fdts/stm32mp157-pinctrl.dtsi b/fdts/stm32mp157-pinctrl.dtsi
index 8037e4fb0..6bb99e97d 100644
--- a/fdts/stm32mp157-pinctrl.dtsi
+++ b/fdts/stm32mp157-pinctrl.dtsi
@@ -315,6 +315,18 @@
 					bias-disable;
 				};
 			};
+
+			i2c2_pins_a: i2c2-0 {
+				pins {
+					pinmux = <STM32_PINMUX('H', 4, AF4)>, /* I2C2_SCL */
+							 <STM32_PINMUX('H', 5, AF4)>; /* I2C2_SDA */
+					bias-disable;
+					drive-open-drain;
+					slew-rate = <0>;
+				};
+			};
+
+
 		};
 
 		pinctrl_z: pin-controller-z@54004000 {
diff --git a/fdts/stm32mp157a-dk1.dts b/fdts/stm32mp157a-dk1.dts
index f081575ea..0ef987b4d 100644
--- a/fdts/stm32mp157a-dk1.dts
+++ b/fdts/stm32mp157a-dk1.dts
@@ -29,9 +29,9 @@
 	st,digbypass;
 };
 
-&i2c4 {
+&i2c2 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&i2c4_pins_a>;
+	pinctrl-0 = <&i2c2_pins_a>;
 	i2c-scl-rising-time-ns = <185>;
 	i2c-scl-falling-time-ns = <20>;
 	status = "okay";
@@ -162,9 +162,9 @@
 	status = "okay";
 };
 
-&sdmmc1 {
+&sdmmc2 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc1_b4_pins_a>;
+	pinctrl-0 = <&sdmmc2_b4_pins_a>;
 	broken-cd;
 	st,neg-edge;
 	bus-width = <4>;
@@ -209,7 +209,7 @@
 		gpio7 = &gpioh;
 		gpio8 = &gpioi;
 		gpio25 = &gpioz;
-		i2c3 = &i2c4;
+		i2c1 = &i2c2;
 	};
 };
 
diff --git a/fdts/stm32mp157c.dtsi b/fdts/stm32mp157c.dtsi
index e649c3a2b..f3b4e4072 100644
--- a/fdts/stm32mp157c.dtsi
+++ b/fdts/stm32mp157c.dtsi
@@ -347,6 +347,21 @@
 			status = "disabled";
 		};
 
+		i2c2: i2c@40013000 {
+			compatible = "st,stm32mp15-i2c";
+			reg = <0x40013000 0x400>;
+			interrupt-names = "event", "error";
+			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&rcc I2C2_K>;
+			resets = <&rcc I2C2_R>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			st,syscfg-fmp = <&syscfg 0x4 0x2>;
+			wakeup-source;
+			status = "disabled";
+		};
+
 		rtc: rtc@5c004000 {
 			compatible = "st,stm32mp1-rtc";
 			reg = <0x5c004000 0x400>;
diff --git a/plat/st/stm32mp1/stm32mp1_def.h b/plat/st/stm32mp1/stm32mp1_def.h
index 7d7d77399..32093a268 100644
--- a/plat/st/stm32mp1/stm32mp1_def.h
+++ b/plat/st/stm32mp1/stm32mp1_def.h
@@ -491,6 +491,7 @@ static inline uint32_t tamp_bkpr(uint32_t idx)
 /*******************************************************************************
  * STM32MP1 I2C
  ******************************************************************************/
+#define I2C2_BASE			U(0x40013000)
 #define I2C4_BASE			U(0x5C002000)
 #define I2C6_BASE			U(0x5C009000)
 
diff --git a/plat/st/stm32mp1/stm32mp1_shared_resources.c b/plat/st/stm32mp1/stm32mp1_shared_resources.c
index 09d91361b..9f5433210 100644
--- a/plat/st/stm32mp1/stm32mp1_shared_resources.c
+++ b/plat/st/stm32mp1/stm32mp1_shared_resources.c
@@ -403,6 +403,7 @@ static void register_periph_iomem(uintptr_t base, unsigned int state)
 	case UART7_BASE:
 	case UART8_BASE:
 	case IWDG2_BASE:
+	case I2C2_BASE:
 		/* Allow drivers to register some non secure resources */
 		VERBOSE("IO for non secure resource 0x%x\n",
 			(unsigned int)base);

For anyone interested, I’ve ported my patches and imported the USB DFU support in to my v2.4-LS branch which is based on mainline v2.4. It seems to work on my machine.

Hi all ,

I ran into the same issue and this discussion has been extremely informative.
I thank all participants of this forum.
Further on this i had few queries which are as follows
So i tried following this link :


to generate a bootable image for stm32mp157c-dk2 board which obviously works fine for the dk2 board but for the SoM board was not working since it has missing DTS changes.
After making those DTS changes i am still struggling to boot the board.
I am pretty sure no TF-A boot is involved here . My confusion is ->> do i need to make use of TF-A boot to make this work or it should work just fine with U-boot?
@ekorre @166291

How far have you gotten it to boot? There’s two working stacks I’ve used with the Odyssey:

  1. Mainline linux with some extra patches, mainline barebox, patched arm trusted firmware
  2. Seeed’s kernel, Seeed’s u-boot

If you’re using stock Buildroot you might have to choose some forks for the kernel/u-boot, and change the dts. Try using Seeed’s kernel and u-boot.

@166291: Thanks for responding back quickly.

For me the ddr power init fails , so basically i am at very beginning of it.
Also to my surprise few changes for i2c2 were already present in latest st kernel.
I just had to do minor changes such as changing i2c4 to i2c2 in stm32mp157a-dk1.dts
The reason for me to try all of this is because the RPMSG drivers are missing in the basic image provided by Seeed. Hence i am not able to perform IPC to M4.

I tried to two different ways:

  1. Using latest buildroot : Kernel: 5.10-stm32mp-r1 and Uboot: v2020.10-stm32mp-r1 , with above dts changes.
  2. OpenSTLinux with the dts changes mentioned here.

I will give a try to Seeed’s Kernel and U-boot once haven’t tried it yet.

If you’re using ST kernel, you need to use ST ATF, which doesn’t officially support this SoM and creates some kind of panic in the boot process. Regarding RPMSG drivers, do you mean kernel, bootloader or ATF?

I haven’t hit the DDR power init issue so I’m not too sure what’s happening. I’d recommend trying mainline kernel, ATF and boot with dts patches just to make sure your tools are working.

Okay. So here is the update. RPMSG does not work on the kernel level for Seeed Linux i have verified with the default image which one can download from odyssey wiki page.

Next I tried with Seed’s Kernel : stm32-4.19.y and Seed’s Uboot: v2018.11-stm32mp-r2.2 Got below output.

U-Boot SPL 2018.11-stm32mp-r2.2 (May 04 2021 - 12:50:45 +0530)
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.44
stpmic1_read: failed to read register 0x27 : -110ddr power init failed

If used with new U-boot which is not Seeed’s Uboot I get:

U-Boot SPL 2020.10-stm32mp-r1 (May 04 2021 - 10:54:10 +0530)
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
stpmic1_read: failed to read register x : 32stpmic1_read: failed to read register x : 24z
stpmic1_read: failed to read register x : 39ddr power init failed

For experimentation purpose , i just copied the default compiled dtb : stm32mp1-seeed-npi-base.dtb to /boot directory just to see if that solves the issue. Also made sure theentry was set to correct dtb file in extlinux/extlinux.conf .

@Baozhu @166291 I do not expected to be spoon fed. But i am really confused as to what exactly will make this board boot. I would really appreciate the directions now if this means to manually clone repos , cherry pick apply patches to make it work.

Does Seed’s official image boot? I’m wondering if your hardware is OK, because I’ve never seen that error.

The only image which boots on my HW is the one who direct download link is provided in the Odessey Seeed Wiki.
Link : https://files.seeedstudio.com/linux/ODYSSEY–STM32MP157C/stm32mp1-debian-buster-console-armhf-latest-2gb.img.xz
This is the only image which boot. Apart from that any combinations which are manually built after picking up from Seeeed’s Github are failing for me.

One key difference which i was able to make in above image is that given dtb in boot folder is with different name. (might be different in content as well) is stm32mp1-seeed-npi-base.dtb whose source is no where to be found.
@166291

Those device trees should be in seeed’s kernel branch in arch/arm/boot/dts.

You should open a new topic about this and hopefully get some more attention since this is a separate issue I think to ATF.

‘failed to read register’ seems suspicious to me, almost like it can’t find the PMIC.

Have Seeed done a new hardware revision with the PMIC on another bus?

@166291 : Sure i will start a new thread around this.
According to latest schematic and revision docs available PMIC still is on I2C2.

Hi @166291,

Could you please share the combination which you used along with patches on barebone kernel to make odyssey boot. I confirm that there are no dts files compatible to Seeed’s SoM present on their kernel. https://github.com/Seeed-Studio/linux
Also the U-boot does not contain compatible dts file.
I have hit a dead-end and requesting to help what exact patches you used. This is getting pretty frustrating tbh.
and also did you use buildroot or built each module individually?

Hi Nipun, sorry for the late response, I didn’t check my email. I don’t have a ‘known good’ working image at the moment without building one which would take a bit. I can do that if you’re still out of luck after this post, but I’ve included two images that probably work.

My entire buildroot tree is at https://git.lumina-sensum.com/LuminaSensum/buildroot-MynaPlayer with instructions for building. This runs on the Odyssey.
(Note: I accidentally put the wrong link when initially posting, my bad)

Patches for everything we use is here: https://git.lumina-sensum.com/LuminaSensum/buildroot-MynaPlayer/tree/unstable/board/myna-player-odyssey/rootfs_patches

The ATF stuff is crusty and doesn’t require all those patches. Here is my kernel in Git:


Here is ATF in Git:

Here is some binary files I just copied that you can try, copy MynaPlayer.img to an SD card and see if it boots using a serial cable:
https://novena.jookia.org/MynaPlayer.img (not sure which version this is)
https://novena.jookia.org/buildroot_test/ (my current buildroot test output including an image)

We use a stack of ATF+Barebox+Linux while the stock Seeed uses their U-Boot+Linux. The sources for these are at:


Here’s an example dts there though they have a few: https://github.com/Seeed-Studio/linux/blob/stm32-4.19.y/arch/arm/boot/dts/stm32mp1-seeed-npi-full.dts
The U-Boot source is at https://github.com/Seeed-Studio/u-boot/tree/v2018.11-stm32mp-s

None of these have ever had PMIC-related issues.

Hi @166291:

So after trying out what you suggested i was able to boot the board with the specified branch on the Seeed’s Kernel and Seeed’s U-boot only. Thanks a lot for pointing out to the branch.
However there is still a minor issue in U-boot where-in it is not able to pick up the correct supplied dtb , i have manually halt at U-boot terminal and provide it the same after which it works fine.

I tried downloading image supplied by you. But it seems download is failing so unable to complete it.

My only query which remains is:
I have lot of missing modules in the driver folder no where to be found. Basic drivers such as gpio , rpmsg, led etc itself are missing. Any ideas how to enable those?

Meanwhile I will give a shot to ATF stack suggested by you to see if it works.

I think to enable them you’d have to change the kernel config. As for device trees, you’ll have to install the dtbs to where u-boot can find them. Try using the full device tree and also enabling the gpio/rpmsg/led kernel modules when building.

@166291

Thanks for the inputs.
Now i tried following things ->
Your kernel + Your Custome ATF (v2.2-LS + patch from @ekorre ) + Seeeed’s U-boot

ERROR:   stm32_sdmmc2_init: DT Error
PANIC at PC : 0x2ffd91e1

I haven’t changed any settings in make menuconfig just kept it stm32mp157c-dk2 all the way.
Except in case of kernel where i have kept it as : stm32mp157c-odyssey.dts

Update : Tried with 2.4-LS branch , getting the same kernel panic. Also few changes in the headers files were missing incorporated that , but still looking at the kernel panic.

�NOTICE:  CPU: STM32MP157CAC Rev.B
NOTICE:  Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
ERROR:   stm32_sdmmc2_mmc_init: DT error
ERROR:   SDMMC1 init failed
PANIC at PC : 0x2ffd52d1

Could you try doing a full build of my image using buildroot? I’m not entirely sure what’s happening. It could be that you need to use the dk1 dts instead, I’m not sure which I modified. See the configs in my buildroot repo.


yes, i have done it on ODYSSEY STM32MP157C.

Is your image available (GitHub or similar?), and/or what changes were needed from the standard DK2 image to get it to boot?