Page MenuHomeFreeBSD

aw_spi: improve I/O stability
ClosedPublic

Authored by avg on Dec 19 2021, 9:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 5:32 PM
Unknown Object (File)
Wed, Sep 25, 1:15 PM
Unknown Object (File)
Wed, Sep 25, 6:42 AM
Unknown Object (File)
Tue, Sep 24, 4:41 PM
Unknown Object (File)
Mon, Sep 23, 4:47 PM
Unknown Object (File)
Fri, Sep 20, 10:22 AM
Unknown Object (File)
Thu, Sep 19, 2:45 PM
Unknown Object (File)
Wed, Sep 18, 7:31 PM
Subscribers

Details

Summary

This driver does not use DMA at the moment, so some care is needed to
prevent TX FIFO underruns and RX FIFO overflows.
Several improvements are done in oder to minimize chances of those.

First, the interrupt handling is moved to a filter to minimize latency.
Second, FIFO trigger thresholds are configured for both FIFOs.
The TX FIFO threshold is set to 3/4-th of its size and the RX FIFO
threshold is set to 1/4-th of its size.
The interrupt conditions are changed from the empty FIFO and full FIFO
for the TX and RX correspondingly to going below and above the thresholds.

While here I renamed AW_SPI_IER_RF_ERQ to AW_SPI_IER_RF_RDY which is
closer to what the documentation uses, RF_RDY_INT_EN in the interrupt
control register and RX_RDY in the interrupt status register.

Test Plan

Tested on Orange Pi PC Plus by driving a stick of 8 WS2812 addressable RGB LEDs using SPI MOSI signal.
The LEDs are quite sensitive to timing, so any jitter / stretching is visible.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43468
Build 40356: arc lint + arc unit

Event Timeline

avg requested review of this revision.Dec 19 2021, 9:44 AM

Thanks,
My only use was spi flash and it clearly doesn't care that much as RGB leds about timing.

This revision is now accepted and ready to land.Dec 19 2021, 10:14 AM
This revision was automatically updated to reflect the committed changes.