* Could resource_size can be used for IORESOURCE_IRQ in device tree?
@ 2012-06-27 7:30 zhangfei gao
2012-06-27 8:32 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: zhangfei gao @ 2012-06-27 7:30 UTC (permalink / raw)
To: linux-arm-kernel
Excuse me,
I have one question when using device tree to get resource_size for
IORESOURCE_IRQ
Without dt,
static struct resource
{
.start = 18,
.end = 19,
.flags = IORESOURCE_IRQ,
},
iores = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
resource_size(iores) = 2 can be used to get how many irq.
iores->start = 18; iores->end = 19;
With dt,
interrupts = <18 19>;
The irq can only be parsed one by one.
iores = platform_get_resource(pdev, IORESOURCE_IRQ, 0) ->
iores->start = 18; resource_size(iores) = 1.
iores = platform_get_resource(pdev, IORESOURCE_IRQ, 1) ->
iores->start = 19; resource_size(iores) = 1.
So resource_size(iores) can not be used to parse irq number
from IORESOURCE_IRQ.
Is there any API directly get resource number in dt, like resource_size(iores).
The reason is interrupts is not constant, and we want to parse
directly from resource.
If only one irq, then driver parse irqs internally.
Only if irq number same as channel number, then every channel have own irq.
It seems inconvenient get irq number one by one and check whether they
equals channel number or not.
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Could resource_size can be used for IORESOURCE_IRQ in device tree?
2012-06-27 7:30 Could resource_size can be used for IORESOURCE_IRQ in device tree? zhangfei gao
@ 2012-06-27 8:32 ` Arnd Bergmann
2012-06-27 9:14 ` zhangfei gao
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2012-06-27 8:32 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 27 June 2012, zhangfei gao wrote:
>
> Excuse me,
> I have one question when using device tree to get resource_size for
> IORESOURCE_IRQ
>
> Without dt,
> static struct resource
> {
> .start = 18,
> .end = 19,
> .flags = IORESOURCE_IRQ,
> },
> iores = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> resource_size(iores) = 2 can be used to get how many irq.
> iores->start = 18; iores->end = 19;
IMHO we should just discourage this from being done.
While the API allows you to put multiple interrupts
into a single resource, it does not generally work,
e.g. when the same device is used in another SoC that
puts connects the interrupt lines to non-contiguous
irqs.
It also breaks down with sparse IRQs when you move
away from legacy irqdomains and the linux-internal numbers
that you put in the resource are not related to the hw
numbers any more.
> Is there any API directly get resource number in dt, like resource_size(iores).
> The reason is interrupts is not constant, and we want to parse
> directly from resource.
> If only one irq, then driver parse irqs internally.
> Only if irq number same as channel number, then every channel have own irq.
> It seems inconvenient get irq number one by one and check whether they
> equals channel number or not.
Which driver is it?
I guess in any case the solution would be to split the platform IRQ resource
and change the driver to just read the IRQs individually like most other
drivers do.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Could resource_size can be used for IORESOURCE_IRQ in device tree?
2012-06-27 8:32 ` Arnd Bergmann
@ 2012-06-27 9:14 ` zhangfei gao
0 siblings, 0 replies; 3+ messages in thread
From: zhangfei gao @ 2012-06-27 9:14 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 27, 2012 at 4:32 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday 27 June 2012, zhangfei gao wrote:
>>
>> Excuse me,
>> I have one question when using device tree to get resource_size for
>> IORESOURCE_IRQ
>>
>> Without dt,
>> static struct resource
>> {
>> ? ? ? ? ? ? ? ? .start ?= 18,
>> ? ? ? ? ? ? ? ? .end ? ?= 19,
>> ? ? ? ? ? ? ? ? .flags ?= IORESOURCE_IRQ,
>> },
>> iores = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>> resource_size(iores) = 2 can be used to get how many irq.
>> iores->start = 18; iores->end = 19;
>
> IMHO we should just discourage this from being done.
> While the API allows you to put multiple interrupts
> into a single resource, it does not generally work,
> e.g. when the same device is used in another SoC that
> puts connects the interrupt lines to non-contiguous
> irqs.
>
> It also breaks down with sparse IRQs when you move
> away from legacy irqdomains and the linux-internal numbers
> that you put in the resource are not related to the hw
> numbers any more.
>
>> Is there any API directly get resource number in dt, like resource_size(iores).
>> The reason is interrupts is not constant, and we want to parse
>> directly from resource.
>> If only one irq, then driver parse irqs internally.
>> Only if irq number same as channel number, then every channel have own irq.
>> It seems inconvenient get irq number one by one and check whether they
>> equals channel number or not.
>
> Which driver is it?
>
> I guess in any case the solution would be to split the platform IRQ resource
> and change the driver to just read the IRQs individually like most other
> drivers do.
>
> ? ? ? ?Arnd
Thanks Arnd for kind explanation.
Will change to read the IRQs individually.
The only requirement is parse IORESOURCE_IRQ number first.
Looks no existing API, so just use platform_get_irq one by one.
Thanks a lot for the advice.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-27 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-27 7:30 Could resource_size can be used for IORESOURCE_IRQ in device tree? zhangfei gao
2012-06-27 8:32 ` Arnd Bergmann
2012-06-27 9:14 ` zhangfei gao
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.