On Thu, Oct 01, 2015 at 12:16:49AM +0000, Bondarenko, Anton wrote:Proposed code not able to clear LOOP mode in TEST register. What about something like this:
On 30.09.2015 10:42, Robin Gong wrote:Yes, I know writing 0 is harmless, but we never need to touch this register if
On Fri, Sep 25, 2015 at 07:57:12PM +0200, Anton Bondarenko wrote:LOOP mode can be set dynamically. This mean we should be able to set and clear the flag.
@@ -370,8 +374,12 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,It's better write this MX51_ECSPI_TEST only in LOOP mode.
if (config->mode & SPI_CS_HIGH)
cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
+ if (config->mode & SPI_LOOP)
+ lpb |= MX51_ECSPI_LOOP;
+
writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);
+ writel(lpb, spi_imx->base + MX51_ECSPI_TEST);
Currently only LOOP flag is used. I did not find any problems with writing 0 in the rest
fields of TEST register.
SPI_LOOP flags not set, I'd like below:
if (config->mode & SPI_LOOP) {
lpb |= MX51_ECSPI_LOOP;
writel(lgb, spi_imx->base + MX51_ECSPI_TEST);
}
/*
* Wait until the changes in the configuration register CONFIGREG