From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Ulrich Hecht <uli+renesas@fpond.eu>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux I2C <linux-i2c@vger.kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH v4] i2c: sh_mobile: implement atomic transfers
Date: Mon, 5 Oct 2020 09:36:14 +0200 [thread overview]
Message-ID: <CAMuHMdX=815AT54cOECCVvsD70AbhOzXKAMpQccE5XvOS4TSdw@mail.gmail.com> (raw)
In-Reply-To: <20201002154423.GA16758@ninjato>
Hi Wolfram,
On Fri, Oct 2, 2020 at 5:44 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> On Mon, Sep 28, 2020 at 05:59:50PM +0200, Ulrich Hecht wrote:
> > Implements atomic transfers to fix reboot/shutdown on r8a7790 Lager and
> > similar boards.
> >
> > Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
> > @@ -581,10 +585,12 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg,
> > + if (pd->atomic_xfer) {
> > + unsigned long j = jiffies + pd->adap.timeout;
> > +
> > + time_left = time_before_eq(jiffies, j);
> > + while (time_left &&
> > + !(pd->sr & (ICSR_TACK | SW_DONE))) {
> > + unsigned char sr = iic_rd(pd, ICSR);
> > +
> > + if (sr & (ICSR_AL | ICSR_TACK |
> > + ICSR_WAIT | ICSR_DTE)) {
> > + sh_mobile_i2c_isr(0, pd);
> > + udelay(150);
> > + } else {
> > + cpu_relax();
> > + }
>
> Is it 100% safe to call cpu_relax() that late? Aren't interrupts
> disabled? What is waking the CPU again? And where does the value 150us
> come from?
cpu_relax() does not sleep, usually it's merely a compiler directive.
On arm32/v7 (and most other platforms):
#define cpu_relax() barrier()
#define barrier() __asm__ __volatile__("": : :"memory")
On arm64:
static inline void cpu_relax(void)
{
asm volatile("yield" ::: "memory");
}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2020-10-05 7:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 15:59 [PATCH v4] i2c: sh_mobile: implement atomic transfers Ulrich Hecht
2020-10-02 15:44 ` Wolfram Sang
2020-10-05 7:36 ` Geert Uytterhoeven [this message]
2020-10-06 7:59 ` Ulrich Hecht
2020-10-05 7:39 ` Geert Uytterhoeven
2020-10-06 6:40 ` Wolfram Sang
2020-10-08 9:48 ` Wolfram Sang
2020-11-06 14:27 ` Wolfram Sang
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='CAMuHMdX=815AT54cOECCVvsD70AbhOzXKAMpQccE5XvOS4TSdw@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=geert+renesas@glider.be \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=uli+renesas@fpond.eu \
--cc=wsa@the-dreams.de \
/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;
as well as URLs for NNTP newsgroup(s).