summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ichiic.c
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-01-15 10:28:18 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-01-15 10:28:18 +0000
commit2ff294f1b2d08257fa18966165e6e2d28810136e (patch)
treebd0dd8984f1733e3db04be89a055047740fed761 /sys/dev/pci/ichiic.c
parent7cb21437ce6acbba8ec9be80f0347045282fe62d (diff)
In iic_exec don't fail immediately if bus is already busy. It might be
running a BIOS' transfer so wait a bit and try again.
Diffstat (limited to 'sys/dev/pci/ichiic.c')
-rw-r--r--sys/dev/pci/ichiic.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/ichiic.c b/sys/dev/pci/ichiic.c
index 4cdc1066008..fc9547e45c6 100644
--- a/sys/dev/pci/ichiic.c
+++ b/sys/dev/pci/ichiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ichiic.c,v 1.11 2006/01/15 10:06:06 grange Exp $ */
+/* $OpenBSD: ichiic.c,v 1.12 2006/01/15 10:28:16 grange Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -202,8 +202,13 @@ ichiic_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
DPRINTF(("%s: exec: op %d, addr 0x%x, cmdlen %d, len %d, flags 0x%x\n",
sc->sc_dev.dv_xname, op, addr, cmdlen, len, flags));
- /* Check if there's a transfer already running */
- st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, ICH_SMB_HS);
+ /* Wait for bus to be idle */
+ for (retries = 100; retries > 0; retries--) {
+ st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, ICH_SMB_HS);
+ if (!(st & ICH_SMB_HS_BUSY))
+ break;
+ DELAY(ICHIIC_DELAY);
+ }
DPRINTF(("%s: exec: st 0x%b\n", sc->sc_dev.dv_xname, st,
ICH_SMB_HS_BITS));
if (st & ICH_SMB_HS_BUSY)