]> git.ipfire.org Git - thirdparty/u-boot.git/commit
sunxi: clock: H6: factor out clock_set_pll()
authorAndre Przywara <andre.przywara@arm.com>
Sat, 25 Jan 2025 13:29:34 +0000 (13:29 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Sun, 27 Jul 2025 21:57:35 +0000 (22:57 +0100)
commitff4dda1db2c6f96582fc1691c4fdb83e957e7666
tree7cab9c475303c8760acbd44008aac4a11b3ea25e
parentf02e64d011745de095b8072fd3b0b34f888144e6
sunxi: clock: H6: factor out clock_set_pll()

The SPL initial clock setup code for the Allwinner H6 and H616 SoCs uses
a simple CPU PLL setup routine, which programs all register bits at once,
then waits for the LOCK bit to clear.
The manual suggests to follow a certain procedure for bringing up any
PLLs, which involves several register writes, one at a time, and some
delays. Also the H616 and the new A523 require some tiny changes in this
sequence, and the different SoCs also feature some extra bits here and
there, which we should not just clear.

So factor out the PLL setup routine, and make it follow the manual's
suggestion. This will read the PLL register at the beginning, then tweak
the bits we need to manipulate, and writes the register several times on
the way. This allows to cover the specific bits for different SoCs.

Besides improving the reliability of the PLL setup, this helps with the
A523, which requires *three* CPU PLLs to be programmed.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
arch/arm/mach-sunxi/clock_sun50i_h6.c