All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
To: Robin Gong <b38343@freescale.com>
Cc: "broonie@kernel.org" <broonie@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"Wang, Jiada (ESD)" <Jiada_Wang@mentor.com>,
	"Zapolskiy, Vladimir" <Vladimir_Zapolskiy@mentor.com>
Subject: Re: [PATCH v2 5/8] spi: imx: Add support for loopback for ECSPI controllers
Date: Wed, 21 Oct 2015 01:08:17 +0200	[thread overview]
Message-ID: <5626C961.7070009@gmail.com> (raw)
In-Reply-To: <20151008092827.GB6101@shlinux2>



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

WARNING: multiple messages have this Message-ID (diff)
From: Anton Bondarenko <anton.bondarenko.sama-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Robin Gong <b38343-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: "broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"Wang,
	Jiada (ESD)" <Jiada_Wang-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>,
	"Zapolskiy,
	Vladimir"
	<Vladimir_Zapolskiy-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 5/8] spi: imx: Add support for loopback for ECSPI controllers
Date: Wed, 21 Oct 2015 01:08:17 +0200	[thread overview]
Message-ID: <5626C961.7070009@gmail.com> (raw)
In-Reply-To: <20151008092827.GB6101@shlinux2>



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-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: anton.bondarenko.sama@gmail.com (Anton Bondarenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/8] spi: imx: Add support for loopback for ECSPI controllers
Date: Wed, 21 Oct 2015 01:08:17 +0200	[thread overview]
Message-ID: <5626C961.7070009@gmail.com> (raw)
In-Reply-To: <20151008092827.GB6101@shlinux2>



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

  reply	other threads:[~2015-10-20 23:08 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 17:57 [PATCH v2 0/8] Improvements for SPI IMX driver for Freescale IMX53 and IMX6 families Anton Bondarenko
2015-09-25 17:57 ` Anton Bondarenko
2015-09-25 17:57 ` Anton Bondarenko
2015-09-25 17:57 ` [PATCH v2 1/8] spi: imx: Fix DMA transfer Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-28  3:48   ` kbuild test robot
2015-09-28  3:48     ` kbuild test robot
2015-09-30  8:23   ` Robin Gong
2015-09-30  8:23     ` Robin Gong
2015-09-30  8:23     ` Robin Gong
2015-10-01  0:02     ` Bondarenko, Anton
2015-10-01  0:02       ` Bondarenko, Anton
2015-10-01  0:02       ` Bondarenko, Anton
2015-10-08  9:19       ` Robin Gong
2015-10-08  9:19         ` Robin Gong
2015-10-08  9:19         ` Robin Gong
2015-10-20 23:03         ` Anton Bondarenko
2015-10-20 23:03           ` Anton Bondarenko
2015-10-20 23:03           ` Anton Bondarenko
2015-09-25 17:57 ` [PATCH v2 2/8] spi: imx: replace fixed timeout with calculated one Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-30  8:31   ` Robin Gong
2015-09-30  8:31     ` Robin Gong
2015-09-30  8:31     ` Robin Gong
2015-10-01  0:08     ` Bondarenko, Anton
2015-10-01  0:08       ` Bondarenko, Anton
2015-10-01  0:08       ` Bondarenko, Anton
2015-09-25 17:57 ` [PATCH v2 3/8] spi: imx: add support for all SPI word width for DMA transfer Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-30  8:35   ` Robin Gong
2015-09-30  8:35     ` Robin Gong
2015-10-01  0:34     ` Bondarenko, Anton
2015-10-01  0:34       ` Bondarenko, Anton
2015-10-01  0:34       ` Bondarenko, Anton
2015-10-08  9:51       ` Robin Gong
2015-10-08  9:51         ` Robin Gong
2015-10-08  9:51         ` Robin Gong
2015-10-20 23:28         ` Anton Bondarenko
2015-10-20 23:28           ` Anton Bondarenko
2015-10-20 23:28           ` Anton Bondarenko
2015-09-25 17:57 ` [PATCH v2 4/8] spi: imx: add selection for iMX53 and iMX6 controller type Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57 ` [PATCH v2 5/8] spi: imx: Add support for loopback for ECSPI controllers Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-30  8:42   ` Robin Gong
2015-09-30  8:42     ` Robin Gong
2015-09-30  8:42     ` Robin Gong
2015-10-01  0:16     ` Bondarenko, Anton
2015-10-01  0:16       ` Bondarenko, Anton
2015-10-01  0:16       ` Bondarenko, Anton
2015-10-08  9:28       ` Robin Gong
2015-10-08  9:28         ` Robin Gong
2015-10-08  9:28         ` Robin Gong
2015-10-20 23:08         ` Anton Bondarenko [this message]
2015-10-20 23:08           ` Anton Bondarenko
2015-10-20 23:08           ` Anton Bondarenko
2015-09-25 17:57 ` [PATCH v2 6/8] spi: imx: return error from dma channel request Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-30  8:51   ` Robin Gong
2015-09-30  8:51     ` Robin Gong
2015-09-25 17:57 ` [PATCH v2 7/8] spi: imx: defer spi initialization, if DMA engine is pending Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-30  8:54   ` Robin Gong
2015-09-30  8:54     ` Robin Gong
2015-09-30  8:54     ` Robin Gong
2015-09-25 17:57 ` [PATCH v2 8/8] spi: imx: Add support for SPI Slave mode for imx53 and imx6 chips Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko
2015-09-25 17:57   ` Anton Bondarenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5626C961.7070009@gmail.com \
    --to=anton.bondarenko.sama@gmail.com \
    --cc=Jiada_Wang@mentor.com \
    --cc=Vladimir_Zapolskiy@mentor.com \
    --cc=b38343@freescale.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.