Commit 218e0b57 authored by Marcus Weseloh's avatar Marcus Weseloh Committed by Mark Brown

spi: sun4i: Prevent chip-select from being activated twice before a transfer

The SPI core calls set_cs before a transfer, but the SUN4I_CTL_CS_MANUAL
flag is only set in transfer_one. This leads to the following pattern on
the chip-select line (with runtime power-management on every transfer,
without it only on the first one):

activate, deactivate, activate, transfer, deactivate

Moving the configuration of the SUN4I_CTL_CS_MANUAL flag from transfer_one
to set_cs removes the double activation.
Signed-off-by: default avatarMarcus Weseloh <mweseloh42@gmail.com>
Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8005c49d
...@@ -140,6 +140,9 @@ static void sun4i_spi_set_cs(struct spi_device *spi, bool enable) ...@@ -140,6 +140,9 @@ static void sun4i_spi_set_cs(struct spi_device *spi, bool enable)
reg &= ~SUN4I_CTL_CS_MASK; reg &= ~SUN4I_CTL_CS_MASK;
reg |= SUN4I_CTL_CS(spi->chip_select); reg |= SUN4I_CTL_CS(spi->chip_select);
/* We want to control the chip select manually */
reg |= SUN4I_CTL_CS_MANUAL;
if (enable) if (enable)
reg |= SUN4I_CTL_CS_LEVEL; reg |= SUN4I_CTL_CS_LEVEL;
else else
...@@ -222,9 +225,6 @@ static int sun4i_spi_transfer_one(struct spi_master *master, ...@@ -222,9 +225,6 @@ static int sun4i_spi_transfer_one(struct spi_master *master,
else else
reg |= SUN4I_CTL_DHB; reg |= SUN4I_CTL_DHB;
/* We want to control the chip select manually */
reg |= SUN4I_CTL_CS_MANUAL;
sun4i_spi_write(sspi, SUN4I_CTL_REG, reg); sun4i_spi_write(sspi, SUN4I_CTL_REG, reg);
/* Ensure that we have a parent clock fast enough */ /* Ensure that we have a parent clock fast enough */
......
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