public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Lars Poeschel <larsi@wh2.tu-dresden.de>,
	Lars Poeschel <poeschel@lemonage.de>,
	Grant Likely <grant.likely@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Enric Balletbo i Serra <eballetbo@gmail.com>,
	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Kevin Hilman <khilman@linaro.org>, Balaji T K <balajitk@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	Jon Hunter <jgchunter@gmail.com>,
	mark.rutland@arm.com, ian.campbell@citrix.com,
	galak@codeaurora.org, pawel.moll@arm.com
Subject: Re: [PATCH v2] RFC: interrupt consistency check for OF GPIO IRQs
Date: Mon, 19 Aug 2013 13:35:22 -0600	[thread overview]
Message-ID: <5212737A.1030904@wwwdotorg.org> (raw)
In-Reply-To: <9241298.URG9CVQFmF@flatron>

On 08/17/2013 03:59 AM, Tomasz Figa wrote:
> [Ccing DT maintainers, as they may have some ideas as well]
> 
> On Saturday 17 of August 2013 02:16:11 Linus Walleij wrote:
>> On Thu, Aug 15, 2013 at 11:53 AM, Tomasz Figa <tomasz.figa@gmail.com>  wrote:
...

>>> This is the biggest problem of this patch. It assumes that there is
>>> only a single and shared GPIO/interrupt specification scheme, which
>>> might not be true.
>>>
>>> First of all, almost all interrupt bindings have an extra,
>>> semi-generic
>>> flags field as last cell in the specifier. Now there can be more than
>>> one> 
>>> cell used to index GPIOs and interrupts, for example:
>>>         interrupts = <1 3 8>
>>>
>>> which could mean: bank 1, pin 3, low level triggered.
>>
>> You are right, but:
>> Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
>> Specifies how to handle the one-celled and two-celled versions.
>>
>> And nothing else is specified. So it's not overly complex.
> 
> The documentation states that:
> 
> 	It is the responsibility of the interrupt controller's binding to 
> 	define the length and format of the interrupt specifier.
> 
> Then two _example_ formats follow, preceded by following statement:
> 
> 	The following two variants are commonly used:
> 
> I already know a variant which uses three (Exynos combiner) and four 
> (S3C24xx interrupt controller) cells. They are not pin controllers, but 
> you can't stop anyone from adopting similar or even more complex 
> specifiers formats for their hardware, especially when it matches more 
> closely the interrupt/pin layout used in their hardware.

Yes, the binding doc interrupts.txt mentioned above does not specify
*the* one-/two-cell format, but *a* common/possible one- and two-cell
format. There's no strict reason that all interrupt controllers have to
use those exact formats. The only way to parse interrupt specifiers is
to ask the driver for the the interrupt controller code to parse the
property.

The same goes for GPIOs.

>> But we have to read out the #interrupt-cells specifier from the
>> controller I guess, but since we the gcn pointer we can do this
>> easily. (I'll fix...)
>>
>>> I think you may need to reuse a lot of the code that normally parses
>>> the interrupts property, i.e. the irq_of_parse_and_map() path, which
>>> will then give you the hwirq index inside your irq chip, which may
>>> (or may not) be the same as the GPIO offset inside your GPIO chip.
>>
>> We don't need to map it, and that's the hard part of that code.
>> We just need to add some code to check the number of
>> cells.
> 
> Not really. Only the interrupt controller's driver (or rather its .xlate() 
> callback) knows how to map all the cells into hwirq index. So we must at 
> least get the irq domain associated with the node and call its .xlate() 
> callback with requested count of cells.

Yes.

  reply	other threads:[~2013-08-19 19:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13  9:46 [PATCH v2] RFC: interrupt consistency check for OF GPIO IRQs Lars Poeschel
2013-08-13 15:22 ` Kevin Hilman
2013-08-15  9:53 ` Tomasz Figa
2013-08-15 12:12   ` Lars Poeschel
2013-08-15 12:31     ` Tomasz Figa
2013-08-17  0:26       ` Linus Walleij
2013-08-17  0:16   ` Linus Walleij
2013-08-17  9:59     ` Tomasz Figa
2013-08-19 19:35       ` Stephen Warren [this message]
2013-08-21 13:21         ` Lars Poeschel
2013-08-21 23:00           ` Linus Walleij
2013-08-17  0:02 ` Linus Walleij

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=5212737A.1030904@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=balajitk@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eballetbo@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=javier.martinez@collabora.co.uk \
    --cc=jgchunter@gmail.com \
    --cc=khilman@linaro.org \
    --cc=larsi@wh2.tu-dresden.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=poeschel@lemonage.de \
    --cc=santosh.shilimkar@ti.com \
    --cc=tomasz.figa@gmail.com \
    --cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox