Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt Support for "opp-microvolt" with more than one cell



details:   https://anonhg.NetBSD.org/src/rev/618a7b04b312
branches:  trunk
changeset: 994334:618a7b04b312
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Nov 01 14:47:36 2018 +0000

description:
Support for "opp-microvolt" with more than one cell

diffstat:

 sys/dev/fdt/cpufreq_dt.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 9aaa889925a1 -r 618a7b04b312 sys/dev/fdt/cpufreq_dt.c
--- a/sys/dev/fdt/cpufreq_dt.c  Thu Nov 01 13:11:11 2018 +0000
+++ b/sys/dev/fdt/cpufreq_dt.c  Thu Nov 01 14:47:36 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 {
        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 @@
                        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);
        }
 



Home | Main Index | Thread Index | Old Index