Commit 2bd16e3e authored by Stefan Sørensen's avatar Stefan Sørensen Committed by Mark Brown

spi: omap2-mcspi: Do not configure the controller on each transfer unless needed

spi_transfer->speed_hz and spi_transfer->bits_per_word used to only be set when
not using the default settings but are not set on every transfer, causing
omap2_mcspi_setup_transfer to be called on each transfer. This patch changes
the check to only call omap2_mcspi_setup_transfer if the settings needs to be
changed.
Signed-off-by: default avatarStefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 38dbfb59
...@@ -1057,12 +1057,15 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) ...@@ -1057,12 +1057,15 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
status = -EINVAL; status = -EINVAL;
break; break;
} }
if (par_override || t->speed_hz || t->bits_per_word) { if (par_override ||
(t->speed_hz != spi->max_speed_hz) ||
(t->bits_per_word != spi->bits_per_word)) {
par_override = 1; par_override = 1;
status = omap2_mcspi_setup_transfer(spi, t); status = omap2_mcspi_setup_transfer(spi, t);
if (status < 0) if (status < 0)
break; break;
if (!t->speed_hz && !t->bits_per_word) if (t->speed_hz == spi->max_speed_hz &&
t->bits_per_word == spi->bits_per_word)
par_override = 0; par_override = 0;
} }
if (cd && cd->cs_per_word) { if (cd && cd->cs_per_word) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment