Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486713

Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes

From Noralf Trønnes <noralf@tronnes.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes
Date 2016-09-19 19:40 +0200
Message-ID <sjaHT-8o6-7@gated-at.bofh.it> (permalink)
References <sj8G6-786-9@gated-at.bofh.it> <sja5c-7Vk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Den 19.09.2016 18:51, skrev Eric Anholt:
> Noralf Trønnes <noralf@tronnes.org> writes:
>
>> 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.
>> In this situation wait_for_completion_timeout() apparently is unable to
>> stop the madness.
>>
>> 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>
> Patches 1, 3 are:
>
> Reviewed-by: Eric Anholt <eric@anholt.net>
>
> For patch 2 I followed some of it, but couldn't quite say it's a review.
> I trust your testing, and that the path has had a lot more testing in
> the downstream tree, so it's:

I don't know how much testing downstream really has had since this feature
is disabled by default. So there is a possibility that this can break some
devices (while at the same time enable others).
I wondered about adding a module parameter so it could be disabled at
runtime, but decided to see what the review would be first.
It is of course possible to add a this module parameter later should it
turn out to break some device.

Noralf.

> Acked-by: Eric Anholt <eric@anholt.net>
>
> Thanks!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes Noralf Trønnes <noralf@tronnes.org> - 2016-09-19 17:30 +0200
  [PATCH 3/3] i2c: bcm2835: Use ratelimited logging on transfer errors Noralf Trønnes <noralf@tronnes.org> - 2016-09-19 17:30 +0200
  [PATCH 2/3] i2c: bcm2835: Add support for combined write-read transfer Noralf Trønnes <noralf@tronnes.org> - 2016-09-19 17:30 +0200
    Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read  transfer Martin Sperl <kernel@martin.sperl.org> - 2016-09-20 09:20 +0200
      Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read  transfer Noralf Trønnes <noralf@tronnes.org> - 2016-09-20 10:50 +0200
        Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read  transfer Martin Sperl <kernel@martin.sperl.org> - 2016-09-20 12:20 +0200
          Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read  transfer Noralf Trønnes <noralf@tronnes.org> - 2016-09-20 13:00 +0200
            Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read transfer kernel@martin.sperl.org - 2016-09-20 13:30 +0200
              Re: [PATCH 2/3] i2c: bcm2835: Add support for combined write-read  transfer Noralf Trønnes <noralf@tronnes.org> - 2016-09-21 15:50 +0200
  Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger than 16 bytes Eric Anholt <eric@anholt.net> - 2016-09-19 19:00 +0200
    Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger  than 16 bytes Noralf Trønnes <noralf@tronnes.org> - 2016-09-19 19:40 +0200
  Re: [PATCH 1/3] i2c: bcm2835: Fix hang for writing messages larger  than 16 bytes Martin Sperl <kernel@martin.sperl.org> - 2016-09-20 09:50 +0200

csiph-web