linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Domen Puncer <domen-CvScVCPLwOZg9hUCZPvPmw@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: SPI devices that require lots of small transfers, how?
Date: Thu, 11 Dec 2008 16:35:36 +0100	[thread overview]
Message-ID: <20081211153536.GM1924@domen-work> (raw)

Hello!

I'm writing a driver for a 2 Mbit/s wireless chip interfaced via SPI.
Now, transmit isn't a problem, I can push data out at full speed
(interrupt handler just signals with a semaphore that there's a free TX
buffer, then in process context I write the next one).

I'm having trouble with receiving lots of data.
The chip has 3 32-byte buffers, with interrupt per received buffer this
makes about 7800 interrupts/second at full speed.
Offloading RX transfers to userspace doesn't seem to be an option, since
it misses packets; those 3 buffers fill up pretty fast.

If I handle it in interrupt, with spi_async, then I'm not sure how can I
implement this RX loop (pseudocode, to get the idea):
	do {
		spi_device_read_payload()
		spi_device_clear_rx_interrupt()
	} while (spi_device_there_is_more_data())

A recursion with spi_async() callbacks doesn't sound safe.

(Handling in interrupt, without the above loop doesn't seem fast enough
either, I'm losing packets).


Any ideas, suggestions, comments are very much welcome.
Surely someone had to deal with something similar in the past?


	Domen

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

                 reply	other threads:[~2008-12-11 15:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20081211153536.GM1924@domen-work \
    --to=domen-cvscvcplwozg9huczpvpmw@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).