Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-07 Thread Viresh Kumar
On 7 March 2013 19:49, Russell King - ARM Linux  wrote:
> So how is this different from any other clock which may also return zero
> from its clk_get_rate() ?
>
> If that's the condition you want to check for, call clk_get_rate() after
> a successful clk_get*() and check for the condition.  Don't go treating
> the cookie somehow specially.  You're *assuming* a behaviour that is
> inappropriate for the side of the interface you're working with.

Okay. I will replace the earlier fixup with following:

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index fdf54a9..87b7e48 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -9,8 +9,7 @@ config ARM_BIG_LITTLE_CPUFREQ
 config ARM_DT_BL_CPUFREQ
tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
select ARM_BIG_LITTLE_CPUFREQ
-   depends on OF
-   default n
+   depends on OF && HAVE_CLK
help
  This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
  This gets frequency tables from DT.
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 2486b9a..a41fd89 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -147,7 +147,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)

 static int get_cluster_clk_and_freq_table(u32 cluster)
 {
-   char name[9] = "cluster";
+   char name[9] = "cpu-cluster";
int count;

if (atomic_inc_return(_usage[cluster]) != 1)


For more clarity i will resend this patch now will all updates.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-07 Thread Russell King - ARM Linux
On Thu, Mar 07, 2013 at 10:03:28AM +0800, Viresh Kumar wrote:
> On 7 March 2013 08:51, Russell King - ARM Linux  
> wrote:
> > On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
> >> On 5 March 2013 18:52, Russell King - ARM Linux  
> >> wrote:
> >> > On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
> >> >> + clk[cluster] = clk_get(NULL, name);
> >> >> + if (!IS_ERR_OR_NULL(clk[cluster])) {
> >> >
> >> > NAK.  Two reasons.
> >> >
> >> > 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
> >> >times.
> >>
> >> Hey, i had a second thought about this one and i have some other opinion
> >> here. This is a cpufreq driver and we need clock support for sure here, we
> >> can't work without it. And so here is the latest fixup:
> >
> > NAK.  You just don't understand.
> 
> Poor me!!
> 
> I still remember the huge discussions we had during "clk: Add non
> CONFIG_HAVE_CLK routines" patchset.
> 
> For others: https://lkml.org/lkml/2012/4/24/389
> 
> Back to the discussion, I understand that clk_get() just returns a cookie and
> NULL is not an error and so it shouldn't be treated specially. And that's what
> we do with most of our drivers as all other clk routines (clk_get[set]_rate())
> have safe guards against the NULL clk, and they wouldn't complain.
> 
> The special case we have in a cpufreq driver is, we can't work with
> zero returned
> from clk_get_rate()... That will make cpufreq driver work badly.

So how is this different from any other clock which may also return zero
from its clk_get_rate() ?

If that's the condition you want to check for, call clk_get_rate() after
a successful clk_get*() and check for the condition.  Don't go treating
the cookie somehow specially.  You're *assuming* a behaviour that is
inappropriate for the side of the interface you're working with.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-07 Thread Russell King - ARM Linux
On Thu, Mar 07, 2013 at 10:03:28AM +0800, Viresh Kumar wrote:
 On 7 March 2013 08:51, Russell King - ARM Linux li...@arm.linux.org.uk 
 wrote:
  On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
  On 5 March 2013 18:52, Russell King - ARM Linux li...@arm.linux.org.uk 
  wrote:
   On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
   + clk[cluster] = clk_get(NULL, name);
   + if (!IS_ERR_OR_NULL(clk[cluster])) {
  
   NAK.  Two reasons.
  
   1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
  times.
 
  Hey, i had a second thought about this one and i have some other opinion
  here. This is a cpufreq driver and we need clock support for sure here, we
  can't work without it. And so here is the latest fixup:
 
  NAK.  You just don't understand.
 
 Poor me!!
 
 I still remember the huge discussions we had during clk: Add non
 CONFIG_HAVE_CLK routines patchset.
 
 For others: https://lkml.org/lkml/2012/4/24/389
 
 Back to the discussion, I understand that clk_get() just returns a cookie and
 NULL is not an error and so it shouldn't be treated specially. And that's what
 we do with most of our drivers as all other clk routines (clk_get[set]_rate())
 have safe guards against the NULL clk, and they wouldn't complain.
 
 The special case we have in a cpufreq driver is, we can't work with
 zero returned
 from clk_get_rate()... That will make cpufreq driver work badly.

So how is this different from any other clock which may also return zero
from its clk_get_rate() ?

If that's the condition you want to check for, call clk_get_rate() after
a successful clk_get*() and check for the condition.  Don't go treating
the cookie somehow specially.  You're *assuming* a behaviour that is
inappropriate for the side of the interface you're working with.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-07 Thread Viresh Kumar
On 7 March 2013 19:49, Russell King - ARM Linux li...@arm.linux.org.uk wrote:
 So how is this different from any other clock which may also return zero
 from its clk_get_rate() ?

 If that's the condition you want to check for, call clk_get_rate() after
 a successful clk_get*() and check for the condition.  Don't go treating
 the cookie somehow specially.  You're *assuming* a behaviour that is
 inappropriate for the side of the interface you're working with.

Okay. I will replace the earlier fixup with following:

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index fdf54a9..87b7e48 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -9,8 +9,7 @@ config ARM_BIG_LITTLE_CPUFREQ
 config ARM_DT_BL_CPUFREQ
tristate Generic ARM big LITTLE CPUfreq driver probed via DT
select ARM_BIG_LITTLE_CPUFREQ
-   depends on OF
-   default n
+   depends on OF  HAVE_CLK
help
  This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
  This gets frequency tables from DT.
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 2486b9a..a41fd89 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -147,7 +147,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)

 static int get_cluster_clk_and_freq_table(u32 cluster)
 {
-   char name[9] = cluster;
+   char name[9] = cpu-cluster;
int count;

if (atomic_inc_return(cluster_usage[cluster]) != 1)


For more clarity i will resend this patch now will all updates.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 09:50, Olof Johansson  wrote:
> On Wed, Mar 6, 2013 at 5:46 PM, Olof Johansson  wrote:
>
>> This binding makes no sense to me. It needs to be substantially better
>> documented, not just a couple of sentences that people that understand
>> bit.LITTLE thoroughly can make sense of.
>>
>> It also duplicates the cpu binding. I suspect this should instead be done
>> through additions of the cpu bindings instead of duplication. So this needs 
>> to
>> be substantially reworked.

Actually, i wasn't getting in new bindings for cpu/cluster for big
LITTLE but was
just trying to get bindings for getting freq-table for cpufreq driver.

Lorenzo (cc'd) actually has a patch for getting the bindings in and he
is looking
to send them soon. I know these can change after some review and the plan was
i will fix cpufreq bindings again once that patch is in. We don't have
any mainlined
hardware for it for now and so it wouldn't break anything.

> Also, _ALWAYS_ cc devicetree-discuss on new bindings. get_maintainer
> tells you to do so.

I knew it and i messed up with it. Will surely take care of it next time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 08:51, Russell King - ARM Linux  wrote:
> On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
>> On 5 March 2013 18:52, Russell King - ARM Linux  
>> wrote:
>> > On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
>> >> + clk[cluster] = clk_get(NULL, name);
>> >> + if (!IS_ERR_OR_NULL(clk[cluster])) {
>> >
>> > NAK.  Two reasons.
>> >
>> > 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
>> >times.
>>
>> Hey, i had a second thought about this one and i have some other opinion
>> here. This is a cpufreq driver and we need clock support for sure here, we
>> can't work without it. And so here is the latest fixup:
>
> NAK.  You just don't understand.

Poor me!!

I still remember the huge discussions we had during "clk: Add non
CONFIG_HAVE_CLK routines" patchset.

For others: https://lkml.org/lkml/2012/4/24/389

Back to the discussion, I understand that clk_get() just returns a cookie and
NULL is not an error and so it shouldn't be treated specially. And that's what
we do with most of our drivers as all other clk routines (clk_get[set]_rate())
have safe guards against the NULL clk, and they wouldn't complain.

The special case we have in a cpufreq driver is, we can't work with
zero returned
from clk_get_rate()... That will make cpufreq driver work badly.

And that's why i got two additions
- depends on HAVE_CLK
- and using IS_ERR_OR_NULL

as NULL returned from clk_get is not a error but is not acceptable to
the cpufreq
driver.

Because i now have the HAVE_CLK dependency i am not sure if we can get NULL
returned from clk_get() at all. Can you get around something here?

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Olof Johansson
On Wed, Mar 6, 2013 at 5:46 PM, Olof Johansson  wrote:

> This binding makes no sense to me. It needs to be substantially better
> documented, not just a couple of sentences that people that understand
> bit.LITTLE thoroughly can make sense of.
>
> It also duplicates the cpu binding. I suspect this should instead be done
> through additions of the cpu bindings instead of duplication. So this needs to
> be substantially reworked.

Also, _ALWAYS_ cc devicetree-discuss on new bindings. get_maintainer
tells you to do so.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Olof Johansson
On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
> +++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
> @@ -0,0 +1,29 @@
> +Generic ARM big LITTLE cpufreq driver's DT glue
> +---
> +
> +It is DT specific glue layer for generic cpufreq driver for big LITTLE 
> systems.
> +
> +Both required and optional properties listed below must be defined under node
> +cluster*. * can be 0 or 1.
> +
> +Required properties:
> +- freqs: List of all supported frequencies.
> +
> +Optional properties:
> +- clock-latency: Specify the possible maximum transition latency for clock, 
> in
> +  unit of nanoseconds.
> +
> +Examples:
> +
> +cluster0: cluster@0 {
> +..
> +
> + freqs = <5 6 7 8 9 10 
> 11 12>;
> + clock-latency = <20>;
> +
> + ..
> +
> +cores {
> + ..
> +};
> +};

This binding makes no sense to me. It needs to be substantially better
documented, not just a couple of sentences that people that understand
bit.LITTLE thoroughly can make sense of.

It also duplicates the cpu binding. I suspect this should instead be done
through additions of the cpu bindings instead of duplication. So this needs to
be substantially reworked.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 08:49, Harvey Harrison  wrote:
> On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar  wrote:
>
>> clk[cluster] = clk_get_sys(name, NULL);
>> -   if (!IS_ERR(clk[cluster])) {
>> +   if (!IS_ERR_OR_NULL(clk[cluster])) {
>> pr_debug("%s: clk: %p & freq table: %p, cluster: %d\n",
>> __func__, clk[cluster], freq_table[cluster],
>> cluster);
>
>
> You seem pretty attached to IS_ERR_OR_NULL here.

Haha. Not really. I just wanted to get more logical conclusion out. Please check
the other mail (where i would reply to Russell), which might have more
discussion
around this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Russell King - ARM Linux
On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
> On 5 March 2013 18:52, Russell King - ARM Linux  
> wrote:
> > On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
> >> + clk[cluster] = clk_get(NULL, name);
> >> + if (!IS_ERR_OR_NULL(clk[cluster])) {
> >
> > NAK.  Two reasons.
> >
> > 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
> >times.
> 
> Hey, i had a second thought about this one and i have some other opinion
> here. This is a cpufreq driver and we need clock support for sure here, we
> can't work without it. And so here is the latest fixup:

NAK.  You just don't understand.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Harvey Harrison
On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar  wrote:

> clk[cluster] = clk_get_sys(name, NULL);
> -   if (!IS_ERR(clk[cluster])) {
> +   if (!IS_ERR_OR_NULL(clk[cluster])) {
> pr_debug("%s: clk: %p & freq table: %p, cluster: %d\n",
> __func__, clk[cluster], freq_table[cluster],
> cluster);


You seem pretty attached to IS_ERR_OR_NULL here.

Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 5 March 2013 18:52, Russell King - ARM Linux  wrote:
> On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
>> + clk[cluster] = clk_get(NULL, name);
>> + if (!IS_ERR_OR_NULL(clk[cluster])) {
>
> NAK.  Two reasons.
>
> 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
>times.

Hey, i had a second thought about this one and i have some other opinion
here. This is a cpufreq driver and we need clock support for sure here, we
can't work without it. And so here is the latest fixup:

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index fdf54a9..87b7e48 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -9,8 +9,7 @@ config ARM_BIG_LITTLE_CPUFREQ
 config ARM_DT_BL_CPUFREQ
tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
select ARM_BIG_LITTLE_CPUFREQ
-   depends on OF
-   default n
+   depends on OF && HAVE_CLK
help
  This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
  This gets frequency tables from DT.
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 2486b9a..d1fdc65 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -147,7 +147,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)

 static int get_cluster_clk_and_freq_table(u32 cluster)
 {
-   char name[9] = "cluster";
+   char name[9] = "cpu-cluster";
int count;

if (atomic_inc_return(_usage[cluster]) != 1)
@@ -159,7 +159,7 @@ static int get_cluster_clk_and_freq_table(u32 cluster)

name[7] = cluster + '0';
clk[cluster] = clk_get_sys(name, NULL);
-   if (!IS_ERR(clk[cluster])) {
+   if (!IS_ERR_OR_NULL(clk[cluster])) {
pr_debug("%s: clk: %p & freq table: %p, cluster: %d\n",
__func__, clk[cluster], freq_table[cluster],
cluster);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 01:25, Russell King - ARM Linux  wrote:
> On Wed, Mar 06, 2013 at 12:38:36AM +0800, Viresh Kumar wrote:
>> So how does below fix look to you?
>
> Much better, but I think you want a better device name than just "clusterN".

I will try to find some other name, maybe cpu-cluster (as what you suggested
initially).

> Also, please get rid of that "default n" - n is the default default default
> default default default there's no need to specify it. :)

Ok :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Russell King - ARM Linux
On Wed, Mar 06, 2013 at 12:38:36AM +0800, Viresh Kumar wrote:
> So how does below fix look to you?

Much better, but I think you want a better device name than just "clusterN".

Also, please get rid of that "default n" - n is the default default default
default default default there's no need to specify it. :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Russell King - ARM Linux
On Wed, Mar 06, 2013 at 12:38:36AM +0800, Viresh Kumar wrote:
 So how does below fix look to you?

Much better, but I think you want a better device name than just clusterN.

Also, please get rid of that default n - n is the default default default
default default default there's no need to specify it. :)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 01:25, Russell King - ARM Linux li...@arm.linux.org.uk wrote:
 On Wed, Mar 06, 2013 at 12:38:36AM +0800, Viresh Kumar wrote:
 So how does below fix look to you?

 Much better, but I think you want a better device name than just clusterN.

I will try to find some other name, maybe cpu-cluster (as what you suggested
initially).

 Also, please get rid of that default n - n is the default default default
 default default default there's no need to specify it. :)

Ok :)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 5 March 2013 18:52, Russell King - ARM Linux li...@arm.linux.org.uk wrote:
 On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
 + clk[cluster] = clk_get(NULL, name);
 + if (!IS_ERR_OR_NULL(clk[cluster])) {

 NAK.  Two reasons.

 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
times.

Hey, i had a second thought about this one and i have some other opinion
here. This is a cpufreq driver and we need clock support for sure here, we
can't work without it. And so here is the latest fixup:

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index fdf54a9..87b7e48 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -9,8 +9,7 @@ config ARM_BIG_LITTLE_CPUFREQ
 config ARM_DT_BL_CPUFREQ
tristate Generic ARM big LITTLE CPUfreq driver probed via DT
select ARM_BIG_LITTLE_CPUFREQ
-   depends on OF
-   default n
+   depends on OF  HAVE_CLK
help
  This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
  This gets frequency tables from DT.
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 2486b9a..d1fdc65 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -147,7 +147,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)

 static int get_cluster_clk_and_freq_table(u32 cluster)
 {
-   char name[9] = cluster;
+   char name[9] = cpu-cluster;
int count;

if (atomic_inc_return(cluster_usage[cluster]) != 1)
@@ -159,7 +159,7 @@ static int get_cluster_clk_and_freq_table(u32 cluster)

name[7] = cluster + '0';
clk[cluster] = clk_get_sys(name, NULL);
-   if (!IS_ERR(clk[cluster])) {
+   if (!IS_ERR_OR_NULL(clk[cluster])) {
pr_debug(%s: clk: %p  freq table: %p, cluster: %d\n,
__func__, clk[cluster], freq_table[cluster],
cluster);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Harvey Harrison
On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar viresh.ku...@linaro.org wrote:

 clk[cluster] = clk_get_sys(name, NULL);
 -   if (!IS_ERR(clk[cluster])) {
 +   if (!IS_ERR_OR_NULL(clk[cluster])) {
 pr_debug(%s: clk: %p  freq table: %p, cluster: %d\n,
 __func__, clk[cluster], freq_table[cluster],
 cluster);


You seem pretty attached to IS_ERR_OR_NULL here.

Harvey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Russell King - ARM Linux
On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
 On 5 March 2013 18:52, Russell King - ARM Linux li...@arm.linux.org.uk 
 wrote:
  On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
  + clk[cluster] = clk_get(NULL, name);
  + if (!IS_ERR_OR_NULL(clk[cluster])) {
 
  NAK.  Two reasons.
 
  1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
 times.
 
 Hey, i had a second thought about this one and i have some other opinion
 here. This is a cpufreq driver and we need clock support for sure here, we
 can't work without it. And so here is the latest fixup:

NAK.  You just don't understand.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 08:49, Harvey Harrison harvey.harri...@gmail.com wrote:
 On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar viresh.ku...@linaro.org wrote:

 clk[cluster] = clk_get_sys(name, NULL);
 -   if (!IS_ERR(clk[cluster])) {
 +   if (!IS_ERR_OR_NULL(clk[cluster])) {
 pr_debug(%s: clk: %p  freq table: %p, cluster: %d\n,
 __func__, clk[cluster], freq_table[cluster],
 cluster);


 You seem pretty attached to IS_ERR_OR_NULL here.

Haha. Not really. I just wanted to get more logical conclusion out. Please check
the other mail (where i would reply to Russell), which might have more
discussion
around this.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Olof Johansson
On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
 +++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
 @@ -0,0 +1,29 @@
 +Generic ARM big LITTLE cpufreq driver's DT glue
 +---
 +
 +It is DT specific glue layer for generic cpufreq driver for big LITTLE 
 systems.
 +
 +Both required and optional properties listed below must be defined under node
 +cluster*. * can be 0 or 1.
 +
 +Required properties:
 +- freqs: List of all supported frequencies.
 +
 +Optional properties:
 +- clock-latency: Specify the possible maximum transition latency for clock, 
 in
 +  unit of nanoseconds.
 +
 +Examples:
 +
 +cluster0: cluster@0 {
 +..
 +
 + freqs = 5 6 7 8 9 10 
 11 12;
 + clock-latency = 20;
 +
 + ..
 +
 +cores {
 + ..
 +};
 +};

This binding makes no sense to me. It needs to be substantially better
documented, not just a couple of sentences that people that understand
bit.LITTLE thoroughly can make sense of.

It also duplicates the cpu binding. I suspect this should instead be done
through additions of the cpu bindings instead of duplication. So this needs to
be substantially reworked.


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Olof Johansson
On Wed, Mar 6, 2013 at 5:46 PM, Olof Johansson o...@lixom.net wrote:

 This binding makes no sense to me. It needs to be substantially better
 documented, not just a couple of sentences that people that understand
 bit.LITTLE thoroughly can make sense of.

 It also duplicates the cpu binding. I suspect this should instead be done
 through additions of the cpu bindings instead of duplication. So this needs to
 be substantially reworked.

Also, _ALWAYS_ cc devicetree-discuss on new bindings. get_maintainer
tells you to do so.


-Olof
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 08:51, Russell King - ARM Linux li...@arm.linux.org.uk wrote:
 On Thu, Mar 07, 2013 at 08:32:37AM +0800, Viresh Kumar wrote:
 On 5 March 2013 18:52, Russell King - ARM Linux li...@arm.linux.org.uk 
 wrote:
  On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
  + clk[cluster] = clk_get(NULL, name);
  + if (!IS_ERR_OR_NULL(clk[cluster])) {
 
  NAK.  Two reasons.
 
  1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
 times.

 Hey, i had a second thought about this one and i have some other opinion
 here. This is a cpufreq driver and we need clock support for sure here, we
 can't work without it. And so here is the latest fixup:

 NAK.  You just don't understand.

Poor me!!

I still remember the huge discussions we had during clk: Add non
CONFIG_HAVE_CLK routines patchset.

For others: https://lkml.org/lkml/2012/4/24/389

Back to the discussion, I understand that clk_get() just returns a cookie and
NULL is not an error and so it shouldn't be treated specially. And that's what
we do with most of our drivers as all other clk routines (clk_get[set]_rate())
have safe guards against the NULL clk, and they wouldn't complain.

The special case we have in a cpufreq driver is, we can't work with
zero returned
from clk_get_rate()... That will make cpufreq driver work badly.

And that's why i got two additions
- depends on HAVE_CLK
- and using IS_ERR_OR_NULL

as NULL returned from clk_get is not a error but is not acceptable to
the cpufreq
driver.

Because i now have the HAVE_CLK dependency i am not sure if we can get NULL
returned from clk_get() at all. Can you get around something here?

--
viresh
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Viresh Kumar
On 7 March 2013 09:50, Olof Johansson o...@lixom.net wrote:
 On Wed, Mar 6, 2013 at 5:46 PM, Olof Johansson o...@lixom.net wrote:

 This binding makes no sense to me. It needs to be substantially better
 documented, not just a couple of sentences that people that understand
 bit.LITTLE thoroughly can make sense of.

 It also duplicates the cpu binding. I suspect this should instead be done
 through additions of the cpu bindings instead of duplication. So this needs 
 to
 be substantially reworked.

Actually, i wasn't getting in new bindings for cpu/cluster for big
LITTLE but was
just trying to get bindings for getting freq-table for cpufreq driver.

Lorenzo (cc'd) actually has a patch for getting the bindings in and he
is looking
to send them soon. I know these can change after some review and the plan was
i will fix cpufreq bindings again once that patch is in. We don't have
any mainlined
hardware for it for now and so it wouldn't break anything.

 Also, _ALWAYS_ cc devicetree-discuss on new bindings. get_maintainer
 tells you to do so.

I knew it and i messed up with it. Will surely take care of it next time.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-05 Thread Viresh Kumar
On 5 March 2013 18:52, Russell King - ARM Linux  wrote:
> On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
>> +static void put_cluster_clk_and_freq_table(u32 cluster)
>> +{
>> + if (!atomic_dec_return(_usage[cluster])) {
>> + clk_put(clk[cluster]);
>> + clk[cluster] = NULL;
>
> What's the point in setting the clk to NULL?

I couldn't find one and the same is true for freq_table[] too.

>> +static int get_cluster_clk_and_freq_table(u32 cluster)
>> +{
>> + char name[9] = "cluster";
>> + int count;
>> +
>> + if (atomic_inc_return(_usage[cluster]) != 1)
>> + return 0;
>> +
>> + freq_table[cluster] = arm_bL_ops->get_freq_tbl(cluster, );
>> + if (!freq_table[cluster])
>> + goto atomic_dec;
>> +
>> + name[7] = cluster + '0';
>> + clk[cluster] = clk_get(NULL, name);
>> + if (!IS_ERR_OR_NULL(clk[cluster])) {
>
> NAK.  Two reasons.
>
> 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
>times.

AAHH .. How can i mess up with this concept.. I am really feeling bad now.

> 2. Maybe clk_get_sys() rather than clk_get() and use a sensible device
>name ("cpu-cluster.%u" maybe) rather than a connection name with a
>NULL device?

That's a good comment (rather than pointing at some stupid mistake), I will
probably keep the same name for the device as well.

So how does below fix look to you?

--x-x-
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 0d6de0e..2486b9a 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -140,9 +140,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)
 {
if (!atomic_dec_return(_usage[cluster])) {
clk_put(clk[cluster]);
-   clk[cluster] = NULL;
arm_bL_ops->put_freq_tbl(cluster);
-   freq_table[cluster] = NULL;
pr_debug("%s: cluster: %d\n", __func__, cluster);
}
 }
@@ -160,8 +158,8 @@ static int get_cluster_clk_and_freq_table(u32 cluster)
goto atomic_dec;

name[7] = cluster + '0';
-   clk[cluster] = clk_get(NULL, name);
-   if (!IS_ERR_OR_NULL(clk[cluster])) {
+   clk[cluster] = clk_get_sys(name, NULL);
+   if (!IS_ERR(clk[cluster])) {
pr_debug("%s: clk: %p & freq table: %p, cluster: %d\n",
__func__, clk[cluster], freq_table[cluster],
cluster);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-05 Thread Russell King - ARM Linux
On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
> +static void put_cluster_clk_and_freq_table(u32 cluster)
> +{
> + if (!atomic_dec_return(_usage[cluster])) {
> + clk_put(clk[cluster]);
> + clk[cluster] = NULL;

What's the point in setting the clk to NULL?

> +static int get_cluster_clk_and_freq_table(u32 cluster)
> +{
> + char name[9] = "cluster";
> + int count;
> +
> + if (atomic_inc_return(_usage[cluster]) != 1)
> + return 0;
> +
> + freq_table[cluster] = arm_bL_ops->get_freq_tbl(cluster, );
> + if (!freq_table[cluster])
> + goto atomic_dec;
> +
> + name[7] = cluster + '0';
> + clk[cluster] = clk_get(NULL, name);
> + if (!IS_ERR_OR_NULL(clk[cluster])) {

NAK.  Two reasons.

1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
   times.

2. Maybe clk_get_sys() rather than clk_get() and use a sensible device
   name ("cpu-cluster.%u" maybe) rather than a connection name with a
   NULL device?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-05 Thread Russell King - ARM Linux
On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
 +static void put_cluster_clk_and_freq_table(u32 cluster)
 +{
 + if (!atomic_dec_return(cluster_usage[cluster])) {
 + clk_put(clk[cluster]);
 + clk[cluster] = NULL;

What's the point in setting the clk to NULL?

 +static int get_cluster_clk_and_freq_table(u32 cluster)
 +{
 + char name[9] = cluster;
 + int count;
 +
 + if (atomic_inc_return(cluster_usage[cluster]) != 1)
 + return 0;
 +
 + freq_table[cluster] = arm_bL_ops-get_freq_tbl(cluster, count);
 + if (!freq_table[cluster])
 + goto atomic_dec;
 +
 + name[7] = cluster + '0';
 + clk[cluster] = clk_get(NULL, name);
 + if (!IS_ERR_OR_NULL(clk[cluster])) {

NAK.  Two reasons.

1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
   times.

2. Maybe clk_get_sys() rather than clk_get() and use a sensible device
   name (cpu-cluster.%u maybe) rather than a connection name with a
   NULL device?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-05 Thread Viresh Kumar
On 5 March 2013 18:52, Russell King - ARM Linux li...@arm.linux.org.uk wrote:
 On Tue, Mar 05, 2013 at 12:52:41PM +0800, Viresh Kumar wrote:
 +static void put_cluster_clk_and_freq_table(u32 cluster)
 +{
 + if (!atomic_dec_return(cluster_usage[cluster])) {
 + clk_put(clk[cluster]);
 + clk[cluster] = NULL;

 What's the point in setting the clk to NULL?

I couldn't find one and the same is true for freq_table[] too.

 +static int get_cluster_clk_and_freq_table(u32 cluster)
 +{
 + char name[9] = cluster;
 + int count;
 +
 + if (atomic_inc_return(cluster_usage[cluster]) != 1)
 + return 0;
 +
 + freq_table[cluster] = arm_bL_ops-get_freq_tbl(cluster, count);
 + if (!freq_table[cluster])
 + goto atomic_dec;
 +
 + name[7] = cluster + '0';
 + clk[cluster] = clk_get(NULL, name);
 + if (!IS_ERR_OR_NULL(clk[cluster])) {

 NAK.  Two reasons.

 1. IS_ERR_OR_NULL.  You know about this, it's been on the list several
times.

AAHH .. How can i mess up with this concept.. I am really feeling bad now.

 2. Maybe clk_get_sys() rather than clk_get() and use a sensible device
name (cpu-cluster.%u maybe) rather than a connection name with a
NULL device?

That's a good comment (rather than pointing at some stupid mistake), I will
probably keep the same name for the device as well.

So how does below fix look to you?

--x-x-
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 0d6de0e..2486b9a 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -140,9 +140,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)
 {
if (!atomic_dec_return(cluster_usage[cluster])) {
clk_put(clk[cluster]);
-   clk[cluster] = NULL;
arm_bL_ops-put_freq_tbl(cluster);
-   freq_table[cluster] = NULL;
pr_debug(%s: cluster: %d\n, __func__, cluster);
}
 }
@@ -160,8 +158,8 @@ static int get_cluster_clk_and_freq_table(u32 cluster)
goto atomic_dec;

name[7] = cluster + '0';
-   clk[cluster] = clk_get(NULL, name);
-   if (!IS_ERR_OR_NULL(clk[cluster])) {
+   clk[cluster] = clk_get_sys(name, NULL);
+   if (!IS_ERR(clk[cluster])) {
pr_debug(%s: clk: %p  freq table: %p, cluster: %d\n,
__func__, clk[cluster], freq_table[cluster],
cluster);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-04 Thread Viresh Kumar
big LITTLE is ARM's new Architecture focussing power/performance needs of modern
world. More information about big LITTLE can be found here:

http://www.arm.com/products/processors/technologies/biglittleprocessing.php
http://lwn.net/Articles/481055/

In order to keep cpufreq support for all big LITTLE platforms simple/generic,
this patch tries to add a generic cpufreq driver layer for all big LITTLE
platforms.

The driver is divided into two parts:
- Core driver: Generic and shared across all big LITTLE SoC's
- Glue drivers: Per platform drivers providing ops to the core driver

This patch adds in a generic glue driver which would extract information from
Device Tree.

Future SoC's can either reuse the DT glue or write their own depending on the
need.

Signed-off-by: Sudeep KarkadaNagesha 
Signed-off-by: Viresh Kumar 
---

This is pushed here:

http://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/cpufreq-biglittle

 .../bindings/cpufreq/arm_big_little_dt.txt |  29 +++
 MAINTAINERS|  11 +
 drivers/cpufreq/Kconfig.arm|  13 +
 drivers/cpufreq/Makefile   |   4 +
 drivers/cpufreq/arm_big_little.c   | 278 +
 drivers/cpufreq/arm_big_little.h   |  40 +++
 drivers/cpufreq/arm_big_little_dt.c| 125 +
 7 files changed, 500 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
 create mode 100644 drivers/cpufreq/arm_big_little.c
 create mode 100644 drivers/cpufreq/arm_big_little.h
 create mode 100644 drivers/cpufreq/arm_big_little_dt.c

diff --git a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt 
b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
new file mode 100644
index 000..6f534eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
@@ -0,0 +1,29 @@
+Generic ARM big LITTLE cpufreq driver's DT glue
+---
+
+It is DT specific glue layer for generic cpufreq driver for big LITTLE systems.
+
+Both required and optional properties listed below must be defined under node
+cluster*. * can be 0 or 1.
+
+Required properties:
+- freqs: List of all supported frequencies.
+
+Optional properties:
+- clock-latency: Specify the possible maximum transition latency for clock, in
+  unit of nanoseconds.
+
+Examples:
+
+cluster0: cluster@0 {
+..
+
+   freqs = <5 6 7 8 9 10 
11 12>;
+   clock-latency = <20>;
+
+   ..
+
+cores {
+   ..
+};
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 554fd30..b14b749 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2206,6 +2206,17 @@ S:   Maintained
 F: drivers/cpufreq/
 F: include/linux/cpufreq.h
 
+CPU FREQUENCY DRIVERS - ARM BIG LITTLE
+M: Viresh Kumar 
+M: Sudeep KarkadaNagesha 
+L: cpuf...@vger.kernel.org
+L: linux...@vger.kernel.org
+W: 
http://www.arm.com/products/processors/technologies/biglittleprocessing.php
+S: Maintained
+F: drivers/cpufreq/arm_big_little.h
+F: drivers/cpufreq/arm_big_little.c
+F: drivers/cpufreq/arm_big_little_dt.c
+
 CPUID/MSR DRIVER
 M: "H. Peter Anvin" 
 S: Maintained
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 030ddf6..fdf54a9 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -2,6 +2,19 @@
 # ARM CPU Frequency scaling drivers
 #
 
+config ARM_BIG_LITTLE_CPUFREQ
+   tristate
+   depends on ARM_CPU_TOPOLOGY
+
+config ARM_DT_BL_CPUFREQ
+   tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
+   select ARM_BIG_LITTLE_CPUFREQ
+   depends on OF
+   default n
+   help
+ This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
+ This gets frequency tables from DT.
+
 config ARM_OMAP2PLUS_CPUFREQ
bool "TI OMAP2+"
depends on ARCH_OMAP2PLUS
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 863fd18..d1b0832 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -44,6 +44,10 @@ obj-$(CONFIG_X86_INTEL_PSTATE)   += 
intel_pstate.o
 
 
##
 # ARM SoC drivers
+obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ)   += arm_big_little.o
+# big LITTLE per platform glues. Keep DT_BL_CPUFREQ as the last entry in all 
big
+# LITTLE drivers, so that it is probed last.
+obj-$(CONFIG_ARM_DT_BL_CPUFREQ)+= arm_big_little_dt.o
 obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o
 obj-$(CONFIG_ARM_S3C2416_CPUFREQ)  += s3c2416-cpufreq.o
 obj-$(CONFIG_ARM_S3C64XX_CPUFREQ)  += s3c64xx-cpufreq.o
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
new file mode 100644
index 

[PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-04 Thread Viresh Kumar
big LITTLE is ARM's new Architecture focussing power/performance needs of modern
world. More information about big LITTLE can be found here:

http://www.arm.com/products/processors/technologies/biglittleprocessing.php
http://lwn.net/Articles/481055/

In order to keep cpufreq support for all big LITTLE platforms simple/generic,
this patch tries to add a generic cpufreq driver layer for all big LITTLE
platforms.

The driver is divided into two parts:
- Core driver: Generic and shared across all big LITTLE SoC's
- Glue drivers: Per platform drivers providing ops to the core driver

This patch adds in a generic glue driver which would extract information from
Device Tree.

Future SoC's can either reuse the DT glue or write their own depending on the
need.

Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
Signed-off-by: Viresh Kumar viresh.ku...@linaro.org
---

This is pushed here:

http://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/cpufreq-biglittle

 .../bindings/cpufreq/arm_big_little_dt.txt |  29 +++
 MAINTAINERS|  11 +
 drivers/cpufreq/Kconfig.arm|  13 +
 drivers/cpufreq/Makefile   |   4 +
 drivers/cpufreq/arm_big_little.c   | 278 +
 drivers/cpufreq/arm_big_little.h   |  40 +++
 drivers/cpufreq/arm_big_little_dt.c| 125 +
 7 files changed, 500 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
 create mode 100644 drivers/cpufreq/arm_big_little.c
 create mode 100644 drivers/cpufreq/arm_big_little.h
 create mode 100644 drivers/cpufreq/arm_big_little_dt.c

diff --git a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt 
b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
new file mode 100644
index 000..6f534eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
@@ -0,0 +1,29 @@
+Generic ARM big LITTLE cpufreq driver's DT glue
+---
+
+It is DT specific glue layer for generic cpufreq driver for big LITTLE systems.
+
+Both required and optional properties listed below must be defined under node
+cluster*. * can be 0 or 1.
+
+Required properties:
+- freqs: List of all supported frequencies.
+
+Optional properties:
+- clock-latency: Specify the possible maximum transition latency for clock, in
+  unit of nanoseconds.
+
+Examples:
+
+cluster0: cluster@0 {
+..
+
+   freqs = 5 6 7 8 9 10 
11 12;
+   clock-latency = 20;
+
+   ..
+
+cores {
+   ..
+};
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 554fd30..b14b749 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2206,6 +2206,17 @@ S:   Maintained
 F: drivers/cpufreq/
 F: include/linux/cpufreq.h
 
+CPU FREQUENCY DRIVERS - ARM BIG LITTLE
+M: Viresh Kumar viresh.ku...@linaro.org
+M: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
+L: cpuf...@vger.kernel.org
+L: linux...@vger.kernel.org
+W: 
http://www.arm.com/products/processors/technologies/biglittleprocessing.php
+S: Maintained
+F: drivers/cpufreq/arm_big_little.h
+F: drivers/cpufreq/arm_big_little.c
+F: drivers/cpufreq/arm_big_little_dt.c
+
 CPUID/MSR DRIVER
 M: H. Peter Anvin h...@zytor.com
 S: Maintained
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 030ddf6..fdf54a9 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -2,6 +2,19 @@
 # ARM CPU Frequency scaling drivers
 #
 
+config ARM_BIG_LITTLE_CPUFREQ
+   tristate
+   depends on ARM_CPU_TOPOLOGY
+
+config ARM_DT_BL_CPUFREQ
+   tristate Generic ARM big LITTLE CPUfreq driver probed via DT
+   select ARM_BIG_LITTLE_CPUFREQ
+   depends on OF
+   default n
+   help
+ This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
+ This gets frequency tables from DT.
+
 config ARM_OMAP2PLUS_CPUFREQ
bool TI OMAP2+
depends on ARCH_OMAP2PLUS
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 863fd18..d1b0832 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -44,6 +44,10 @@ obj-$(CONFIG_X86_INTEL_PSTATE)   += 
intel_pstate.o
 
 
##
 # ARM SoC drivers
+obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ)   += arm_big_little.o
+# big LITTLE per platform glues. Keep DT_BL_CPUFREQ as the last entry in all 
big
+# LITTLE drivers, so that it is probed last.
+obj-$(CONFIG_ARM_DT_BL_CPUFREQ)+= arm_big_little_dt.o
 obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o
 obj-$(CONFIG_ARM_S3C2416_CPUFREQ)  += s3c2416-cpufreq.o
 obj-$(CONFIG_ARM_S3C64XX_CPUFREQ)  += s3c64xx-cpufreq.o
diff