All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Feng Tang <feng.tang@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"spi-devel-general@lists.sourceforge.net" 
	<spi-devel-general@lists.sourceforge.net>,
	alan@linux.intel.com, alek.du@intel.com
Subject: Re: [PATCH 3/5] dw_spi: rework message processing
Date: Thu, 16 Jun 2011 12:52:29 -0700	[thread overview]
Message-ID: <4DFA5EFD.6020608@gmail.com> (raw)
In-Reply-To: <BANLkTinaP5w4N-pnoWMor-JWQfC8mc9yWg@mail.gmail.com>

On 06/16/2011 10:38 AM, Grant Likely wrote:
> On Thu, Jun 16, 2011 at 11:28 AM, Dirk Brandewie
> <dirk.brandewie@gmail.com>  wrote:
>> On 06/16/2011 07:00 AM, Feng Tang wrote:
>>>
>>> 4. I saw you enable both TX/RX interrupt when doing interrupt transfer,
>>> spi
>>>     devices' TX/RX are born to be simutaneous, when one word is sent over
>>>     TX line, a RX word will be received from RX line, so both the orignal
>>>     interrupt transfer handling written by me and the later optimization
>>>     from Alek Du only enable TX interrupt, which will only generate half of
>>>     IRQs comparing to enble both TX/RX, this is huge when the data rate is
>>>     several Mb per second
>>
>> I the current driver the txfltr register is set to 0 (FIFO empty) in the
>> interrupt transfer case which will drop chip select every FIFO length bytes.
>>
>> In my transfer setup the RX FIFO interrupt is set to a value lower than the
>> TX threshold which will keep both interrupts from firing at the same time.
>>
>> The TX interrupt will drive the transfer until there are less than
>> tx_threshold bytes left to transfer then by the RX interrupt to drive the
>> remainder of the transfer without dropping chip select.
>
> Be careful here.  Can you guarantee that the kernel will process the
> IRQ before the FIFO drains?  If not, then you'll need something more
> reliable.

I can't guarantee when IRQ are processed :-)

Without actual control over when chip is de-asserted I don't think we guarantee 
that chip select will be not dropped, chip select is dropped when the TX fifo 
goes empty.

With a sufficiently high bitrate client, heavily loaded system and fixed size 
fifo we are domed at some point.  As tx_threshold approaches fifo depth you give 
yourself a bigger buffer in time but increase the number of interrupts you need 
to deal with increasing the system load.

For high bitrate devices the client driver should be using DMA IMHO to work 
around this limitation in the designware IP.  Of course this doesn't solve the 
problem of chip select dropping between transfers in the same message.

I took a SWAG at tx_threshold in my changes to try to limit the number of 
interrupts it will need tuning for a reasonable default and likely the addition 
of a module parameter or platform data to set it for any given SOC/system.

--Dirk





  reply	other threads:[~2011-06-16 19:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 17:23 [PATCH 0/5] Designware SPI driver update dirk.brandewie
2011-06-15 17:23 ` [PATCH 1/5] spi/makefile: Fix typo from reorganize drivers patch dirk.brandewie
2011-06-16 12:31   ` Grant Likely
2011-06-15 17:23 ` [PATCH 2/5] spi/dw_spi: expose dw_spi platform data stucture dirk.brandewie
2011-06-15 17:23 ` [PATCH 3/5] dw_spi: rework message processing dirk.brandewie
2011-06-15 17:23   ` dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2011-06-16 13:14   ` Grant Likely
2011-06-16 16:03     ` Dirk Brandewie
2011-06-16 16:40       ` Grant Likely
2011-06-16 14:00   ` Feng Tang
2011-06-16 14:00     ` Feng Tang
2011-06-16 17:28     ` Dirk Brandewie
2011-06-16 17:28       ` Dirk Brandewie
2011-06-16 17:38       ` Grant Likely
2011-06-16 17:38         ` Grant Likely
2011-06-16 19:52         ` Dirk Brandewie [this message]
2011-06-16 19:52           ` Dirk Brandewie
2011-06-17  1:22       ` Feng Tang
2011-06-17  1:22         ` Feng Tang
2011-06-17  1:34     ` Du, Alek
2011-06-17  1:34       ` Du, Alek
2011-06-15 17:23 ` [PATCH 4/5] spi/spi-dw: update function naming convention dirk.brandewie
2011-06-15 17:23   ` dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2011-06-16 13:15   ` Grant Likely
2011-06-15 17:23 ` [PATCH 5/5] spi_dw_pci: Add runtime power management dirk.brandewie
2011-06-15 17:23   ` dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2011-06-16 13:16   ` Grant Likely

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=4DFA5EFD.6020608@gmail.com \
    --to=dirk.brandewie@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=alek.du@intel.com \
    --cc=feng.tang@intel.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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.