U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alain Volmat <alain.volmat@foss.st.com>
To: "Jorge Ramirez-Ortiz, Foundries" <jorge@foundries.io>
Cc: <uboot-stm32@st-md-mailman.stormreply.com>,
	<u-boot@lists.denx.de>, <patrice.chotard@foss.st.com>,
	<patrick.delaunay@foss.st.com>, <hs@denx.de>,
	<oleksandr.suvorov@foundries.io>
Subject: Re: [PATCH 3/3] i2c: stm32: only send a STOP upon transfer completion
Date: Thu, 8 Sep 2022 11:17:13 +0200	[thread overview]
Message-ID: <20220908091713.GA1762989@gnbcxd0016.gnb.st.com> (raw)
In-Reply-To: <20220908083622.GA117999@trex>

Hi Jorge,

On Thu, Sep 08, 2022 at 10:36:22AM +0200, Jorge Ramirez-Ortiz, Foundries wrote:
> On 08/09/22, 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).
> 
> um I debugged this - took me a couple of days - and I proposed a fix that has just
> been massaged a little in this PR.
> 
> IMO the best thing to do is either adding me - or to be fair yourself since you
> invested almost zero time on it - as a co-author. The hard bit was to find the
> issue in the first place.
> 
> what do you think?

I'm very sorry, it wasn't my intention at all but indeed I should have
taken more care to highlight your work.  Sorry about that.
I'm going to push a v2 for the serie, highlighting that and putting
your Signed-of first.

> 
> I'll try to find some time to test this.
> 
> > 
> > Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
> > ---
> >  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(&regs->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(&regs->cr2, mask);
> > -
> >  	return stm32_i2c_check_end_of_message(i2c_priv);
> >  }
> >  
> > -- 
> > 2.25.1
> > 

      reply	other threads:[~2022-09-08 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  8:06 [PATCH 0/3] i2c: stm32: cleanup & stop handling fix Alain Volmat
2022-09-08  8:06 ` [PATCH 1/3] i2c: stm32: fix comment and remove unused AUTOEND bit Alain Volmat
2022-09-08 12:48   ` Patrick DELAUNAY
2022-09-08  8:06 ` [PATCH 2/3] i2c: stm32: remove unused stop parameter in start & reload handling Alain Volmat
2022-09-08 12:48   ` Patrick DELAUNAY
2022-09-08  8:06 ` [PATCH 3/3] i2c: stm32: only send a STOP upon transfer completion Alain Volmat
2022-09-08  8:36   ` Jorge Ramirez-Ortiz, Foundries
2022-09-08  9:17     ` Alain Volmat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220908091713.GA1762989@gnbcxd0016.gnb.st.com \
    --to=alain.volmat@foss.st.com \
    --cc=hs@denx.de \
    --cc=jorge@foundries.io \
    --cc=oleksandr.suvorov@foundries.io \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox