All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rpi-kernel
	<linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 3/6] spi: bcm2835: fill FIFO before enabling interrupts to
Date: Tue, 7 Apr 2015 08:25:05 +0200	[thread overview]
Message-ID: <B9B4E3CA-D9F2-4A79-BC78-C3BD4B3844F2@martin.sperl.org> (raw)
In-Reply-To: <20150406172130.GU6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>


> On 06.04.2015, at 19:21, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> Right, and I have to say I do suspect that the underlying thing is that
> the FIFO is underrunning, but as far as the optimization is concerned
> that's a separate thing.  The reason this isn't enabled for native chip
> selects is that it's not working, the reason it's not working is
> something that should indeed probably be investigated.
Actually it happens exactly when setting the CS-register with the
interrupt flags enabled - typically observed in the middle of a transmit
of a byte the CS jumps, but the clock and data continue the transfers
correctly

As the CS register contains the interrupt flags as well as the 
control for the native-chip-selects this is impacting the chip select
lines in native mode.

I have never seen a glitch on the CLK or MISO/MOSI line in my logic
analyzer only CS jumps in the order of 1 sample in the logic analyzer
- @20MHz sample rate, so in the order of 50ns, probably less...

On top that happens only under some rare circumstances and can get rarely
observed - lots of samples (and memory) are needed to catch that one,
which typically results in a message in dmesg due to some unexpected
response crc checksum errors stalled processing.

This is from my experience from over a year ago with a fully DMA
pipelined driver that did all the programming of SPI in DMA as well and
there were some reports of people seeing "glitches" before I moved to
GPIO-CS (equivalents)

See also:
http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=19489&start=125#p451817
for some observations mostly related to CLEAR_TX/CLEAR_RX that also
de-assert CS for short periods.

I also saw it _once_ in one of my traces when using native_cs 2-3 weeks
ago, but unfortunately I did not keep the capture...

Hence the requirement to use of gpio-cs when running this optimization,
as then the CS is not managed by the HW itself.

I have been filling (dd if=/dev/zero) a 2GB SD card repeatedly (more
than 9 times) for the last  12 hours and I have seen no issues -
besides the spi bus being occupied and spi_bus_locked for 17ms for
the data-transfers, which obviously impacts packet-reception (packet
loss) on CAN and ethernet network - but that is expected due to this
heavy load and long transfers.

Note that this test was executed using the latest patches I have sent
running at 16k interrupts/s and 4400 context-switches/second at 4MHz 
SPI-bus-speed for the SD-card.
The transfer of 1.6GB to the SD-card (filling up the partition) took
about 4350 seconds or 366kB/s - 3600s would be the ideal situation
without overheads, latencies or similar.


--
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:[~2015-04-07  6:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-29 14:03 [PATCH 3/6] spi: bcm2835: fill FIFO before enabling interrupts to Martin Sperl
     [not found] ` <3628E5E2-7EA9-488F-AF5F-A2E43D2D1E3E-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-03-29 16:55   ` Mark Brown
2015-03-31  3:16   ` Stephen Warren
     [not found]     ` <551A1185.6060502-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-31  5:25       ` Mark Brown
     [not found]         ` <20150331052519.GZ2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-05  1:49           ` Stephen Warren
     [not found]             ` <552094B5.3050109-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-04-06 17:21               ` Mark Brown
     [not found]                 ` <20150406172130.GU6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-07  6:25                   ` Martin Sperl [this message]
     [not found]                     ` <B9B4E3CA-D9F2-4A79-BC78-C3BD4B3844F2-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-04-07  6:43                       ` Martin Sperl
2015-04-07 15:39                       ` Stephen Warren
     [not found]                         ` <5523FA17.6040009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-04-07 16:28                           ` Mark Brown
     [not found]                             ` <20150407162857.GM6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-08  9:41                               ` Martin Sperl
2015-04-07 17:05                           ` Martin Sperl
     [not found]                             ` <1BAEDC46-354E-49F4-BC6A-6AA5C1A4A1B4-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-04-07 17:40                               ` Mark Brown
     [not found]                                 ` <20150407174003.GN6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-07 18:18                                   ` Martin Sperl
     [not found]                                     ` <BD11C8AC-F517-4120-BBD6-07618EE86604-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-04-07 18:23                                       ` Mark Brown
     [not found]                                         ` <20150407182327.GP6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-07 20:28                                           ` Martin Sperl
2015-04-08  2:01                               ` Stephen Warren
     [not found]                                 ` <55248C07.8070903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-04-08  7:14                                   ` Martin Sperl
2015-03-31  5:51       ` Martin Sperl

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=B9B4E3CA-D9F2-4A79-BC78-C3BD4B3844F2@martin.sperl.org \
    --to=kernel-tqfnsx0mhmxhksadf0wuew@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@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 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.