linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: irq: Pass trigger type in IRQ resource flags
@ 2013-05-18 22:56 Tomasz Figa
  2013-06-05 18:20 ` Tomasz Figa
  0 siblings, 1 reply; 6+ messages in thread
From: Tomasz Figa @ 2013-05-18 22:56 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: linux-arm-kernel, Rob Herring, Grant Likely, linux-kernel, Tomasz Figa

Some drivers might rely on availability of trigger flags in IRQ
resource, for example to configure the hardware for particular interrupt
type. However current code creating IRQ resources from data in device
tree does not configure trigger flags in resulting resources.

This patch solves the problem, based on the fact that
irq_of_parse_and_map() configures the trigger based on DT interrupt
specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
and we can get trigger type by calling irqd_get_trigger_type() after
mapping the interrupt.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/of/irq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index a3c1c5a..79a7a26 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 		r->start = r->end = irq;
 		r->flags = IORESOURCE_IRQ;
 		r->name = name ? name : dev->full_name;
+
+		/*
+		 * Some drivers might rely on availability of trigger flags
+		 * in IRQ resource. Since irq_of_parse_and_map() configures the
+		 * trigger based on interrupt specifier and IRQD_TRIGGER_*
+		 * flags are consistent with IORESOURCE_IRQ_*, we can get
+		 * trigger type that was just set and pass it through resource
+		 * flags as well.
+		 */
+		r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
 	}
 
 	return irq;
-- 
1.8.2.1


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

* Re: [PATCH] of: irq: Pass trigger type in IRQ resource flags
  2013-05-18 22:56 [PATCH] of: irq: Pass trigger type in IRQ resource flags Tomasz Figa
@ 2013-06-05 18:20 ` Tomasz Figa
  2013-06-14 22:00   ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Tomasz Figa @ 2013-06-05 18:20 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: linux-arm-kernel, Rob Herring, Grant Likely, linux-kernel

Hi,

On Sunday 19 of May 2013 00:56:30 Tomasz Figa wrote:
> Some drivers might rely on availability of trigger flags in IRQ
> resource, for example to configure the hardware for particular interrupt
> type. However current code creating IRQ resources from data in device
> tree does not configure trigger flags in resulting resources.
> 
> This patch solves the problem, based on the fact that
> irq_of_parse_and_map() configures the trigger based on DT interrupt
> specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
> and we can get trigger type by calling irqd_get_trigger_type() after
> mapping the interrupt.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> ---
>  drivers/of/irq.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index a3c1c5a..79a7a26 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int
> index, struct resource *r) r->start = r->end = irq;
>  		r->flags = IORESOURCE_IRQ;
>  		r->name = name ? name : dev->full_name;
> +
> +		/*
> +		 * Some drivers might rely on availability of trigger 
flags
> +		 * in IRQ resource. Since irq_of_parse_and_map() 
configures the
> +		 * trigger based on interrupt specifier and IRQD_TRIGGER_*
> +		 * flags are consistent with IORESOURCE_IRQ_*, we can get
> +		 * trigger type that was just set and pass it through 
resource
> +		 * flags as well.
> +		 */
> +		r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
>  	}
> 
>  	return irq;

Any comments on this patch?

Best regards,
Tomasz


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

* Re: [PATCH] of: irq: Pass trigger type in IRQ resource flags
  2013-06-05 18:20 ` Tomasz Figa
@ 2013-06-14 22:00   ` Grant Likely
  2013-06-15  0:57     ` Javier Martinez Canillas
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2013-06-14 22:00 UTC (permalink / raw)
  To: Tomasz Figa, devicetree-discuss
  Cc: linux-arm-kernel, Rob Herring, linux-kernel, Javier Martinez Canillas

On Wed, 05 Jun 2013 20:20:39 +0200, Tomasz Figa <tomasz.figa@gmail.com> wrote:
> Hi,
> 
> On Sunday 19 of May 2013 00:56:30 Tomasz Figa wrote:
> > Some drivers might rely on availability of trigger flags in IRQ
> > resource, for example to configure the hardware for particular interrupt
> > type. However current code creating IRQ resources from data in device
> > tree does not configure trigger flags in resulting resources.
> > 
> > This patch solves the problem, based on the fact that
> > irq_of_parse_and_map() configures the trigger based on DT interrupt
> > specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
> > and we can get trigger type by calling irqd_get_trigger_type() after
> > mapping the interrupt.
> > 
> > Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> > ---
> >  drivers/of/irq.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > index a3c1c5a..79a7a26 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int
> > index, struct resource *r) r->start = r->end = irq;
> >  		r->flags = IORESOURCE_IRQ;
> >  		r->name = name ? name : dev->full_name;
> > +
> > +		/*
> > +		 * Some drivers might rely on availability of trigger 
> flags
> > +		 * in IRQ resource. Since irq_of_parse_and_map() 
> configures the
> > +		 * trigger based on interrupt specifier and IRQD_TRIGGER_*
> > +		 * flags are consistent with IORESOURCE_IRQ_*, we can get
> > +		 * trigger type that was just set and pass it through 
> resource
> > +		 * flags as well.
> > +		 */
> > +		r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
> >  	}
> > 
> >  	return irq;
> 
> Any comments on this patch?

That's actually a pretty good solution and a whole lot less invasive
that the approach that Javier was pursuing. Javier, I'm going to pick
up this patch. Please yell if it doesn't solve the problem that you're
trying to solve.

g.


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

* Re: [PATCH] of: irq: Pass trigger type in IRQ resource flags
  2013-06-14 22:00   ` Grant Likely
@ 2013-06-15  0:57     ` Javier Martinez Canillas
  0 siblings, 0 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2013-06-15  0:57 UTC (permalink / raw)
  To: Grant Likely
  Cc: Tomasz Figa, devicetree-discuss, linux-arm-kernel, Rob Herring,
	linux-kernel


On 15/06/2013, at 00:00, Grant Likely <grant.likely@linaro.org> wrote:

> On Wed, 05 Jun 2013 20:20:39 +0200, Tomasz Figa <tomasz.figa@gmail.com> wrote:
>> Hi,
>> 
>> On Sunday 19 of May 2013 00:56:30 Tomasz Figa wrote:
>>> Some drivers might rely on availability of trigger flags in IRQ
>>> resource, for example to configure the hardware for particular interrupt
>>> type. However current code creating IRQ resources from data in device
>>> tree does not configure trigger flags in resulting resources.
>>> 
>>> This patch solves the problem, based on the fact that
>>> irq_of_parse_and_map() configures the trigger based on DT interrupt
>>> specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
>>> and we can get trigger type by calling irqd_get_trigger_type() after
>>> mapping the interrupt.
>>> 
>>> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
>>> ---
>>> drivers/of/irq.c | 10 ++++++++++
>>> 1 file changed, 10 insertions(+)
>>> 
>>> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
>>> index a3c1c5a..79a7a26 100644
>>> --- a/drivers/of/irq.c
>>> +++ b/drivers/of/irq.c
>>> @@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int
>>> index, struct resource *r) r->start = r->end = irq;
>>>        r->flags = IORESOURCE_IRQ;
>>>        r->name = name ? name : dev->full_name;
>>> +
>>> +        /*
>>> +         * Some drivers might rely on availability of trigger
>> flags
>>> +         * in IRQ resource. Since irq_of_parse_and_map()
>> configures the
>>> +         * trigger based on interrupt specifier and IRQD_TRIGGER_*
>>> +         * flags are consistent with IORESOURCE_IRQ_*, we can get
>>> +         * trigger type that was just set and pass it through
>> resource
>>> +         * flags as well.
>>> +         */
>>> +        r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
>>>    }
>>> 
>>>    return irq;
>> 
>> Any comments on this patch?
> 
> That's actually a pretty good solution and a whole lot less invasive
> that the approach that Javier was pursuing. Javier, I'm going to pick
> up this patch. Please yell if it doesn't solve the problem that you're
> trying to solve.
> 
> g.
> 

It solves the issue I was trying to solve and the solution is indeed more elegant and simpler than the one I posted.

Thanks a lot for pointing this out.

Best regards,
Javier

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

* Re: [PATCH] of: irq: Pass trigger type in IRQ resource flags
  2013-09-28 17:52 Tomasz Figa
@ 2013-10-04 17:42 ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2013-10-04 17:42 UTC (permalink / raw)
  To: Tomasz Figa, devicetree; +Cc: linux-kernel, Rob Herring, Tomasz Figa

On Sat, 28 Sep 2013 19:52:51 +0200, Tomasz Figa <tomasz.figa@gmail.com> wrote:
> Some drivers might rely on availability of trigger flags in IRQ
> resource, for example to configure the hardware for particular interrupt
> type. However current code creating IRQ resources from data in device
> tree does not configure trigger flags in resulting resources.
> 
> This patch tries to solve the problem, based on the fact that
> irq_of_parse_and_map() configures the trigger based on DT interrupt
> specifier and IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
> and we can get correct trigger flags by calling irqd_get_trigger_type()
> after mapping the interrupt.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>

Applied, thanks.

g.

> ---
>  drivers/of/irq.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index 1752988..12742d0 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -356,6 +356,16 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
>  		r->start = r->end = irq;
>  		r->flags = IORESOURCE_IRQ;
>  		r->name = name ? name : dev->full_name;
> +
> +		/*
> +		 * Some drivers might rely on availability of trigger flags
> +		 * in IRQ resource. Since irq_of_parse_and_map() configures the
> +		 * trigger based on interrupt specifier and IRQD_TRIGGER_*
> +		 * flags are consistent with IORESOURCE_IRQ_*, we can get
> +		 * trigger type that was just set and pass it through resource
> +		 * flags as well.
> +		 */
> +		r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
>  	}
>  
>  	return irq;
> -- 
> 1.8.3.2
> 


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

* [PATCH] of: irq: Pass trigger type in IRQ resource flags
@ 2013-09-28 17:52 Tomasz Figa
  2013-10-04 17:42 ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Tomasz Figa @ 2013-09-28 17:52 UTC (permalink / raw)
  To: devicetree; +Cc: linux-kernel, Grant Likely, Rob Herring, Tomasz Figa

Some drivers might rely on availability of trigger flags in IRQ
resource, for example to configure the hardware for particular interrupt
type. However current code creating IRQ resources from data in device
tree does not configure trigger flags in resulting resources.

This patch tries to solve the problem, based on the fact that
irq_of_parse_and_map() configures the trigger based on DT interrupt
specifier and IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
and we can get correct trigger flags by calling irqd_get_trigger_type()
after mapping the interrupt.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/of/irq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 1752988..12742d0 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -356,6 +356,16 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 		r->start = r->end = irq;
 		r->flags = IORESOURCE_IRQ;
 		r->name = name ? name : dev->full_name;
+
+		/*
+		 * Some drivers might rely on availability of trigger flags
+		 * in IRQ resource. Since irq_of_parse_and_map() configures the
+		 * trigger based on interrupt specifier and IRQD_TRIGGER_*
+		 * flags are consistent with IORESOURCE_IRQ_*, we can get
+		 * trigger type that was just set and pass it through resource
+		 * flags as well.
+		 */
+		r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
 	}
 
 	return irq;
-- 
1.8.3.2


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

end of thread, other threads:[~2013-10-07 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-18 22:56 [PATCH] of: irq: Pass trigger type in IRQ resource flags Tomasz Figa
2013-06-05 18:20 ` Tomasz Figa
2013-06-14 22:00   ` Grant Likely
2013-06-15  0:57     ` Javier Martinez Canillas
2013-09-28 17:52 Tomasz Figa
2013-10-04 17:42 ` 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).