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 5E071ECAAD3 for ; Fri, 9 Sep 2022 08:30:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FCCE844E6; Fri, 9 Sep 2022 10:30:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="UnFHY0H3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB1EF83E4C; Fri, 9 Sep 2022 10:30:44 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 678DC844E6 for ; Fri, 9 Sep 2022 10:30:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wr1-x433.google.com with SMTP id t7so1469864wrm.10 for ; Fri, 09 Sep 2022 01:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date; bh=fBpCjizgmu50sDhjofNSK8n9JdwBT/AevOXrj9hPX4g=; b=UnFHY0H3zt6DAwIWc9giFmeCKzUtfzcg+fr2Ky0oclvHrOuYwXGQK3w3nJlESCrPDD 7lOfh3SQhHqjUqfN28V42/A4b/ICJjXF3Bym6zT6wUGyI4iMCDCCKEyjwHDdgMAMhueS CqhIDA5HlpLPRuU+906tAn24a8lPzE8WDjanpO7FZHDVfjPrSvcJc2sDc9aWm2erxCzh lxbpgdIocqIoMLLgoSb4ko1Ps1JyhHk/AsxKtdeblcNkTvtCEaEEvNWVB+giG9YV4GOL TrGOaU8Q1sGT6+BKkGdjRw95IMhyua7NpAt0aWCaa54+0smppYuZ6N46unvh+mX3NUwx b3mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date; bh=fBpCjizgmu50sDhjofNSK8n9JdwBT/AevOXrj9hPX4g=; b=J8kJdiwnEFOPH3DIpzbL4qBV3n7/17cbcr0tMc5lxYA4JIDWNiY+tr7n3Y6uXZOBIq MdMZtMX7yj9j6B6Y6sojDQaPUuWEuCsxFDcnGZRccZICAXyt2mB/IJLUOKUSHB7yijB+ zglgxn46UCINwLU3lwJaQmad8vqC4tWz0varFgWyzHZtmJK14k4wYv90GuuaHuXjGTXH PO2Zrg+T6F9RgKq+tjvSuFqK6/hGhcWlHB4APnnnayMaA7GKYaqFVO7zURnIkJkutqmb E5P1o/BTLVAtrOybfRYVgCG3OSG8osEL9i0XRDk+xh60ApOO1UMZN5RZCtn/lUvfiXIE IrbQ== X-Gm-Message-State: ACgBeo1YhzfhavmWMhSfiqGfOkl2Qgf3ljJS479ovDGtCaNHE36OiytF Mx1IuZ6wG0mFdV3AJeujfiqe5g== X-Google-Smtp-Source: AA6agR5lehtMjLw5PKFA+dck+2mRGdnRP4KPXupasFf4nwUsvkcbNwOs10U+2rGaOxSkb/Bt1aY9Qg== X-Received: by 2002:adf:e199:0:b0:228:60f6:f775 with SMTP id az25-20020adfe199000000b0022860f6f775mr7270497wrb.478.1662712239920; Fri, 09 Sep 2022 01:30:39 -0700 (PDT) Received: from trex (131.red-83-60-92.dynamicip.rima-tde.net. [83.60.92.131]) by smtp.gmail.com with ESMTPSA id p7-20020a05600c1d8700b003b33de17577sm1402264wms.13.2022.09.09.01.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 01:30:39 -0700 (PDT) From: "Jorge Ramirez-Ortiz, Foundries" X-Google-Original-From: "Jorge Ramirez-Ortiz, Foundries" Date: Fri, 9 Sep 2022 10:30:38 +0200 To: Patrick DELAUNAY Cc: Alain Volmat , uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de, patrice.chotard@foss.st.com, jorge@foundries.io, hs@denx.de, oleksandr.suvorov@foundries.io Subject: Re: [PATCH v2 3/3] i2c: stm32: only send a STOP upon transfer completion Message-ID: <20220909083038.GA314457@trex> References: <20220908105934.1764482-1-alain.volmat@foss.st.com> <20220908105934.1764482-4-alain.volmat@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 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 >