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 26855ECAAD5 for ; Mon, 12 Sep 2022 08:35:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 70BEC849BA; Mon, 12 Sep 2022 10:35:31 +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="mM+6stjj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71359849BA; Mon, 12 Sep 2022 10:35:29 +0200 (CEST) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 E7C75845FE for ; Mon, 12 Sep 2022 10:35:22 +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-x430.google.com with SMTP id k9so14185203wri.0 for ; Mon, 12 Sep 2022 01:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date; bh=s29l0wZzNZF8YyTkoEnvxt+MybTnCeKVppKqy7+Lexg=; b=mM+6stjjnKNrpjat/4eFUdCfFlotsJs+3xZoK9v5UNTGmz9kNwV9zmJCz6uQmzP/Jo WQ5GA/aA7TVcIkG7mTkMnIOEuiv+K6sojuVfNOWgpUGKwZdv5YcuSmkT83rJt+Lr/ZqE YEDTwfUBRaO4gCKifoygyZ3xAqXAJJQ41sDsc4ILq3fP+L+5/IQGwenb6499Eih9mMv+ fJLm9p1gS+kPVrSOAvbxRc6oaOqDxtDk3f+5M2NegrZGas0jiNx12hygg5fuZSlQD4r+ 63OcsdBiVac4ZhMYGXb27hYESohJ4nwCcI+4+cGn3geTnOBOC1JynyNLGvFcuxtkqG+L EznA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date; bh=s29l0wZzNZF8YyTkoEnvxt+MybTnCeKVppKqy7+Lexg=; b=fRAmWBThWMKuZve899wRGxERi+iXkK82LhQ0htG9W7jbAHkkgb9rAIp/bO6Gb4Gpq9 RRBeDcICtU08FyaW/Z/MmrVIVLnEpi4SOJVnflxrHmKlT8F2fHzAyMzj6uwoF0UusuI1 WsewMiXZAQp0WF+pWV7IdlY+s6ozeoZBK8M0vAC0Sak8JxX0x/lAgIdt3MNT9lw0GLhl sTIXbpJg30Xhv57vduKWWHYaXjwD8onIBFprygd92071s03uscS7LsZexqMF6RuluKKm FcCMzuaPSyGHAjlDcG5lroQxbCmyFrx/HBFXxj+pxEyl1U6q+GIKroh5+sX9AOLzJBQ2 zBfw== X-Gm-Message-State: ACgBeo1IF9ZdHTNDuMFhhoaXf9x6GW31BX2/V2KHOaYNXSPEA+29T7G3 hNu+qI0JMba+o4S+/tvQibe5/g== X-Google-Smtp-Source: AA6agR7rLVBw3wIrPRlD29m0AGzpwUcyh8eQjXUALvAGroxRLtpqgC2wN/cWfZc1+f7ZN9WdLUJMhw== X-Received: by 2002:a05:6000:1a8f:b0:228:e3c3:679 with SMTP id f15-20020a0560001a8f00b00228e3c30679mr13522002wry.281.1662971722426; Mon, 12 Sep 2022 01:35:22 -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 w10-20020a05600c038a00b003b2878b9e0dsm8836560wmd.20.2022.09.12.01.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:35:22 -0700 (PDT) From: "Jorge Ramirez-Ortiz, Foundries" X-Google-Original-From: "Jorge Ramirez-Ortiz, Foundries" Date: Mon, 12 Sep 2022 10:35:20 +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 v3 3/3] i2c: stm32: do not set the STOP condition on error Message-ID: <20220912083520.GA168503@trex> References: <20220909160627.1793406-1-alain.volmat@foss.st.com> <20220909160627.1793406-4-alain.volmat@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 12/09/22, Patrick DELAUNAY wrote: > Hi Alain, > > On 9/9/22 18:06, 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. > > > > 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 | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c > > index 0ec67b5c12..2db7f44d44 100644 > > --- a/drivers/i2c/stm32f7_i2c.c > > +++ b/drivers/i2c/stm32f7_i2c.c > > @@ -483,9 +483,9 @@ 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); > > + /* End of transfer, send stop condition if appropriate */ > > + if (!ret && !(status & (STM32_I2C_ISR_NACKF | STM32_I2C_ISR_ERRORS))) > > + setbits_le32(®s->cr2, STM32_I2C_CR2_STOP); > > return stm32_i2c_check_end_of_message(i2c_priv); > > } > > > > Reviewed-by: Patrick Delaunay > Tested-by: Patrick Delaunay [stm32mp157c-dk2] > > No regression detection on ST Microelectonics board. > > - No error trace on boot > > - I2C probe command is OK > >   STM32MP> i2c probe >   Valid chip addresses: 28 33 > > - And other tests done with the 2 I2C devices STPMIC1 & STUSB1600 are ok: >   regulalor command > >   pmic status command > >   USB type C connection/deconnection > > > @Jorge: can you test also for your use-case, thanks yes I did test a few hours ago and it is good on my end. can add my tested tag if needed Tested-by: Jorge Ramirez-Ortiz btw I also sent a patch to fix the way some dts properties are handled. shall I submit separately or will it be includeed in this set? > > > Thanks > Patrick > >