]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
spi/imx: set the inactive state of the clock according to the clock polarity
authorKnut Wohlrab <knut.wohlrab@de.bosch.com>
Tue, 25 Sep 2012 11:21:57 +0000 (13:21 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 28 Sep 2012 13:05:08 +0000 (14:05 +0100)
There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <knut.wohlrab@de.bosch.com>
Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/spi/spi-imx.c

index e834ff8c0188281dc0fe25304c31df4294afde5f..d64655b70b59d45386799f8f550fb69d5a53fc4f 100644 (file)
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
 #define MX51_ECSPI_CONFIG_SCLKPOL(cs)  (1 << ((cs) +  4))
 #define MX51_ECSPI_CONFIG_SBBCTRL(cs)  (1 << ((cs) +  8))
 #define MX51_ECSPI_CONFIG_SSBPOL(cs)   (1 << ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)  (1 << ((cs) + 20))
 
 #define MX51_ECSPI_INT         0x10
 #define MX51_ECSPI_INT_TEEN            (1 <<  0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
        if (config->mode & SPI_CPHA)
                cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
 
-       if (config->mode & SPI_CPOL)
+       if (config->mode & SPI_CPOL) {
                cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+               cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+       }
        if (config->mode & SPI_CS_HIGH)
                cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);