summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-01-15 22:03:18 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-01-15 22:03:18 +0000
commita1b8555a256d86e34f41f9829dc7a4f2397a7fc8 (patch)
tree11dced877188951f84909a67ab7de72929447a10 /sys/dev
parentfddd2ea453bc08280eb864b7b1d12971a179c40d (diff)
Commit missing bits too:
If we attach an lm(4) to isa(4) that is already attached to iic(4), disable the one attached to iic(4). idea from deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2c/lm_i2c.c5
-rw-r--r--sys/dev/ic/lm78.c12
-rw-r--r--sys/dev/ic/lm78var.h7
3 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/i2c/lm_i2c.c b/sys/dev/i2c/lm_i2c.c
index bf826a5556d..8cf2b4a1071 100644
--- a/sys/dev/i2c/lm_i2c.c
+++ b/sys/dev/i2c/lm_i2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm_i2c.c,v 1.7 2006/01/14 15:14:33 kettenis Exp $ */
+/* $OpenBSD: lm_i2c.c,v 1.8 2006/01/15 22:03:17 kettenis Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -80,6 +80,9 @@ lm_i2c_attach(struct device *parent, struct device *self, void *aux)
sc->sc_lmsc.lm_readreg = lm_i2c_readreg;
lm_attach(&sc->sc_lmsc);
+ /* Remember we attached to iic(4). */
+ sc->sc_lmsc.sbusaddr = ia->ia_addr;
+
iic_acquire_bus(sc->sc_tag, 0);
cmd = 0x4a;
diff --git a/sys/dev/ic/lm78.c b/sys/dev/ic/lm78.c
index 344aaae4f89..816a58216de 100644
--- a/sys/dev/ic/lm78.c
+++ b/sys/dev/ic/lm78.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm78.c,v 1.1 2006/01/14 15:14:33 kettenis Exp $ */
+/* $OpenBSD: lm78.c,v 1.2 2006/01/15 22:03:17 kettenis Exp $ */
/*
* Copyright (c) 2005, 2006 Mark Kettenis
@@ -375,7 +375,7 @@ def_match(struct lm_softc *sc)
int
wb_match(struct lm_softc *sc)
{
- int banksel, vendid, chipid, devid;
+ int banksel, vendid, devid;
/* Read vendor ID */
banksel = sc->lm_readreg(sc, WB_BANKSEL);
@@ -391,10 +391,10 @@ wb_match(struct lm_softc *sc)
/* Read device/chip ID */
sc->lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0);
devid = sc->lm_readreg(sc, LM_CHIPID);
- chipid = sc->lm_readreg(sc, WB_BANK0_CHIPID);
+ sc->chipid = sc->lm_readreg(sc, WB_BANK0_CHIPID);
sc->lm_writereg(sc, WB_BANKSEL, banksel);
- DPRINTF(("winbond chip id 0x%x\n", chipid));
- switch(chipid) {
+ DPRINTF(("winbond chip id 0x%x\n", sc->chipid));
+ switch(sc->chipid) {
case WB_CHIPID_W83627HF:
printf(": W83627HF\n");
lm_setup_sensors(sc, w83627hf_sensors);
@@ -446,7 +446,7 @@ wb_match(struct lm_softc *sc)
}
break;
default:
- printf(": unknown Winbond chip (ID 0x%x)\n", chipid);
+ printf(": unknown Winbond chip (ID 0x%x)\n", sc->chipid);
/* Handle as a standard LM78. */
lm_setup_sensors(sc, lm78_sensors);
sc->refresh_sensor_data = lm_refresh_sensor_data;
diff --git a/sys/dev/ic/lm78var.h b/sys/dev/ic/lm78var.h
index 862e7444e64..3eda4b42fb8 100644
--- a/sys/dev/ic/lm78var.h
+++ b/sys/dev/ic/lm78var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm78var.h,v 1.2 2006/01/14 20:05:06 kettenis Exp $ */
+/* $OpenBSD: lm78var.h,v 1.3 2006/01/15 22:03:17 kettenis Exp $ */
/*
* Copyright (c) 2005, 2006 Mark Kettenis
@@ -128,7 +128,7 @@ struct lm_sensor {
};
struct lm_softc {
- struct device sc_dev;
+ struct device sc_dev;
struct sensor sensors[WB_MAX_SENSORS];
struct lm_sensor *lm_sensors;
@@ -137,6 +137,9 @@ struct lm_softc {
u_int8_t (*lm_readreg)(struct lm_softc *, int);
void (*lm_writereg)(struct lm_softc *, int, int);
+
+ u_int8_t sbusaddr;
+ u_int8_t chipid;
};
void lm_attach(struct lm_softc *);