From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.233]) by ozlabs.org (Postfix) with ESMTP id 0C546474E2 for ; Thu, 4 Sep 2008 23:23:23 +1000 (EST) Received: by rv-out-0506.google.com with SMTP id f6so3583895rvb.9 for ; Thu, 04 Sep 2008 06:23:21 -0700 (PDT) Message-ID: <319b0ac50809040623q1c32049ake8a5ea21fd5972cd@mail.gmail.com> Date: Thu, 4 Sep 2008 15:23:21 +0200 From: "=?ISO-8859-1?Q?S=E9bastien_Chr=E9tien?=" To: benh@kernel.crashing.org Subject: Re: irq In-Reply-To: <319b0ac50809040127l2c506007vd6400a5edf912b71@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_47548_27550536.1220534601446" References: <319b0ac50809030715h1a03a606jacddd400019f4483@mail.gmail.com> <48BEA106.9090307@selcomgroup.com> <319b0ac50809030803p6d659468wd7d2425224653374@mail.gmail.com> <6a6049b80809030905u561043ecr1438d20aebf5598d@mail.gmail.com> <48BEBD17.1030705@gmail.com> <20080903170815.GA10979@loki.buserror.net> <48BEFB5D.3040903@gmail.com> <1220497366.4879.27.camel@pasglop> <319b0ac50809040127l2c506007vd6400a5edf912b71@mail.gmail.com> Cc: Scott Wood , M B , linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , ------=_Part_47548_27550536.1220534601446 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I try to write a device tree about irq : IT_controller: irq_controller@20006000 { clock-frequency =3D <0>; interrupt-controller; #address-cells =3D <0>; reg =3D <0x20006000 0x100>; compatible =3D "it"; device_type =3D "it"; big-endian; }; uart@200b1000{ device_type=3D"uart"; compatible=3D"uart"; interrupts =3D <0x18 0>; interrupt-parent=3D<&IT_controller>; }; uart_irq=3Dof_find_node_by_type(NULL, "uart"); if(uart_irq=3D=3DNULL) printk("%s: No uart node found !\n", __func__); virt=3Dirq_of_parse_and_map(uart_irq, 0); printk("Virtual irq : %d \n",virt); When I boot linux, virt=3D0; What is wrong ? 2008/9/4, S=E9bastien Chr=E9tien : > > I read the booting_without_of.txt document and the Interrupt Mapping > docucument from http://playground.sun.com/1275. But I don't understand al= l > parameters. Can somebody help me to create my device tree about interrupt > part ? > > I have an interrupt controller at the adresse 0x20006000. The irq_id rang= e > is 1 to 63. > I would like to try UART interrupt, which have ids : 0x18 (tranmission fi= fo > empty, > 0x19 (reception fifo full), 0x1a (reception error), 0x1b (break emission)= . > What other informations are needed ? > > > Nothing is cascaded. > > Thanks > > > > > 2008/9/4, Benjamin Herrenschmidt : >> >> On Wed, 2008-09-03 at 23:02 +0200, S=E9bastien Chr=E9tien wrote: >> >> > irq_of_parse_and_map is equivalent to ioremap in the MMU case ? >> >> >> On the powerpc architecture, we use virtualized IRQ numbers in order to >> deal with the wide range of interrupt controllers around and multiple >> of them cascaded. >> >> The base function to "map" a physical interrupt to a virtual interrupt >> is irq_create_mapping(). It takes an irq_host argument which represent >> the IRQ "domain" (typically irq controller) off which the interrupt you >> are trying to map hangs. >> >> If you pass NULL, it will use the "default" controller, which doesn't >> always exist, it depends on the platform. Usually, platforms set that >> to the toplevel PIC. >> >> However, normally, that function shouldn't be used directly. Instead, >> you should create a representation of your device in the device-tree >> along with the appropriate interrupt mapping, and then use the >> irq_of_parse_and_map() function to obtain a mapped virtual irq based >> on the device-tree information. This will take care of finding the >> right irq_host but will also properly setup the polarity of the >> interrupt etc... >> >> Now, as to how you should represent the interrupt in the device-tree, >> this should be explained in Documentation/booting-without-of.txt >> >> Cheers, >> Ben. >> >> > ------=_Part_47548_27550536.1220534601446 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I try to write a device tree about irq :

IT_controller: irq_controller@20006000 {
               = clock-frequency =3D <0>;
               = interrupt-controller;
            #address-cells =3D= <0>;
               = reg =3D <0x20006000 0x100>;
               = compatible =3D "it";
               = device_type =3D "it";
               = big-endian;
           };

           uart@200b1000{
               = device_type=3D"uart";
               = compatible=3D"uart";
               = interrupts =3D <0x18 0>;
               interrupt-parent=3D<&IT_controller>;   
           };


uart_irq=3Dof_find_node_by_type(NULL, "uart");
    if(uart_irq=3D=3DNULL)
         printk("%s: No uart node f= ound !\n", __func__);

    virt=3Dirq_of_parse_and_map(uart_irq, 0);
    printk("Virtual irq : %d \n",virt);


When I boot linux, virt=3D0;

What is wrong ?


2008/9/4, S=E9bastien Chr=E9tien &= lt;sebastien.chreti= en.enseirb@gmail.com>:
I read the booting_without_of.txt document and the Interrupt Mapping docucument from http://playgroun= d.sun.com/1275. But I don't understand all parameters. Can somebody help me to create my device tree about interrupt part ?

I have an interrupt controller at the adresse 0x20006000. The irq_id range = is 1 to 63.
I would like to try UART interrupt, which have ids : 0x18 (tranmission fifo= empty,
0x19 (reception fifo full), 0x1a (reception error), 0x1b (break emission).<= br> What other informations are needed ?


Nothing is cascaded.

Thanks




2008/9/4, Benjamin Herrenschmidt &= lt;benh@kernel.crashing.org= >:
On Wed, 2008-09-03 at 23:02 +0200, S=E9bastien Chr=E9tien wrote:

&= gt; irq_of_parse_and_map is equivalent to ioremap in the MMU case ?

On the powerpc architecture, we use virtualized IRQ numbers in order = to
deal with the wide range of interrupt controllers around and multiple
= of them cascaded.

The base function to "map" a physical = interrupt to a virtual interrupt
is irq_create_mapping(). It takes an i= rq_host argument which represent
the IRQ "domain" (typically irq controller) off which the interr= upt you
are trying to map hangs.

If you pass NULL, it will use= the "default" controller, which doesn't
always exist, it= depends on the platform. Usually, platforms set that
to the toplevel PIC.

However, normally, that function shouldn'= ;t be used directly. Instead,
you should create a representation of you= r device in the device-tree
along with the appropriate interrupt mappin= g, and then use the
irq_of_parse_and_map() function to obtain a mapped virtual irq based
o= n the device-tree information. This will take care of finding the
right= irq_host but will also properly setup the polarity of the
interrupt et= c...

Now, as to how you should represent the interrupt in the device-tree,=
this should be explained in Documentation/booting-without-of.txt
<= br> Cheers,
Ben.



------=_Part_47548_27550536.1220534601446--