From: Wolfram Sang <wsa@the-dreams.de>
To: Ulrich Hecht <uli+renesas@fpond.eu>
Cc: linux-renesas-soc@vger.kernel.org, geert@linux-m68k.org,
linux-i2c@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH v4] i2c: sh_mobile: implement atomic transfers
Date: Fri, 2 Oct 2020 17:44:23 +0200 [thread overview]
Message-ID: <20201002154423.GA16758@ninjato> (raw)
In-Reply-To: <20200928155950.1185-1-uli+renesas@fpond.eu>
[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]
Hi Uli,
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>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
It works, but I have two comments and two questions:
> @@ -581,10 +585,12 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg,
> pd->pos = -1;
> pd->sr = 0;
>
> + if (pd->atomic_xfer)
> + return;
> +
> pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8);
> if (pd->dma_buf)
> sh_mobile_i2c_xfer_dma(pd);
> -
This blank line should stay.
...
> + 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?
> + time_left = time_before_eq(jiffies, j);
> + }
> + } else {
> + /* The interrupt handler takes care of the rest... */
> + time_left = wait_event_timeout(pd->wait,
> + pd->sr & (ICSR_TACK | SW_DONE),
> + pd->adap.timeout);
> +
> + /* 'stop_after_dma' tells if DMA xfer was complete */
> + i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg,
> + pd->stop_after_dma);
>
This blank line can go.
Thanks and regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-10-02 15:44 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 [this message]
2020-10-05 7:36 ` Geert Uytterhoeven
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=20201002154423.GA16758@ninjato \
--to=wsa@the-dreams.de \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=uli+renesas@fpond.eu \
/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.