All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rui Sousa <rui.sousa@laposte.net>
To: David Brownell <david-b@pacbell.net>
Cc: dmitry pervushin <dpervushin@gmail.com>,
	Vitaly Wool <vwool@ru.mvista.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	basicmark@yahoo.com, komal_shah802003@yahoo.com,
	stephen@streetfiresound.com,
	spi-devel-general@lists.sourceforge.net, Joachim_Jaeger@digi.com
Subject: Re: [spi-devel-general] Re: [PATCH 2.6-git 0/4] SPI core refresh
Date: Tue, 13 Dec 2005 19:02:05 +0100	[thread overview]
Message-ID: <1134496925.10394.54.camel@localhost.localdomain> (raw)
In-Reply-To: <200512130835.38754.david-b@pacbell.net>

On Tue, 2005-12-13 at 08:35 -0800, David Brownell wrote:
> > On Mon, 2005-12-12 at 19:01 +0100, Rui Sousa wrote:
> > > How do you handle IRQ's generated by a SPI device (e.g ack the
> > > interrupt, check if it was the SPI device that generated the
> > > interrupt, ...) if you can't read/write on the SPI bus from interrupt
> > > context?
> 
> I don't understand the question.  The SPI controller may be busy
> handling transactions for a different device,

If you provide an async API to start with... if everything is sync
then this problem goes away[1]. When I started writing the SPI layer for
my platform (before any SPI patches started circulating) I was going
to use an async API and then decided against it. For the type of device
I'm using, a SLIC device, where only control data is exchanged on the
SPI bus (read register, check some bit, write register, ...) and very
small amounts of data are transferred at a time (4 bytes maximum) there
is really no point to an async API.

Once you give the possibility to transfer data asynchronously on the SPI
bus, and even if you add a pseudo sync interface, you loose the
possibility to call the transfer function (synchronously) from hard/soft
interrupt context. One way or the other you will eventually need to
sleep.

This forces a simple code like:

u8 device_read_reg(int reg)
{
	u8 buf;

	buf = reg;
	spi_write(dev, &buf, 1);

	spi_read(dev, &buf, 1);

	return buf[0];
}

to be moved to user context or to become much more complex (state
machine + async callbacks).

I guess what I'm trying to say is that for a simple device like the one
I'm using, having an async API adds more trouble that what it's worth
it. Unfortunately I don't have a better solution to put forward.

>  so the best you
> could do from _any_ IRQ handler is to queue some messages that
> will get to the IRQ-issuing device sometime later.
>   It's not
> possible to make the other transactions finish any faster, or
> abort them safely mid-transfer.
> 
> The way the ads7846 driver handles it, for example, is to issue
> a transaction collecting a bunch of touchscreen sensor readings.
> And disable its (nonsharable) irq,

nonsharable is the magic word. I thought of this solution, leaving the
interrupt handler with the interrupt masked and do all the handling in
a workqueue... but my GPIO pin used to generate the interrupt is being
shared with another device.

>  since the interrupt will be
> raised for some time and there's no portable way for Linux to
> force the IRQ to trigger only on the relevant edge.
> 
> See the 2.6.15-rc5-mm1 patches...
> 
> - Dave
> 
> 

Rui

[1] I know this is not a reasonable solution for a number of cases.



  reply	other threads:[~2005-12-13 18:03 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 15:20 [PATCH 2.6-git 0/4] SPI core refresh Vitaly Wool
2005-12-12 15:22 ` [PATCH 2.6-git 1/4] SPI core refresh: SPI core patch Vitaly Wool
2005-12-12 15:49   ` Russell King
2005-12-12 15:24 ` [PATCH 2.6-git 2/4] SPI core refresh: MTD dataflash driver Vitaly Wool
2005-12-12 15:26 ` [PATCH 2.6-git 3/4] SPI core refresh: SPI/PNX controller Vitaly Wool
2005-12-12 15:27 ` [PATCH 2.6-git 4/4] SPI core refresh: dumb EEPROM driver Vitaly Wool
2005-12-12 18:01 ` [PATCH 2.6-git 0/4] SPI core refresh Rui Sousa
2005-12-13 12:09   ` [spi-devel-general] " dmitry pervushin
2005-12-13 15:11     ` Rui Sousa
2005-12-13 17:06       ` dmitry pervushin
2005-12-14  6:57       ` Vitaly Wool
2005-12-14 14:28         ` Rui Sousa
2005-12-13 16:35     ` David Brownell
2005-12-13 18:02       ` Rui Sousa [this message]
2005-12-13 14:06 ` [PATCH/RFC] SPI: add async message handing library to David Brownell's core Vitaly Wool
2005-12-13 16:53   ` [PATCH/RFC] SPI: add DMAUNSAFE analog " Vitaly Wool
2005-12-13 19:01     ` David Brownell
2005-12-13 19:15       ` Greg KH
2005-12-14 13:50         ` Vitaly Wool
2005-12-14 17:18           ` Greg KH
2005-12-14 17:53             ` Vitaly Wool
2005-12-14 18:50               ` [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 19:29                 ` Vitaly Wool
2005-12-14 19:02               ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core David Brownell
2005-12-14 19:19                 ` Vitaly Wool
2005-12-14 19:33                   ` [spi-devel-general] Re: [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 19:34                 ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Vitaly Wool
2005-12-15  6:47                 ` Vitaly Wool
2005-12-15 16:44                   ` Greg KH
2005-12-15 22:23                     ` Vitaly Wool
2005-12-15 23:02                       ` Greg KH
2005-12-16  8:37                         ` Vitaly Wool
2005-12-16 17:34                           ` Greg KH
2005-12-16 18:32                             ` [spi-devel-general] Re: [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-15 20:06                   ` David Brownell
2005-12-15 22:17                     ` Vitaly Wool
2005-12-15 22:33                       ` Greg KH
2005-12-16  3:34                         ` Andy Isaacson
2005-12-16  5:17                           ` Greg KH
2005-12-14 19:16               ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Greg KH
2005-12-14 19:30                 ` Vitaly Wool
2005-12-15 10:00               ` [spi-devel-general] " dmitry pervushin
2005-12-14 17:22           ` David Brownell
2005-12-14 17:50             ` Vitaly Wool
2005-12-14 19:17               ` [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 20:11                 ` Vitaly Wool
2005-12-13 21:47       ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Vitaly Wool
2005-12-13 22:15       ` Vitaly Wool
2005-12-14 16:55         ` David Brownell
2005-12-14 17:23           ` Vitaly Wool
2005-12-14 18:48   ` [PATCH/RFC] SPI: add async message handing library " Stephen Street
2005-12-14 19:41     ` Vitaly Wool
2005-12-14 21:19       ` Stephen Street
2005-12-14 19:31   ` [PATCH/RFC] SPI: add async message handing library David Brownell
2005-12-15 12:19   ` [PATCH/RFC] SPI: async message handing library update Vitaly Wool
2005-12-18 18:59     ` David Brownell
2005-12-19 15:40       ` [spi-devel-general] " dmitry pervushin
2005-12-20  7:23         ` David Brownell
2005-12-20 18:02       ` Vitaly Wool
2005-12-22 17:28         ` David Brownell
2005-12-22 22:10           ` Vitaly Wool
2005-12-22 23:55             ` David Brownell
2005-12-21 13:17       ` Vitaly Wool

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=1134496925.10394.54.camel@localhost.localdomain \
    --to=rui.sousa@laposte.net \
    --cc=Joachim_Jaeger@digi.com \
    --cc=basicmark@yahoo.com \
    --cc=david-b@pacbell.net \
    --cc=dpervushin@gmail.com \
    --cc=komal_shah802003@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=stephen@streetfiresound.com \
    --cc=vwool@ru.mvista.com \
    /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.