]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
spi: omap2-mcspi: Fix set_cs function for active high
authorMichael Welling <mwelling@ieee.org>
Sun, 24 May 2015 02:13:43 +0000 (21:13 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 25 May 2015 12:00:04 +0000 (13:00 +0100)
The core spi driver swaps the polarity of the enable based on SPI_CS_HIGH.
The omap2 controller has an internal configuration register bit called
OMAP2_MCSPI_CHCONF_EPOL to handle active high chip selects as well.

So we have to revert swap the polarity back for the correct setting of the
OMAP2_MCSPI_CHCONF_FORCE bit in omap2_mcspi_set_cs.

Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-omap2-mcspi.c

index 304b427db95d1e90a37034a76f9252a6aa1a0bb6..502db29fd0fe79685e3bec7591e9d9064eb46b51 100644 (file)
@@ -247,6 +247,13 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable)
 {
        u32 l;
 
+       /* The controller handles the inverted chip selects
+        * using the OMAP2_MCSPI_CHCONF_EPOL bit so revert
+        * the inversion from the core spi_set_cs function.
+        */
+       if (spi->mode & SPI_CS_HIGH)
+               enable = !enable;
+
        if (spi->controller_state) {
                l = mcspi_cached_chconf0(spi);