[PATCH v3 3/4] pci: pcie_dw_rockchip: drop clk_release_bulk calls
Daniele Briguglio
hello at superkali.me
Tue Jun 9 22:06:25 CEST 2026
> Though the whole clk handling is quite strange.
> I would assume that it's always a
> - clk-request
> - clk-enable
> something
> - clk-disable
> - clk-release
>
> That a clk-disable also hides in the clk-release is really surprising,
> and I guess a lot of places in u-boot will encounter the same
> imbalance - just mitigated by the fact that the double-disable
> won't matter.
>
> Directly in clk_get_bulk the problem is apparent ...
> The function tries to get all the clocks, and on error calls
> clk_release_all on the already gotten clocks.
>
> All of these clocks never got enabled, but are getting double-disabled
> by the clk_release_all() call.
>
> Very very strange ;-)
Right. clk_release_bulk() hides a clk_disable(), and clk_get_bulk() does
the same in its own error path: it calls clk_release_all() on clocks it
only ever requested, never enabled. Everywhere else that double-disable
is a no-op, so nobody notices. The gated-fixed-clock driver is what makes
it bite, since there the disable actually toggles the regulator.
Thanks for the review, and for testing on the rock-5-itx.
Daniele
More information about the U-Boot
mailing list