From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A5CC433F5 for ; Thu, 18 Nov 2021 18:37:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B2E3613DB for ; Thu, 18 Nov 2021 18:37:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B2E3613DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=metanate.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jk5kyLhlC7SLPnwaCz0UUBdvrZzkp9q2z49odLiB9gI=; b=xFVi9KBVrS6RmU bl1fp396CSyE4kqOxdymxh8Cco9r73lKRQdPMq5Dh2Pkjd3DgMwq289EggvE1Ik4tQ/LMVTB5XXYz rfFLV/ylOusvSP2UTDGbiiYAZRQRaIuRrJT3ol3bKZv04VQF9O1IWEOkUKtucdDcFPm70Z/XoRlbQ uaZc7rq9PZRhf7mBX7HSuGZ1/pEg/oxiLUfy5XmdIfGUkMmx13I2w7ny/CCwKh5IM6Y6SdVMxtClw /TYAYdWx0uFflk2HJ2vN4zPiMAxI6e/sPiIus+dSdzMncovZ2MF9AAT/YpiQlScbEO0vuI19pIcsx 5DE36J/aU9q66/9BgfNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnmGQ-008aJB-Fv; Thu, 18 Nov 2021 18:36:02 +0000 Received: from [2001:8b0:1628:5005::111] (helo=metanate.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnmGH-008aI2-Om; Thu, 18 Nov 2021 18:35:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=In-Reply-To:Content-Type:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=QKgxJEyKREs5TCvjoyhQ6xe2fnBuo6nhs1/99d9iV9Q=; b=c65u9 HcBQSG3ZOrz7WhpKNvFBToTxxuOwoB0mdqh3XDrgGoB31WfiXiYY+hQEF/DqIegvpf/8NkwtUTtLK lZQ8lNpUNFBl4yJxn+sT3qwMH7/9Eg28IyOHWc/ayLGnOS8ELY3GJopKNuHb5mPyXwO8wP1vUleug NR7FFbSpb13IGjWgozLMj2h9wCtDjumWgxlGJisGTKjK/aFnjP9Y71Fr5Dphg6wELmhQFmxiuV4+U EuBWHyYgaxeaUc5bBmnDiZoLCPI8/wc5wkXwE8NeVp+k1ZQWFCzd/BUqid272fkfYBqAj25II99gr uycuGlr8Raey+Ij0FFKkmo1lVLRjQ==; Received: from [81.174.171.191] (helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mnmGE-0005PJ-QL; Thu, 18 Nov 2021 18:35:50 +0000 Date: Thu, 18 Nov 2021 18:35:49 +0000 From: John Keeping To: Tobias Schramm Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Heiko Stuebner Subject: Re: [PATCH] i2c: rk3x: disable and reenable I2C after timeouts to fix stuck low SDA Message-ID: References: <20210826174632.91887-1-t.schramm@manjaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210826174632.91887-1-t.schramm@manjaro.org> X-Authenticated: YES X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211118_103553_861052_F4980D8C X-CRM114-Status: GOOD ( 16.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 26, 2021 at 07:46:32PM +0200, Tobias Schramm wrote: > Previously the SDA line sometimes remained stuck low after timeouts > rendering the I2C bus unusable. Testing has shown that disabling and > reenabling the I2C peripheral after sending the stop condition seems to > unstick SDA reliably. > Disable and reenable the I2C controller on timeout after sending stop > condition to unstick SDA. > > Signed-off-by: Tobias Schramm I haven't seen the issue described here, so I can't test whether this fix works, but the explanation makes sense, so: Reviewed-by: John Keeping > --- > drivers/i2c/busses/i2c-rk3x.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c > index 819ab4ee517e..fc330cc3686a 100644 > --- a/drivers/i2c/busses/i2c-rk3x.c > +++ b/drivers/i2c/busses/i2c-rk3x.c > @@ -1108,6 +1108,16 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, > val |= REG_CON_EN | REG_CON_STOP; > i2c_writel(i2c, val, REG_CON); > > + /* > + * Sometimes SDA remains stuck low after timeouts. > + * Disable and reenable the I2C peripheral to unstick > + * SDA. > + */ > + val &= ~REG_CON_EN; > + i2c_writel(i2c, val, REG_CON); > + val |= REG_CON_EN; > + i2c_writel(i2c, val, REG_CON); > + > i2c->state = STATE_IDLE; > > ret = -ETIMEDOUT; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel