[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5626C961.7070009@gmail.com>
Date: Wed, 21 Oct 2015 01:08:17 +0200
From: Anton Bondarenko <anton.bondarenko.sama@...il.com>
To: Robin Gong <b38343@...escale.com>
Cc: "broonie@...nel.org" <broonie@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"Wang, Jiada (ESD)" <Jiada_Wang@...tor.com>,
"Zapolskiy, Vladimir" <Vladimir_Zapolskiy@...tor.com>
Subject: Re: [PATCH v2 5/8] spi: imx: Add support for loopback for ECSPI
controllers
On 08.10.2015 11:28, Robin Gong wrote:
> On Thu, Oct 01, 2015 at 12:16:49AM +0000, Bondarenko, Anton wrote:
>> On 30.09.2015 10:42, Robin Gong wrote:
>>> On Fri, Sep 25, 2015 at 07:57:12PM +0200, Anton Bondarenko wrote:
>>>> @@ -370,8 +374,12 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
>>>> 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);
>>> It's better write this MX51_ECSPI_TEST only in LOOP mode.
>> LOOP mode can be set dynamically. This mean we should be able to set and clear the flag.
>> Currently only LOOP flag is used. I did not find any problems with writing 0 in the rest
>> fields of TEST register.
> Yes, I know writing 0 is harmless, but we never need to touch this register if
> 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);
> }
>
Proposed code not able to clear LOOP mode in TEST register. What about
something like this:
if (config->mode & SPI_LOOP)
lpb |= MX51_ECSPI_LOOP;
if ((readl(spi_imx->base + MX51_ECSPI_TEST) & MX51_ECSPI_LOOP) != lpb)
writel(lpb, spi_imx->base + MX51_ECSPI_TEST);
In this case driver will write TEST register only if needed.
>>>>
>>>> /*
>>>> * Wait until the changes in the configuration register CONFIGREG
Regards,
Anton
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists