• Trent Piepho's avatar
    spi: spi-mxs: Don't set clock for each xfer · a560943e
    Trent Piepho authored
    mxs_spi_setup_transfer() would set the SSP SCK rate every time it was
    called, which is before every transfer.  It is uncommon for the SCK rate to
    change between transfers (or at all of that matter) and this causes many
    unnecessary reprogrammings of the clock registers.
    
    Code changed to only set the rate when it changes.  This significantly
    speeds up short SPI messages, especially messages made up of many transfers,
    as the calculation of the clock divisors is rather costly.  On an iMX287,
    using spidev with messages that consist of 511 transfers of 4 bytes each at
    an SCK of 48 MHz, the effective transfer rate more than doubles from about
    290 KB/sec to 600 KB/sec!
    Signed-off-by: default avatarTrent Piepho <tpiepho@gmail.com>
    Cc: Marek Vasut <marex@denx.de>
    Cc: Fabio Estevam <fabio.estevam@freescale.com>
    Cc: Shawn Guo <shawn.guo@linaro.org>
    Signed-off-by: default avatarMark Brown <broonie@linaro.org>
    a560943e
spi-mxs.c 14.5 KB