summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bondarenko <anton.bondarenko.sama@gmail.com>2015-12-08 09:43:43 +0300
committerMark Brown <broonie@kernel.org>2015-12-16 01:40:35 +0300
commitf677f17cced0ca72a4331b64de119b35b19facb0 (patch)
treeac0e01ce3f039692e8bf9c8ff4a1e9ff104eb2d2
parentf8a876176f38e00aab200d308506ca4a4ba57b39 (diff)
downloadlinux-f677f17cced0ca72a4331b64de119b35b19facb0.tar.xz
spi: imx: fix loopback mode setup after controller reset
If controller hold in reset it's not possible to write any register except CTRL. So all other registers must be updated only after controller bring out from reset. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-imx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 410522fdd4c9..3aa33c8c819f 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -356,6 +356,9 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
else
cfg &= ~MX51_ECSPI_CONFIG_SSBPOL(config->cs);
+ /* CTRL register always go first to bring out controller from reset */
+ writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
+
reg = readl(spi_imx->base + MX51_ECSPI_TESTREG);
if (config->mode & SPI_LOOP)
reg |= MX51_ECSPI_TESTREG_LBC;
@@ -363,7 +366,6 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
reg &= ~MX51_ECSPI_TESTREG_LBC;
writel(reg, spi_imx->base + MX51_ECSPI_TESTREG);
- writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);
/*