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 769CEECAAA1 for ; Fri, 9 Sep 2022 08:43:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 10E2984B2C; Fri, 9 Sep 2022 10:43:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1662713019; bh=9oO8+iuvPFknqTNAmr1waie6Z9Twi3P5wDPNToXx7n8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=PAJOMaTn2T6vvo8vQtWh+jEHffp5FwfXDiecwZaMEsKYLJhy0HefM3g4XZxyjV/P5 okMHr/Vh9fCRfoNYvjEkJi+4Wk0BpCLKZpT4nD3M/IjaE1GIfNLGcx9tKCS1sgxCwL Ps3MWTUKWEkWNEPrdojICoR5zGrJ/UYdu+BzN5Fg5qaRYjIiqw/O/Q/zVWGJqhk4yN RS/IOHaR4Uk1AVDntUMdJjhO4hZVZYSpmNvrMnqs3tZeljo8MrjmUKQUN6SZmTrvnT nI9wQ0pC+6MML/o/YTrPc3wcOW9NrvSJs0lPE6IYjWHt6ZDNL9AND61bzlP37BI/sF IHH2LPQnwXoqg== Received: from [192.168.1.107] (82-131-156-114.pool.digikabel.hu [82.131.156.114]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hs@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1409883FC6; Fri, 9 Sep 2022 10:43:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1662713018; bh=9oO8+iuvPFknqTNAmr1waie6Z9Twi3P5wDPNToXx7n8=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Xz7OR87ygFfVUsb1aW62xlsKcb53zd5D0rLDfRh85cacaVS31x31evPUe2enXDwlg sphdFqEYJrDMAhtKEuIiV7YEyo47Gn2QNywoKULlz2zwrhVzFsx1wiDLZ8Jc9jt0vv o6pqKbrgbK0OjP+44Ifbh2i57g9abizAEK5rLNOp6jlYZojTjtsaqYsANcM5/bKXp4 BXwRzAFO6sOJ4udCijfX8Vs+unEJtD4kvM+YUeVSf3/yQAGksPPLA0Pswbgp4uUMhc vlzMsrkQrzZXD0LWVGL2BDxdAskkFZvTP+xkn67X0iW8AlZ962Wjw+tMgd4QRscFmo ZvIfNv+VaxSTw== Subject: Re: [PATCH v2 3/3] i2c: stm32: only send a STOP upon transfer completion To: "Jorge Ramirez-Ortiz, Foundries" , Patrick DELAUNAY Cc: Alain Volmat , uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de, patrice.chotard@foss.st.com, oleksandr.suvorov@foundries.io References: <20220908105934.1764482-1-alain.volmat@foss.st.com> <20220908105934.1764482-4-alain.volmat@foss.st.com> <20220909083038.GA314457@trex> From: Heiko Schocher Message-ID: <68306400-21b9-5fb6-cae9-55bdd1381168@denx.de> Date: Fri, 9 Sep 2022 10:43:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20220909083038.GA314457@trex> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Reply-To: hs@denx.de 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 Hello Jorge, On 09.09.22 10:30, Jorge Ramirez-Ortiz, Foundries wrote: > On 08/09/22, Patrick DELAUNAY wrote: >> Hi, >> >> On 9/8/22 12:59, Alain Volmat wrote: >>> Current function stm32_i2c_message_xfer is sending a STOP >>> whatever the result of the transaction is. This can cause issues >>> such as making the bus busy since the controller itself is already >>> sending automatically a STOP when a NACK is generated. This can >>> be especially seen when the processing get slower (ex: enabling lots >>> of debug messages), ending up send 2 STOP (one automatically by the >>> controller and a 2nd one at the end of the stm32_i2c_message_xfer >>> function). >>> > > Cmon no need to thank me, that is kind of excessive :) > Just the sign-off or codevelop tags for reference > > > if you can wait before merging I will test the series before monday I would love to see a test before we merge this. @Patrick: feel free to merge it through stm32 repo. Thanks! bye, Heiko > > thanks > Jorge > >>> Thanks to Jorge Ramirez-Ortiz for diagnosing and proposing a first >>> fix for this. [1] >>> >>> [1] https://lore.kernel.org/u-boot/20220815145211.31342-2-jorge@foundries.io/ >>> >>> Reported-by: Jorge Ramirez-Ortiz, Foundries >>> Signed-off-by: Jorge Ramirez-Ortiz >>> Signed-off-by: Alain Volmat >>> --- >>> drivers/i2c/stm32f7_i2c.c | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c >>> index 0ec67b5c12..8803979d3e 100644 >>> --- a/drivers/i2c/stm32f7_i2c.c >>> +++ b/drivers/i2c/stm32f7_i2c.c >>> @@ -477,16 +477,16 @@ static int stm32_i2c_message_xfer(struct stm32_i2c_priv *i2c_priv, >>> if (ret) >>> break; >>> + /* End of transfer, send stop condition */ >>> + mask = STM32_I2C_CR2_STOP; >>> + setbits_le32(®s->cr2, mask); >>> + >>> if (!stop) >>> /* Message sent, new message has to be sent */ >>> return 0; >>> } >>> } >>> - /* 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); >>> } >> >> >> Reviewed-by: Patrick Delaunay >> >> Thanks >> Patrick >> -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de