// SPDX-License-Identifier: GPL-2.0-or-later /* * PowerPC 4xx Clock and Power Management * * Copyright (C) 2010, Applied Micro Circuits Corporation * Victor Gallardo (vgallardo@apm.com) * * Based on arch/powerpc/platforms/44x/idle.c: * Jerone Young <jyoung5@us.ibm.com> * Copyright 2008 IBM Corp. * * Based on arch/powerpc/sysdev/fsl_pmc.c: * Anton Vorontsov <avorontsov@ru.mvista.com> * Copyright 2009 MontaVista Software, Inc. * * See file CREDITS for list of people who contributed to this * project.
*/
/* CPM controller supports 3 different types of sleep interface * known as class 1, 2 and 3. For class 1 units, they are * unconditionally put to sleep when the corresponding CPM bit is * set. For class 2 and 3 units this is not case; if they can be * put to sleep, they will. Here we do not verify, we just * set them and expect them to eventually go off when they can.
*/
value = dcr_read(cpm.dcr_host, cpm.dcr_offset[cpm_reg]);
dcr_write(cpm.dcr_host, cpm.dcr_offset[cpm_reg], value | mask);
/* return old state, to restore later if needed */ return value;
}
/* save off initial state */
msr_save = mfmsr(); /* sync required when CPM0_ER[CPU] is set */
mb(); /* set wait state MSR */
mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
isync(); /* return to initial state */
mtmsr(msr_save);
isync();
}
for (i = 0; i < ARRAY_SIZE(idle_mode); i++) { if (idle_mode[i].enabled)
s += sprintf(s, "[%s] ", idle_mode[i].name); else
s += sprintf(s, "%s ", idle_mode[i].name);
}
*(s-1) = '\n'; /* convert the last space to a newline */
return s - buf;
}
static ssize_t cpm_idle_store(struct kobject *kobj, struct kobj_attribute *attr, constchar *buf, size_t n)
{ int i; char *p; int len;
p = memchr(buf, '\n', n);
len = p ? p - buf : n;
for (i = 0; i < ARRAY_SIZE(idle_mode); i++) { if (strncmp(buf, idle_mode[i].name, len) == 0) {
cpm_idle_config(i); return n;
}
}
if (dcr_base == 0 || dcr_len == 0) {
printk(KERN_ERR "cpm: could not parse dcr property for %pOF\n",
np);
ret = -EINVAL; goto node_put;
}
cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
if (!DCR_MAP_OK(cpm.dcr_host)) {
printk(KERN_ERR "cpm: failed to map dcr property for %pOF\n",
np);
ret = -EINVAL; goto node_put;
}
/* All 4xx SoCs with a CPM controller have one of two * different order for the CPM registers. Some have the * CPM registers in the following order (ER,FR,SR). The * others have them in the following order (SR,ER,FR).
*/
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.