summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-03-04 14:27:28 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-03-04 14:27:28 +0000
commit7d2c1a5c284fb9788b26240535c2a92062ef2f56 (patch)
tree5bfb9aa44195c0b404442317606ab1e2dc348319
parenta6b45738d29b3bc5aa4971ec65457e10c9e20cc5 (diff)
Fix panic caused by bcw_leds_switch_all() because reading from wrong
register. Noted while testing on sparc64.
-rw-r--r--sys/dev/ic/bcw.c13
-rw-r--r--sys/dev/ic/bcwreg.h4
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/ic/bcw.c b/sys/dev/ic/bcw.c
index a50b0cada85..2282d051be0 100644
--- a/sys/dev/ic/bcw.c
+++ b/sys/dev/ic/bcw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcw.c,v 1.64 2007/03/04 00:43:26 mglocker Exp $ */
+/* $OpenBSD: bcw.c,v 1.65 2007/03/04 14:27:27 mglocker Exp $ */
/*
* Copyright (c) 2006 Jon Simola <jsimola@gmail.com>
@@ -3051,7 +3051,7 @@ bcw_leds_switch_all(struct bcw_softc *sc, int on)
uint16_t ledctl;
int i, bit_on;
- ledctl = BCW_READ16(sc, BCW_GPIO_CTRL);
+ ledctl = BCW_READ16(sc, BCW_MMIO_GPIO_CONTROL);
for (i = 0; i < BCW_NR_LEDS; i++) {
led = &(sc->leds[i]);
@@ -3067,7 +3067,7 @@ bcw_leds_switch_all(struct bcw_softc *sc, int on)
ledctl &= ~(1 << i);
}
- BCW_WRITE16(sc, BCW_GPIO_CTRL, ledctl);
+ BCW_WRITE16(sc, BCW_MMIO_GPIO_CONTROL, ledctl);
}
int
@@ -3103,6 +3103,13 @@ bcw_gpio_init(struct bcw_softc *sc)
if (sc->sc_chip_rev >= 2)
mask |= 0x0010; /* FIXME this is redundant */
+ /*
+ * TODO
+ * We need to switch to common or pci core before we can write
+ * to BCW_GPIO_CTR.
+ */
+ return (0);
+
BCW_WRITE(sc, BCW_GPIO_CTRL, (BCW_READ(sc, BCW_GPIO_CTRL) & mask) |
set);
diff --git a/sys/dev/ic/bcwreg.h b/sys/dev/ic/bcwreg.h
index 22f34594a12..2e8182ce6fb 100644
--- a/sys/dev/ic/bcwreg.h
+++ b/sys/dev/ic/bcwreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcwreg.h,v 1.15 2007/02/23 10:40:54 mglocker Exp $ */
+/* $OpenBSD: bcwreg.h,v 1.16 2007/03/04 14:27:27 mglocker Exp $ */
/*
* Copyright (c) 2006 Jon Simola <jsimola@gmail.com>
@@ -344,6 +344,8 @@
#define BCW_MMIO_CHANNEL 0x3f0
#define BCW_MMIO_CHANNEL_EXT 0x3f4
+#define BCW_MMIO_GPIO_CONTROL 0x49c
+
/* LEDS */
#define BCW_NR_LEDS 4