diff options
author | Achin Gupta <achin.gupta@arm.com> | 2013-03-10 22:36:51 +0000 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2013-05-03 13:50:06 +0100 |
commit | d7100bcd5899eea0bf1eb45e9bccd3fd783ae252 (patch) | |
tree | 6283913b84676c8d4a0c2c34b95aebb7d3347981 | |
parent | 892404cc9460bdc9156ec0ca3ac27c6f20539213 (diff) | |
download | vexpress-lsk-d7100bcd5899eea0bf1eb45e9bccd3fd783ae252.tar.gz |
ARM: TC2: replace hard coded cluster and cpu values with constants
This patch adds constants in a tc2 specific header file to prevent
use of hard coded values for specifying the number of cpus and
clusters.
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
-rw-r--r-- | arch/arm/mach-vexpress/include/mach/tc2.h | 10 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/tc2_pm.c | 16 |
2 files changed, 21 insertions, 5 deletions
diff --git a/arch/arm/mach-vexpress/include/mach/tc2.h b/arch/arm/mach-vexpress/include/mach/tc2.h new file mode 100644 index 00000000000..d3b5a2225a0 --- /dev/null +++ b/arch/arm/mach-vexpress/include/mach/tc2.h @@ -0,0 +1,10 @@ +#ifndef __MACH_TC2_H +#define __MACH_TC2_H + +/* + * cpu and cluster limits + */ +#define TC2_MAX_CPUS 3 +#define TC2_MAX_CLUSTERS 2 + +#endif diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c index 54757301ca5..52173568d6c 100644 --- a/arch/arm/mach-vexpress/tc2_pm.c +++ b/arch/arm/mach-vexpress/tc2_pm.c @@ -25,6 +25,7 @@ #include <asm/cp15.h> #include <mach/motherboard.h> +#include <mach/tc2.h> #include <linux/vexpress.h> #include <linux/arm-cci.h> @@ -37,12 +38,13 @@ */ static arch_spinlock_t tc2_pm_lock = __ARCH_SPIN_LOCK_UNLOCKED; -static int tc2_pm_use_count[3][2]; +static int tc2_pm_use_count[TC2_MAX_CPUS][TC2_MAX_CLUSTERS]; static int tc2_pm_power_up(unsigned int cpu, unsigned int cluster) { pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - if (cluster >= 2 || cpu >= vexpress_spc_get_nb_cpus(cluster)) + if (cluster >= TC2_MAX_CLUSTERS || + cpu >= vexpress_spc_get_nb_cpus(cluster)) return -EINVAL; /* @@ -90,7 +92,8 @@ static void tc2_pm_down(u64 residency) cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cluster >= 2 || cpu >= vexpress_spc_get_nb_cpus(cluster)); + BUG_ON(cluster >= TC2_MAX_CLUSTERS || + cpu >= vexpress_spc_get_nb_cpus(cluster)); __mcpm_cpu_going_down(cpu, cluster); @@ -194,7 +197,8 @@ static void tc2_pm_powered_up(void) cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cluster >= 2 || cpu >= vexpress_spc_get_nb_cpus(cluster)); + BUG_ON(cluster >= TC2_MAX_CLUSTERS || + cpu >= vexpress_spc_get_nb_cpus(cluster)); local_irq_save(flags); arch_spin_lock(&tc2_pm_lock); @@ -232,7 +236,9 @@ static void __init tc2_pm_usage_count_init(void) cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cpu >= 3 || cluster >= 2); + BUG_ON(cluster >= TC2_MAX_CLUSTERS || + cpu >= vexpress_spc_get_nb_cpus(cluster)); + tc2_pm_use_count[cpu][cluster] = 1; } |