diff options
author | 2019-08-18 15:51:18 +0000 | |
---|---|---|
committer | 2019-08-18 15:51:18 +0000 | |
commit | 2933375bc60052ed1dc390f1419c65c854bb8c57 (patch) | |
tree | e91bde9987e9235d38c364704e0cb76d41356951 | |
parent | Implement a few Linux compat ACPI interfaces and enable the ACPI support (diff) | |
download | wireguard-openbsd-2933375bc60052ed1dc390f1419c65c854bb8c57.tar.xz wireguard-openbsd-2933375bc60052ed1dc390f1419c65c854bb8c57.zip |
In polled mode, wait on STOP detected bit to be set in the interrupt status
register like we do for non-polled mode. This seems to increase the
reliability of i2c transfers on the controller integrated on the Ampare
eMAG processor.
ok jcs@, mlarkin@
-rw-r--r-- | sys/dev/ic/dwiic.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/ic/dwiic.c b/sys/dev/ic/dwiic.c index 80b598f08ce..89de133ee1b 100644 --- a/sys/dev/ic/dwiic.c +++ b/sys/dev/ic/dwiic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic.c,v 1.6 2019/08/06 06:56:29 kettenis Exp $ */ +/* $OpenBSD: dwiic.c,v 1.7 2019/08/18 15:51:18 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -407,14 +407,13 @@ dwiic_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, const void *cmdbuf, if (I2C_OP_STOP_P(op) && I2C_OP_WRITE_P(op)) { if (flags & I2C_F_POLL) { - /* wait for bus to be idle */ for (retries = 100; retries > 0; retries--) { - st = dwiic_read(sc, DW_IC_STATUS); - if (!(st & DW_IC_STATUS_ACTIVITY)) + st = dwiic_read(sc, DW_IC_RAW_INTR_STAT); + if (st & DW_IC_INTR_STOP_DET) break; DELAY(1000); } - if (st & DW_IC_STATUS_ACTIVITY) + if (!(st & DW_IC_INTR_STOP_DET)) printf("%s: timed out waiting for bus idle\n", sc->sc_dev.dv_xname); } else { |