* [PATCH] clk: add option to keep boot clocks on
@ 2013-04-26 23:39 Olof Johansson
2013-04-27 0:08 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Olof Johansson @ 2013-04-26 23:39 UTC (permalink / raw)
To: linux-arm-kernel
This is primarily useful when there's a driver that doesn't claim clocks
properly, but the bootloader does. It's not expected to be used in normal
cases, but for bringup and debug it's very useful to have the option to
not gate unclaimed clocks that are still on.
Signed-off-by: Olof Johansson <olof@lixom.net>
---
Mike, this is a pretty trivial patch that I would love to see in 3.10
even though it's getting late. I'm definitely not picky about the naming
of the boot option, so feel free to change it.
-Olof
drivers/clk/clk.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 20ce67f..b22551e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -499,10 +499,24 @@ out:
return;
}
+
+static bool keep_boot_clocks;
+static int __init clk_keep_boot_clocks(char *__unused)
+{
+ keep_boot_clocks = true;
+ return 1;
+}
+__setup("clk_keep_boot_clocks", clk_keep_boot_clocks);
+
static int clk_disable_unused(void)
{
struct clk *clk;
+ if (keep_boot_clocks) {
+ pr_warn("clk: Not disabling unused clocks\n");
+ return 0;
+ }
+
clk_prepare_lock();
hlist_for_each_entry(clk, &clk_root_list, child_node)
--
1.8.1.192.gc4361b8
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] clk: add option to keep boot clocks on
2013-04-26 23:39 [PATCH] clk: add option to keep boot clocks on Olof Johansson
@ 2013-04-27 0:08 ` Randy Dunlap
2013-04-27 0:22 ` Olof Johansson
2013-04-27 18:17 ` Mike Turquette
2013-04-27 21:10 ` [PATCH v2] clk: add clk_ignore_unused " Olof Johansson
2 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2013-04-27 0:08 UTC (permalink / raw)
To: linux-arm-kernel
On 04/26/13 16:39, Olof Johansson wrote:
> This is primarily useful when there's a driver that doesn't claim clocks
> properly, but the bootloader does. It's not expected to be used in normal
> cases, but for bringup and debug it's very useful to have the option to
> not gate unclaimed clocks that are still on.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
add to Documentation/kernel-parameters.txt or somewhere else?
> ---
>
> Mike, this is a pretty trivial patch that I would love to see in 3.10
> even though it's getting late. I'm definitely not picky about the naming
> of the boot option, so feel free to change it.
>
>
> -Olof
>
> drivers/clk/clk.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 20ce67f..b22551e 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -499,10 +499,24 @@ out:
> return;
> }
>
> +
> +static bool keep_boot_clocks;
> +static int __init clk_keep_boot_clocks(char *__unused)
> +{
> + keep_boot_clocks = true;
> + return 1;
> +}
> +__setup("clk_keep_boot_clocks", clk_keep_boot_clocks);
> +
> static int clk_disable_unused(void)
> {
> struct clk *clk;
>
> + if (keep_boot_clocks) {
> + pr_warn("clk: Not disabling unused clocks\n");
> + return 0;
> + }
> +
> clk_prepare_lock();
>
> hlist_for_each_entry(clk, &clk_root_list, child_node)
>
--
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] clk: add option to keep boot clocks on
2013-04-27 0:08 ` Randy Dunlap
@ 2013-04-27 0:22 ` Olof Johansson
0 siblings, 0 replies; 7+ messages in thread
From: Olof Johansson @ 2013-04-27 0:22 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 26, 2013 at 5:08 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 04/26/13 16:39, Olof Johansson wrote:
>> This is primarily useful when there's a driver that doesn't claim clocks
>> properly, but the bootloader does. It's not expected to be used in normal
>> cases, but for bringup and debug it's very useful to have the option to
>> not gate unclaimed clocks that are still on.
>>
>> Signed-off-by: Olof Johansson <olof@lixom.net>
>
> add to Documentation/kernel-parameters.txt or somewhere else?
Ah, yes, of course. I'll wait for Mike to provide input on the color
of the shed, since it might change location in the file if it's
renamed. And then repost with documentation update.
-Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] clk: add option to keep boot clocks on
2013-04-26 23:39 [PATCH] clk: add option to keep boot clocks on Olof Johansson
2013-04-27 0:08 ` Randy Dunlap
@ 2013-04-27 18:17 ` Mike Turquette
2013-04-27 21:07 ` Olof Johansson
2013-04-27 21:10 ` [PATCH v2] clk: add clk_ignore_unused " Olof Johansson
2 siblings, 1 reply; 7+ messages in thread
From: Mike Turquette @ 2013-04-27 18:17 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Olof Johansson (2013-04-26 16:39:51)
> This is primarily useful when there's a driver that doesn't claim clocks
> properly, but the bootloader does. It's not expected to be used in normal
> cases, but for bringup and debug it's very useful to have the option to
> not gate unclaimed clocks that are still on.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
>
> Mike, this is a pretty trivial patch that I would love to see in 3.10
> even though it's getting late. I'm definitely not picky about the naming
> of the boot option, so feel free to change it.
>
This bike shed could be improved with a different color of paint.
Opinions below:
>
> -Olof
>
> drivers/clk/clk.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 20ce67f..b22551e 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -499,10 +499,24 @@ out:
> return;
> }
>
> +
Remove extra whitespace.
> +static bool keep_boot_clocks;
> +static int __init clk_keep_boot_clocks(char *__unused)
> +{
> + keep_boot_clocks = true;
> + return 1;
> +}
> +__setup("clk_keep_boot_clocks", clk_keep_boot_clocks);
s/clk_keep_boot_clocks/clk_ignore_unused/
This matches nicely with the existing CLK_IGNORE_UNUSED flag in
include/linux/clk-provider.h
In addition to Randy's suggestion to update kernel-parameters.txt,
please also toss in a note somewhere in Documentation/clk.txt so that
others bringing up new platforms can more easily find out about this
boot option. Don't worry about making it pretty since I plan to rework
the clock documentation for 3.11.
Otherwise patch looks good to me. I did some testing and I would be
comfortable sneaking this in for 3.10.
Regards,
Mike
> +
> static int clk_disable_unused(void)
> {
> struct clk *clk;
>
> + if (keep_boot_clocks) {
> + pr_warn("clk: Not disabling unused clocks\n");
> + return 0;
> + }
> +
> clk_prepare_lock();
>
> hlist_for_each_entry(clk, &clk_root_list, child_node)
> --
> 1.8.1.192.gc4361b8
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] clk: add option to keep boot clocks on
2013-04-27 18:17 ` Mike Turquette
@ 2013-04-27 21:07 ` Olof Johansson
0 siblings, 0 replies; 7+ messages in thread
From: Olof Johansson @ 2013-04-27 21:07 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 27, 2013 at 11:17:13AM -0700, Mike Turquette wrote:
> Quoting Olof Johansson (2013-04-26 16:39:51)
> > This is primarily useful when there's a driver that doesn't claim clocks
> > properly, but the bootloader does. It's not expected to be used in normal
> > cases, but for bringup and debug it's very useful to have the option to
> > not gate unclaimed clocks that are still on.
> >
> > Signed-off-by: Olof Johansson <olof@lixom.net>
> > ---
> >
> > Mike, this is a pretty trivial patch that I would love to see in 3.10
> > even though it's getting late. I'm definitely not picky about the naming
> > of the boot option, so feel free to change it.
> >
>
> This bike shed could be improved with a different color of paint.
> Opinions below:
>
> >
> > -Olof
> >
> > drivers/clk/clk.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 20ce67f..b22551e 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -499,10 +499,24 @@ out:
> > return;
> > }
> >
> > +
>
> Remove extra whitespace.
>
> > +static bool keep_boot_clocks;
> > +static int __init clk_keep_boot_clocks(char *__unused)
> > +{
> > + keep_boot_clocks = true;
> > + return 1;
> > +}
> > +__setup("clk_keep_boot_clocks", clk_keep_boot_clocks);
>
> s/clk_keep_boot_clocks/clk_ignore_unused/
>
> This matches nicely with the existing CLK_IGNORE_UNUSED flag in
> include/linux/clk-provider.h
>
> In addition to Randy's suggestion to update kernel-parameters.txt,
> please also toss in a note somewhere in Documentation/clk.txt so that
> others bringing up new platforms can more easily find out about this
> boot option. Don't worry about making it pretty since I plan to rework
> the clock documentation for 3.11.
>
> Otherwise patch looks good to me. I did some testing and I would be
> comfortable sneaking this in for 3.10.
Great, thanks. I'm happy to paint in any color requested. :)
V2 patch posted separately.
-Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] clk: add clk_ignore_unused option to keep boot clocks on
2013-04-26 23:39 [PATCH] clk: add option to keep boot clocks on Olof Johansson
2013-04-27 0:08 ` Randy Dunlap
2013-04-27 18:17 ` Mike Turquette
@ 2013-04-27 21:10 ` Olof Johansson
2013-04-28 6:06 ` Mike Turquette
2 siblings, 1 reply; 7+ messages in thread
From: Olof Johansson @ 2013-04-27 21:10 UTC (permalink / raw)
To: linux-arm-kernel
This is primarily useful when there's a driver that doesn't claim clocks
properly, but the bootloader leaves them on. It's not expected to be used
in normal cases, but for bringup and debug it's very useful to have the
option to not gate unclaimed clocks that are still on.
Signed-off-by: Olof Johansson <olof@lixom.net>
---
Documentation/clk.txt | 11 +++++++++++
Documentation/kernel-parameters.txt | 8 ++++++++
drivers/clk/clk.c | 13 +++++++++++++
3 files changed, 32 insertions(+)
diff --git a/Documentation/clk.txt b/Documentation/clk.txt
index 4274a54..b9911c2 100644
--- a/Documentation/clk.txt
+++ b/Documentation/clk.txt
@@ -231,3 +231,14 @@ To better enforce this policy, always follow this simple rule: any
statically initialized clock data MUST be defined in a separate file
from the logic that implements its ops. Basically separate the logic
from the data and all is well.
+
+ Part 6 - Disabling clock gating of unused clocks
+
+Sometimes during development it can be useful to be able to bypass the
+default disabling of unused clocks. For example, if drivers aren't enabling
+clocks properly but rely on them being on from the bootloader, bypassing
+the disabling means that the driver will remain functional while the issues
+are sorted out.
+
+To bypass this disabling, include "clk_ignore_unused" in the bootargs to the
+kernel.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index c4fa000..c3bfacb 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -44,6 +44,7 @@ parameter is applicable:
AVR32 AVR32 architecture is enabled.
AX25 Appropriate AX.25 support is enabled.
BLACKFIN Blackfin architecture is enabled.
+ CLK Common clock infrastructure is enabled.
CMA Contiguous Memory Area support is enabled.
DRM Direct Rendering Management support is enabled.
DYNAMIC_DEBUG Build in debug messages and enable them at runtime
@@ -473,6 +474,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
cio_ignore= [S390]
See Documentation/s390/CommonIO for details.
+ clk_ignore_unused
+ [CLK]
+ Keep all clocks already enabled by bootloader on,
+ even if no driver has claimed them. This is useful
+ for debug and development, but should not be
+ needed on a platform with proper driver support.
+ For more information, see Documentation/clk.txt.
clock= [BUGS=X86-32, HW] gettimeofday clocksource override.
[Deprecated]
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 20ce67f..934cfd1 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -499,10 +499,23 @@ out:
return;
}
+static bool clk_ignore_unused;
+static int __init clk_ignore_unused_setup(char *__unused)
+{
+ clk_ignore_unused = true;
+ return 1;
+}
+__setup("clk_ignore_unused", clk_ignore_unused_setup);
+
static int clk_disable_unused(void)
{
struct clk *clk;
+ if (clk_ignore_unused) {
+ pr_warn("clk: Not disabling unused clocks\n");
+ return 0;
+ }
+
clk_prepare_lock();
hlist_for_each_entry(clk, &clk_root_list, child_node)
--
1.8.1.192.gc4361b8
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] clk: add clk_ignore_unused option to keep boot clocks on
2013-04-27 21:10 ` [PATCH v2] clk: add clk_ignore_unused " Olof Johansson
@ 2013-04-28 6:06 ` Mike Turquette
0 siblings, 0 replies; 7+ messages in thread
From: Mike Turquette @ 2013-04-28 6:06 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Olof Johansson (2013-04-27 14:10:18)
> This is primarily useful when there's a driver that doesn't claim clocks
> properly, but the bootloader leaves them on. It's not expected to be used
> in normal cases, but for bringup and debug it's very useful to have the
> option to not gate unclaimed clocks that are still on.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
Thanks for the respin. I had to fix up a trivial merge issue with
Documentation/kernel-parameters.txt, but no big deal. Patch is merged
into clk-next.
Regards,
Mike
> ---
> Documentation/clk.txt | 11 +++++++++++
> Documentation/kernel-parameters.txt | 8 ++++++++
> drivers/clk/clk.c | 13 +++++++++++++
> 3 files changed, 32 insertions(+)
>
> diff --git a/Documentation/clk.txt b/Documentation/clk.txt
> index 4274a54..b9911c2 100644
> --- a/Documentation/clk.txt
> +++ b/Documentation/clk.txt
> @@ -231,3 +231,14 @@ To better enforce this policy, always follow this simple rule: any
> statically initialized clock data MUST be defined in a separate file
> from the logic that implements its ops. Basically separate the logic
> from the data and all is well.
> +
> + Part 6 - Disabling clock gating of unused clocks
> +
> +Sometimes during development it can be useful to be able to bypass the
> +default disabling of unused clocks. For example, if drivers aren't enabling
> +clocks properly but rely on them being on from the bootloader, bypassing
> +the disabling means that the driver will remain functional while the issues
> +are sorted out.
> +
> +To bypass this disabling, include "clk_ignore_unused" in the bootargs to the
> +kernel.
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index c4fa000..c3bfacb 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -44,6 +44,7 @@ parameter is applicable:
> AVR32 AVR32 architecture is enabled.
> AX25 Appropriate AX.25 support is enabled.
> BLACKFIN Blackfin architecture is enabled.
> + CLK Common clock infrastructure is enabled.
> CMA Contiguous Memory Area support is enabled.
> DRM Direct Rendering Management support is enabled.
> DYNAMIC_DEBUG Build in debug messages and enable them at runtime
> @@ -473,6 +474,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>
> cio_ignore= [S390]
> See Documentation/s390/CommonIO for details.
> + clk_ignore_unused
> + [CLK]
> + Keep all clocks already enabled by bootloader on,
> + even if no driver has claimed them. This is useful
> + for debug and development, but should not be
> + needed on a platform with proper driver support.
> + For more information, see Documentation/clk.txt.
>
> clock= [BUGS=X86-32, HW] gettimeofday clocksource override.
> [Deprecated]
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 20ce67f..934cfd1 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -499,10 +499,23 @@ out:
> return;
> }
>
> +static bool clk_ignore_unused;
> +static int __init clk_ignore_unused_setup(char *__unused)
> +{
> + clk_ignore_unused = true;
> + return 1;
> +}
> +__setup("clk_ignore_unused", clk_ignore_unused_setup);
> +
> static int clk_disable_unused(void)
> {
> struct clk *clk;
>
> + if (clk_ignore_unused) {
> + pr_warn("clk: Not disabling unused clocks\n");
> + return 0;
> + }
> +
> clk_prepare_lock();
>
> hlist_for_each_entry(clk, &clk_root_list, child_node)
> --
> 1.8.1.192.gc4361b8
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-28 6:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 23:39 [PATCH] clk: add option to keep boot clocks on Olof Johansson
2013-04-27 0:08 ` Randy Dunlap
2013-04-27 0:22 ` Olof Johansson
2013-04-27 18:17 ` Mike Turquette
2013-04-27 21:07 ` Olof Johansson
2013-04-27 21:10 ` [PATCH v2] clk: add clk_ignore_unused " Olof Johansson
2013-04-28 6:06 ` Mike Turquette
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).