From nobody Fri Dec 10 12:30:20 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 F176418CFDD7; Fri, 10 Dec 2021 12:30:21 +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 4J9Vbx2sxdz3rZk; Fri, 10 Dec 2021 12:30:21 +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 1751F1A2E9; Fri, 10 Dec 2021 12:30:21 +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 1BACUKQG064445; Fri, 10 Dec 2021 12:30:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BACUKhr064442; Fri, 10 Dec 2021 12:30:20 GMT (envelope-from git) Date: Fri, 10 Dec 2021 12:30:20 GMT Message-Id: <202112101230.1BACUKhr064442@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: 5efa75707b21 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 5efa75707b2155c74078b1189f6015662e2f478d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639139421; 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=n7TH0kf1CUNqBlB/1p+Aqi6ssQqjzhnZRmGnmTsc/+s=; b=NvqVLtCLrz/03+oo1OuJxUBcMYOTURrF3l9pc5M+/HWyd9dkhXFrxvCD4cGohnn/iIGKFW di/v1utgsXgdvNKDorvSo2MeagTtyvHo8o2WsHIoxiqCycOIo1EB3IR3Bqf7H6D+SjWXy7 hRET8wST2unZeHxvP3QDaT1kLyBC7o+YHFwCSkTeUKXrYej6+MRsAVRKQALj8zigQdzhHL UTmL+vrOqbr0/kpACQfblyvLgZmICsbjLGw+l0p4gVkKIPre7LPoy4UrZXxg2s38bJ65Mg rv1gMoB6jELUsUOAXVO0rBivIwvNDSZdDisemUt97wzHTT5UQqXCQ+q9M7kD4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639139421; a=rsa-sha256; cv=none; b=Th4OvyfOHSMUDF3cE/PrcAugjGVxHradBGQDMJ2b+D4OLBrejXvC4dhVbZiCWBSossNJcu 9qLUKdEYQnno2jeEZL7qjhD4Y60RsANr2GuHECztr2eEZSAE7CoCaMs5IXpt6Db8v+JKs3 iiEIjHm4cvKTATHQrzYoDiIaNr/99xiOrdaqZQgqUyfJZeQoYe4tRHgMibyq+Q2ERp+tjk MyKWfJf4uxHNLxT4NJkjgBLCyOR4SjxtWzcNn9sIpmXyhagEqRmNJHqvxain8pE5sct8PO Neq/Vd2WWvk0jtXCdFCBCGWek2SsZjRX+6QAMvmKbVIpV8qVEaFQYEZ4JoZfjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=5efa75707b2155c74078b1189f6015662e2f478d commit 5efa75707b2155c74078b1189f6015662e2f478d Author: Andriy Gapon AuthorDate: 2021-11-26 07:30:38 +0000 Commit: Andriy Gapon CommitDate: 2021-12-10 12:30:12 +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;