crust-firmware / crust

SCP (power management) firmware for sunxi SoCs
Other
150 stars 34 forks source link

Stop using the trusted watchdog for OSC16M calibration #199

Closed smaeul closed 2 years ago

smaeul commented 2 years ago

Type of issue

Enhancement

Description

Linux likes to turn off the TWD clock. One way to get around this is to not use the TWD. However, the TWD is currently used as the 24 MHz counter for OSC16M calibration. So some alternative must be found before the TWD can be disabled.

Everything except A64/H5 has a "timestamp status" MMIO range with a free-running 64-bit counter running at 24 MHz. There is also a latched 64-bit counter in the R_CPUCFG space. This latched counter could be used if the calibration procedure was flipped, to delay using OSC16M and count OSC24M cycles (whereas now it delays using OSC24M and counts OSC16M cycles).

There are other timers available, but one concern is their availability during sleep. See #198.