staticvoid rcpm_v1_cpu_enter_state(int cpu, int state)
{ int hw_cpu = get_hard_smp_processor_id(cpu); unsignedint mask = 1 << hw_cpu;
switch (state) { case E500_PM_PH10:
setbits32(&rcpm_v1_regs->cdozcr, mask); break; case E500_PM_PH15:
setbits32(&rcpm_v1_regs->cnapcr, mask); break; default:
pr_warn("Unknown cpu PM state (%d)\n", state); break;
}
}
staticvoid rcpm_v2_cpu_enter_state(int cpu, int state)
{ int hw_cpu = get_hard_smp_processor_id(cpu);
u32 mask = 1 << cpu_core_index_of_thread(cpu);
switch (state) { case E500_PM_PH10: /* one bit corresponds to one thread for PH10 of 6500 */
setbits32(&rcpm_v2_regs->tph10setr0, 1 << hw_cpu); break; case E500_PM_PH15:
setbits32(&rcpm_v2_regs->pcph15setr, mask); break; case E500_PM_PH20:
setbits32(&rcpm_v2_regs->pcph20setr, mask); break; case E500_PM_PH30:
setbits32(&rcpm_v2_regs->pcph30setr, mask); break; default:
pr_warn("Unknown cpu PM state (%d)\n", state);
}
}
#ifdef CONFIG_PPC64 staticvoid qoriq_disable_thread(int cpu)
{ int thread = cpu_thread_in_core(cpu);
book3e_stop_thread(thread);
} #endif
staticvoid rcpm_v2_cpu_die(int cpu)
{ #ifdef CONFIG_PPC64 int primary;
if (threads_per_core == 2) {
primary = cpu_first_thread_sibling(cpu); if (cpu_is_offline(primary) && cpu_is_offline(primary + 1)) { /* if both threads are offline, put the cpu in PH20 */
rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
} else { /* if only one thread is offline, disable the thread */
qoriq_disable_thread(cpu);
}
} #endif
if (threads_per_core == 1)
rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
}
staticvoid rcpm_v1_cpu_exit_state(int cpu, int state)
{ int hw_cpu = get_hard_smp_processor_id(cpu); unsignedint mask = 1 << hw_cpu;
switch (state) { case E500_PM_PH10:
clrbits32(&rcpm_v1_regs->cdozcr, mask); break; case E500_PM_PH15:
clrbits32(&rcpm_v1_regs->cnapcr, mask); break; default:
pr_warn("Unknown cpu PM state (%d)\n", state); break;
}
}
staticint rcpm_v1_plat_enter_state(int state)
{
u32 *pmcsr_reg = &rcpm_v1_regs->powmgtcsr; int ret = 0; int result;
switch (state) { case PLAT_PM_SLEEP:
setbits32(pmcsr_reg, RCPM_POWMGTCSR_SLP);
/* Upon resume, wait for RCPM_POWMGTCSR_SLP bit to be clear. */
result = spin_event_timeout(
!(in_be32(pmcsr_reg) & RCPM_POWMGTCSR_SLP), 10000, 10); if (!result) {
pr_err("timeout waiting for SLP bit to be cleared\n");
ret = -ETIMEDOUT;
} break; default:
pr_warn("Unknown platform PM state (%d)", state);
ret = -EINVAL;
}
return ret;
}
staticint rcpm_v2_plat_enter_state(int state)
{
u32 *pmcsr_reg = &rcpm_v2_regs->powmgtcsr; int ret = 0; int result;
switch (state) { case PLAT_PM_LPM20: /* clear previous LPM20 status */
setbits32(pmcsr_reg, RCPM_POWMGTCSR_P_LPM20_ST); /* enter LPM20 status */
setbits32(pmcsr_reg, RCPM_POWMGTCSR_LPM20_RQ);
/* At this point, the device is in LPM20 status. */
/* resume ... */
result = spin_event_timeout(
!(in_be32(pmcsr_reg) & RCPM_POWMGTCSR_LPM20_ST), 10000, 10); if (!result) {
pr_err("timeout waiting for LPM20 bit to be cleared\n");
ret = -ETIMEDOUT;
} break; default:
pr_warn("Unknown platform PM state (%d)\n", state);
ret = -EINVAL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.