From nobody Fri Dec 10 12:31:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F7F718D17CB; Fri, 10 Dec 2021 12:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9VdB5gzpz3sTv; Fri, 10 Dec 2021 12:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CAEC1A2F6; Fri, 10 Dec 2021 12:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BACVQmP066137; Fri, 10 Dec 2021 12:31:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BACVQwt066136; Fri, 10 Dec 2021 12:31:26 GMT (envelope-from git) Date: Fri, 10 Dec 2021 12:31:26 GMT Message-Id: <202112101231.1BACVQwt066136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 1fc756504f7c - stable/12 - twsi: do not attempt transfer if bus is not idle List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1fc756504f7cc017519cdb23383221ffc3d0c580 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639139487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nuT/OOAOtQ9VCxnvlyfxgvWpTurM3lrL6zylEU9P2Xg=; b=iXcqToIeBJQnczySBmbg4dmzR1xCPsdFhOHUdrNxDEJiQ99GmwLj1Ay00aXjsjRxs5YrGn b8RbOsrrAzX7uVJsLXfOT13JKspvR3bAZr0KSCns7d402OUrVKLcAM1gaPgng++fcfcu7E J0B4fiYzimbEiVTvgfyhQ4tFp+df+XRAOyAMETY/HzcoELANEomFsklSDLeU5rMajrdAze F2W85ZFTVmW8r5pwrrwEPK6+AKwaHvYevPBoO3X1O7uzhXiFXKI3eBIOk8pPKcuababjme cPFb2TQd0EeWYLNDQdu5oG58zGTDGtCrTJfz0wpTbvF1dJULs75vx/jQoRkf2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639139487; a=rsa-sha256; cv=none; b=xdHoSQtvVF3m0N4fNvZWWQHC8gxEarYjezgMiaUv+qrfmKQWVQtVgvDP7NWqGw+F5/gBEK UuuNHpGGND/O4n970ZlbVUqJR1NsbPLZQt5mepSqbvmUg6Wf6SAKUzhTkMDeM3RCUlsoij 5CBgPVLn10WqdpgwCdM/7ICcg9vSswO8lmreCtEi5Pp1xxcOuDKs3NnAy8Dkp5lST8jJ1M I0dvqoND6i4uqw6mRGnvgf+Fp7jOnCSBvmYH2EHK09/4NgDbDkYYMsCxVCWJhUK99a013G N+/zJW47J0HEoYrsilrnvmd7SM5PNSA70vaQ9u0VmO9stayTfcdRKA3kv0zDrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=1fc756504f7cc017519cdb23383221ffc3d0c580 commit 1fc756504f7cc017519cdb23383221ffc3d0c580 Author: Andriy Gapon AuthorDate: 2021-11-26 07:30:38 +0000 Commit: Andriy Gapon CommitDate: 2021-12-10 12:30:50 +0000 twsi: do not attempt transfer if bus is not idle (cherry picked from commit cb167e1ae95473d836393a07456d8dbcfbb7f758) --- sys/dev/iicbus/twsi/twsi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/iicbus/twsi/twsi.c b/sys/dev/iicbus/twsi/twsi.c index 05f67786cad0..5e899313ac45 100644 --- a/sys/dev/iicbus/twsi/twsi.c +++ b/sys/dev/iicbus/twsi/twsi.c @@ -484,6 +484,7 @@ static int twsi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { struct twsi_softc *sc; + uint32_t status; int error; sc = device_get_softc(dev); @@ -496,7 +497,15 @@ twsi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) ("starting a transfer while another is active")); debugf(sc, "transmitting %d messages\n", nmsgs); - debugf(sc, "status=%x\n", TWSI_READ(sc, sc->reg_status)); + status = TWSI_READ(sc, sc->reg_status); + debugf(sc, "status=0x%x\n", status); + if (status != TWSI_STATUS_IDLE) { + debugf(sc, "Bad status at start of transfer\n"); + TWSI_WRITE(sc, sc->reg_control, TWSI_CONTROL_STOP); + mtx_unlock(&sc->mutex); + return (IIC_ESTATUS); + } + sc->nmsgs = nmsgs; sc->msgs = msgs; sc->msg_idx = 0;