* [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT
@ 2012-10-23 13:56 Jean-Christophe PLAGNIOL-VILLARD
2012-10-24 7:44 ` Linus Walleij
2012-10-24 12:01 ` Linus Walleij
0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-23 13:56 UTC (permalink / raw)
To: linux-arm-kernel
If we do this
interrupt-parent = <&pioA>;
interrupts = <7 0x0>;
The current core map the irq correctly but the gpio is not configured as input.
The pinctrl configure the pin as gpio with the correct mux parameter but is
not responsible to configure it as input.
So do it during the xlate
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/pinctrl/pinctrl-at91.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 01bf924..7d95c80 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1255,9 +1255,33 @@ static int at91_gpio_irq_map(struct irq_domain *h, unsigned int virq,
return 0;
}
+int at91_gpio_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
+ const u32 *intspec, unsigned int intsize,
+ irq_hw_number_t *out_hwirq, unsigned int *out_type)
+{
+ struct at91_gpio_chip *at91_gpio = d->host_data;
+ int ret;
+ int pin = at91_gpio->chip.base + intspec[0];
+
+ if (WARN_ON(intsize < 2))
+ return -EINVAL;
+ *out_hwirq = intspec[0];
+ *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
+
+ ret = gpio_request(pin, ctrlr->full_name);
+ if (ret)
+ return ret;
+
+ ret = gpio_direction_input(pin);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static struct irq_domain_ops at91_gpio_ops = {
.map = at91_gpio_irq_map,
- .xlate = irq_domain_xlate_twocell,
+ .xlate = at91_gpio_irq_domain_xlate,
};
static int at91_gpio_of_irq_setup(struct device_node *node,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT
2012-10-23 13:56 [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-24 7:44 ` Linus Walleij
2012-10-24 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-24 12:01 ` Linus Walleij
1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2012-10-24 7:44 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Oct 23, 2012 at 3:56 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> If we do this
>
> interrupt-parent = <&pioA>;
> interrupts = <7 0x0>;
>
> The current core map the irq correctly but the gpio is not configured as input.
> The pinctrl configure the pin as gpio with the correct mux parameter but is
> not responsible to configure it as input.
>
> So do it during the xlate
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Looks OK to me: do you want me to just apply it on my AT91 branch
on the pinctrl tree?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT
2012-10-24 7:44 ` Linus Walleij
@ 2012-10-24 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-24 9:21 UTC (permalink / raw)
To: linux-arm-kernel
On 09:44 Wed 24 Oct , Linus Walleij wrote:
> On Tue, Oct 23, 2012 at 3:56 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
>
> > If we do this
> >
> > interrupt-parent = <&pioA>;
> > interrupts = <7 0x0>;
> >
> > The current core map the irq correctly but the gpio is not configured as input.
> > The pinctrl configure the pin as gpio with the correct mux parameter but is
> > not responsible to configure it as input.
> >
> > So do it during the xlate
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>
> Looks OK to me: do you want me to just apply it on my AT91 branch
> on the pinctrl tree?
if 3.8 I prefer via at91 if you don't mind
Best Regards,
J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT
2012-10-23 13:56 [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT Jean-Christophe PLAGNIOL-VILLARD
2012-10-24 7:44 ` Linus Walleij
@ 2012-10-24 12:01 ` Linus Walleij
1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-10-24 12:01 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Oct 23, 2012 at 3:56 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> If we do this
>
> interrupt-parent = <&pioA>;
> interrupts = <7 0x0>;
>
> The current core map the irq correctly but the gpio is not configured as input.
> The pinctrl configure the pin as gpio with the correct mux parameter but is
> not responsible to configure it as input.
>
> So do it during the xlate
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Applied to my at91 branch, thanks!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-24 12:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 13:56 [PATCH 1/1] gpio/at91: auto request and configure the pio as input when the interrupt is used via DT Jean-Christophe PLAGNIOL-VILLARD
2012-10-24 7:44 ` Linus Walleij
2012-10-24 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-24 12:01 ` Linus Walleij
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).