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);