Commit 64bafa9d authored by Jean-Christophe DUBOIS's avatar Jean-Christophe DUBOIS Committed by Arnd Bergmann

[CELL] fix cbe_cpufreq for legacy SLOF tree.

Previous patch changed based on Christian Krafft's comment.

On some legacy SLOF tree the generic code is unable to ioremap some Cell BE
registers. Therefore the "generic" functions are returning a NULL pointer,
triggering a crash on such platforms.

Let's handle this more gracefully.
Signed-off-by: default avatarJean-Christophe DUBOIS <jcd@tribudubois.net>
Acked-by: default avatarChristian Kraff <krafft@de.ibm.com>
Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
parent 74889e41
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/of_platform.h> #include <asm/of_platform.h>
#include <asm/prom.h> #include <asm/prom.h>
#include "cbe_regs.h"
#include "cbe_cpufreq.h" #include "cbe_cpufreq.h"
static DEFINE_MUTEX(cbe_switch_mutex); static DEFINE_MUTEX(cbe_switch_mutex);
...@@ -78,6 +79,15 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -78,6 +79,15 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
pr_debug("init cpufreq on CPU %d\n", policy->cpu); pr_debug("init cpufreq on CPU %d\n", policy->cpu);
/*
* Let's check we can actually get to the CELL regs
*/
if (!cbe_get_cpu_pmd_regs(policy->cpu) ||
!cbe_get_cpu_mic_tm_regs(policy->cpu)) {
pr_info("invalid CBE regs pointers for cpufreq\n");
return -EINVAL;
}
max_freqp = of_get_property(cpu, "clock-frequency", NULL); max_freqp = of_get_property(cpu, "clock-frequency", NULL);
of_node_put(cpu); of_node_put(cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment