Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c get EEPROM data from uni_n instead of poking aro...



details:   https://anonhg.NetBSD.org/src/rev/a856362f251d
branches:  trunk
changeset: 831220:a856362f251d
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Mar 16 22:10:31 2018 +0000

description:
get EEPROM data from uni_n instead of poking around in OF

diffstat:

 sys/dev/i2c/adadc.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 417cb21d8170 -r a856362f251d sys/dev/i2c/adadc.c
--- a/sys/dev/i2c/adadc.c       Fri Mar 16 22:08:53 2018 +0000
+++ b/sys/dev/i2c/adadc.c       Fri Mar 16 22:10:31 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $ */
+/* $NetBSD: adadc.c,v 1.3 2018/03/16 22:10:31 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.3 2018/03/16 22:10:31 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -126,7 +126,7 @@
        struct adadc_softc *sc = device_private(self);
        struct i2c_attach_args *ia = aux;
        envsys_data_t *s;
-       int error, ch, cpuid;
+       int error, ch;
        uint32_t eeprom[40];
        char loc[256];
        int which_cpu;
@@ -186,11 +186,7 @@
                ch = OF_peer(ch);
        }
        aprint_debug_dev(self, "monitoring CPU %d\n", which_cpu);
-       if (which_cpu == 0) {
-               cpuid = OF_finddevice("/u3/i2c/cpuid@a0");
-       } else
-               cpuid = OF_finddevice("/u3/i2c/cpuid@a2");
-       error = OF_getprop(cpuid, "cpuid", eeprom, sizeof(eeprom));
+       error = get_cpuid(which_cpu, (uint8_t *)eeprom);
        if (error >= 0) {
                sc->sc_diode_slope = eeprom[0x11] >> 16;
                sc->sc_diode_offset = (int16_t)(eeprom[0x11] & 0xffff) << 12;



Home | Main Index | Thread Index | Old Index