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=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 0994ACA9EAF for ; Mon, 21 Oct 2019 13:59:17 +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 CF587214B2 for ; Mon, 21 Oct 2019 13:59:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S9oTbb1M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF587214B2 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+infradead-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=bombadil.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=Mw6yegbtLnFtUqD/g9SMTyRX25PI6phppTfFsPHMFyw=; b=S9oTbb1Mjnw17YHRuHFU1KPle SycnsnXfedQCqerBsMdUYU25Zgla4n5nUDzy4XTr7t9iEB1HSKFxtbSKuU6+DmCfmHSZRbW4kGuH2 /uu2nTNCstP7ammFmXcRKW1EMyZqdZIHQH3FCZgiKbUVeXR37oaNiPvjTfBlGyEWVoHUJpH4qP60m YgbIKV7aMT6lec2kukxCcTUVgoweOVdCbGdzFEGwGdgSThWYfdPhBcgm0nkHHFd9oRk05biVuLdOj Sn2VWZkNZFUnQyUmNkuQi3mrNMsyn1e8AEGuO3rLg3XrcN2SfVIDoVpTlW514oXU1ANoUbkCEWgo9 Mo9+NT3aQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iMYDM-0000Mz-Cg; Mon, 21 Oct 2019 13:59:16 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iMYDI-0000Lr-8e for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2019 13:59:14 +0000 Received: from localhost (p54B33572.dip0.t-ipconnect.de [84.179.53.114]) by pokefinder.org (Postfix) with ESMTPSA id C76372C0076; Mon, 21 Oct 2019 15:59:10 +0200 (CEST) Date: Mon, 21 Oct 2019 15:59:10 +0200 From: Wolfram Sang To: Fabrice Gasnier Subject: Re: [PATCH] i2c: i2c-stm32f7: fix a race in slave mode with arbitration loss irq Message-ID: <20191021135910.GA26782@ninjato> References: <1569919869-3218-1-git-send-email-fabrice.gasnier@st.com> MIME-Version: 1.0 In-Reply-To: <1569919869-3218-1-git-send-email-fabrice.gasnier@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191021_065912_456580_9009F8F2 X-CRM114-Status: GOOD ( 12.63 ) 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: alexandre.torgue@st.com, linux-kernel@vger.kernel.org, pierre-yves.mordret@st.com, alain.volmat@st.com, linux-i2c@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============3422119733111780452==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3422119733111780452== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 01, 2019 at 10:51:09AM +0200, Fabrice Gasnier wrote: > When in slave mode, an arbitration loss (ARLO) may be detected before the > slave had a chance to detect the stop condition (STOPF in ISR). > This is seen when two master + slave adapters switch their roles. It > provokes the i2c bus to be stuck, busy as SCL line is stretched. > - the I2C_SLAVE_STOP event is never generated due to STOPF flag is set but > don't generate an irq (race with ARLO irq, STOPIE is masked). STOPF flag > remains set until next master xfer (e.g. when STOPIE irq get unmasked). > In this case, completion is generated too early: immediately upon new > transfer request (then it doesn't send all data). > - Some data get stuck in TXDR register. As a consequence, the controller > stretches the SCL line: the bus gets busy until a future master transfer > triggers the bus busy / recovery mechanism (this can take time... and > may never happen at all) >=20 > So choice is to let the STOPF being detected by the slave isr handler, > to properly handle this stop condition. E.g. don't mask IRQs in error > handler, when the slave is running. >=20 > Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support") >=20 > Signed-off-by: Fabrice Gasnier Applied to for-current, thanks! --+HP7ph2BbKc20aGI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl2tuaoACgkQFA3kzBSg KbY98A/+L5w+rU+ZlnLyPHs8O2CoyNVWD0XjDnXAYbAwpuCKQBjMjaTmom8/ucQM JU86jNaLS9KM3yL8bhXnPiuXit/DXnq484npH49uK+GTVFK7pnVNu/QhBuLJzXPO xvO4glb1xpFoNHAA7o16T4EQvK5YfZFmdxcbqPVxNfNOyxIHxwBkb5ZQHQwdVNvq 8izptQqmRWwm6DUQj5Cnbd3DOghf73SBMarADbzZOIJn2yIKNInWJTw18WY+sj8T ayrS0KbcITMSbiArT5on/5Vwv0tM5uPYKilQPUR81YDSpZTidmXRblR04h5MS3or j41iqKTldQ1xCBG/V9Z1unE4d3CWtBzGQD55UlBlzkvlV+kFsN8EjkW2Ow4HCIG9 Xn1NbcBvhidymJe94yGgu+YhUVmj5web+EjqLwZoodofg4fxZXRDWHYE8WMUdB9R aYv6JERZJq0TSdr1kfGa2lB1FCzMAvtlyH+nnRQsskYHoVWgco5j/VSHfxnQog8+ O3Doke9VfMtAyOyYmKdogBD5jeO/iZJGLjE/LVC/jnPYVNI0psVD5ifeT1WZprqU 5JnzBK5JVMZxFrP20nT6ZBdGWFi9YygUHF7tichu6LAk+lCZddE9g9rHghVwMlwN /RjlN9Ada2ceFOp3MzL2R4WORf1WZgAPSjrU2Tpz7CRuy0K4r3M= =Kfp4 -----END PGP SIGNATURE----- --+HP7ph2BbKc20aGI-- --===============3422119733111780452== 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 --===============3422119733111780452==--