提交 8f3086d2 编写于 作者: H Heiner Kallweit 提交者: Mark Brown

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: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 60d9531a
...@@ -249,6 +249,7 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, ...@@ -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; int bits_per_word = t ? t->bits_per_word : spi->bits_per_word;
u32 pm, hz = t ? t->speed_hz : spi->max_speed_hz; u32 pm, hz = t ? t->speed_hz : spi->max_speed_hz;
struct spi_mpc8xxx_cs *cs = spi->controller_state; struct spi_mpc8xxx_cs *cs = spi->controller_state;
u32 hw_mode_old = cs->hw_mode;
/* mask out bits we are going to set */ /* mask out bits we are going to set */
cs->hw_mode &= ~(CSMODE_LEN(0xF) | CSMODE_DIV16 | CSMODE_PM(0xF)); cs->hw_mode &= ~(CSMODE_LEN(0xF) | CSMODE_DIV16 | CSMODE_PM(0xF));
...@@ -271,6 +272,8 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, ...@@ -271,6 +272,8 @@ static void fsl_espi_setup_transfer(struct spi_device *spi,
cs->hw_mode |= CSMODE_PM(pm); cs->hw_mode |= CSMODE_PM(pm);
/* 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), fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(spi->chip_select),
cs->hw_mode); cs->hw_mode);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册