All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Jon Hunter <jon-hunter@ti.com>,
	Stephen Warren <swarren@nvidia.com>,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <rob.herring@calxeda.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-omap <linux-omap@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/1] of/irq: store IRQ trigger/level in struct resource flags
Date: Mon, 08 Apr 2013 17:05:26 -0500	[thread overview]
Message-ID: <51633F26.7000400@gmail.com> (raw)
In-Reply-To: <1365148088-11175-1-git-send-email-javier.martinez@collabora.co.uk>

On 04/05/2013 02:48 AM, Javier Martinez Canillas wrote:
> According to Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> the "#interrupt-cells" property of an "interrupt-controller" is used
> to define the number of cells needed to specify a single interrupt.
> 
> A commonly used variant is two cell on which #interrupt-cells = <2>
> and the first cell defines the index of the interrupt in the controller
> and the second cell is used to specify any of the following flags:
> 
>     - bits[3:0] trigger type and level flags
>         1 = low-to-high edge triggered
>         2 = high-to-low edge triggered
>         4 = active high level-sensitive
>         8 = active low level-sensitive
> 
> An example of an interrupt controller which use the two cell format is
> the OMAP GPIO controller that allows GPIO lines to be used as IRQ
> (Documentation/devicetree/bindings/gpio/gpio-omap.txt)
> 
> But setting #interrupt-cells = <2> on the OMAP GPIO device node and
> specifying the GPIO-IRQ type and level flags on the second cell does not
> store this value on the populated IORESOURCE_IRQ struct resource.
> 
> This is because when using an IRQ from an interrupt controller and
> setting both cells (e.g:)
> 
> 	interrupt-parent = <&gpio6>;
> 	interrupts = <16 8>;
> 
> A call to of_irq_to_resource() is made and this function calls to
> irq_of_parse_and_map_type() to get the virtual IRQ mapped to the real
> index for this interrupt controller. This IRQ number is populated on
> the struct resource:
> 
> int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
> {
> 	int irq = irq_of_parse_and_map(dev, index);
> 	..
> 	r->start = r->end = irq;
> }
> 
> irq_of_parse_and_map() calls to irq_create_of_mapping() which calls to
> the correct xlate function handler according to "#interrupt-cells"
> (irq_domain_xlate_onecell or irq_domain_xlate_twocell) and to
> irq_set_irq_type() to set the IRQ type.
> 
> But the type is never returned so it can't be saved on the IRQ struct
> resource flags member.
> 
> This means that drivers that need the IRQ type/level flags defined in
> the DT won't be able to get it.

But the interrupt controllers that need the information should be able
to get to it via irqd_get_trigger_type. What problem exactly are you
trying to fix? What driver would use this?

My understanding of the IORESOURCE_IRQ_xxx (and DMA) bits are they are
ISA specific and therefore should not be used on non-ISA buses.

Rob



WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] of/irq: store IRQ trigger/level in struct resource flags
Date: Mon, 08 Apr 2013 17:05:26 -0500	[thread overview]
Message-ID: <51633F26.7000400@gmail.com> (raw)
In-Reply-To: <1365148088-11175-1-git-send-email-javier.martinez@collabora.co.uk>

On 04/05/2013 02:48 AM, Javier Martinez Canillas wrote:
> According to Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> the "#interrupt-cells" property of an "interrupt-controller" is used
> to define the number of cells needed to specify a single interrupt.
> 
> A commonly used variant is two cell on which #interrupt-cells = <2>
> and the first cell defines the index of the interrupt in the controller
> and the second cell is used to specify any of the following flags:
> 
>     - bits[3:0] trigger type and level flags
>         1 = low-to-high edge triggered
>         2 = high-to-low edge triggered
>         4 = active high level-sensitive
>         8 = active low level-sensitive
> 
> An example of an interrupt controller which use the two cell format is
> the OMAP GPIO controller that allows GPIO lines to be used as IRQ
> (Documentation/devicetree/bindings/gpio/gpio-omap.txt)
> 
> But setting #interrupt-cells = <2> on the OMAP GPIO device node and
> specifying the GPIO-IRQ type and level flags on the second cell does not
> store this value on the populated IORESOURCE_IRQ struct resource.
> 
> This is because when using an IRQ from an interrupt controller and
> setting both cells (e.g:)
> 
> 	interrupt-parent = <&gpio6>;
> 	interrupts = <16 8>;
> 
> A call to of_irq_to_resource() is made and this function calls to
> irq_of_parse_and_map_type() to get the virtual IRQ mapped to the real
> index for this interrupt controller. This IRQ number is populated on
> the struct resource:
> 
> int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
> {
> 	int irq = irq_of_parse_and_map(dev, index);
> 	..
> 	r->start = r->end = irq;
> }
> 
> irq_of_parse_and_map() calls to irq_create_of_mapping() which calls to
> the correct xlate function handler according to "#interrupt-cells"
> (irq_domain_xlate_onecell or irq_domain_xlate_twocell) and to
> irq_set_irq_type() to set the IRQ type.
> 
> But the type is never returned so it can't be saved on the IRQ struct
> resource flags member.
> 
> This means that drivers that need the IRQ type/level flags defined in
> the DT won't be able to get it.

But the interrupt controllers that need the information should be able
to get to it via irqd_get_trigger_type. What problem exactly are you
trying to fix? What driver would use this?

My understanding of the IORESOURCE_IRQ_xxx (and DMA) bits are they are
ISA specific and therefore should not be used on non-ISA buses.

Rob

  reply	other threads:[~2013-04-08 22:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05  7:48 [PATCH 1/1] of/irq: store IRQ trigger/level in struct resource flags Javier Martinez Canillas
2013-04-05  7:48 ` Javier Martinez Canillas
2013-04-08 22:05 ` Rob Herring [this message]
2013-04-08 22:05   ` Rob Herring
2013-04-08 22:16   ` Stephen Warren
2013-04-08 22:16     ` Stephen Warren
2013-04-08 22:56     ` Javier Martinez Canillas
2013-04-08 22:56       ` Javier Martinez Canillas
2013-04-09  2:45       ` Rob Herring
2013-04-09  2:45         ` Rob Herring
2013-04-09  8:26         ` Javier Martinez Canillas
2013-04-09  8:26           ` Javier Martinez Canillas
2013-04-09  8:28           ` Javier Martinez Canillas
2013-04-09  8:28             ` Javier Martinez Canillas
2013-04-18 12:17         ` Javier Martinez Canillas
2013-04-18 12:17           ` Javier Martinez Canillas
2013-04-08 22:44   ` Javier Martinez Canillas
2013-04-08 22:44     ` Javier Martinez Canillas
2013-06-05 23:26     ` Grant Likely
2013-06-05 23:26       ` Grant Likely
2013-06-06  8:00       ` Javier Martinez Canillas
2013-06-06  8:00         ` Javier Martinez Canillas
2013-06-06  8:50       ` Jean-Christophe PLAGNIOL-VILLARD
2013-06-06  8:50         ` Jean-Christophe PLAGNIOL-VILLARD
2013-06-06  9:13         ` Javier Martinez Canillas
2013-06-06  9:13           ` Javier Martinez Canillas
2013-06-06  9:58         ` Tomasz Figa
2013-06-06  9:58           ` Tomasz Figa
2013-06-05 23:34 ` Grant Likely
2013-06-05 23:34   ` Grant Likely
2013-06-06  8:47   ` Javier Martinez Canillas
2013-06-06  8:47     ` Javier Martinez Canillas

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=51633F26.7000400@gmail.com \
    --to=robherring2@gmail.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=javier.martinez@collabora.co.uk \
    --cc=jon-hunter@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@nvidia.com \
    --cc=tglx@linutronix.de \
    /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.