summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-fsl-espi.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-11-04 21:01:12 +0100
committerMark Brown <broonie@kernel.org>2016-11-04 14:46:39 -0600
commit8f3086d2a9c1104f42d2d0247ef52b01c6d898d8 (patch)
tree26e56443abcf6ac574670471a5fe5e88ef69cf6a /drivers/spi/spi-fsl-espi.c
parent60d9531a61efc8e6b69d04089d50a0a929090fe1 (diff)
downloadblackbird-op-linux-8f3086d2a9c1104f42d2d0247ef52b01c6d898d8.tar.gz
blackbird-op-linux-8f3086d2a9c1104f42d2d0247ef52b01c6d898d8.zip
spi: fsl-espi: don't write ESPI_SPMODE register if the mode doesn't change
There's no need to bother the chip if the mode doesn't change. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-fsl-espi.c')
-rw-r--r--drivers/spi/spi-fsl-espi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 1029bd2ff5f1..edb524f831a3 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -249,6 +249,7 @@ static void fsl_espi_setup_transfer(struct spi_device *spi,
int bits_per_word = t ? t->bits_per_word : spi->bits_per_word;
u32 pm, hz = t ? t->speed_hz : spi->max_speed_hz;
struct spi_mpc8xxx_cs *cs = spi->controller_state;
+ u32 hw_mode_old = cs->hw_mode;
/* mask out bits we are going to set */
cs->hw_mode &= ~(CSMODE_LEN(0xF) | CSMODE_DIV16 | CSMODE_PM(0xF));
@@ -271,8 +272,10 @@ static void fsl_espi_setup_transfer(struct spi_device *spi,
cs->hw_mode |= CSMODE_PM(pm);
- fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(spi->chip_select),
- cs->hw_mode);
+ /* don't write the mode register if the mode doesn't change */
+ if (cs->hw_mode != hw_mode_old)
+ fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(spi->chip_select),
+ cs->hw_mode);
}
static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
OpenPOWER on IntegriCloud