From owner-p4-projects@FreeBSD.ORG Tue Nov 28 22:34:50 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9DEBC16A47C; Tue, 28 Nov 2006 22:34:50 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5375A16A403 for ; Tue, 28 Nov 2006 22:34:50 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4847143C9F for ; Tue, 28 Nov 2006 22:34:45 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kASMYoEl005356 for ; Tue, 28 Nov 2006 22:34:50 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kASMYnPi005353 for perforce@freebsd.org; Tue, 28 Nov 2006 22:34:49 GMT (envelope-from imp@freebsd.org) Date: Tue, 28 Nov 2006 22:34:49 GMT Message-Id: <200611282234.kASMYnPi005353@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 110638 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2006 22:34:50 -0000 http://perforce.freebsd.org/chv.cgi?CH=110638 Change 110638 by imp@imp_lighthouse on 2006/11/28 22:34:44 check for errors too. Not sure I clear them all correctly, but it is a start. # We wedge something hard, however, when we try to write to a part # that doesn't have write enable asserted. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_twi.c#30 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_twi.c#30 (text+ko) ==== @@ -204,10 +204,10 @@ struct at91_twi_softc *sc = xsc; uint32_t status; - /* Reading the status also clears the interrupt */ status = RD4(sc, TWI_SR); if (status == 0) return; + sc->flags |= status & (TWI_SR_OVRE | TWI_SR_UNRE | TWI_SR_NACK); if (status & TWI_SR_RXRDY) sc->flags |= TWI_SR_RXRDY; if (status & TWI_SR_TXRDY) @@ -227,7 +227,9 @@ sc->flags = 0; WR4(sc, TWI_IER, bit); err = msleep(sc, &sc->sc_mtx, PZERO | PCATCH, "iic", MAX(1,hz/10)); - if (sc->flags & bit) + if (sc->flags & ~bit) + err = EIO; + else if (sc->flags & bit) err = 0; else if (err == 0) err = EBUSY;