From: Thierry Reding <thierry.reding@gmail.com>
To: "Randolph Maaßen" <gaireg@gaireg.de>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
Mark Brown <broonie@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Sowjanya Komatineni <skomatineni@nvidia.com>,
linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: tegra20-slink: change chip select action order
Date: Tue, 26 Mar 2019 15:44:37 +0100 [thread overview]
Message-ID: <20190326144437.GA21654@ulmo> (raw)
In-Reply-To: <20190326143050.26232-1-gaireg@gaireg.de>
[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]
On Tue, Mar 26, 2019 at 03:30:50PM +0100, Randolph Maaßen wrote:
> To transfer via SPI the tegra20-slink driver first sets the command
> register, which contains the chip select value, and after that the
> command2 register, which contains the chip select line. This leads to a
> small spike in the chip selct 0 line between the set of the value and
> the selection of the chip select line.
>
> This commit changes the order of the register writes so that first the
> chip select line is chosen and then the value is set, removing the
> spike.
>
> Signed-off-by: Randolph Maaßen <gaireg@gaireg.de>
> ---
> drivers/spi/spi-tegra20-slink.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
Looks good to me. Adding Sowjanya who has been looking into SPI
recently.
Thierry
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 1427f343b39a..6d4679126213 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -717,9 +717,6 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
> command2 = tspi->command2_reg;
> command2 &= ~(SLINK_RXEN | SLINK_TXEN);
>
> - tegra_slink_writel(tspi, command, SLINK_COMMAND);
> - tspi->command_reg = command;
> -
> tspi->cur_direction = 0;
> if (t->rx_buf) {
> command2 |= SLINK_RXEN;
> @@ -729,9 +726,18 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
> command2 |= SLINK_TXEN;
> tspi->cur_direction |= DATA_DIR_TX;
> }
> +
> + /*
> + * Writing to the command2 register bevore the command register prevents
> + * a spike in chip_select line 0. This selects the chip_select line
> + * before changing the chip_select value.
> + */
> tegra_slink_writel(tspi, command2, SLINK_COMMAND2);
> tspi->command2_reg = command2;
>
> + tegra_slink_writel(tspi, command, SLINK_COMMAND);
> + tspi->command_reg = command;
> +
> if (total_fifo_words > SLINK_FIFO_DEPTH)
> ret = tegra_slink_start_dma_based_transfer(tspi, t);
> else
> --
> 2.11.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-03-26 14:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 14:30 [PATCH] spi: tegra20-slink: change chip select action order Randolph Maaßen
2019-03-26 14:44 ` Thierry Reding [this message]
2019-03-26 19:11 ` Sowjanya Komatineni
2019-03-28 16:34 ` Thierry Reding
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=20190326144437.GA21654@ulmo \
--to=thierry.reding@gmail.com \
--cc=broonie@kernel.org \
--cc=gaireg@gaireg.de \
--cc=jonathanh@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=skomatineni@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).