From: Rob Herring <robherring2@gmail.com>
To: David Daney <david.daney@cavium.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
David Daney <ddaney.cavm@gmail.com>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
"ralf@linux-mips.org" <ralf@linux-mips.org>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
Rob Herring <rob.herring@calxeda.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 4/5] MIPS: Octeon: Setup irq_domains for interrupts.
Date: Sat, 03 Mar 2012 13:35:33 -0600 [thread overview]
Message-ID: <4F527285.1020500@gmail.com> (raw)
In-Reply-To: <4F511FB0.5070901@cavium.com>
On 03/02/2012 01:29 PM, David Daney wrote:
> On 03/02/2012 11:07 AM, Grant Likely wrote:
>> On Fri, 02 Mar 2012 10:03:58 -0800, David
>> Daney<david.daney@cavium.com> wrote:
>>> On 03/02/2012 06:22 AM, Rob Herring wrote:
>>> [...]
>>>>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>>>>> index ce30e2f..01344ae 100644
>>>>> --- a/arch/mips/Kconfig
>>>>> +++ b/arch/mips/Kconfig
>>>>> @@ -1432,6 +1432,7 @@ config CPU_CAVIUM_OCTEON
>>>>> select WEAK_ORDERING
>>>>> select CPU_SUPPORTS_HIGHMEM
>>>>> select CPU_SUPPORTS_HUGEPAGES
>>>>> + select IRQ_DOMAIN
>>>>
>>>> IIRC, Grant has a patch cued up that enables IRQ_DOMAIN for all of
>>>> MIPS.
>>>>
>>>
>>> Indeed, I now see it in linux-next. I will remove this one.
>>>
>>>>> help
>>>>> The Cavium Octeon processor is a highly integrated chip
>>>>> containing
>>>>> many ethernet hardware widgets for networking tasks. The
>>>>> processor
>>>>> diff --git a/arch/mips/cavium-octeon/octeon-irq.c
>>>>> b/arch/mips/cavium-octeon/octeon-irq.c
>>>>> index bdcedd3..e9f2f6c 100644
>>>>> --- a/arch/mips/cavium-octeon/octeon-irq.c
>>>>> +++ b/arch/mips/cavium-octeon/octeon-irq.c
>>> [...]
>>>>> +static void __init octeon_irq_set_ciu_mapping(unsigned int irq,
>>>>> + unsigned int line,
>>>>> + unsigned int bit,
>>>>> + struct irq_domain *domain,
>>>>> struct irq_chip *chip,
>>>>> irq_flow_handler_t handler)
>>>>> {
>>>>> + struct irq_data *irqd;
>>>>> union octeon_ciu_chip_data cd;
>>>>>
>>>>> irq_set_chip_and_handler(irq, chip, handler);
>>>>> -
>>>>> cd.l = 0;
>>>>> cd.s.line = line;
>>>>> cd.s.bit = bit;
>>>>>
>>>>> irq_set_chip_data(irq, cd.p);
>>>>> octeon_irq_ciu_to_irq[line][bit] = irq;
>>>>> +
>>>>> + irqd = irq_get_irq_data(irq);
>>>>> + irqd->hwirq = line<< 6 | bit;
>>>>> + irqd->domain = domain;
>>>>
>>>> I think the domain code will set these.
>>>
>>> It is my understanding that the domain code only does this for:
>>>
>>> o irq_domain_add_legacy()
>>>
>>> o irq_create_direct_mapping()
>>>
>>> o irq_create_mapping()
>>>
>>> We use none of those. So I do it here.
>>>
>>> If there is a better way, I am open to suggestions.
>>
>> irq_create_mapping is called by irq_create_of_mapping() which is
>> in turn called by irq_of_parse_and-map(). irq_domain always
>> manages the hwirq and domain values. Driver code cannot manipulate
>> them manually.
>>
>
> I really must be missing something.
>
> Given:
>
> 1) I must have a mapping between hwirq and irq that I control so that
> non-OF code using the OCTEON_IRQ_* constants continues to work.
Those defines are what you need to work to get rid of.
> 2) irq_create_mapping() will allocate a random irq value if none is
> already assigned to the hwirq.
>
> Therefore: To avoid having random irq values assigned, I must manually
> assign them.
>
So you should be using legacy domain if you need to maintain fixed hwirq
to linux irq numbers. "linear" is a bit confusing as it doesn't mean
linear 1:1 irq number assignment, but linear search.
Ultimately, for DT boot you should use of_irq_init to scan the dts, and
then create a linear domain for each interrupt controller node. You may
need to decide on linear vs. legacy at runtime based on having a DT node
pointer or not.
Rob
WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Cc: "linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org"
<linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
"ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org"
<ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
Subject: Re: [PATCH v6 4/5] MIPS: Octeon: Setup irq_domains for interrupts.
Date: Sat, 03 Mar 2012 13:35:33 -0600 [thread overview]
Message-ID: <4F527285.1020500@gmail.com> (raw)
In-Reply-To: <4F511FB0.5070901-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
On 03/02/2012 01:29 PM, David Daney wrote:
> On 03/02/2012 11:07 AM, Grant Likely wrote:
>> On Fri, 02 Mar 2012 10:03:58 -0800, David
>> Daney<david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org> wrote:
>>> On 03/02/2012 06:22 AM, Rob Herring wrote:
>>> [...]
>>>>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>>>>> index ce30e2f..01344ae 100644
>>>>> --- a/arch/mips/Kconfig
>>>>> +++ b/arch/mips/Kconfig
>>>>> @@ -1432,6 +1432,7 @@ config CPU_CAVIUM_OCTEON
>>>>> select WEAK_ORDERING
>>>>> select CPU_SUPPORTS_HIGHMEM
>>>>> select CPU_SUPPORTS_HUGEPAGES
>>>>> + select IRQ_DOMAIN
>>>>
>>>> IIRC, Grant has a patch cued up that enables IRQ_DOMAIN for all of
>>>> MIPS.
>>>>
>>>
>>> Indeed, I now see it in linux-next. I will remove this one.
>>>
>>>>> help
>>>>> The Cavium Octeon processor is a highly integrated chip
>>>>> containing
>>>>> many ethernet hardware widgets for networking tasks. The
>>>>> processor
>>>>> diff --git a/arch/mips/cavium-octeon/octeon-irq.c
>>>>> b/arch/mips/cavium-octeon/octeon-irq.c
>>>>> index bdcedd3..e9f2f6c 100644
>>>>> --- a/arch/mips/cavium-octeon/octeon-irq.c
>>>>> +++ b/arch/mips/cavium-octeon/octeon-irq.c
>>> [...]
>>>>> +static void __init octeon_irq_set_ciu_mapping(unsigned int irq,
>>>>> + unsigned int line,
>>>>> + unsigned int bit,
>>>>> + struct irq_domain *domain,
>>>>> struct irq_chip *chip,
>>>>> irq_flow_handler_t handler)
>>>>> {
>>>>> + struct irq_data *irqd;
>>>>> union octeon_ciu_chip_data cd;
>>>>>
>>>>> irq_set_chip_and_handler(irq, chip, handler);
>>>>> -
>>>>> cd.l = 0;
>>>>> cd.s.line = line;
>>>>> cd.s.bit = bit;
>>>>>
>>>>> irq_set_chip_data(irq, cd.p);
>>>>> octeon_irq_ciu_to_irq[line][bit] = irq;
>>>>> +
>>>>> + irqd = irq_get_irq_data(irq);
>>>>> + irqd->hwirq = line<< 6 | bit;
>>>>> + irqd->domain = domain;
>>>>
>>>> I think the domain code will set these.
>>>
>>> It is my understanding that the domain code only does this for:
>>>
>>> o irq_domain_add_legacy()
>>>
>>> o irq_create_direct_mapping()
>>>
>>> o irq_create_mapping()
>>>
>>> We use none of those. So I do it here.
>>>
>>> If there is a better way, I am open to suggestions.
>>
>> irq_create_mapping is called by irq_create_of_mapping() which is
>> in turn called by irq_of_parse_and-map(). irq_domain always
>> manages the hwirq and domain values. Driver code cannot manipulate
>> them manually.
>>
>
> I really must be missing something.
>
> Given:
>
> 1) I must have a mapping between hwirq and irq that I control so that
> non-OF code using the OCTEON_IRQ_* constants continues to work.
Those defines are what you need to work to get rid of.
> 2) irq_create_mapping() will allocate a random irq value if none is
> already assigned to the hwirq.
>
> Therefore: To avoid having random irq values assigned, I must manually
> assign them.
>
So you should be using legacy domain if you need to maintain fixed hwirq
to linux irq numbers. "linear" is a bit confusing as it doesn't mean
linear 1:1 irq number assignment, but linear search.
Ultimately, for DT boot you should use of_irq_init to scan the dts, and
then create a linear domain for each interrupt controller node. You may
need to decide on linear vs. legacy at runtime based on having a DT node
pointer or not.
Rob
next prev parent reply other threads:[~2012-03-03 19:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 0:56 [PATCH v6 0/5] MIPS: Octeon: Use Device Tree David Daney
2012-03-01 0:56 ` [PATCH v6 1/5] MIPS: Octeon: Add device tree source files David Daney
2012-03-01 0:56 ` [PATCH v6 2/5] MIPS: Don't define early_init_devtree() and device_tree_init() in prom.c for CPU_CAVIUM_OCTEON David Daney
2012-03-01 0:56 ` David Daney
2012-03-01 0:57 ` [PATCH v6 3/5] MIPS: Octeon: Add irq handlers for GPIO interrupts David Daney
2012-03-01 0:57 ` [PATCH v6 4/5] MIPS: Octeon: Setup irq_domains for interrupts David Daney
2012-03-02 14:22 ` Rob Herring
2012-03-02 18:03 ` David Daney
2012-03-02 19:07 ` Grant Likely
2012-03-02 19:29 ` David Daney
2012-03-03 19:35 ` Rob Herring [this message]
2012-03-03 19:35 ` Rob Herring
2012-03-04 5:09 ` David Daney
2012-03-04 5:09 ` David Daney
2012-03-09 5:57 ` Grant Likely
2012-03-09 18:45 ` David Daney
2012-03-09 21:07 ` Rob Herring
2012-03-10 0:08 ` David Daney
2012-03-10 16:20 ` Rob Herring
2012-03-10 16:20 ` Rob Herring
2012-03-03 19:38 ` Rob Herring
2012-03-04 5:41 ` David Daney
2012-03-02 19:02 ` Grant Likely
2012-03-01 0:57 ` [PATCH v6 5/5] MIPS: Octeon: Initialize and fixup device tree David Daney
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=4F527285.1020500@gmail.com \
--to=robherring2@gmail.com \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=rob.herring@calxeda.com \
/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.