diff mbox

[10/11] cpufreq: tegra: select CPU_FREQ_TABLE for ARCH_TEGRA

Message ID CAKohponC5pKABTi=t64ZXrHxi-Y6cbvAXtjY=_aMkka4s-MCiQ@mail.gmail.com
State Accepted
Headers show

Commit Message

Viresh Kumar June 13, 2013, 4:24 a.m. UTC
On 12 June 2013 21:20, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 06/12/2013 02:15 AM, Viresh Kumar wrote:
>> ARCH_TEGRA selects ARCH_HAS_CPUFREQ, so CPUFREQ will be enabled for all variants
>> of TEGRA. CPUFreq driver for tegra is enabled if ARCH_TEGRA is selected. Driver
>> uses APIs from freq_table.c and so we must select CPU_FREQ_TABLE for ARCH_TEGRA.
>>
>> This also removes select CPU_FREQ_TABLE from individual tegra variants.
>
> I guess the real issue here is that drivers/cpufreq/tegra-cpufreq.c gets
> built based on ARCH_TEGRA, which doesn't depend on nor select CPU_FREQ
> itself, so:
>
>         select CPU_FREQ_TABLE if CPU_FREQ
>
> ... isn't guaranteed to fire.
>
> The correct solution seems to be:
>
> * Add CONFIG_ARM_TEGRA_CPUFREQ to drivers/cpufreq/Kconfig.arm.
> * Make that Kconfig option selct CPU_FREQ_TABLE.
> * Make that Kconfig option be def_bool ARCH_TEGRA.
> * Modify drivers/cpufreq/Makefile to build tegra-cpufreq.c based on that.
> * Remove all the cpufreq-related stuff from arch/arm/mach-tegra/Kconfig.
>
> That way, tegra-cpufreq.c can't be built if !CPU_FREQ, and Tegra's
> cpufreq works the same way as all the other cpufreq drivers.

Hmmm. check this out (attached too for you to test):

----------x---------------x------------

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Wed, 12 Jun 2013 12:05:48 +0530
Subject: [PATCH] cpufreq: tegra: create CONFIG_ARM_TEGRA_CPUFREQ

currently Tegra cpufreq driver gets built based on ARCH_TEGRA, which doesn't
depend on nor select CPU_FREQ itself, so:

        select CPU_FREQ_TABLE if CPU_FREQ

... isn't guaranteed to fire.

The correct solution seems to be:

* Add CONFIG_ARM_TEGRA_CPUFREQ to drivers/cpufreq/Kconfig.arm.
* Make that Kconfig option selct CPU_FREQ_TABLE.
* Make that Kconfig option be def_bool ARCH_TEGRA.
* Modify drivers/cpufreq/Makefile to build tegra-cpufreq.c based on that.
* Remove all the cpufreq-related stuff from arch/arm/mach-tegra/Kconfig.

That way, tegra-cpufreq.c can't be built if !CPU_FREQ, and Tegra's
cpufreq works the same way as all the other cpufreq drivers.

This patch does it.

Suggested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-tegra/Kconfig | 3 ---
 drivers/cpufreq/Kconfig.arm | 8 ++++++++
 drivers/cpufreq/Makefile    | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

Stephen Warren June 13, 2013, 3:43 p.m. UTC | #1
On 06/12/2013 10:24 PM, Viresh Kumar wrote:
> On 12 June 2013 21:20, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 06/12/2013 02:15 AM, Viresh Kumar wrote:
>>> ARCH_TEGRA selects ARCH_HAS_CPUFREQ, so CPUFREQ will be enabled for all variants
>>> of TEGRA. CPUFreq driver for tegra is enabled if ARCH_TEGRA is selected. Driver
>>> uses APIs from freq_table.c and so we must select CPU_FREQ_TABLE for ARCH_TEGRA.
>>>
>>> This also removes select CPU_FREQ_TABLE from individual tegra variants.
>>
>> I guess the real issue here is that drivers/cpufreq/tegra-cpufreq.c gets
>> built based on ARCH_TEGRA, which doesn't depend on nor select CPU_FREQ
>> itself, so:
>>
>>         select CPU_FREQ_TABLE if CPU_FREQ
>>
>> ... isn't guaranteed to fire.
>>
>> The correct solution seems to be:
>>
>> * Add CONFIG_ARM_TEGRA_CPUFREQ to drivers/cpufreq/Kconfig.arm.
>> * Make that Kconfig option selct CPU_FREQ_TABLE.
>> * Make that Kconfig option be def_bool ARCH_TEGRA.
>> * Modify drivers/cpufreq/Makefile to build tegra-cpufreq.c based on that.
>> * Remove all the cpufreq-related stuff from arch/arm/mach-tegra/Kconfig.
>>
>> That way, tegra-cpufreq.c can't be built if !CPU_FREQ, and Tegra's
>> cpufreq works the same way as all the other cpufreq drivers.
> 
> Hmmm. check this out (attached too for you to test):

This certainly generates the correct .config when I "make
tegra_defconfig" after applying it, and a build after disabling CPU_FREQ
links OK, so,

Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

(I assume this patch would go through the cpufreq tree?)
Viresh Kumar June 13, 2013, 3:46 p.m. UTC | #2
On 13 June 2013 21:13, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 06/12/2013 10:24 PM, Viresh Kumar wrote:
>> On 12 June 2013 21:20, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>> On 06/12/2013 02:15 AM, Viresh Kumar wrote:
>>>> ARCH_TEGRA selects ARCH_HAS_CPUFREQ, so CPUFREQ will be enabled for all variants
>>>> of TEGRA. CPUFreq driver for tegra is enabled if ARCH_TEGRA is selected. Driver
>>>> uses APIs from freq_table.c and so we must select CPU_FREQ_TABLE for ARCH_TEGRA.
>>>>
>>>> This also removes select CPU_FREQ_TABLE from individual tegra variants.
>>>
>>> I guess the real issue here is that drivers/cpufreq/tegra-cpufreq.c gets
>>> built based on ARCH_TEGRA, which doesn't depend on nor select CPU_FREQ
>>> itself, so:
>>>
>>>         select CPU_FREQ_TABLE if CPU_FREQ
>>>
>>> ... isn't guaranteed to fire.
>>>
>>> The correct solution seems to be:
>>>
>>> * Add CONFIG_ARM_TEGRA_CPUFREQ to drivers/cpufreq/Kconfig.arm.
>>> * Make that Kconfig option selct CPU_FREQ_TABLE.
>>> * Make that Kconfig option be def_bool ARCH_TEGRA.
>>> * Modify drivers/cpufreq/Makefile to build tegra-cpufreq.c based on that.
>>> * Remove all the cpufreq-related stuff from arch/arm/mach-tegra/Kconfig.
>>>
>>> That way, tegra-cpufreq.c can't be built if !CPU_FREQ, and Tegra's
>>> cpufreq works the same way as all the other cpufreq drivers.
>>
>> Hmmm. check this out (attached too for you to test):
>
> This certainly generates the correct .config when I "make
> tegra_defconfig" after applying it, and a build after disabling CPU_FREQ
> links OK, so,

Yeah, I also compile tested it.

> Tested-by: Stephen Warren <swarren@nvidia.com>
> Acked-by: Stephen Warren <swarren@nvidia.com>
>
> (I assume this patch would go through the cpufreq tree?)

Yes. Via my ARM cpufreq tree.
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 84d72fc..5c0db06 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -28,7 +28,6 @@  config ARCH_TEGRA_2x_SOC
 	select ARM_ERRATA_754327 if SMP
 	select ARM_ERRATA_764369 if SMP
 	select ARM_GIC
-	select CPU_FREQ_TABLE if CPU_FREQ
 	select CPU_V7
 	select PINCTRL
 	select PINCTRL_TEGRA20
@@ -46,7 +45,6 @@  config ARCH_TEGRA_3x_SOC
 	select ARM_ERRATA_754322
 	select ARM_ERRATA_764369 if SMP
 	select ARM_GIC
-	select CPU_FREQ_TABLE if CPU_FREQ
 	select CPU_V7
 	select PINCTRL
 	select PINCTRL_TEGRA30
@@ -63,7 +61,6 @@  config ARCH_TEGRA_114_SOC
 	select ARM_ARCH_TIMER
 	select ARM_GIC
 	select ARM_L1_CACHE_SHIFT_6
-	select CPU_FREQ_TABLE if CPU_FREQ
 	select CPU_V7
 	select PINCTRL
 	select PINCTRL_TEGRA114
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index d52261b..5085427 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -154,3 +154,11 @@  config ARM_SPEAR_CPUFREQ
 	default y
 	help
 	  This adds the CPUFreq driver support for SPEAr SOCs.
+
+config ARM_TEGRA_CPUFREQ
+	bool "TEGRA CPUFreq support"
+	depends on ARCH_TEGRA
+	select CPU_FREQ_TABLE
+	default y
+	help
+	  This adds the CPUFreq driver support for TEGRA SOCs.
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 13c3f83..9c873e7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -71,7 +71,7 @@  obj-$(CONFIG_ARM_S5PV210_CPUFREQ)	+= s5pv210-cpufreq.o
 obj-$(CONFIG_ARM_SA1100_CPUFREQ)	+= sa1100-cpufreq.o
 obj-$(CONFIG_ARM_SA1110_CPUFREQ)	+= sa1110-cpufreq.o
 obj-$(CONFIG_ARM_SPEAR_CPUFREQ)		+= spear-cpufreq.o
-obj-$(CONFIG_ARCH_TEGRA)		+= tegra-cpufreq.o
+obj-$(CONFIG_ARM_TEGRA_CPUFREQ)		+= tegra-cpufreq.o

 ##################################################################################
 # PowerPC platform drivers