summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorOleg Safiullin <form@cvs.openbsd.org>2008-10-08 15:06:50 +0000
committerOleg Safiullin <form@cvs.openbsd.org>2008-10-08 15:06:50 +0000
commit0fc65faf178148be82085611e137644a38eb410d (patch)
tree003410649991aec2711c5a2785cadff6d0cfca8d /sys/dev
parentfd5b5e72af8ce84860eb6051cb5d24b336144f2c (diff)
o chip revision is 4-bit value
o some #define's instead of digits
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/it.c12
-rw-r--r--sys/dev/isa/itvar.h6
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/isa/it.c b/sys/dev/isa/it.c
index 658dfc8669b..4ef4b336c30 100644
--- a/sys/dev/isa/it.c
+++ b/sys/dev/isa/it.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: it.c,v 1.32 2008/04/07 17:50:37 form Exp $ */
+/* $OpenBSD: it.c,v 1.33 2008/10/08 15:06:49 form Exp $ */
/*
* Copyright (c) 2007-2008 Oleg Safiullin <form@pdp-11.org.ru>
@@ -189,7 +189,6 @@ it_attach(struct device *parent, struct device *self, void *aux)
struct it_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
int i;
- u_int8_t cr;
sc->sc_iot = ia->ia_iot;
sc->sc_iobase = ia->ipa_io[0].base;
@@ -204,7 +203,7 @@ it_attach(struct device *parent, struct device *self, void *aux)
/* get chip id and rev */
sc->sc_chipid = it_readreg(sc->sc_iot, sc->sc_ioh, IT_CHIPID1) << 8;
sc->sc_chipid |= it_readreg(sc->sc_iot, sc->sc_ioh, IT_CHIPID2);
- sc->sc_chiprev = it_readreg(sc->sc_iot, sc->sc_ioh, IT_CHIPREV);
+ sc->sc_chiprev = it_readreg(sc->sc_iot, sc->sc_ioh, IT_CHIPREV) & 0x0f;
/* get environment controller base address */
it_writereg(sc->sc_iot, sc->sc_ioh, IT_LDN, IT_EC_LDN);
@@ -224,8 +223,7 @@ it_attach(struct device *parent, struct device *self, void *aux)
it_exit(sc->sc_iot, sc->sc_ioh);
LIST_INSERT_HEAD(&it_softc_list, sc, sc_list);
-
- printf(": IT%xF rev 0x%02x", sc->sc_chipid, sc->sc_chiprev);
+ printf(": IT%xF rev 0x%x", sc->sc_chipid, sc->sc_chiprev);
if (sc->sc_ec_iobase == 0) {
printf(", EC disabled\n");
@@ -260,8 +258,8 @@ it_attach(struct device *parent, struct device *self, void *aux)
}
/* activate monitoring */
- cr = it_ec_readreg(sc, IT_EC_CFG);
- it_ec_writereg(sc, IT_EC_CFG, cr | 0x09);
+ it_ec_writereg(sc, IT_EC_CFG,
+ it_ec_readreg(sc, IT_EC_CFG) | IT_EC_CFG_START | IT_EC_INT_CLEAR);
/* initialize sensors */
strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname,
diff --git a/sys/dev/isa/itvar.h b/sys/dev/isa/itvar.h
index b15becd6420..06e11e00e1f 100644
--- a/sys/dev/isa/itvar.h
+++ b/sys/dev/isa/itvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: itvar.h,v 1.9 2008/04/07 09:43:54 form Exp $ */
+/* $OpenBSD: itvar.h,v 1.10 2008/10/08 15:06:49 form Exp $ */
/*
* Copyright (c) 2007-2008 Oleg Safiullin <form@pdp-11.org.ru>
@@ -67,6 +67,10 @@
#define IT_EC_VOLTBASE 0x20
#define IT_EC_TEMPBASE 0x29
+#define IT_EC_CFG_START 0x01
+#define IT_EC_INT_CLEAR 0x08
+#define IT_EC_CFG_UPDVBAT 0x40
+
#define IT_WDT_LDN 0x07
#define IT_WDT_CSR 0x71