devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Daney <ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@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>,
	David Daney
	<david.s.daney-Re5JQEeQqe8AvxtiuMwx3w@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, 10 Mar 2012 10:20:09 -0600	[thread overview]
Message-ID: <4F5B7F39.50106@gmail.com> (raw)
In-Reply-To: <4F5A9B75.8090301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 03/09/2012 06:08 PM, David Daney wrote:
> On 03/09/2012 01:07 PM, Rob Herring wrote:
>> On 03/09/2012 12:45 PM, David Daney wrote:
> [...]
>>>
>>> Probably I have not explained well enough why legacy will not work.
>>>
>>> We have three different interrupt controllers (although only one is
>>> currently in-tree).  hwirq to irq mapping for them is more or less as
>>> follows:
>>
>> I'll just repeat what others have said: if it's not upstream it doesn't
>> exist.
>>
>> We have no knowledge about out of tree h/w to understand what you need
>>
>>> irq                 hwirqCIU        hwirqCIU2      hwirqCIU3
>>> ----------------------------------------------------------------------
>>> OCTEON_IRQ_USB0     56               81             934562
>>> OCTEON_IRQ_TWSI     45              224             100543
>>> OCTEON_IRQ_UART0    34              228               4572
>>> .
>>> .
>>> .
>>
>> How many actual hwirqs in each case and what is the range?
>>
>> So for CIU3, it seems you would need to use a radix tree. CIU2 is
>> probably borderline depending on what is the max number. But because you
>> don't yet have code in tree for either yet, you can use a linear domain
>> for now. It shouldn't be hard to switch from linear to radix later.
>>
>>> Now what we notice here is that there is no possible 1:1 linearly
>>> increasing mapping possible for the irq and *all* three hwirq sets.  We
>>> want a single binary that contains support for all three interrupt
>>> controllers, so the OCTEON_IRQ_* values have to be the same for all
>>> three interrupt controllers.  Because of this, legacy mapping is
>>> *impossible*.
>>
>> OCTEON_IRQ_* values need to go. You may not have to do that now, but
>> certainly before doing support for CIU2 and CIU3 you do. Those platforms
>> should be DT only.
>>
>>>
>>> Since the possible ranges of the hwirq values is very large and quite
>>> sparse, probably the radix mapping will be required.
>>>
>>
>> Yes. You're not the only one with this issue.
>>
>>> Also to support non-OF drivers and architecture specific code for the
>>> near future, I really think the existing IRQ values *must* be preserved.
>>>
>>
>> For a legacy boot yes. But when you boot with DT, you should not need
>> them.
> 
> It is not a matter of how the system is booted, rather what all the
> drivers are expecting...
> 
>> This is certainly possible as several ARM platforms do this. You
>> need to start with minimal set of drivers enabled for DT and add them
>> back in 1 by 1.
>>
> 
> What I don't understand about this is what happens during the transition?
> 
> What if a shared interrupt were referred from one non-OF driver by its
> symbolic OCTEON_IRQ_? value, and from a second driver by its hwirq value
> extracted from the DT?  In that case you would be referring to the same
> interrupt line by two different irq values, clearly that should be
> prevented.
> 
> At a minimum, the change made for each converted driver would have to
> include: removing the OCTEON_IRQ_? values,  Maintain a list of hwirqs
> that are outside of the domain and report this by the.map() function,
> and then update this list.

Drivers should only deal with Linux irq numbers and should only get them
as a resource passed into the driver probe. This is true with or without
DT. I only see 2 drivers directly using OCTEON_IRQ defines: ethernet and
watchdog. Fix them. The serial setup code needs to use resources as
well. The other place you will see irq defines is platform device
declarations (i2c is an example in your case). For DT boot, you would
not register the static devices and the devices should be created
dynamically.

Rob

  parent reply	other threads:[~2012-03-10 16:20 UTC|newest]

Thread overview: 20+ 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
     [not found] ` <1330563422-14078-1-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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: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
     [not found]           ` <4F511FB0.5070901-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2012-03-03 19:35             ` Rob Herring
     [not found]               ` <4F527285.1020500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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
     [not found]                           ` <4F5A9B75.8090301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-10 16:20                             ` Rob Herring [this message]
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=4F5B7F39.50106@gmail.com \
    --to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=david.s.daney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    /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 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).