From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Mans Rullgard <mans-2StjZFpD7GcAvxtiuMwx3w@public.gmane.org>,
"Yang,
Wenyou" <Wenyou.Yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi: atmel: fix handling of cs_change set on non-last xfer
Date: Tue, 26 Jan 2016 18:01:01 +0100 [thread overview]
Message-ID: <56A7A64D.1070601@atmel.com> (raw)
In-Reply-To: <1453080351-29593-1-git-send-email-mans-2StjZFpD7GcAvxtiuMwx3w@public.gmane.org>
Le 18/01/2016 02:25, Mans Rullgard a écrit :
> The driver does the wrong thing when cs_change is set on a non-last
> xfer in a message. When cs_change is set, the driver deactivates the
> CS and leaves it off until a later xfer again has cs_change set whereas
> it should be briefly toggling CS off and on again.
>
> This patch brings the behaviour of the driver back in line with the
> documentation and common sense. The delay of 10 us is the same as is
> used by the default spi_transfer_one_message() function in spi.c.
>
> Fixes: 8090d6d1a415 ("spi: atmel: Refactor spi-atmel to use SPI framework queue")
> Signed-off-by: Mans Rullgard <mans-2StjZFpD7GcAvxtiuMwx3w@public.gmane.org>
Hi Mans,
Yes, it seems to be a sensible thing to do:
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Thanks, best regards.
> ---
> drivers/spi/spi-atmel.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index aebad36391c9..4b8ccf1f897e 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -315,7 +315,6 @@ struct atmel_spi {
> struct atmel_spi_dma dma;
>
> bool keep_cs;
> - bool cs_active;
>
> u32 fifo_size;
> };
> @@ -1406,11 +1405,9 @@ static int atmel_spi_one_transfer(struct spi_master *master,
> &msg->transfers)) {
> as->keep_cs = true;
> } else {
> - as->cs_active = !as->cs_active;
> - if (as->cs_active)
> - cs_activate(as, msg->spi);
> - else
> - cs_deactivate(as, msg->spi);
> + cs_deactivate(as, msg->spi);
> + udelay(10);
> + cs_activate(as, msg->spi);
> }
> }
>
> @@ -1433,7 +1430,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
> atmel_spi_lock(as);
> cs_activate(as, spi);
>
> - as->cs_active = true;
> as->keep_cs = false;
>
> msg->status = 0;
>
--
Nicolas Ferre
--
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
next prev parent reply other threads:[~2016-01-26 17:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 1:25 [PATCH] spi: atmel: fix handling of cs_change set on non-last xfer Mans Rullgard
[not found] ` <1453080351-29593-1-git-send-email-mans-2StjZFpD7GcAvxtiuMwx3w@public.gmane.org>
2016-01-26 17:01 ` Nicolas Ferre [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-10-18 15:35 Gregory CLEMENT
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=56A7A64D.1070601@atmel.com \
--to=nicolas.ferre-aife0yeh4naavxtiumwx3w@public.gmane.org \
--cc=Wenyou.Yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mans-2StjZFpD7GcAvxtiuMwx3w@public.gmane.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 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).