How to get clk rate using clk name?

victorascroft at victorascroft at
Fri Jun 26 11:32:46 EDT 2015


I am writing a driver for a device which does not require a clock specified
in the device tree and always has the clock enabled for it. In this driver
I require the clock rate of a specific clock, let's say having the name
"foo", for a specific timing calculation.

Having this clock name, is it possible to get the clock rate?. With functions
like clk_get_rate it is mandatory to have the struct clk pointer to the specific
clock which I do not have. While it is definitely possible to specify a clock
explicitly in the DT specification and then have the clock allocation done in
the clock driver for the SoC, since the peripheral block does not require the
clock explicitly, I did like to avoid this.

Is this doable? Something like clk_lookup_by_name("foo") returning a struct clk


More information about the Kernelnewbies mailing list