From nobody Wed Dec 22 06:59: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 89F3518FA56F; Wed, 22 Dec 2021 06:59: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 4JJkhS2zrjz3PV5; Wed, 22 Dec 2021 06:59:20 +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 2A67418B4B; Wed, 22 Dec 2021 06:59:20 +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 1BM6xKOo036911; Wed, 22 Dec 2021 06:59:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BM6xKoH036910; Wed, 22 Dec 2021 06:59:20 GMT (envelope-from git) Date: Wed, 22 Dec 2021 06:59:20 GMT Message-Id: <202112220659.1BM6xKoH036910@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: 7d47f5aae8b3 - stable/12 - rk_i2c: keep sending bytes until all bytes are sent 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: 7d47f5aae8b3080858e5bad6379d2cb54d0d40a1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640156360; 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=21DktO8Gzt6phcCmvmV57ICfMAtNKQ5i/e3mdX3wW7E=; b=P13iJ2/gF/oJ7P1a/175rPZco/CDem88BzMzhR9+pj67xecspoqInS+DSkI1kdnSKnKl7H 6nOLZMB8O78I6IkGQ0krE3yLDkJ9H/iSLBQW/dXX0lJxWkjPVYCwEy8s/dOAaBALq0uI9Z V2fGIPBIovBAsRCJrsRA6m5pfp3moYVVsI9nQeja4W0/Q4WkpYQTgTsynOF2Io9JkHykbB vOXCAgEUFXmNbDtakF78s/YjLggb6gfUFqZbkKm+lxuYY3EfLhN81w5QlqIDwk83QkoxF6 E7MECuW0UxbI8At0znUUOzKVxcGI8PV33l1aV4Q8cM0Kqycbx6VR45D8SXN7uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640156360; a=rsa-sha256; cv=none; b=PmgQdvsVJ0y7+sQqRXUczbsIIDKYSXhQJ0weSNT9wQ1FZj0hK2vPOS7iRLDsBwCsTWrKOm YcnruoAHXEQxDz1ESMYlWCIBifo9esjU5W9/cJcMa1YnOdGFQUqTNSCy5ha5nqfjehSluS G4qFZtkyl4UDsdlKbKxg7MnVfANBYGmrf9OezL9di9fWEO4DyuFtb5Xu88Z8hNeRAto9Tm CwNIIgHuQDdUW5AtMsuUOyahmH/uUU8+UcKPT9kQ+CPf2GawenpndxH5Sa5e0RAIrzhKE5 2VWQ7Kkqcf53Ik10V5ySaRGj5oc3XZF/laYkq8iCijjsL6YBYWTIclF0HV2Qnw== 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=7d47f5aae8b3080858e5bad6379d2cb54d0d40a1 commit 7d47f5aae8b3080858e5bad6379d2cb54d0d40a1 Author: Andriy Gapon AuthorDate: 2021-12-15 08:51:24 +0000 Commit: Andriy Gapon CommitDate: 2021-12-22 06:57:15 +0000 rk_i2c: keep sending bytes until all bytes are sent Previously the code would decalre the transfer complete after sending first 31 bytes (plus the slave address) of a larger I2C write transfer. That was tested using a large write to an EEPROM with 32-byte write page size and a 2-byte address type. Such a transaction needed to send 34 bytes, 2 bytes for an offset and 32 bytes of actual data. (cherry picked from commit 7dc8a0e5dff4ad4c9c10442bef5228a91a98d5d6) --- sys/arm64/rockchip/rk_i2c.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c index 13fd5cebaf2d..078f0be52ec0 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -348,8 +348,14 @@ rk_i2c_intr_locked(struct rk_i2c_softc *sc) break; case STATE_WRITE: - if (sc->cnt == sc->msg->len && - !(sc->msg->flags & IIC_M_NOSTOP)) { + if (sc->cnt < sc->msg->len) { + /* Keep writing. */ + RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBTFIEN | + RK_I2C_IEN_NAKRCVIEN); + transfer_len = rk_i2c_fill_tx(sc); + RK_I2C_WRITE(sc, RK_I2C_MTXCNT, transfer_len); + break; + } else if (!(sc->msg->flags & IIC_M_NOSTOP)) { rk_i2c_send_stop(sc); break; }