linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* irq
@ 2008-09-03 14:15 Sébastien Chrétien
  2008-09-03 14:36 ` irq Daniele Bosi
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-03 14:15 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

Hello,

I am trying to register a function writh IRQ :

static irqreturn_t uart_test (int irq , void *dev_id)
{
    printk("/!\\ Interruption : tx_empty\n");
       return IRQ_HANDLED;
}

    req=request_irq(0x18,uart_test,NULL,"uart_test",NULL);
    printk("Initialisation IRQ UART : %d \n", req);

When I boot linux ppc, the req value is -38.
What is wrong ?

[-- Attachment #2: Type: text/html, Size: 570 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 14:15 irq Sébastien Chrétien
@ 2008-09-03 14:36 ` Daniele Bosi
  2008-09-03 15:03   ` irq Sébastien Chrétien
  0 siblings, 1 reply; 12+ messages in thread
From: Daniele Bosi @ 2008-09-03 14:36 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: linuxppc-dev

Try to set some flag into the third parameter of the request_irq()
function like:

SA_SHIRQ                Interrupt is shared

SA_INTERRUPT            Disable local interrupts while processing

SA_SAMPLE_RANDOM        The interrupt can be used for entropy

otherwise try to use the function install_irq_handler()


bye Daniele



Sébastien Chrétien ha scritto:
> Hello,
>
> I am trying to register a function writh IRQ :
>  
> static irqreturn_t uart_test (int irq , void *dev_id)
> {
>     printk("/!\\ Interruption : tx_empty\n");
>        return IRQ_HANDLED;
> }
>    
>     req=request_irq(0x18,uart_test,NULL,"uart_test",NULL);
>     printk("Initialisation IRQ UART : %d \n", req);   
>
> When I boot linux ppc, the req value is -38.
> What is wrong ?
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

-- 


------------------------------------------------------------------------


  Daniele Bosi

*DIGITEK S.p.A.*

Via L. Romagnoli 24,
41033 Concordia sulla Secchia
Modena (MO), Italy

*Tel*: +39-(0)53556942 Fax. +39-(0)53554550

*Web:    * http://www.digitek.it

*Mail to:* d.bosi@selcomgroup.com <mailto:d.bosi@selcomgroup.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 14:36 ` irq Daniele Bosi
@ 2008-09-03 15:03   ` Sébastien Chrétien
  2008-09-03 16:05     ` irq M B
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-03 15:03 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]

The failure referes to setup_irq :
desc->chip == &no_irq_chip is true

What is irq_desc and how can I initialize it ?


setup_irq(unsigned int irq, struct irqaction *new)
{
    struct irq_desc *desc = irq_desc + irq;
    struct irqaction *old, **p;
    const char *old_name = NULL;
    unsigned long flags;
    int shared = 0;

    if (irq >= NR_IRQS)
        return -EINVAL;

    printk("desc\n");
    if (desc->chip == &no_irq_chip)
        return -ENOSYS;
    printk("desc2\n");

2008/9/3, Daniele Bosi <d.bosi@selcomgroup.com>:
>
> Try to set some flag into the third parameter of the request_irq()
> function like:
>
> SA_SHIRQ                Interrupt is shared
>
> SA_INTERRUPT            Disable local interrupts while processing
>
> SA_SAMPLE_RANDOM        The interrupt can be used for entropy
>
> otherwise try to use the function install_irq_handler()
>
>
> bye Daniele
>
>
>
> Sébastien Chrétien ha scritto:
>
> > Hello,
> >
> > I am trying to register a function writh IRQ :
> >
> > static irqreturn_t uart_test (int irq , void *dev_id)
> > {
> >     printk("/!\\ Interruption : tx_empty\n");
> >        return IRQ_HANDLED;
> > }
> >
> >     req=request_irq(0x18,uart_test,NULL,"uart_test",NULL);
> >     printk("Initialisation IRQ UART : %d \n", req);
> >
> > When I boot linux ppc, the req value is -38.
> > What is wrong ?
>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
> --
>
>
> ------------------------------------------------------------------------
>
>
>   Daniele Bosi
>
> *DIGITEK S.p.A.*
>
> Via L. Romagnoli 24,
> 41033 Concordia sulla Secchia
> Modena (MO), Italy
>
> *Tel*: +39-(0)53556942 Fax. +39-(0)53554550
>
> *Web:    * http://www.digitek.it
>
> *Mail to:* d.bosi@selcomgroup.com <mailto:d.bosi@selcomgroup.com>
>
>

[-- Attachment #2: Type: text/html, Size: 3324 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 15:03   ` irq Sébastien Chrétien
@ 2008-09-03 16:05     ` M B
  2008-09-03 16:36       ` irq Sébastien Chrétien
  0 siblings, 1 reply; 12+ messages in thread
From: M B @ 2008-09-03 16:05 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: linuxppc-dev

Hi,

this seems to be the same problem I had, when registering an irq with UIO.

On Wed, Sep 3, 2008 at 5:03 PM, S=E9bastien Chr=E9tien
<sebastien.chretien.enseirb@gmail.com> wrote:
> The failure referes to setup_irq :
> desc->chip =3D=3D &no_irq_chip is true
>
> What is irq_desc and how can I initialize it ?

I did use irq_create_mapping, to initialize this struct. However I
have no idea if this was right. It seemed to work at first, but I'm
encountering problems now, however I don't know if they come from the
kernel, or UIO interrupt handler. I did this for some test, but irqs
are something you want to be sure they work correctly.

So maybee someone could clarify this as we already raise this issue.

What processor are you using Sebastien? My one is a 405EP

Best Regards

Markus

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 16:05     ` irq M B
@ 2008-09-03 16:36       ` Sébastien Chrétien
  2008-09-03 17:08         ` irq Scott Wood
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-03 16:36 UTC (permalink / raw)
  To: M B; +Cc: Sébastien Chrétien, linuxppc-dev

Ok I will try irq_create_mapping tomorrow.
When have I to use this function ?
I am using a MPC7448.

M B a écrit :
> Hi,
>
> this seems to be the same problem I had, when registering an irq with UIO.
>
> On Wed, Sep 3, 2008 at 5:03 PM, Sébastien Chrétien
> <sebastien.chretien.enseirb@gmail.com> wrote:
>   
>> The failure referes to setup_irq :
>> desc->chip == &no_irq_chip is true
>>
>> What is irq_desc and how can I initialize it ?
>>     
>
> I did use irq_create_mapping, to initialize this struct. However I
> have no idea if this was right. It seemed to work at first, but I'm
> encountering problems now, however I don't know if they come from the
> kernel, or UIO interrupt handler. I did this for some test, but irqs
> are something you want to be sure they work correctly.
>
> So maybee someone could clarify this as we already raise this issue.
>
> What processor are you using Sebastien? My one is a 405EP
>
> Best Regards
>
> Markus
>
>
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 16:36       ` irq Sébastien Chrétien
@ 2008-09-03 17:08         ` Scott Wood
  2008-09-03 21:02           ` irq Sébastien Chrétien
  0 siblings, 1 reply; 12+ messages in thread
From: Scott Wood @ 2008-09-03 17:08 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: M B, linuxppc-dev

On Wed, Sep 03, 2008 at 06:36:39PM +0200, Sébastien Chrétien wrote:
> Ok I will try irq_create_mapping tomorrow.
> When have I to use this function ?

You always need to create a mapping (though doing it with
irq_of_parse_and_map is preferred).  request_irq() takes virtual IRQ
numbers, not hardware IRQ numbers.

-Scott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 17:08         ` irq Scott Wood
@ 2008-09-03 21:02           ` Sébastien Chrétien
  2008-09-03 21:03             ` irq Scott Wood
  2008-09-04  3:02             ` irq Benjamin Herrenschmidt
  0 siblings, 2 replies; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-03 21:02 UTC (permalink / raw)
  To: Scott Wood; +Cc: M B, Sébastien Chrétien, linuxppc-dev

irq_of_parse_and_map is equivalent to ioremap in the MMU case ?

Scott Wood a écrit :
> On Wed, Sep 03, 2008 at 06:36:39PM +0200, Sébastien Chrétien wrote:
>   
>> Ok I will try irq_create_mapping tomorrow.
>> When have I to use this function ?
>>     
>
> You always need to create a mapping (though doing it with
> irq_of_parse_and_map is preferred).  request_irq() takes virtual IRQ
> numbers, not hardware IRQ numbers.
>
> -Scott
>
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 21:02           ` irq Sébastien Chrétien
@ 2008-09-03 21:03             ` Scott Wood
  2008-09-04  3:02             ` irq Benjamin Herrenschmidt
  1 sibling, 0 replies; 12+ messages in thread
From: Scott Wood @ 2008-09-03 21:03 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: M B, linuxppc-dev

Sébastien Chrétien wrote:
> irq_of_parse_and_map is equivalent to ioremap in the MMU case ?

It's more analogous to of_iomap().

-Scott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-03 21:02           ` irq Sébastien Chrétien
  2008-09-03 21:03             ` irq Scott Wood
@ 2008-09-04  3:02             ` Benjamin Herrenschmidt
  2008-09-04  8:27               ` irq Sébastien Chrétien
  1 sibling, 1 reply; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2008-09-04  3:02 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: Scott Wood, M B, linuxppc-dev

On Wed, 2008-09-03 at 23:02 +0200, Sébastien Chrétien 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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-04  3:02             ` irq Benjamin Herrenschmidt
@ 2008-09-04  8:27               ` Sébastien Chrétien
  2008-09-04 13:23                 ` irq Sébastien Chrétien
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-04  8:27 UTC (permalink / raw)
  To: benh; +Cc: Scott Wood, M B, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1981 bytes --]

I read the booting_without_of.txt document and the Interrupt Mapping
docucument from http://playground.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).
What other informations are needed ?


Nothing is cascaded.

Thanks




2008/9/4, Benjamin Herrenschmidt <benh@kernel.crashing.org>:
>
> On Wed, 2008-09-03 at 23:02 +0200, Sébastien Chrétien 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.
>
>

[-- Attachment #2: Type: text/html, Size: 2413 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-04  8:27               ` irq Sébastien Chrétien
@ 2008-09-04 13:23                 ` Sébastien Chrétien
  2008-09-04 14:18                   ` irq Scott Wood
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Chrétien @ 2008-09-04 13:23 UTC (permalink / raw)
  To: benh; +Cc: Scott Wood, M B, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2959 bytes --]

I try to write a device tree about irq :

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

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


uart_irq=of_find_node_by_type(NULL, "uart");
    if(uart_irq==NULL)
         printk("%s: No uart node found !\n", __func__);

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


When I boot linux, virt=0;

What is wrong ?


2008/9/4, Sébastien Chrétien <sebastien.chretien.enseirb@gmail.com>:
>
> I read the booting_without_of.txt document and the Interrupt Mapping
> docucument from http://playground.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).
> What other informations are needed ?
>
>
> Nothing is cascaded.
>
> Thanks
>
>
>
>
> 2008/9/4, Benjamin Herrenschmidt <benh@kernel.crashing.org>:
>>
>> On Wed, 2008-09-03 at 23:02 +0200, Sébastien Chrétien 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.
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 4901 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: irq
  2008-09-04 13:23                 ` irq Sébastien Chrétien
@ 2008-09-04 14:18                   ` Scott Wood
  0 siblings, 0 replies; 12+ messages in thread
From: Scott Wood @ 2008-09-04 14:18 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: M B, linuxppc-dev

On Thu, Sep 04, 2008 at 03:23:21PM +0200, Sébastien Chrétien wrote:
> I try to write a device tree about irq :
> 
> IT_controller: irq_controller@20006000 {
>                clock-frequency = <0>;
>                interrupt-controller;
>             #address-cells = <0>;
>                reg = <0x20006000 0x100>;
>                compatible = "it";
>                device_type = "it";
>                big-endian;
>            };
> 
>            uart@200b1000{
>                device_type="uart";
>                compatible="uart";
>                interrupts = <0x18 0>;
>                interrupt-parent=<&IT_controller>;
>            };
> 
> 
> uart_irq=of_find_node_by_type(NULL, "uart");
>     if(uart_irq==NULL)
>          printk("%s: No uart node found !\n", __func__);
> 
>     virt=irq_of_parse_and_map(uart_irq, 0);
>     printk("Virtual irq : %d \n",virt);
> 
> 
> When I boot linux, virt=0;
> 
> What is wrong ?

You're missing #interrupt-cells, for one.  Also, you need your interrupt
controller driver to register with the IRQ subsystem properly (see other
chained IRQ drivers in the tree).

You should also get rid of device_type, big-endian, and clock-frequency,
and use better compatible names.

-Scott

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-09-04 14:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 14:15 irq Sébastien Chrétien
2008-09-03 14:36 ` irq Daniele Bosi
2008-09-03 15:03   ` irq Sébastien Chrétien
2008-09-03 16:05     ` irq M B
2008-09-03 16:36       ` irq Sébastien Chrétien
2008-09-03 17:08         ` irq Scott Wood
2008-09-03 21:02           ` irq Sébastien Chrétien
2008-09-03 21:03             ` irq Scott Wood
2008-09-04  3:02             ` irq Benjamin Herrenschmidt
2008-09-04  8:27               ` irq Sébastien Chrétien
2008-09-04 13:23                 ` irq Sébastien Chrétien
2008-09-04 14:18                   ` irq Scott Wood

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).