mbox series

[0/9] spi: bcm2835aux: bug fixes and improvements

Message ID 20190224125440.16117-1-kernel@martin.sperl.org (mailing list archive)
Headers show
Series spi: bcm2835aux: bug fixes and improvements | expand

Message

Martin Sperl Feb. 24, 2019, 12:54 p.m. UTC
From: Martin Sperl <kernel@martin.sperl.org>

Set of patches improving the spi-bcm2835aux driver and fixing
a data read corruption bug.

The main motivation is a rare data corruption fix that is mostly
observed in polling mode first reported by Hubert Denkmair.

So this patchset first implements a means to control the parameters
of when polling mode is used via module parameters and exports
the corresponding statistics.

As stated in original patch the driver does not support native CS.
But when cs-gpios is not configured in the dt (so a buggy dt) it is
still working with a lot of limitations, but the driver does not report
this fact.

So this patchset adds reporting and allows for a single native CS
(with limited functionality) to continue working with a buggy DT.
One question here remains: do we need to legacy support DTs
that are not following specs in the first place?

Then there is the real fix for the data-corruption which is split
into 3 parts: some code cleanup with code reuse, removing "dangerous"
fifo read (possibly introducing fifo data corruption) and safe fifo read

Finally we remove some dead code.

Martin Sperl (9):
  spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
  spi: bcm2835aux: warn in dmesg that native cs is not really supported
  spi: bcm2835aux: setup gpio-cs to output and correct level during
    setup
  spi: bcm2835aux: add driver specific stats to debugfs
  spi: bcm2835aux: make the polling duration limits configurable
  spi: bcm2835aux: unifying code between polling and interrupt driven
    code
  spi: bcm2835aux: remove dangerous uncontrolled read of fifo
  spi: bcm2835aux: use BCM2835_AUX_SPI_STAT_RX_LVL
  spi: bcm2835aux: remove dead code

 drivers/spi/spi-bcm2835aux.c | 205 +++++++++++++++++++++++++++++++------------
 1 file changed, 149 insertions(+), 56 deletions(-)

--
2.11.0

Comments

Stefan Wahren Feb. 24, 2019, 7:22 p.m. UTC | #1
Hi Martin,

> kernel@martin.sperl.org hat am 24. Februar 2019 um 13:54 geschrieben:
> 
> 
> From: Martin Sperl <kernel@martin.sperl.org>
> 
> Set of patches improving the spi-bcm2835aux driver and fixing
> a data read corruption bug.
> 
> The main motivation is a rare data corruption fix that is mostly
> observed in polling mode first reported by Hubert Denkmair.
> 
> So this patchset first implements a means to control the parameters
> of when polling mode is used via module parameters and exports
> the corresponding statistics.
> 
> As stated in original patch the driver does not support native CS.
> But when cs-gpios is not configured in the dt (so a buggy dt) it is
> still working with a lot of limitations, but the driver does not report
> this fact.
> 
> So this patchset adds reporting and allows for a single native CS
> (with limited functionality) to continue working with a buggy DT.
> One question here remains: do we need to legacy support DTs
> that are not following specs in the first place?
> 
> Then there is the real fix for the data-corruption which is split
> into 3 parts: some code cleanup with code reuse, removing "dangerous"
> fifo read (possibly introducing fifo data corruption) and safe fifo read
> 
> Finally we remove some dead code.
> 
> Martin Sperl (9):
>   spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
>   spi: bcm2835aux: warn in dmesg that native cs is not really supported
>   spi: bcm2835aux: setup gpio-cs to output and correct level during
>     setup
>   spi: bcm2835aux: add driver specific stats to debugfs
>   spi: bcm2835aux: make the polling duration limits configurable
>   spi: bcm2835aux: unifying code between polling and interrupt driven
>     code
>   spi: bcm2835aux: remove dangerous uncontrolled read of fifo
>   spi: bcm2835aux: use BCM2835_AUX_SPI_STAT_RX_LVL
>   spi: bcm2835aux: remove dead code
> 

i consider patch 7 and 8 as possible stable candidates. How about rearranging this series that these patches comes first and could be backported?
Martin Sperl Feb. 24, 2019, 8:11 p.m. UTC | #2
> On 24.02.2019, at 20:22, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>> 
>> Finally we remove some dead code.
>> 
>> Martin Sperl (9):
>>  spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
>>  spi: bcm2835aux: warn in dmesg that native cs is not really supported
>>  spi: bcm2835aux: setup gpio-cs to output and correct level during
>>    setup
>>  spi: bcm2835aux: add driver specific stats to debugfs
>>  spi: bcm2835aux: make the polling duration limits configurable
>>  spi: bcm2835aux: unifying code between polling and interrupt driven
>>    code
>>  spi: bcm2835aux: remove dangerous uncontrolled read of fifo
>>  spi: bcm2835aux: use BCM2835_AUX_SPI_STAT_RX_LVL
>>  spi: bcm2835aux: remove dead code
>> 
> 
> i consider patch 7 and 8 as possible stable candidates. How about rearranging this series that these patches comes first and could be backported?

Well - as far as I know 6+7+8 can get applied independently 
(and you will need 6 as otherwise you would need to apply
at least 8 in 2 places).

The one observation that I have made is that when applying those
against 4.14 you needed some more patches that have gone in since
4.14 to apply cleanly.

Martin