Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62228
b: refs/heads/master
c: a964b9b
h: refs/heads/master
v: v3
  • Loading branch information
Christian Krafft authored and Arnd Bergmann committed Jul 20, 2007
1 parent 5e46089 commit 6d3adad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 813f90728e7d74e9b753e6ef6c6915cd2a047adb
refs/heads/master: a964b9be3e475f30aee334654b4ff200bcdc0092
25 changes: 17 additions & 8 deletions trunk/arch/powerpc/platforms/cell/cbe_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ static int set_pmode_pmi(int cpu, unsigned int pmode)
int ret;
pmi_message_t pmi_msg;
#ifdef DEBUG
u64 time;
long time;
#endif

pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
pmi_msg.data1 = cbe_cpu_to_node(cpu);
pmi_msg.data2 = pmode;

#ifdef DEBUG
time = (u64) get_cycles();
time = jiffies;
#endif

pmi_send_message(pmi_msg);
Expand All @@ -98,9 +98,9 @@ static int set_pmode_pmi(int cpu, unsigned int pmode)
pr_debug("PMI returned slow mode %d\n", ret);

#ifdef DEBUG
time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */
time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */
pr_debug("had to wait %lu ns for a transition\n", time);
time = jiffies - time; /* actual cycles (not cpu cycles!) */
time = jiffies_to_msecs(time);
pr_debug("had to wait %lu ms for a transition using PMI.\n", time);
#endif
return ret;
}
Expand All @@ -123,15 +123,18 @@ static int set_pmode_reg(int cpu, unsigned int pmode)
struct cbe_mic_tm_regs __iomem *mic_tm_regs;
u64 flags;
u64 value;
#ifdef DEBUG
long time;
#endif

local_irq_save(flags);

mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu);
pmd_regs = cbe_get_cpu_pmd_regs(cpu);

pr_debug("pm register is mapped at %p\n", &pmd_regs->pmcr);
pr_debug("mic register is mapped at %p\n", &mic_tm_regs->slow_fast_timer_0);

#ifdef DEBUG
time = jiffies;
#endif
out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]);
out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]);

Expand All @@ -146,13 +149,19 @@ static int set_pmode_reg(int cpu, unsigned int pmode)

out_be64(&pmd_regs->pmcr, value);

#ifdef DEBUG
/* wait until new pmode appears in status register */
value = in_be64(&pmd_regs->pmsr) & 0x07;
while(value != pmode) {
cpu_relax();
value = in_be64(&pmd_regs->pmsr) & 0x07;
}

time = jiffies - time;
time = jiffies_to_msecs(time);
pr_debug("had to wait %lu ms for a transition using " \
"the pervasive unit.\n", time);
#endif
local_irq_restore(flags);

return 0;
Expand Down

0 comments on commit 6d3adad

Please sign in to comment.