Skip to contentSkip to conversation

Clock tree in U-Boot

U-Boot Eric Nelson 2 participants 2 messages Apr 17, 2015

lore
Share & tools
lore
#0 lore raw

Hi all,

Heiko's recent patch set [1] to control the LDB clock on i.MX5/6 boards makes it painfully obvious that some semblance of clock tree is needed, even if it starts off as a shell.

We currently have routines declared in [2] that should be moved into a more common spot:

	void clk_enable(struct clk *clk);
	void clk_disable(struct clk *clk);
	u32 clk_get_rate(struct clk *clk);
	int clk_set_rate(struct clk *clk, unsigned long rate);
	long clk_round_rate(struct clk *clk, unsigned long rate);
	int clk_set_parent(struct clk *clk, struct clk *parent);
	int clk_get_usecount(struct clk *clk);
	struct clk *clk_get_parent(struct clk *clk);

Can we get some agreement on a proper subset of [3] that's appropriate for use in U-Boot?

My thought is that the list above, plus some form of clk_get() and/or clk_get_sys() would be a good start.

Please advise,

Eric

[1] http://lists.denx.de/pipermail/u-boot/2015-April/thread.html#210677
[2] http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/video/ipu.h#l245
[3]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/clk.h?id=refs/tags/v4.0

#1 lore raw

Hi Eric,

Quoted 18 lines · Eric Nelson

Hi all,

Heiko's recent patch set [1] to control the LDB clock on i.MX5/6 boards makes it painfully obvious that some semblance of clock tree is needed, even if it starts off as a shell.

We currently have routines declared in [2] that should be moved into a more common spot:

        void clk_enable(struct clk *clk);
        void clk_disable(struct clk *clk);
        u32 clk_get_rate(struct clk *clk);
        int clk_set_rate(struct clk *clk, unsigned long rate);
        long clk_round_rate(struct clk *clk, unsigned long rate);
        int clk_set_parent(struct clk *clk, struct clk *parent);
        int clk_get_usecount(struct clk *clk);
        struct clk *clk_get_parent(struct clk *clk);
Quoted 7 lines

Can we get some agreement on a proper subset of [3] that's appropriate for use in U-Boot?

My thought is that the list above, plus some form of clk_get() and/or clk_get_sys() would be a good start.

Please advise,

I'd like to see this. It should use driver model I think. The above list looks good to me.

For clk_get(), we could support claiming of clocks so we know when we can turn off its parent / automatically enable it / etc. But perhaps as a first step just implementing a uclass and a driver for one device would be a good start.

Quoted 8 lines

Eric

[1] http://lists.denx.de/pipermail/u-boot/2015-April/thread.html#210677
[2] http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/video/ipu.h#l245
[3]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/clk.h?id=refs/tags/v4.0

Regards,
Simon