linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>,
	Haojian Zhuang
	<haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andy Shevchenko
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Mika Westerberg
	<mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH 2/2] spi: pxa2xx: Fix too early chipselect deassert
Date: Fri, 5 Feb 2016 09:38:29 +0200	[thread overview]
Message-ID: <56B45175.8090101@linux.intel.com> (raw)
In-Reply-To: <874mdo5gwm.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>

On 02/04/2016 11:01 PM, Robert Jarzmik wrote:
> Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> writes:
>
>> There is a chance that chipselect is deasserted too early while the last
>> clock cycle is still running. Protocol analyzers will see this as a failed
>> last byte. This is more likely to occur with slow bitrates, for instance
>> at 25 kbps.
>>
>> Reason for this is when using SPI mode 0 that both SPI host controller and
>> SPI slave will drive the data lines at the falling edge of clock signal
>> and sample at the rising edge. Receive FIFO gets the last bit now at the
>> rising edge and code sees transfer to be finished either by the interrupt
>> in PIO mode or by the DMA completion in DMA mode.
>>
>> The SSP Time Out register SSTO should take care of delaying the
>> completion but it does not seems to have effect at least on Intel
>> Skylake and Broxton even when using long enough values. Depending on
>> timing code may get into point where chipselect is deasserted while the
>> last clock cycle is still running at its second half cycle.
>>
>> Fix this by adding a wait loop in giveback() that waits until SSP becomes
>> idle before deasserting the chipselect.
>>
>> Reported-by: Weifeng Voon <weifeng.voon-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>> For normal development cycle. This is not a fatal issue and I guess real SPI
>> slaves may not hickup because of it. But you never know.
>
> I feel quite nervous about this one, as it will affect all pxa variants, for a
> Skylake and Broxton issues.
>
> What makes me even more nervous is that I don't have a way to test it yet ...
>
> I will neither ack nor block it, let's have others judge it first.
>
I didn't see reason to do this conditionally as pxa2xx_spi_flush() is 
polling the busy bit too. However your question reminded me I haven't 
looked the PXA data sheets at all but just the code only that changes 
don't break the existing PXA cases.

According to PXA3xx datasheet the busy bit is defined as in Intel platforms.

-- 
Jarkko
--
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

  parent reply	other threads:[~2016-02-05  7:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 10:30 [PATCH 1/2] spi: pxa2xx: Update comment in int_transfer_complete() Jarkko Nikula
     [not found] ` <1454581857-12921-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-02-04 10:30   ` [PATCH 2/2] spi: pxa2xx: Fix too early chipselect deassert Jarkko Nikula
     [not found]     ` <1454581857-12921-2-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-02-04 12:16       ` Applied "spi: pxa2xx: Fix too early chipselect deassert" to the spi tree Mark Brown
2016-02-04 21:01       ` [PATCH 2/2] spi: pxa2xx: Fix too early chipselect deassert Robert Jarzmik
     [not found]         ` <874mdo5gwm.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>
2016-02-05  7:38           ` Jarkko Nikula [this message]
2016-02-04 12:16   ` Applied "spi: pxa2xx: Update comment in int_transfer_complete()" to the spi tree Mark Brown
2016-02-04 20:49   ` [PATCH 1/2] spi: pxa2xx: Update comment in int_transfer_complete() Robert Jarzmik

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=56B45175.8090101@linux.intel.com \
    --to=jarkko.nikula-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org \
    --cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=robert.jarzmik-GANU6spQydw@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).