summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/dev/ki2c.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/arch/macppc/dev/ki2c.c b/sys/arch/macppc/dev/ki2c.c
index a8d5b57e8e8..24ac4cd0821 100644
--- a/sys/arch/macppc/dev/ki2c.c
+++ b/sys/arch/macppc/dev/ki2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ki2c.c,v 1.6 2005/11/14 22:29:35 deraadt Exp $ */
+/* $OpenBSD: ki2c.c,v 1.7 2005/11/15 15:35:34 deraadt Exp $ */
/* $NetBSD: ki2c.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -173,9 +173,11 @@ ki2c_setmode(sc, mode, bus)
KASSERT((mode & ~I2C_MODE) == 0);
x = ki2c_readreg(sc, MODE);
- x &= ~I2C_MODE;
+ x &= ~(I2C_MODE);
if (bus)
x |= I2C_BUS1;
+ else
+ x &= ~I2C_BUS1;
x |= mode;
ki2c_writereg(sc, MODE, x);
}
@@ -368,7 +370,7 @@ ki2c_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
return (EINVAL);
/* We handle the subaddress stuff ourselves. */
- ki2c_setmode(sc, I2C_STDMODE, addr >> 7);
+ ki2c_setmode(sc, I2C_STDMODE, addr & 0x80);
addr &= 0x7f;
if (ki2c_write(sc, (addr << 1), 0, cmdbuf, cmdlen) != 0)