Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt opp-v2 table seems to list opps from lowest to h...



details:   https://anonhg.NetBSD.org/src/rev/a5dff0a7109e
branches:  trunk
changeset: 999148:a5dff0a7109e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue May 21 22:15:26 2019 +0000

description:
opp-v2 table seems to list opps from lowest to highest, so swap the order to ensure the highest frequency is first

diffstat:

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

diffs (33 lines):

diff -r 6b65d5ff70f4 -r a5dff0a7109e sys/dev/fdt/cpufreq_dt.c
--- a/sys/dev/fdt/cpufreq_dt.c  Tue May 21 18:09:31 2019 +0000
+++ b/sys/dev/fdt/cpufreq_dt.c  Tue May 21 22:15:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.7 2018/11/01 14:47:36 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.8 2019/05/21 22:15:26 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.7 2018/11/01 14:47:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.8 2019/05/21 22:15:26 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -377,9 +377,11 @@
                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 = be32toh(opp_uv[0]);
-               of_getprop_uint32(opp_node, "clock-latency-ns", &sc->sc_opp[i].latency_ns);
+               /* 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);
        }
 
        return 0;



Home | Main Index | Thread Index | Old Index