1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

drivers: clk: Fix using assigned-clocks in the node of the clock it sets up

This fixes the case where assigned-clocks is used to define a clock
defaults inside this same clock's node. This is used sometimes to setup a
default parents and/or rate for a clock.

example:
muxed_clock: muxed_clock {
	clocks = <&clk_provider 0>, <&clk_provider 1>;
	#clock-cells = <0>;
	assigned-clocks = <&muxed_clock>;
	assigned-clock-parents = <&clk_provider 1>;
};

It doesn't work in u-boot because the assigned-clocks are setup *before*
the clock is probed. (clk_set_parent() will likely crash or fail if called
before the device probe function)
Making it work by handling "assigned-clocks" in 2 steps: first before the
clk device is probed, and then after the clk device is probed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
This commit is contained in:
Jean-Jacques Hiblot
2019-10-22 14:00:06 +02:00
committed by Lukasz Majewski
parent dd2e0ce2a4
commit fd1ba29652
3 changed files with 48 additions and 9 deletions

View File

@@ -244,10 +244,13 @@ static inline int clk_release_all(struct clk *clk, int count)
*
* @dev: A device to process (the ofnode associated with this device
* will be processed).
* @stage: A integer. 0 indicates that this is called before the device
* is probed. 1 indicates that this is called just after the
* device has been probed
*/
int clk_set_defaults(struct udevice *dev);
int clk_set_defaults(struct udevice *dev, int stage);
#else
static inline int clk_set_defaults(struct udevice *dev)
static inline int clk_set_defaults(struct udevice *dev, int stage)
{
return 0;
}