From 303910cfb1b894ce520c926f04c78d18a9a8abfb Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 26 Dec 2005 19:52:59 +0000 Subject: Reset i2c bus if operation times out. --- sys/dev/pci/alipm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/alipm.c b/sys/dev/pci/alipm.c index b4457e05122..136bf91bc81 100644 --- a/sys/dev/pci/alipm.c +++ b/sys/dev/pci/alipm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alipm.c,v 1.1 2005/12/24 23:36:36 kettenis Exp $ */ +/* $OpenBSD: alipm.c,v 1.2 2005/12/26 19:52:58 kettenis Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -244,13 +244,13 @@ alipm_smb_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, DELAY(ALIPM_DELAY); } if (retries == 0) { - printf("%s: timeout waiting until bus is idle\n", - sc->sc_dev.dv_xname); + printf("%s: timeout st 0x%b\n", sc->sc_dev.dv_xname, + st, ALIPM_SMB_HS_BITS); return (ETIMEDOUT); } if (st & (ALIPM_SMB_HS_FAILED | ALIPM_SMB_HS_BUSERR | ALIPM_SMB_HS_DEVERR)) { - printf("%s: bus error 0x%b\n", sc->sc_dev.dv_xname, + printf("%s: error st 0x%b\n", sc->sc_dev.dv_xname, st, ALIPM_SMB_HS_BITS); return (EIO); } @@ -299,7 +299,11 @@ alipm_smb_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, DELAY(ALIPM_DELAY); } if (retries == 0) { - printf("%s: timeout\n", sc->sc_dev.dv_xname); + printf("%s: timeout st 0x%b, resetting\n", + sc->sc_dev.dv_xname, st, ALIPM_SMB_HS_BITS); + bus_space_write_1(sc->sc_iot, sc->sc_ioh, ALIPM_SMB_HC, + ALIPM_SMB_HC_RESET); + st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, ALIPM_SMB_HS); error = ETIMEDOUT; goto done; } -- cgit v1.2.3