]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
spi: sun4i: Prevent chip-select from being activated twice before a transfer
authorMarcus Weseloh <mweseloh42@gmail.com>
Tue, 5 Jan 2016 20:46:20 +0000 (21:46 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 7 Jan 2016 15:41:25 +0000 (15:41 +0000)
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: Marcus Weseloh <mweseloh42@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sun4i.c

index fbb0a4d74e91c6716d6adc87c8c9bbae91487ed5..a6d936c68674ce20216d28b20022995990075761 100644 (file)
@@ -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(spi->chip_select);
 
+       /* We want to control the chip select manually */
+       reg |= SUN4I_CTL_CS_MANUAL;
+
        if (enable)
                reg |= SUN4I_CTL_CS_LEVEL;
        else
@@ -222,9 +225,6 @@ static int sun4i_spi_transfer_one(struct spi_master *master,
        else
                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);
 
        /* Ensure that we have a parent clock fast enough */