clock framework: Don't disable a clock already enabled by boot loader?
Hi,
we register a clock using clk_register_clkdev() etc already enabled by a boot loader. We are doing only the clk_register_clkdev(), but no clock_enable() etc on this clock.
With this, enable_count for this clock is zero, while in fact it's already on. I.e. the kernel doesn't know that it is on.
This results in
late_initcall(clk_disable_unused())
disabling this clock because the kernel thinks it's unused.
Is this the intended behavior? Is there a way to let the kernel know "the clock is enabled already, set enable_count != 0"? Or is the only way to do this correctly calling clock_enable() on an already enabled clock?
Many thanks and best regards
Dirk
Hi Dirk,
Quoted 9 lines · Dirk Behme
Hi,
we register a clock using
clk_register_clkdev()etc already enabled by a boot loader. We are doing only theclk_register_clkdev(), but noclock_enable()etc on this clock.With this,
enable_countfor this clock is zero, while in fact it's already on. I.e. the kernel doesn't know that it is on.
Quoted 7 lines
This results in
late_initcall(clk_disable_unused())
disabling this clock because the kernel thinks it's unused.
Is this the intended behavior?
Yes, and it's great since after this point the hardware state is in sync with the enable counter.
Quoted 4 lines
Is there a way to let the kernel know
"the clock is enabled already, setenable_count!= 0"? Or is the only way to do this correctly callingclock_enable()on an already enabled clock?
You could set the CLK_IGNORE_UNUSED flag in the clock, but I suggest to just clk_get/clk_enable the clock in the driver using it.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Hi Sascha,
Am 25.05.2013 01:00, schrieb Sascha Hauer:
Quoted 23 lines
Hi Dirk,
Quoted 9 lines · Dirk Behme
Hi,
we register a clock using
clk_register_clkdev()etc already enabled by a boot loader. We are doing only theclk_register_clkdev(), but noclock_enable()etc on this clock.With this,
enable_countfor this clock is zero, while in fact it's already on. I.e. the kernel doesn't know that it is on.Quoted 7 lines
This results in
late_initcall(clk_disable_unused())
disabling this clock because the kernel thinks it's unused.
Is this the intended behavior?
Yes, and it's great since after this point the hardware state is in sync with the enable counter.
Quoted 7 lines
Quoted 4 lines
Is there a way to let the kernel know
"the clock is enabled already, setenable_count!= 0"? Or is the only way to do this correctly callingclock_enable()on an already enabled clock?You could set the
CLK_IGNORE_UNUSEDflag in the clock, but I suggest to just clk_get/clk_enable the clock in the driver using it.
Thanks for the fast answer! :)
Hmm, but what's the best way to set a flag in
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-imx/clk-imx6q.c
?
In mx6q_clocks_init() there doesn't seem to be an explicit interface to set the flags?
I'm not sure if
clk[xxx]->flags |= CLK_IGNORE_UNUSED;
is the way to go?
Best regards
Dirk
Quoted 6 lines · Dirk Behme
Hmm, but what's the best way to set a flag in
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-imx/clk-imx6q.c
?
Quoted 9 lines
In
mx6q_clocks_init()there doesn't seem to be an explicit interface to set the flags?I'm not sure if
clk[xxx]->flags |=
CLK_IGNORE_UNUSED;is the way to go?
Commit 1e43525 (clk: add clk_ignore_unused option to keep boot clocks on) introduced an option "clk_ignore_unused" for bypassing clk_disable_unused() call.
Shawn
Am 25.05.2013 08:54, schrieb Shawn Guo:
Quoted 12 lines · Dirk Behme
Quoted 11 lines
Hmm, but what's the best way to set a flag in
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-imx/clk-imx6q.c
?
In
mx6q_clocks_init()there doesn't seem to be an explicit interface to set the flags?I'm not sure if
Quoted 7 lines
Quoted 4 lines
clk[xxx]->flags |=
CLK_IGNORE_UNUSED;is the way to go?
Commit 1e43525 (clk: add
clk_ignore_unusedoption to keep boot clocks on) introduced an option "clk_ignore_unused" for bypassingclk_disable_unused()call.
Yes, I know ;) But this is slightly different: In the end it disables the complete clk_disable_unused() call, i.e. for all unused clocks.
I'd like to set the flag CLK_IGNORE_UNUSED for just one clock. I.e. I want to set a flag for an i.MX6 clock, and I want to set it only for one clock.
What's the preferred way to do this?
Best regards
Dirk
Quoted 9 lines · Dirk Behme
Yes, I know ;) But this is slightly different: In the end it disables the complete
clk_disable_unused()call, i.e. for all unused clocks.I'd like to set the flag
CLK_IGNORE_UNUSEDfor just one clock. I.e. I want to set a flag for an i.MX6 clock, and I want to set it only for one clock.What's the preferred way to do this?
I do not like the idea to set CLK_IGNORE_UNUSED in clock driver on clk basis. If the clk is needed by some driver, why cannot the driver enable it using clk API? Or if the clk is some fundamental one that does not clearly belong to particular IP block and no driver wants to manage it, we may want to not implement it in clock driver at all and just leave it to bootloader to set it up for once.
Shawn