From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from snvl-smtp1.trimble.com (snvl-smtp1.trimble.com [155.63.64.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "snvl-smtp1.trimble.com", Issuer "Trimble CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B69D0DE53B for ; Sat, 26 Apr 2008 02:22:17 +1000 (EST) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8A6EF.937D08A3" Subject: mpc5200 arch=powerpc kernel=2.6.24: how do I request external IRQ0-3? Date: Fri, 25 Apr 2008 09:14:51 -0700 Message-ID: <161B3BAD77161449A144FF054231C3D60206D6DC@uss-am-xch-01.am.trimblecorp.net> From: "Mike Timmons" To: List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. ------_=_NextPart_001_01C8A6EF.937D08A3 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I am confused on a very simple subject: requesting an external IRQ from a custom driver I'm writing for a lite5200b-based board running kernel 2.6.24, arch=3Dpowerpc.=20 =20 With the old arch=3Dppc I saw reference to MPC52xx_IRQ3 and such. I = don't see reference to specific IRQs under the powerpc arch. I am starting to better understand the dts scheme for peripheral interrupts, but I am hung-up on the seemingly simple task of requesting an external IRQ and registering a callback from my driver: =20 request_irq( virtual_irq_number_for_IRQ3_that_I_don't_know_right_now, &my_callback, flags, name, dev) =20 For this to work do I need to create a child node in the dts that specifies interrupts =3D <1 3 2> for IRQ3? Must the IRQ I'm requesting = be associated with the dev argument to request_irq via the dts? =20 I just think I'm missing something very obvious as regards using IRQ[0-3] on the mpc52xx. The DTS makes sens to me for peripheral interrupts getting associated with their respective peripherals, but when I want any old driver to use IRQ0-3 How do I request it? =20 Thanks. ------_=_NextPart_001_01C8A6EF.937D08A3 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I am confused on a very simple subject: requesting an external IRQ from a custom driver I’m writing  for a = lite5200b-based board running kernel 2.6.24, arch=3Dpowerpc. =

 

With the old arch=3Dppc I saw reference to = MPC52xx_IRQ3 and such. I don’t see reference to specific IRQs under the powerpc = arch. I am starting to better understand the dts scheme for peripheral interrupts, = but I am hung-up on the seemingly simple task of requesting an external IRQ = and registering a callback from my driver:

 

request_irq(  = virtual_irq_number_for_IRQ3_that_I_don’t_know_right_now, &my_callback, flags, name, dev)

 

For this to work do I need to create a child node in = the dts that specifies interrupts =3D <1 3 2> for IRQ3?  Must the IRQ = I’m requesting be associated with the dev argument to request_irq via the = dts?

 

I just think I’m missing something very obvious = as regards using IRQ[0-3] on the mpc52xx. The DTS makes sens to me for = peripheral interrupts getting associated with their respective peripherals, but = when I want any old driver to use IRQ0-3 How do I request = it?

 

Thanks.

------_=_NextPart_001_01C8A6EF.937D08A3-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 975FADDE1A for ; Sun, 27 Apr 2008 11:58:54 +1000 (EST) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JpwAE-0003Tp-5F for linuxppc-embedded@ozlabs.org; Sat, 26 Apr 2008 18:58:50 -0700 Message-ID: <16918127.post@talk.nabble.com> Date: Sat, 26 Apr 2008 18:58:50 -0700 (PDT) From: mtwallet To: linuxppc-embedded@ozlabs.org Subject: Re: mpc5200 arch=powerpc kernel=2.6.24: how do I request external IRQ0-3? In-Reply-To: <161B3BAD77161449A144FF054231C3D60206D6DC@uss-am-xch-01.am.trimblecorp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii References: <161B3BAD77161449A144FF054231C3D60206D6DC@uss-am-xch-01.am.trimblecorp.net> List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , I got something working. I created a "device" child in the DTS file and used th platform driver subsystem to register my module and get the virtual IRQ as derived from the interrupt triplet-style spec in the dts file. I'm still not real content as my child is nested with the SOC peripherals, but this is more of a style/readability hang-up for me, for now. At least now I can get the virtual irq by registering a platform driver, requesting the irq number, and successfully requesting the irq. I welcome any advice if I have used the dts file in an unintended fashion, but it feels like the right place to specify a "device", even if all the device embodies is an IRQ. Newbie conceptual difficulty overcome. mtwallet wrote: > > I am confused on a very simple subject: requesting an external IRQ from > a custom driver I'm writing for a lite5200b-based board running kernel > 2.6.24, arch=powerpc. > > > > With the old arch=ppc I saw reference to MPC52xx_IRQ3 and such. I don't > see reference to specific IRQs under the powerpc arch. I am starting to > better understand the dts scheme for peripheral interrupts, but I am > hung-up on the seemingly simple task of requesting an external IRQ and > registering a callback from my driver: > > > > request_irq( virtual_irq_number_for_IRQ3_that_I_don't_know_right_now, > &my_callback, flags, name, dev) > > > > For this to work do I need to create a child node in the dts that > specifies interrupts = <1 3 2> for IRQ3? Must the IRQ I'm requesting be > associated with the dev argument to request_irq via the dts? > > > > I just think I'm missing something very obvious as regards using > IRQ[0-3] on the mpc52xx. The DTS makes sens to me for peripheral > interrupts getting associated with their respective peripherals, but > when I want any old driver to use IRQ0-3 How do I request it? > > > > Thanks. > > > _______________________________________________ > Linuxppc-embedded mailing list > Linuxppc-embedded@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc-embedded > -- View this message in context: http://www.nabble.com/mpc5200-arch%3Dpowerpc-kernel%3D2.6.24%3A-how-do-I-request-external-IRQ0-3--tp16900805p16918127.html Sent from the linuxppc-embedded mailing list archive at Nabble.com. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247]) by ozlabs.org (Postfix) with ESMTP id 75320DDE1A for ; Sun, 27 Apr 2008 15:01:25 +1000 (EST) Received: by an-out-0708.google.com with SMTP id c37so1105080anc.78 for ; Sat, 26 Apr 2008 22:01:24 -0700 (PDT) Message-ID: Date: Sat, 26 Apr 2008 23:01:24 -0600 From: "Grant Likely" Sender: glikely@secretlab.ca To: mtwallet Subject: Re: mpc5200 arch=powerpc kernel=2.6.24: how do I request external IRQ0-3? In-Reply-To: <16918127.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 References: <161B3BAD77161449A144FF054231C3D60206D6DC@uss-am-xch-01.am.trimblecorp.net> <16918127.post@talk.nabble.com> Cc: linuxppc-embedded@ozlabs.org List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, Apr 26, 2008 at 7:58 PM, mtwallet wrote: > > I got something working. I created a "device" child in the DTS file and used > th platform driver subsystem to register my module and get the virtual IRQ > as derived from the interrupt triplet-style spec in the dts file. Sorry I didn't get back to you right away. Yes, the best/right thing to do is put a node in your device tree to capture the interrupt and other interfaces to your custom device. You should consider using the of_platform infrastructure for registering your device. Your driver code can extract its register locations and interrupts directly from a device tree node. For an example, look at the ulite_of_probe and ulite_of_driver in driver/serial/uartlite.c. > I'm still not real content as my child is nested with the SOC peripherals, > but this is more of a style/readability hang-up for me, for now. At least > now I can get the virtual irq by registering a platform driver, requesting > the irq number, and successfully requesting the irq. > > I welcome any advice if I have used the dts file in an unintended fashion, > but it feels like the right place to specify a "device", even if all the > device embodies is an IRQ. Newbie conceptual difficulty overcome. Your part of the way there. Your node should be a child of the device that it is connected to. Is it attached to the local bus? or i2c? It should have a "compatible" property so that your device driver can find it (in the form 'compatible = ",";'). It should have both an 'interrupt-parent' and an 'interrupts' property for specifying the interrupt. If the device is addressable, it should have a 'reg' property. You're right that it shouldn't be mixed in with the SoC nodes because that doesn't accurately describe your platform. But, it is perfectly fine for it to be a child of one of the SoC nodes (for example if it is attached to one of the i2c busses). Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.