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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8747FC433DF for ; Tue, 25 Aug 2020 13:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C0C520639 for ; Tue, 25 Aug 2020 13:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbgHYN2y (ORCPT ); Tue, 25 Aug 2020 09:28:54 -0400 Received: from sauhun.de ([88.99.104.3]:47938 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726429AbgHYN2v (ORCPT ); Tue, 25 Aug 2020 09:28:51 -0400 Received: from localhost (p54b33ab6.dip0.t-ipconnect.de [84.179.58.182]) by pokefinder.org (Postfix) with ESMTPSA id 374132C04D5; Tue, 25 Aug 2020 15:28:47 +0200 (CEST) Date: Tue, 25 Aug 2020 15:28:46 +0200 From: Wolfram Sang To: Phil Reid Cc: Codrin.Ciubotariu@microchip.com, kamel.bouhara@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com Subject: Re: [PATCH 2/4] i2c: at91: implement i2c bus recovery Message-ID: <20200825132846.GA1753@kunai> Mail-Followup-To: Wolfram Sang , Phil Reid , Codrin.Ciubotariu@microchip.com, kamel.bouhara@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com References: <20191002144658.7718-1-kamel.bouhara@bootlin.com> <20191002144658.7718-3-kamel.bouhara@bootlin.com> <20191021202044.GB3607@kunai> <724d3470-0561-1b3f-c826-bc16c74a8c0a@bootlin.com> <1e70ae35-052b-67cc-27c4-1077c211efd0@microchip.com> <20191024150726.GA1120@kunai> <65d83bb0-9a0c-c6e2-1c58-cb421c69816c@electromag.com.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <65d83bb0-9a0c-c6e2-1c58-cb421c69816c@electromag.com.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Phil, yes, this thread is old but a similar issue came up again... On Fri, Oct 25, 2019 at 09:14:00AM +0800, Phil Reid wrote: > >=20 > > > So at the beginning of a new transfer, we should check if SDA (or SCL= ?) > > > is low and, if it's true, only then we should try recover the bus. > >=20 > > Yes, this is the proper time to do it. Remember, I2C does not define a > > timeout. > >=20 >=20 > FYI: Just a single poll at the start of the transfer, for it being low, w= ill cause problems with multi-master buses. > Bus recovery should be attempted after a timeout when trying to communica= te, even thou i2c doesn't define a timeout. >=20 > I'm trying to fix the designware drivers handling of this at the moment. I wonder what you ended up with? You are right, a single poll is not enough. It only might be if one applies the new "single-master" binding for a given bus. If that is not present, my best idea so far is to poll SDA for the time defined in adapter->timeout and if it is all low, then initiate a recovery. All the best, Wolfram --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl9FEg4ACgkQFA3kzBSg KbZfXhAAgtg4dw1Y8ofe9LYQHp/xN3Z+LqaNGBmsKeC7XBv0/j/OuBqokWUtPeZ2 LKs9hWvaKCiIBNZH8LElTWFS9XSlmiLD7Stw8pUm5Gcav/Hf8FRB3WJ93QGNQcA4 /kQFrmO7Mxez+Yb3ndImfXQyexOJjzteaxVfbmVLIHC8V2L+LY+M7QiuzEG4vT9C /KhzaKVmfGevX0HL0lZcShLCf5Nk8Na/hMfxxK1GisaMvEacilOQBqWyFq5Z9oQd h7T0BKO0wn5Az3+lVVzI7qiCTQumy+9bhWJuSWXeVoxmCk2dklCFw/bUnjuVpzOk agaRh4BiBmp/zxDVtmS8rihL6htu+2JlFrSPEk1Pl5pfgx5oE2D+cuwRRqkgZwgZ EOe60+VfNVkQ5epcCBKRKNOqKnL8ZOG0Q0iVkuxqEVLCnhe4sM31nZ0Z8pioHb8P K2Mgr7GvqZCWQLdCHBy16B6LmsIqjwn2BwYcTo9EAGTWbhej7fGoykcuPI4r5QSO ivHhv8+sR795YmveXuV9OdXThHoZXVjhe2CQMxm8pQ17PW0M000X3j2FHj4qb5AL UQJfYd8o4WHPyJ8VtvdiPbeIQVhhkIysIg5FGJXgydrsMt/CyCuj6epLPWPRm+TB vtXTdWN2BLhXYFdxGtnkQdHZnqo58ZGxM3eDHPwywGsWpEr/wAc= =3nwt -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z-- 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 X-Spam-Level: X-Spam-Status: No, score=-4.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29E14C433E1 for ; Tue, 25 Aug 2020 13:30:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E69B120639 for ; Tue, 25 Aug 2020 13:30:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EvfEM68c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E69B120639 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=the-dreams.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jGqHuU0N0DnQ0HeOcYh+eLjktIZ0HXB0RBseGS1Dpfc=; b=EvfEM68c/xzS53kPOgdH2yH3O VfiX5hdSHM1f4Qn6M2et2/v/KMMUTdB4a56POaBApM44BWXwtxf5Sd7XvA0BVQWNp8AAA8zA34D1A qQrHSiHZJfCm7V+wG3Df/rL9Tg4kGtEn0IyIp6xbBxfvyijnAKVNb4pERu+A2c4XXBUg5c1LpLXB8 YF96b46aaUSeTdgAYiCilk57UrP28qxdjaQHHAh9gbbIGqdeirdQgzkr1I1djUcPlwGSHtu34da0p hqC/V4mX+ZG1R6NxWQSj5iKHxfb/1odfIIWiz8Z+43XQ6NuxnL0n74HTDTH5ZZZvfWBfW9eKOSJdt RsLfzFXPA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAZ0M-00017B-VU; Tue, 25 Aug 2020 13:28:51 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAZ0J-00016W-TS for linux-arm-kernel@lists.infradead.org; Tue, 25 Aug 2020 13:28:48 +0000 Received: from localhost (p54b33ab6.dip0.t-ipconnect.de [84.179.58.182]) by pokefinder.org (Postfix) with ESMTPSA id 374132C04D5; Tue, 25 Aug 2020 15:28:47 +0200 (CEST) Date: Tue, 25 Aug 2020 15:28:46 +0200 From: Wolfram Sang To: Phil Reid Subject: Re: [PATCH 2/4] i2c: at91: implement i2c bus recovery Message-ID: <20200825132846.GA1753@kunai> Mail-Followup-To: Wolfram Sang , Phil Reid , Codrin.Ciubotariu@microchip.com, kamel.bouhara@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com References: <20191002144658.7718-1-kamel.bouhara@bootlin.com> <20191002144658.7718-3-kamel.bouhara@bootlin.com> <20191021202044.GB3607@kunai> <724d3470-0561-1b3f-c826-bc16c74a8c0a@bootlin.com> <1e70ae35-052b-67cc-27c4-1077c211efd0@microchip.com> <20191024150726.GA1120@kunai> <65d83bb0-9a0c-c6e2-1c58-cb421c69816c@electromag.com.au> MIME-Version: 1.0 In-Reply-To: <65d83bb0-9a0c-c6e2-1c58-cb421c69816c@electromag.com.au> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200825_092848_226099_2B4932C6 X-CRM114-Status: GOOD ( 15.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, alexandre.belloni@bootlin.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ludovic.Desroches@microchip.com, linux-i2c@vger.kernel.org, thomas.petazzoni@bootlin.com, Codrin.Ciubotariu@microchip.com, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============4043782036392740800==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4043782036392740800== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Phil, yes, this thread is old but a similar issue came up again... On Fri, Oct 25, 2019 at 09:14:00AM +0800, Phil Reid wrote: > >=20 > > > So at the beginning of a new transfer, we should check if SDA (or SCL= ?) > > > is low and, if it's true, only then we should try recover the bus. > >=20 > > Yes, this is the proper time to do it. Remember, I2C does not define a > > timeout. > >=20 >=20 > FYI: Just a single poll at the start of the transfer, for it being low, w= ill cause problems with multi-master buses. > Bus recovery should be attempted after a timeout when trying to communica= te, even thou i2c doesn't define a timeout. >=20 > I'm trying to fix the designware drivers handling of this at the moment. I wonder what you ended up with? You are right, a single poll is not enough. It only might be if one applies the new "single-master" binding for a given bus. If that is not present, my best idea so far is to poll SDA for the time defined in adapter->timeout and if it is all low, then initiate a recovery. All the best, Wolfram --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl9FEg4ACgkQFA3kzBSg KbZfXhAAgtg4dw1Y8ofe9LYQHp/xN3Z+LqaNGBmsKeC7XBv0/j/OuBqokWUtPeZ2 LKs9hWvaKCiIBNZH8LElTWFS9XSlmiLD7Stw8pUm5Gcav/Hf8FRB3WJ93QGNQcA4 /kQFrmO7Mxez+Yb3ndImfXQyexOJjzteaxVfbmVLIHC8V2L+LY+M7QiuzEG4vT9C /KhzaKVmfGevX0HL0lZcShLCf5Nk8Na/hMfxxK1GisaMvEacilOQBqWyFq5Z9oQd h7T0BKO0wn5Az3+lVVzI7qiCTQumy+9bhWJuSWXeVoxmCk2dklCFw/bUnjuVpzOk agaRh4BiBmp/zxDVtmS8rihL6htu+2JlFrSPEk1Pl5pfgx5oE2D+cuwRRqkgZwgZ EOe60+VfNVkQ5epcCBKRKNOqKnL8ZOG0Q0iVkuxqEVLCnhe4sM31nZ0Z8pioHb8P K2Mgr7GvqZCWQLdCHBy16B6LmsIqjwn2BwYcTo9EAGTWbhej7fGoykcuPI4r5QSO ivHhv8+sR795YmveXuV9OdXThHoZXVjhe2CQMxm8pQ17PW0M000X3j2FHj4qb5AL UQJfYd8o4WHPyJ8VtvdiPbeIQVhhkIysIg5FGJXgydrsMt/CyCuj6epLPWPRm+TB vtXTdWN2BLhXYFdxGtnkQdHZnqo58ZGxM3eDHPwywGsWpEr/wAc= =3nwt -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z-- --===============4043782036392740800== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4043782036392740800==--