Skip to contentSkip to conversation

clk: stm32mp1: add support for IWDG1

PATCH In review Antonio Borneo 2 participants 6 messages Nov 5 – Nov 9

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

PATCH 1/3 clk: stm32mp1: add support for IWDG1

From: Thomas Bourgoin <[email protected]>

Add the missing IWDG1 peripheral clock, controlled by the IWDG1APBEN bit (at position 15) in RCC_MP_APB5ENSETR.

This allows SPL or U-Boot to ping IWDG1 if it was started by the hardware or by an earlier boot stage.

---
 drivers/clk/stm32/clk-stm32mp1.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/stm32/clk-stm32mp1.c +1 -0
index 823ce132d0b..04087cabc14 100644
@@ -561,6 +561,7 @@ static const struct stm32mp1_clk_gate stm32mp1_clk_gate[] = {
 	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 3, I2C6_K, _I2C46_SEL),
 	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 4, USART1_K, _UART1_SEL),
 	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 8, RTCAPB, _PCLK5),
+	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 15, IWDG1, _UNKNOWN_SEL),
 	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 16, BSEC, _UNKNOWN_SEL),
 	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 20, STGEN_K, _STGEN_SEL),
 

base-commit: dfcfc4c9f78d1743f490a497082a4ec8e058aae8

Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 ARM: dts: stm32: disable iwdg2 in stm32mp157a-dk1-u-boot

IWDG2 is not used by U-Boot, but its node is enabled in the device tree inherited from the upstream Linux kernel.

Disable the node to prevent U-Boot from starting the watchdog when
CONFIG_WATCHDOG_AUTOSTART=y
as in stm32mp15_basic_defconfig.

---
 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +4 -0
index 78ebc3d3ea3..4ed747db6be 100644
@@ -88,6 +88,10 @@
 	};
 };
 
+&iwdg2 {
+	status = "disabled";
+};
+
 &pmic {
 	bootph-all;
 };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 2/3] ARM: dts: stm32: disable iwdg2 in stm32mp157a-dk1-u-boot

Hi,

Quoted 17 lines · Antonio Borneo

IWDG2 is not used by U-Boot, but its node is enabled in the device tree inherited from the upstream Linux kernel.

Disable the node to prevent U-Boot from starting the watchdog when
CONFIG_WATCHDOG_AUTOSTART=y
as in stm32mp15_basic_defconfig.

---
  arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +0 -0
index 78ebc3d3ea3..4ed747db6be 100644

arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi line 97

Quoted 10 lines
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +4 -0
@@ -88,6 +88,10 @@
  	};
  };
 
+&iwdg2 {
+	status = "disabled";
+};
+
  &pmic {
  	bootph-all;
  };

It is preferable to don't deactivated the nodes activated in Linux kernel device tree

in u-boot specific device tree (Add-on device tree = <board>-u-boot.dtsi)

because you change the expected behavior if Linux kernel is started with U-Boot device tree.

As you just wait avoid to automatic start IWDG2 in U-Boot, you can use  "u-boot,noautostart;"

and the expected behavior is handled in UCLASS function wdt_pre_probe():

- by default : autostart=IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART);

- UCLASS override autostart=false if  property "u-boot,noautostart" is presen

So I propose to change:

+&iwdg2 {
+ u-boot,noautostart;
+};
+

regards

Patrick

#3 lore raw

PATCH 3/3 ARM: dts: stm32: disable iwdg2 in stm32mp157c-ed1-u-boot

In reply to Antonio Borneo

IWDG2 is not used by U-Boot, but its node is enabled in the device tree inherited from the upstream Linux kernel.

Disable the node to prevent U-Boot from starting the watchdog when
CONFIG_WATCHDOG_AUTOSTART=y
as in stm32mp15_basic_defconfig.

---
 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +4 -0
index ef97a1184a9..cc986ccf50b 100644
@@ -72,6 +72,10 @@
 	};
 };
 
+&iwdg2 {
+	status = "disabled";
+};
+
 &pmic {
 	bootph-all;
 };
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 3/3] ARM: dts: stm32: disable iwdg2 in stm32mp157c-ed1-u-boot

Hi,

Quoted 17 lines · Antonio Borneo

IWDG2 is not used by U-Boot, but its node is enabled in the device tree inherited from the upstream Linux kernel.

Disable the node to prevent U-Boot from starting the watchdog when
CONFIG_WATCHDOG_AUTOSTART=y
as in stm32mp15_basic_defconfig.

---
  arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +0 -0
index ef97a1184a9..cc986ccf50b 100644

arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi line 81

Quoted 10 lines
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +4 -0
@@ -72,6 +72,10 @@
  	};
  };
 
+&iwdg2 {
+	status = "disabled";
+};
+
  &pmic {
  	bootph-all;
  };

So I propose to change:

+&iwdg2 {
+ u-boot,noautostart;
+};
+

regards

Patrick

Reviewed-by on v1 1/3
#5 lore raw
In reply to Antonio Borneo

Hi,

Quoted 27 lines · Antonio Borneo

From: Thomas Bourgoin <[email protected]>

Add the missing IWDG1 peripheral clock, controlled by the IWDG1APBEN bit (at position 15) in RCC_MP_APB5ENSETR.

This allows SPL or U-Boot to ping IWDG1 if it was started by the hardware or by an earlier boot stage.

---
  drivers/clk/stm32/clk-stm32mp1.c | 1 +
  1 file changed, 1 insertion(+)
drivers/clk/stm32/clk-stm32mp1.c +1 -0
index 823ce132d0b..04087cabc14 100644
@@ -561,6 +561,7 @@ static const struct stm32mp1_clk_gate stm32mp1_clk_gate[] = {
  	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 3, I2C6_K, _I2C46_SEL),
  	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 4, USART1_K, _UART1_SEL),
  	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 8, RTCAPB, _PCLK5),
+	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 15, IWDG1, _UNKNOWN_SEL),
  	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 16, BSEC, _UNKNOWN_SEL),
  	STM32MP1_CLK_SET_CLR(RCC_MP_APB5ENSETR, 20, STGEN_K, _STGEN_SEL),
 
Quoted 1 line

base-commit: dfcfc4c9f78d1743f490a497082a4ec8e058aae8

a missing clocks, as IWDG1 wasn't activated in non-secure until now

but no reason to don't support this use-case for basic boot weth SPL

or to have a special behavior for this APB5 clock

PS: for trusted boot: OP-TEE use the IWDG1 and when RCC is secured with TZEN=1

     then all clocks in RCC_MP_APB5ENSETR are secured

Thanks
Patrick