mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 18:40:10 +00:00
powerpc/cpuidle: Fix parsing of idle state flags from device-tree
commit 95707d8528 upstream.
Flags from device-tree need to be parsed with accessors for
interpreting correct value in little-endian.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Reviewed-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ca0cfb304a
commit
41b071acdb
@@ -160,10 +160,10 @@ static int powernv_cpuidle_driver_init(void)
|
|||||||
static int powernv_add_idle_states(void)
|
static int powernv_add_idle_states(void)
|
||||||
{
|
{
|
||||||
struct device_node *power_mgt;
|
struct device_node *power_mgt;
|
||||||
struct property *prop;
|
|
||||||
int nr_idle_states = 1; /* Snooze */
|
int nr_idle_states = 1; /* Snooze */
|
||||||
int dt_idle_states;
|
int dt_idle_states;
|
||||||
u32 *flags;
|
const __be32 *idle_state_flags;
|
||||||
|
u32 len_flags, flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Currently we have snooze statically defined */
|
/* Currently we have snooze statically defined */
|
||||||
@@ -174,18 +174,18 @@ static int powernv_add_idle_states(void)
|
|||||||
return nr_idle_states;
|
return nr_idle_states;
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = of_find_property(power_mgt, "ibm,cpu-idle-state-flags", NULL);
|
idle_state_flags = of_get_property(power_mgt, "ibm,cpu-idle-state-flags", &len_flags);
|
||||||
if (!prop) {
|
if (!idle_state_flags) {
|
||||||
pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n");
|
pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n");
|
||||||
return nr_idle_states;
|
return nr_idle_states;
|
||||||
}
|
}
|
||||||
|
|
||||||
dt_idle_states = prop->length / sizeof(u32);
|
dt_idle_states = len_flags / sizeof(u32);
|
||||||
flags = (u32 *) prop->value;
|
|
||||||
|
|
||||||
for (i = 0; i < dt_idle_states; i++) {
|
for (i = 0; i < dt_idle_states; i++) {
|
||||||
|
|
||||||
if (flags[i] & IDLE_USE_INST_NAP) {
|
flags = be32_to_cpu(idle_state_flags[i]);
|
||||||
|
if (flags & IDLE_USE_INST_NAP) {
|
||||||
/* Add NAP state */
|
/* Add NAP state */
|
||||||
strcpy(powernv_states[nr_idle_states].name, "Nap");
|
strcpy(powernv_states[nr_idle_states].name, "Nap");
|
||||||
strcpy(powernv_states[nr_idle_states].desc, "Nap");
|
strcpy(powernv_states[nr_idle_states].desc, "Nap");
|
||||||
@@ -196,7 +196,7 @@ static int powernv_add_idle_states(void)
|
|||||||
nr_idle_states++;
|
nr_idle_states++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags[i] & IDLE_USE_INST_SLEEP) {
|
if (flags & IDLE_USE_INST_SLEEP) {
|
||||||
/* Add FASTSLEEP state */
|
/* Add FASTSLEEP state */
|
||||||
strcpy(powernv_states[nr_idle_states].name, "FastSleep");
|
strcpy(powernv_states[nr_idle_states].name, "FastSleep");
|
||||||
strcpy(powernv_states[nr_idle_states].desc, "FastSleep");
|
strcpy(powernv_states[nr_idle_states].desc, "FastSleep");
|
||||||
|
|||||||
Reference in New Issue
Block a user