Module Name: src
Committed By: jmcneill
Date: Mon Oct 28 10:43:09 UTC 2019
Modified Files:
src/sys/dev/fdt: cpufreq_dt.c
Log Message:
Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/fdt/cpufreq_dt.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.10 src/sys/dev/fdt/cpufreq_dt.c:1.11
--- src/sys/dev/fdt/cpufreq_dt.c:1.10 Mon Oct 7 13:54:59 2019
+++ src/sys/dev/fdt/cpufreq_dt.c Mon Oct 28 10:43:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.10 2019/10/07 13:54:59 martin Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.11 2019/10/28 10:43:08 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.10 2019/10/07 13:54:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.11 2019/10/28 10:43:08 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -363,7 +363,7 @@ cpufreq_dt_parse_opp_v2(struct cpufreq_d
struct cpufreq_dt_table *table;
const u_int *opp_uv;
uint64_t opp_hz;
- int opp_node, len, i;
+ int opp_node, len, i, index;
const int opp_table = fdtbus_get_phandle(phandle, "operating-points-v2");
if (opp_table < 0)
@@ -379,27 +379,33 @@ cpufreq_dt_parse_opp_v2(struct cpufreq_d
}
for (opp_node = OF_child(opp_table); opp_node; opp_node = OF_peer(opp_node)) {
- if (fdtbus_status_okay(opp_node))
- sc->sc_nopp++;
+ if (!fdtbus_status_okay(opp_node))
+ continue;
+ if (of_hasprop(opp_node, "opp-suspend"))
+ continue;
+ sc->sc_nopp++;
}
if (sc->sc_nopp == 0)
return EINVAL;
sc->sc_opp = kmem_zalloc(sizeof(*sc->sc_opp) * sc->sc_nopp, KM_SLEEP);
+ index = sc->sc_nopp - 1;
for (opp_node = OF_child(opp_table), i = 0; opp_node; opp_node = OF_peer(opp_node), i++) {
if (!fdtbus_status_okay(opp_node))
continue;
+ if (of_hasprop(opp_node, "opp-suspend"))
+ continue;
if (of_getprop_uint64(opp_node, "opp-hz", &opp_hz) != 0)
return EINVAL;
opp_uv = fdtbus_get_prop(opp_node, "opp-microvolt", &len);
if (opp_uv == NULL || len < 1)
return EINVAL;
/* Table is in reverse order */
- const int index = sc->sc_nopp - i - 1;
sc->sc_opp[index].freq_khz = (u_int)(opp_hz / 1000);
sc->sc_opp[index].voltage_uv = be32toh(opp_uv[0]);
of_getprop_uint32(opp_node, "clock-latency-ns", &sc->sc_opp[index].latency_ns);
+ --index;
}
return 0;