* Interrupts on GPIO
@ 2009-03-30 15:57 Yann Pelletier
  2009-03-30 16:32 ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Pelletier @ 2009-03-30 15:57 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org
Hi,=20
I'd like to add supports for interrupts handling from GPIO controller.  Som=
e of these interrupts are from I2C devices and some others are from SPI dev=
ices.
What is the best approach to enable interrupts handling for those devices t=
hrough GPIO.
Note that I'm developing on a custom board based on mpc8313_rdb using linux=
 2.6.28.5
Also,=20
# cat /proc/interrupts
           CPU0      =20
 16:         60   IPIC   Level     serial
 17:          0   IPIC   Level     fpga
 18:          4   IPIC   Level     mpc83xx_spi
 21:          0   IPIC   Level     i2c-mpc
 22:          7   IPIC   Level     i2c-mpc
According to my platform device tree, serial irq should be on int9, SPI on =
int16 and i2c on int14,15.  This causes me some problems as I need int18 to=
 map to external IRQ2.
Thanks for support.
Yann
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Interrupts on GPIO
  2009-03-30 15:57 Interrupts on GPIO Yann Pelletier
@ 2009-03-30 16:32 ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2009-03-30 16:32 UTC (permalink / raw)
  To: Yann Pelletier; +Cc: linuxppc-dev@ozlabs.org
On Mon, Mar 30, 2009 at 9:57 AM, Yann Pelletier
<ypelletier@haivision.com> wrote:
>
> Hi,
> I'd like to add supports for interrupts handling from GPIO controller. =
=A0Some of these interrupts are from I2C devices and some others are from S=
PI devices.
>
> What is the best approach to enable interrupts handling for those devices=
 through GPIO.
Modify the GPIO driver to also be a cascaded IRQ driver (see
http://patchwork.ozlabs.org/patch/21914/ for an example).
> Also,
>
> # cat /proc/interrupts
> =A0 =A0 =A0 =A0 =A0 CPU0
> =A016: =A0 =A0 =A0 =A0 60 =A0 IPIC =A0 Level =A0 =A0 serial
> =A017: =A0 =A0 =A0 =A0 =A00 =A0 IPIC =A0 Level =A0 =A0 fpga
> =A018: =A0 =A0 =A0 =A0 =A04 =A0 IPIC =A0 Level =A0 =A0 mpc83xx_spi
> =A021: =A0 =A0 =A0 =A0 =A00 =A0 IPIC =A0 Level =A0 =A0 i2c-mpc
> =A022: =A0 =A0 =A0 =A0 =A07 =A0 IPIC =A0 Level =A0 =A0 i2c-mpc
>
> According to my platform device tree, serial irq should be on int9, SPI o=
n int16 and i2c on int14,15. =A0This causes me some problems as I need int1=
8 to map to external IRQ2.
These numbers are *Linux internal* virtual irq numbers.  They have no
relation to the physical IRQ number for each interrupt controller.
Just make sure your Device Tree maps the IRQs correctly and you'll be
okay.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE:  Interrupts on GPIO
       [not found] <mailman.3884.1238431353.26545.linuxppc-dev@ozlabs.org>
@ 2009-03-31 20:59 ` Yann Pelletier
  2009-03-31 21:38   ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Pelletier @ 2009-03-31 20:59 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org
> Message: 7
> Date: Mon, 30 Mar 2009 10:32:17 -0600
> From: Grant Likely <grant.likely@secretlab.ca>
> Subject: > To: Yann Pelletier <ypelletier@haivision.com>
> Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
> Message-ID:
> 	<fa686aa40903300932p2c92110g2907bb7bf80d44d@mail.gmail.com>
> Content-Type: text/plain; charset=3DISO-8859-1
>=20
> On Mon, Mar 30, 2009 at 9:57 AM, Yann Pelletier
> <ypelletier@haivision.com> wrote:
> >
> > Hi,
> > I'd like to add supports for interrupts handling from GPIO controller.
> ?Some of these interrupts are from I2C devices and some others are from
> SPI devices.
> >
> > What is the best approach to enable interrupts handling for those
> devices through GPIO.
>=20
> Modify the GPIO driver to also be a cascaded IRQ driver (see
> http://patchwork.ozlabs.org/patch/21914/ for an example).
>=20
I've looked at the patch but I wonder if this would be applicable to the MP=
C8313.  If my understanding is good, in the MPC52xx you have 8 gpio only in=
terrupts and 8 gpio/gpt.  With the MPC8313, each GPIO can act as an interru=
pt but they are all muxed to only 1 interrupt in the IPIC.  So I'm concern =
about making the GPIO controller act as an interrupt controller.
> > Also,
> >
> > # cat /proc/interrupts
> > ? ? ? ? ? CPU0
> > ?16: ? ? ? ? 60 ? IPIC ? Level ? ? serial
> > ?17: ? ? ? ? ?0 ? IPIC ? Level ? ? fpga
> > ?18: ? ? ? ? ?4 ? IPIC ? Level ? ? mpc83xx_spi
> > ?21: ? ? ? ? ?0 ? IPIC ? Level ? ? i2c-mpc
> > ?22: ? ? ? ? ?7 ? IPIC ? Level ? ? i2c-mpc
> >
> > According to my platform device tree, serial irq should be on int9, SPI
> on int16 and i2c on int14,15. ?This causes me some problems as I need
> int18 to map to external IRQ2.
>=20
> These numbers are *Linux internal* virtual irq numbers.  They have no
> relation to the physical IRQ number for each interrupt controller.
> Just make sure your Device Tree maps the IRQs correctly and you'll be
> okay.
>=20
This is good now, thanks
> g.
>=20
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>=20
>=20
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Interrupts on GPIO
  2009-03-31 20:59 ` Yann Pelletier
@ 2009-03-31 21:38   ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2009-03-31 21:38 UTC (permalink / raw)
  To: Yann Pelletier; +Cc: linuxppc-dev@ozlabs.org
On Tue, Mar 31, 2009 at 2:59 PM, Yann Pelletier
<ypelletier@haivision.com> wrote:
>> Message: 7
>> Date: Mon, 30 Mar 2009 10:32:17 -0600
>> From: Grant Likely <grant.likely@secretlab.ca>
>> Subject: > To: Yann Pelletier <ypelletier@haivision.com>
>> Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
>> Message-ID:
>> =A0 =A0 =A0 <fa686aa40903300932p2c92110g2907bb7bf80d44d@mail.gmail.com>
>> Content-Type: text/plain; charset=3DISO-8859-1
>>
>> On Mon, Mar 30, 2009 at 9:57 AM, Yann Pelletier
>> <ypelletier@haivision.com> wrote:
>> >
>> > Hi,
>> > I'd like to add supports for interrupts handling from GPIO controller.
>> ?Some of these interrupts are from I2C devices and some others are from
>> SPI devices.
>> >
>> > What is the best approach to enable interrupts handling for those
>> devices through GPIO.
>>
>> Modify the GPIO driver to also be a cascaded IRQ driver (see
>> http://patchwork.ozlabs.org/patch/21914/ for an example).
>>
>
> I've looked at the patch but I wonder if this would be applicable to the =
MPC8313. =A0If my understanding is good, in the MPC52xx you have 8 gpio onl=
y interrupts and 8 gpio/gpt. =A0With the MPC8313, each GPIO can act as an i=
nterrupt but they are all muxed to only 1 interrupt in the IPIC. =A0So I'm =
concern about making the GPIO controller act as an interrupt controller.
Why?  The situation really isn't any different.  Using the GPIO
controller hardware as a Linux interrupt controller means that other
drivers can just use it without having to do anything special.  It's
just and IRQ.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply	[flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-31 21:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-30 15:57 Interrupts on GPIO Yann Pelletier
2009-03-30 16:32 ` Grant Likely
     [not found] <mailman.3884.1238431353.26545.linuxppc-dev@ozlabs.org>
2009-03-31 20:59 ` Yann Pelletier
2009-03-31 21:38   ` Grant Likely
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).