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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F36F7C28D13 for ; Thu, 25 Aug 2022 13:36:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE8ED84880; Thu, 25 Aug 2022 15:36:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="IVfwpwM8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6561E84880; Thu, 25 Aug 2022 15:36:51 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CEDA58488F for ; Thu, 25 Aug 2022 15:36:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=4236e11cee=patrice.chotard@foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27PACPXa023729; Thu, 25 Aug 2022 15:36:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=GfbVqOpL9sCiZg1XNLCKqYx63otKju8LNYNwpFETfxg=; b=IVfwpwM8F8pd2kkE0Vh+0ZJ1xsauBZA3cdb1wlriQGRiVWmSa1OEs0wEOIAxiXhNqRC4 /9VqBtaP3oraYRL6EZuIF9DHh3nLTDb4wQiivyD1Pl/LNdNIHnn1zN8ARgDxmODPKLEj OzAr8scuyX+g7bpVWEJpwBOYFaOj3HNg8Xq8duIq4C4NhlEz98dIeSk8KNGWQcRnSyrg qqc2knFQTaqSSJqqC6XN7XkZ1FZgD+hm2HY+QFh1QK8nqDRjQzhP+doXXugeYIABPPTw HXY84ARjfXsMRdhIqKVVHX5jF01yCCGWKewBalHEm1S1b0jQccd0H5ckb7Pyo9FHUUaT Fw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3j58m5kf92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 15:36:45 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F3B07100034; Thu, 25 Aug 2022 15:36:37 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E7EBD22AFF5; Thu, 25 Aug 2022 15:36:37 +0200 (CEST) Received: from [10.201.21.72] (10.75.127.46) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Thu, 25 Aug 2022 15:36:37 +0200 Message-ID: <80f7f6f4-22bf-7ece-2a6e-0ae34c493cd9@foss.st.com> Date: Thu, 25 Aug 2022 15:36:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCHv2 2/2] i2c: stm32f7: do not set the STOP condition on error Content-Language: en-US To: Jorge Ramirez-Ortiz , , , , CC: , References: <20220815145211.31342-1-jorge@foundries.io> <20220815145211.31342-2-jorge@foundries.io> From: Patrice CHOTARD In-Reply-To: <20220815145211.31342-2-jorge@foundries.io> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-25_05,2022-08-25_01,2022-06-22_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean +Alain (with the correct email address ;-)) Alain, can you have a look a this patch and give your feedback on it. On my side i tested it on stm32mp157c-ev1 and stm32mp157c-dk2, i didn't see any regression but i prefer to get expert feedback Thanks Patrice On 8/15/22 16:52, Jorge Ramirez-Ortiz wrote: > Sending the stop condition without waiting for transfer complete > has been found to lock the bus (BUSY) when NACKF is raised. > > Tested accessing the NXP SE05X I2C device. > https://www.nxp.com/docs/en/application-note/AN12399.pdf > > Signed-off-by: Jorge Ramirez-Ortiz > Reviewed-by: Oleksandr Suvorov > --- > drivers/i2c/stm32f7_i2c.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c > index 3a727e68ac..14827e5cec 100644 > --- a/drivers/i2c/stm32f7_i2c.c > +++ b/drivers/i2c/stm32f7_i2c.c > @@ -485,9 +485,11 @@ static int stm32_i2c_message_xfer(struct stm32_i2c_priv *i2c_priv, > } > } > > - /* End of transfer, send stop condition */ > - mask = STM32_I2C_CR2_STOP; > - setbits_le32(®s->cr2, mask); > + if (!ret) { > + /* End of transfer, send stop condition */ > + mask = STM32_I2C_CR2_STOP; > + setbits_le32(®s->cr2, mask); > + } > > return stm32_i2c_check_end_of_message(i2c_priv); > }