• Vladimir Oltean's avatar
    spi: spi-fsl-dspi: Use EOQ for last word in buffer even for XSPI mode · ea93ed4c
    Vladimir Oltean authored
    The EOQ mode has a hardware limitation in that it stops the transmission
    (including the deassertion of the chip select signal) once the host CPU
    requests end-of-queue for a particular word in the TX FIFO.
    
    And XSPI mode has a limitation in that we need a separate CMD FIFO entry
    for the last byte in the buffer, where the chip select signal needs to
    be deasserted. It's not a functional limitation, but it's rather clunky
    and the fact that we need to halt the pipeline and write a single entry
    to the TX FIFO whenever a buffer ends brings the throughput down when
    transmitting small buffers.
    
    So the idea here is to use EOQ's limitation in our favor when using XSPI
    mode. Stop special-casing that final word in the buffer, and just kill
    the chip select signal by issuing an EOQ for that last word. Now it can
    be mixed in with all the other words in the current TX FIFO train.
    
    A small trick here is that we still keep using the XSPI-specific
    signaling via the CMDTCFQ interrupt in RSER, and not enabling the EOQ
    interrupt, in order to avoid hardware weirdness (potential races with
    separate interrupts being raised for CMDTCFQ and EOQ for what is in fact
    the end of the same transmission). That is just theoretical, but it's
    good to be cautious, and the EOQ interrupt isn't needed.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://lore.kernel.org/r/20200304220044.11193-12-olteanv@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    ea93ed4c
spi-fsl-dspi.c 35.7 KB