linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Sperl <kernel@martin.sperl.org>
To: "Noralf Trønnes" <noralf@tronnes.org>,
	wsa@the-dreams.de, swarren@wwwdotorg.org, eric@anholt.net
Cc: linux-rpi-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes
Date: Tue, 20 Sep 2016 08:46:58 +0200	[thread overview]
Message-ID: <e473206c-7f9c-7b7d-d75d-7879425fc2f9@martin.sperl.org> (raw)
In-Reply-To: <1474298777-5858-1-git-send-email-noralf@tronnes.org>

On 19.09.2016 17:26, Noralf Trønnes wrote:
> Writing messages larger than the FIFO size results in a hang, rendering
> the machine unusable. This is because the RXD status flag is set on the
> first interrupt which results in bcm2835_drain_rxfifo() stealing bytes
> from the buffer. The controller continues to trigger interrupts waiting
> for the missing bytes, but bcm2835_fill_txfifo() has none to give.
I remember having seen similar interrupt issues with the SPI HW-block.
> In this situation wait_for_completion_timeout() apparently is unable to
> stop the madness.
That is because it is a level irq that immediately triggers another 
interrupt giving
no CPU no time to do other (threaded) OS activity - this might be slightly
different for multi-core machines...
> The BCM2835 ARM Peripherals datasheet has this to say about the flags:
>    TXD: is set when the FIFO has space for at least one byte of data.
>    RXD: is set when the FIFO contains at least one byte of data.
>    TXW: is set during a write transfer and the FIFO is less than full.
>    RXR: is set during a read transfer and the FIFO is or more full.
>
> Implementing the logic from the downstream i2c-bcm2708 driver solved
> the hang problem.
>
> Signed-off-by: Noralf Trønnes<noralf@tronnes.org>
Reviewed-by: Martin Sperl <kernel@martin.sperl.org>

      parent reply	other threads:[~2016-09-20  7:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 15:26 [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes Noralf Trønnes
2016-09-19 15:26 ` [PATCH 2/3] i2c: bcm2835: Add support for combined write-read transfer Noralf Trønnes
2016-09-20  7:19   ` Martin Sperl
2016-09-20  8:41     ` Noralf Trønnes
2016-09-20 10:15       ` Martin Sperl
2016-09-20 10:56         ` Noralf Trønnes
2016-09-20 11:29           ` kernel
2016-09-21 13:45             ` Noralf Trønnes
2016-09-19 15:26 ` [PATCH 3/3] i2c: bcm2835: Use ratelimited logging on transfer errors Noralf Trønnes
2016-09-19 16:51 ` [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes Eric Anholt
2016-09-19 17:36   ` Noralf Trønnes
2016-09-20  6:46 ` Martin Sperl [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=e473206c-7f9c-7b7d-d75d-7879425fc2f9@martin.sperl.org \
    --to=kernel@martin.sperl.org \
    --cc=eric@anholt.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=noralf@tronnes.org \
    --cc=swarren@wwwdotorg.org \
    --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).