linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* clock framework: Don't disable a clock already enabled by boot loader?
@ 2013-05-24 12:44 Dirk Behme
  2013-05-24 23:00 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-05-24 12:44 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* clock framework: Don't disable a clock already enabled by boot loader?
  2013-05-24 12:44 clock framework: Don't disable a clock already enabled by boot loader? Dirk Behme
@ 2013-05-24 23:00 ` Sascha Hauer
  2013-05-25  5:59   ` Dirk Behme
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2013-05-24 23:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Dirk,

On Fri, May 24, 2013 at 02:44:58PM +0200, Dirk Behme wrote:
> 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?

Yes, and it's great since after this point the hardware state is in sync
with the enable counter.

> 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?

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

-- 
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 |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* clock framework: Don't disable a clock already enabled by boot loader?
  2013-05-24 23:00 ` Sascha Hauer
@ 2013-05-25  5:59   ` Dirk Behme
  2013-05-25  6:54     ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-05-25  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha,

Am 25.05.2013 01:00, schrieb Sascha Hauer:
> Hi Dirk,
>
> On Fri, May 24, 2013 at 02:44:58PM +0200, Dirk Behme wrote:
>> 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?
>
> Yes, and it's great since after this point the hardware state is in sync
> with the enable counter.
>
>> 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?
>
> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* clock framework: Don't disable a clock already enabled by boot loader?
  2013-05-25  5:59   ` Dirk Behme
@ 2013-05-25  6:54     ` Shawn Guo
  2013-05-25  7:16       ` Dirk Behme
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2013-05-25  6:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 25, 2013 at 07:59:45AM +0200, Dirk Behme wrote:
> 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?
> 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* clock framework: Don't disable a clock already enabled by boot loader?
  2013-05-25  6:54     ` Shawn Guo
@ 2013-05-25  7:16       ` Dirk Behme
  2013-05-25 11:17         ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-05-25  7:16 UTC (permalink / raw)
  To: linux-arm-kernel

Am 25.05.2013 08:54, schrieb Shawn Guo:
> On Sat, May 25, 2013 at 07:59:45AM +0200, Dirk Behme wrote:
>> 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?
>>
> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* clock framework: Don't disable a clock already enabled by boot loader?
  2013-05-25  7:16       ` Dirk Behme
@ 2013-05-25 11:17         ` Shawn Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2013-05-25 11:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 25, 2013 at 09:16:44AM +0200, Dirk Behme wrote:
> 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?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-25 11:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24 12:44 clock framework: Don't disable a clock already enabled by boot loader? Dirk Behme
2013-05-24 23:00 ` Sascha Hauer
2013-05-25  5:59   ` Dirk Behme
2013-05-25  6:54     ` Shawn Guo
2013-05-25  7:16       ` Dirk Behme
2013-05-25 11:17         ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).