diff options
author | Andrew Y. Kuksov <qxovxp@gmail.com> | 2015-07-14 09:23:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-10-22 13:07:52 -0400 |
commit | 1476253cef9dbfc1f7f6a1bd19252ca528cd63bd (patch) | |
tree | 147550249f6d026795d7a6f3c838bcfa7d31c291 /drivers/spi/spi-imx.c | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) |
spi: imx: fix ecspi mode setup
Fixed problem with setting spi mode 0 or 1 after setting mode 2 or 3
SPI_MODE_0 and SPI_MODE_1 requires clock low when inactive. SPI_MODE_2
and SPI_MODE_3 requires clk high when inactive.
Currently driver can just set bits in fields SCLK_PHA (SPI Clock/Data
Phase Control), SCLK_POL (SPI Clock Polarity Control),
SCLK_CTL (controls the inactive state of SCLK) ans SS_POL (SPI SS
Polarity Select) of ECSPIx_CONFIGREG register.
This patch allows driver to clear corresponding bits in these fields.
Signed-off-by: Andrew Y. Kuksov <qxovxp@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-imx.c')
-rw-r--r-- | drivers/spi/spi-imx.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index f9deb84e4e55..0e5723ab47f0 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -336,13 +336,20 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, | |||
336 | 336 | ||
337 | if (config->mode & SPI_CPHA) | 337 | if (config->mode & SPI_CPHA) |
338 | cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs); | 338 | cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs); |
339 | else | ||
340 | cfg &= ~MX51_ECSPI_CONFIG_SCLKPHA(config->cs); | ||
339 | 341 | ||
340 | if (config->mode & SPI_CPOL) { | 342 | if (config->mode & SPI_CPOL) { |
341 | cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs); | 343 | cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs); |
342 | cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs); | 344 | cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs); |
345 | } else { | ||
346 | cfg &= ~MX51_ECSPI_CONFIG_SCLKPOL(config->cs); | ||
347 | cfg &= ~MX51_ECSPI_CONFIG_SCLKCTL(config->cs); | ||
343 | } | 348 | } |
344 | if (config->mode & SPI_CS_HIGH) | 349 | if (config->mode & SPI_CS_HIGH) |
345 | cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs); | 350 | cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs); |
351 | else | ||
352 | cfg &= ~MX51_ECSPI_CONFIG_SSBPOL(config->cs); | ||
346 | 353 | ||
347 | writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); | 354 | writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); |
348 | writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); | 355 | writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); |