Hi Daniel,

On Thu, Aug 4, 2016 at 8:16 PM, Daniel Palmer <[email protected]> wrote:
> On 5 August 2016 at 02:56, Chris Brandt <[email protected]> wrote:
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Daniel Palmer
>> I got DMA working on the RZ/A1H and started to notice this:
>>
>> spi_master spi0: receive timeout
>>
>> What seems to be happening is that there is a DMA transfer for the SPI bus
>> happening so the interrupts are masked. A small transfer that is smaller
>> than the fifo size comes along so __rspi_can_dma returns false and a PIO
>> transfer is started but the interrupt to say it's finished is handled by the
>> DMA controller so the spi driver never sees that it finished. Making
>> __rspi_can_dma always return true makes the problem go away.

> I think I have actually worked this one out. I was blaming the SPI
> driver incorrectly.

As a person having worked on the rspi driver, I'm happy to hear that ;-)

> The DMA driver (Hacked up version from the BSP with DT support) was
> never resetting the register (DMARS) that causes the SPI interrupts to
> be routed there instead.
> So after a DMA transfer PIO never worked again.

Oops...

> I'm not sure it's actually any faster with DMA as there are massive
> delays between each byte being transmitted.

That's a shame, as on R-Car Gen2 it made a big difference when using
DMA for single SPI transfers, cfr.

commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577
Author: Geert Uytterhoeven <[email protected]>
Date:   Mon Jun 2 15:38:17 2014 +0200

    spi: rspi: Add DMA support for QSPI on R-Car Gen2

    Enable DMA support for QSPI on R-Car Gen2, for Single, Dual, and Quad SPI
    Transfers.

    Performance figures for reading from a QSPI FLASH driven at 24.375 MHz
    on r8a7791/koelsch:
      - Single:  1.1 Mbps PIO, 23 Mbps DMA
      - Dual  : 12.7 Mbps PIO, 48 Mbps DMA
      - Quad  : 13   Mbps PIO, 70 Mbps DMA

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Reply via email to