]> git.baikalelectronics.ru Git - kernel.git/commit
spi: spi-mxs: Don't set clock for each xfer
authorTrent Piepho <tpiepho@gmail.com>
Tue, 1 Oct 2013 20:15:47 +0000 (13:15 -0700)
committerMark Brown <broonie@linaro.org>
Fri, 18 Oct 2013 00:00:32 +0000 (01:00 +0100)
commit39762651d4b9710ad4f04b6e9b63c5fcf387c8dd
tree5b585266e5d3660eb93b5fe2f6c4a80da3061a44
parent1fcc15faa266db1a4003c86a7784a8ec72ccf2d3
spi: spi-mxs: Don't set clock for each xfer

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: Trent 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: Mark Brown <broonie@linaro.org>
drivers/spi/spi-mxs.c