> Previously I found OpenBSD-6.6, 6.7 and -current did not work on
> my Orange Pi PC (Allwinner H3).
> For these days I was looking for what caused this problem, and
> finally I found the M field of H3_PLL_CPUX_CTRL_REG (@0x01c20000)
> made thing worse.
> This, M value should be 2. If this is 1, system will be hang.
> Here is easy test method that writing value 0x90001431 (default)
> and 0x90001410, they produce same clock frequency 1008MHz.
I've being testing an h3 machine (orangepi-one) that was unusable,
with hangs and random vm faults mostly at boot time.
Thanks for pointing to the problem!
It seems that the PLL is not been stabilized although LOCK is read as
set. You can check it by putting a delay in sxiccmu_h3_set_frequency
after H3_PLL_CPUX_LOCK is tested, delay(200) is sufficient, the machine
will boot ok.
Using a divider seams to make the stabilizing faster, but this
random behavior is a little tricky to make a solution of it, and
in the future other problems could arise.
What about gating the PLL before applying the multipliers and ungating
Note that the datasheet warns about the need of waiting 8 cycles of the
current clock after changing CPUX_CLK_SRC_SEL, So it may be helpful to
add a small delay after setting CPUX_CLK_SRC_SEL. I put delay(1) as a
reference, I'm starting to look under the hood of OpenBSD, I don't know
what is the preffered way to deal with such a small delay in cycles in
--- /usr/src/sys/dev/fdt/sxiccmu.c.orig Wed Jul 8 21:23:35 2020
+++ /usr/src/sys/dev/fdt/sxiccmu.c Fri Jul 10 21:35:49 2020
@@ -1158,6 +1158,7 @@
At least the problems at boot are gone, but there is still some
instability with this soc. These socs are very sensitive to high
frequencies and the heat they produce. I think DVFS is a must here,
I will try setting hw.setperf=90 for a while.