From nobody Fri Nov 26 14:23:59 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 13EF918A2993; Fri, 26 Nov 2021 14:24:02 +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 4J0xnX25C1z4cMR; Fri, 26 Nov 2021 14:24:00 +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 EF5CF2402; Fri, 26 Nov 2021 14:23:59 +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 1AQENx6N002417; Fri, 26 Nov 2021 14:23:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AQENxG6002416; Fri, 26 Nov 2021 14:23:59 GMT (envelope-from git) Date: Fri, 26 Nov 2021 14:23:59 GMT Message-Id: <202111261423.1AQENxG6002416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: cb167e1ae954 - main - 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/main X-Git-Reftype: branch X-Git-Commit: cb167e1ae95473d836393a07456d8dbcfbb7f758 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637936640; 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=5A+49B9KLqge4YjaS5HuCC1zQNk1ZZnSaILeZvctvBQ=; b=sZilwFRs2YBKuXxw/2WrVUdlFU7S6G0kGrSGOPwwewWx/ZYtVf+sG1tmdLUNrv1w5NWTa3 00gLt7wDj+HspDBeyFPQZL3PRCcWdeMLRXzsCYdLwoiLuys0sLPEAfo5Z7ByzkJWzvAEyZ UDjuGLJt+ax0UZS53H0bRwn20xb81HUdDVWFNvg/L4Ojg8Oo5mmJOi+lGPRnj3btVEA8lY r6W3KJpXnTz6Qf1bhVkLhaQBNm5iCPP2S3PqDfUzCvnPlpRM4KCQhT7jpInN7NWH/i9ewL 8b3bdpPakAWNjrapd7biK2IiRqHv2fqOU2jEf1V4d/yrXmLtafIsd01aK0zGSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637936640; a=rsa-sha256; cv=none; b=plHaR5S7PBcN2XScgosyNZ3TxJGGsTTX01HHYOHCy7mJ/l9leEj8DmYndtQ3gk0z24rBig A9ewNPVVBcvdeG+u7w5AeC0CZXOKZDlYqXy5IxFcI8paVik9ZNJd15jLTs8taoXsT1gsxT H6O94HfYNnwGhZvbn/5fl4bQUvYBN9MeQHUNifZirpOtou0bpSK58oLAbBtxQRW/osqU94 Oz2UxLLUhqiZS+ml6rd5QebMD0JG2afMz2D4q7qIzkStTZGwENy2+Evyk2aXsrNzaukoX4 J8TglVUM+/QLMDHPCs7DFefAsi6vD4JgLg2WkgnUo3ulIL6dxVbvPVv7nRIf5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=cb167e1ae95473d836393a07456d8dbcfbb7f758 commit cb167e1ae95473d836393a07456d8dbcfbb7f758 Author: Andriy Gapon AuthorDate: 2021-11-26 07:30:38 +0000 Commit: Andriy Gapon CommitDate: 2021-11-26 14:15:43 +0000 twsi: do not attempt transfer if bus is not idle MFC after: 2 weeks --- 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;