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

Message ID 881257c10f24b5ca8721b561726bac8887dc922e.1371022830.git.viresh.kumar@linaro.org
State Accepted
Headers show

Commit Message

Viresh Kumar June 12, 2013, 8:15 a.m.
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.

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-tegra/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Stephen Warren June 12, 2013, 3:50 p.m. | #1
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.

Patch

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 84d72fc..3636b6c 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -6,6 +6,7 @@  config ARCH_TEGRA
 	select CLKSRC_MMIO
 	select CLKSRC_OF
 	select COMMON_CLK
+	select CPU_FREQ_TABLE
 	select GENERIC_CLOCKEVENTS
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if LOCAL_TIMERS
@@ -28,7 +29,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 +46,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 +62,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