From: Federico Vaga <federico.vaga@cern.ch>
To: Peter Rosin <peda@axentia.se>
Cc: Peter Korsgaard <peter@korsgaard.com>,
Andrew Lunn <andrew@lunn.ch>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/5] i2c:ocores: stop transfer on timeout
Date: Mon, 11 Feb 2019 14:02:12 +0100 [thread overview]
Message-ID: <7790979.IuqCBRmgNN@pcbe13614> (raw)
In-Reply-To: <d406a2ea-9d37-3eca-d975-818a22ca2458@axentia.se>
On Monday, February 11, 2019 11:44:46 AM CET Peter Rosin wrote:
> On 2019-02-11 09:31, Federico Vaga wrote:
>
> > Detecting a timeout is ok, but we also need to assert a STOP command on
> > the bus in order to prevent it from generating interrupts when there are
> > no on going transfers.
> >
> > Example: very long transmission.
> >
> > 1. ocores_xfer: START a transfer
> > 2. ocores_isr : handle byte by byte the transfer
> > 3. ocores_xfer: goes in timeout [[bugfix here]]
> > 4. ocores_xfer: return to I2C subsystem and to the I2C driver
> > 5. I2C driver : it may clean up the i2c_msg memory
> > 6. ocores_isr : receives another interrupt (pending bytes to be
> >
> > transferred) but the i2c_msg memory is invalid now
> >
> >
> > So, since the transfer was too long, we have to detect the timeout and
> > STOP the transfer.
> >
> > Another point is that we have a critical region here. When handling the
> > timeout condition we may have a running IRQ handler. For this reason I
> > introduce a spinlock.
> >
> > In order to make easier to understan locking I have:
> > - added a new function to handle timeout
> > - modified the current ocores_process() function in order to be protected
> >
> > by the new spinlock
> >
> > Like this it is obvious at first sight that this locking serializes
> > the execution of ocores_process() and ocores_process_timeout()
> >
>
>
> *snip*
>
>
> > @@ -184,14 +197,14 @@ static void ocores_process(struct ocores_i2c *i2c)
> >
> >
> >
> > oc_setreg(i2c, OCI2C_DATA, addr);
> > oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START);
>
>
> Didn't checkpatch complain about the double space? Fixing it fits in
> patch 5...
Apparently not, I will add the fix the checkpatch PATCH
> Cheers,
> Peter
next prev parent reply other threads:[~2019-02-11 13:02 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 8:31 [PATCH v4 0/5] i2c:ocores: improvements Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 8:31 ` [PATCH v4 1/5] i2c:ocores: stop transfer on timeout Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 10:24 ` Wolfram Sang
2019-02-11 14:01 ` Andrew Lunn
2019-02-11 14:34 ` Federico Vaga
2019-02-11 14:34 ` Federico Vaga
2019-02-11 14:53 ` Wolfram Sang
2019-02-11 10:44 ` Peter Rosin
2019-02-11 13:02 ` Federico Vaga [this message]
2019-02-11 8:31 ` [PATCH v4 2/5] i2c:ocores: do not handle IRQ if IF is not set Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 10:24 ` Wolfram Sang
2019-02-11 8:31 ` [PATCH v4 3/5] i2c:ocores: add polling interface Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 10:25 ` Wolfram Sang
2019-02-11 13:47 ` Federico Vaga
2019-02-11 13:47 ` Federico Vaga
2019-02-11 10:43 ` Peter Rosin
2019-02-11 13:14 ` Federico Vaga
2019-02-11 13:35 ` Peter Rosin
2019-02-11 13:46 ` Federico Vaga
2019-02-11 8:31 ` [PATCH v4 4/5] i2c:ocores: add SPDX tag Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 10:25 ` Wolfram Sang
2019-02-11 8:31 ` [PATCH v4 5/5] i2c:ocores: checkpatch fixes Federico Vaga
2019-02-11 8:31 ` Federico Vaga
2019-02-11 10:16 ` Peter Rosin
2019-02-11 10:26 ` Wolfram Sang
2019-02-11 10:28 ` Peter Rosin
2019-02-11 10:52 ` Peter Rosin
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=7790979.IuqCBRmgNN@pcbe13614 \
--to=federico.vaga@cern.ch \
--cc=andrew@lunn.ch \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=peter@korsgaard.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.