All of lore.kernel.org
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 4/4] gpio: pl061: enable interrupts with DT style binding
Date: Thu, 09 Feb 2012 18:17:44 -0600	[thread overview]
Message-ID: <4F346228.5020300@gmail.com> (raw)
In-Reply-To: <20120209235805.GB3135@r65073-Latitude-D630>

On 02/09/2012 05:58 PM, Shawn Guo wrote:
> On Thu, Feb 09, 2012 at 04:03:10PM -0600, Rob Herring wrote:
>>
>> On 02/09/2012 02:04 PM, Shawn Guo wrote:
>>> On Fri, Feb 03, 2012 at 04:35:12PM -0600, Rob Herring wrote:
>>> ...
>>>> @@ -126,18 +127,16 @@ static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value)
>>>>  static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
>>>>  {
>>>>  	struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
>>>> -
>>>> -	if (chip->irq_base <= 0)
>>>> -		return -EINVAL;
>>>> -
>>>> -	return chip->irq_base + offset;
>>>> +	if (!chip->irq_gc)
>>>> +		return -ENXIO;
>>>> +	return irq_find_mapping(chip->irq_gc->domain, offset);
>>>
>>> If I understand the driver correctly, it will add a linear domain for
>>> dt case.  Do you have code somewhere creating the mapping before this
>>> irq_find_mapping gets called here?  The reason I'm asking this is I
>>> have to call irq_create_mapping rather than irq_find_mapping here to
>>> get imx gpio driver working with linear domain, otherwise the
>>> irq_find_mapping call will fail.
>>>
>>
>> Right, the user has to call irq_of_parse_and_map (which calls
>> irq_create_mapping ultimately). Interrupts are allocated on demand. The
>> dts needs to declare the gpio controller as an interrupt-controller and
>> the node using the gpio line needs to set its interrupt parent and
>> interrupt connection
>>
> Yes, that's how dt users use irq.  But since I'm trying to make the
> imx gpio irq_domain as linear for both non-dt and dt users.  Calling
> irq_create_mapping here may make sense for me, since it will not
> require all these non-dt users change the way they use gpio irq.
> 

I wouldn't try to use linear for non-DT at this point.

> Even for dt users, there may have some case that can not work in the
> way we expect.
> 
> 	soc {
> 		#address-cells = <1>;
> 		#size-cells = <1>;
> 		compatible = "simple-bus";
> 		interrupt-parent = <&tzic>;
> 		ranges;
> 
> 		esdhc at 70008000 { /* ESDHC2 */
> 			compatible = "fsl,imx51-esdhc";
> 			reg = <0x70008000 0x4000>;
> 			interrupts = <2>;
> 			cd-gpios = <&gpio1 6 0>;
> 			wp-gpios = <&gpio1 5 0>;
> 		};
> 	};
> 
> In above SD example, irq_of_parse_and_map will just work out the SD
> controller internal irq to tzic.  How can we work out the card-detection
> irq to gpio controller in the same way?
> 

That's the limitation in the interrupt binding. Normally, an interrupt
nexus is used for this.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2@gmail.com>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Thomas Gleixner <tglx@linutronix.de>,
	b-cousson@ti.com, Linus Walleij <linus.ml.walleij@gmail.com>
Subject: Re: [PATCH v4 4/4] gpio: pl061: enable interrupts with DT style binding
Date: Thu, 09 Feb 2012 18:17:44 -0600	[thread overview]
Message-ID: <4F346228.5020300@gmail.com> (raw)
In-Reply-To: <20120209235805.GB3135@r65073-Latitude-D630>

On 02/09/2012 05:58 PM, Shawn Guo wrote:
> On Thu, Feb 09, 2012 at 04:03:10PM -0600, Rob Herring wrote:
>>
>> On 02/09/2012 02:04 PM, Shawn Guo wrote:
>>> On Fri, Feb 03, 2012 at 04:35:12PM -0600, Rob Herring wrote:
>>> ...
>>>> @@ -126,18 +127,16 @@ static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value)
>>>>  static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
>>>>  {
>>>>  	struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
>>>> -
>>>> -	if (chip->irq_base <= 0)
>>>> -		return -EINVAL;
>>>> -
>>>> -	return chip->irq_base + offset;
>>>> +	if (!chip->irq_gc)
>>>> +		return -ENXIO;
>>>> +	return irq_find_mapping(chip->irq_gc->domain, offset);
>>>
>>> If I understand the driver correctly, it will add a linear domain for
>>> dt case.  Do you have code somewhere creating the mapping before this
>>> irq_find_mapping gets called here?  The reason I'm asking this is I
>>> have to call irq_create_mapping rather than irq_find_mapping here to
>>> get imx gpio driver working with linear domain, otherwise the
>>> irq_find_mapping call will fail.
>>>
>>
>> Right, the user has to call irq_of_parse_and_map (which calls
>> irq_create_mapping ultimately). Interrupts are allocated on demand. The
>> dts needs to declare the gpio controller as an interrupt-controller and
>> the node using the gpio line needs to set its interrupt parent and
>> interrupt connection
>>
> Yes, that's how dt users use irq.  But since I'm trying to make the
> imx gpio irq_domain as linear for both non-dt and dt users.  Calling
> irq_create_mapping here may make sense for me, since it will not
> require all these non-dt users change the way they use gpio irq.
> 

I wouldn't try to use linear for non-DT at this point.

> Even for dt users, there may have some case that can not work in the
> way we expect.
> 
> 	soc {
> 		#address-cells = <1>;
> 		#size-cells = <1>;
> 		compatible = "simple-bus";
> 		interrupt-parent = <&tzic>;
> 		ranges;
> 
> 		esdhc@70008000 { /* ESDHC2 */
> 			compatible = "fsl,imx51-esdhc";
> 			reg = <0x70008000 0x4000>;
> 			interrupts = <2>;
> 			cd-gpios = <&gpio1 6 0>;
> 			wp-gpios = <&gpio1 5 0>;
> 		};
> 	};
> 
> In above SD example, irq_of_parse_and_map will just work out the SD
> controller internal irq to tzic.  How can we work out the card-detection
> irq to gpio controller in the same way?
> 

That's the limitation in the interrupt binding. Normally, an interrupt
nexus is used for this.

Rob

  reply	other threads:[~2012-02-10  0:17 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 22:35 [PATCH v4 0/4] generic irq chip domain support Rob Herring
2012-02-03 22:35 ` Rob Herring
2012-02-03 22:35 ` [PATCH v4 1/4] ARM: kconfig: always select IRQ_DOMAIN Rob Herring
2012-02-03 22:35   ` Rob Herring
2012-02-03 22:35 ` [PATCH v4 2/4] irq: add irq_domain support to generic-chip Rob Herring
2012-02-03 22:35   ` Rob Herring
2012-02-03 23:47   ` Grant Likely
2012-02-03 23:47     ` Grant Likely
2012-02-08  6:16     ` Shawn Guo
2012-02-08  6:16       ` Shawn Guo
2012-02-04 14:08   ` Shawn Guo
2012-02-04 14:08     ` Shawn Guo
2012-02-04 14:05     ` Grant Likely
2012-02-04 14:05       ` Grant Likely
2012-02-07  4:54     ` Rob Herring
2012-02-07  4:54       ` Rob Herring
2012-02-07  5:25       ` Grant Likely
2012-02-07  5:25         ` Grant Likely
2012-02-08  7:15       ` Shawn Guo
2012-02-08  7:15         ` Shawn Guo
2012-02-08 16:49         ` Rob Herring
2012-02-08 16:49           ` Rob Herring
2012-02-03 22:35 ` [PATCH v4 3/4] ARM: imx: add irq domain support to tzic Rob Herring
2012-02-03 22:35   ` Rob Herring
2012-02-04 14:20   ` Shawn Guo
2012-02-04 14:20     ` Shawn Guo
2012-02-03 22:35 ` [PATCH v4 4/4] gpio: pl061: enable interrupts with DT style binding Rob Herring
2012-02-03 22:35   ` Rob Herring
2012-02-09 20:04   ` Shawn Guo
2012-02-09 20:04     ` Shawn Guo
2012-02-09 22:03     ` Rob Herring
2012-02-09 22:03       ` Rob Herring
2012-02-09 23:58       ` Shawn Guo
2012-02-09 23:58         ` Shawn Guo
2012-02-10  0:17         ` Rob Herring [this message]
2012-02-10  0:17           ` Rob Herring
2012-02-10 16:37           ` Shawn Guo
2012-02-10 16:37             ` Shawn Guo
2012-02-08 22:55 ` [PATCH v6] irq: add irq_domain support to generic-chip Rob Herring
2012-02-08 22:55   ` Rob Herring
2012-02-09 19:48   ` Shawn Guo
2012-02-09 19:48     ` Shawn Guo
2012-02-09 22:31     ` Rob Herring
2012-02-09 22:31       ` Rob Herring
2012-02-09 23:36       ` Shawn Guo
2012-02-09 23:36         ` Shawn Guo
2012-04-13  5:23   ` Thomas Abraham
2012-04-13  5:23     ` Thomas Abraham
2012-04-19 18:34     ` Grant Likely
2012-04-19 18:34       ` Grant Likely

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=4F346228.5020300@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.