Module Name: src
Committed By: jmcneill
Date: Thu Nov 1 14:47:36 UTC 2018
Modified Files:
src/sys/dev/fdt: cpufreq_dt.c
Log Message:
Support for "opp-microvolt" with more than one cell
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/dev/fdt/cpufreq_dt.c:1.7
--- src/sys/dev/fdt/cpufreq_dt.c:1.6 Thu Sep 20 09:19:56 2018
+++ src/sys/dev/fdt/cpufreq_dt.c Thu Nov 1 14:47:36 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.6 2018/09/20 09:19:56 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.7 2018/11/01 14:47:36 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.6 2018/09/20 09:19:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.7 2018/11/01 14:47:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -343,9 +343,9 @@ cpufreq_dt_parse_opp_v2(struct cpufreq_d
{
const int phandle = sc->sc_phandle;
struct cpufreq_dt_table *table;
+ const u_int *opp_uv;
uint64_t opp_hz;
- uint32_t opp_uv;
- int opp_node, i;
+ int opp_node, len, i;
const int opp_table = fdtbus_get_phandle(phandle, "operating-points-v2");
if (opp_table < 0)
@@ -374,10 +374,11 @@ cpufreq_dt_parse_opp_v2(struct cpufreq_d
continue;
if (of_getprop_uint64(opp_node, "opp-hz", &opp_hz) != 0)
return EINVAL;
- if (of_getprop_uint32(opp_node, "opp-microvolt", &opp_uv) != 0)
+ opp_uv = fdtbus_get_prop(opp_node, "opp-microvolt", &len);
+ if (opp_uv == NULL || len < 1)
return EINVAL;
sc->sc_opp[i].freq_khz = (u_int)(opp_hz / 1000);
- sc->sc_opp[i].voltage_uv = opp_uv;
+ sc->sc_opp[i].voltage_uv = be32toh(opp_uv[0]);
of_getprop_uint32(opp_node, "clock-latency-ns", &sc->sc_opp[i].latency_ns);
}