Skip to contentSkip to conversation

ARM: dts: stm32: Prefer HW RTC on DHCOM SoM

PATCH In review Marek Vasut 2 participants 2 messages Jun 20, 2021 – Jul 15, 2021

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

PATCH 1/1 ARM: dts: stm32: Prefer HW RTC on DHCOM SoM

The DHCOM SoM has two RTC, one is the STM32 RTC built into the SoC and another is Microcrystal RV RTC. By default, only the later has battery backup, the former does not. The order in which the RTCs are probed on boot is random, which means the kernel might pick up system time from the STM32 RTC which has no battery backup. This then leads to incorrect initial system time setup, even though the HW RTC has correct time configured in it.

Add DT alias entries, so that the RTCs get assigned fixed IDs and the HW RTC is always picked by the kernel as the default RTC, thus resulting in correct system time in early userspace.

Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
Cc Alexandre Torgue <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +3 -1
index 2af0a6752674..8349c9099e30 100644
@@ -12,6 +12,8 @@ / {
 	aliases {
 		ethernet0 = &ethernet0;
 		ethernet1 = &ksz8851;
+		rtc0 = &hwrtc;
+		rtc1 = &rtc;
 	};
 
 	memory@c0000000 {
@@ -248,7 +250,7 @@ &i2c4 {
 	/delete-property/dmas;
 	/delete-property/dma-names;
 
-	rtc@32 {
+	hwrtc: rtc@32 {
 		compatible = "microcrystal,rv8803";
 		reg = <0x32>;
 	};
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw
Quoted 38 lines · Marek Vasut

The DHCOM SoM has two RTC, one is the STM32 RTC built into the SoC and another is Microcrystal RV RTC. By default, only the later has battery backup, the former does not. The order in which the RTCs are probed on boot is random, which means the kernel might pick up system time from the STM32 RTC which has no battery backup. This then leads to incorrect initial system time setup, even though the HW RTC has correct time configured in it.

Add DT alias entries, so that the RTCs get assigned fixed IDs and the HW RTC is always picked by the kernel as the default RTC, thus resulting in correct system time in early userspace.

Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
Cc Alexandre Torgue <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
  arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +2 -0
index 2af0a6752674..8349c9099e30 100644
@@ -12,6 +12,8 @@ / {
  	aliases {
  		ethernet0 = &ethernet0;
  		ethernet1 = &ksz8851;
+		rtc0 = &hwrtc;
+		rtc1 = &rtc;
  	};
 
  	memory@c0000000 {

arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi &i2c4 { · line 256

Quoted 8 lines
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +1 -1
@@ -248,7 +250,7 @@ &i2c4 {
  	/delete-property/dmas;
  	/delete-property/dma-names;
 
-	rtc@32 {
+	hwrtc: rtc@32 {
  		compatible = "microcrystal,rv8803";
  		reg = <0x32>;
  	};

Applied on stm32-next.

regards
alex

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel