aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-10-23 09:56:41 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-10-24 08:01:15 -0400
commita728c7cdd033f0cbeacc302d2409a2428e68e1be (patch)
tree2b34e56140060750b691f5c7479a76df3862fa67
parent525fae21317658ae556ca850f3004319004641d1 (diff)
gpio/at91: auto request and configure the pio as input when the interrupt is used via DT
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 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-at91.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index f10fad2079c5..676b199d6d22 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,
1255 return 0; 1255 return 0;
1256} 1256}
1257 1257
1258int at91_gpio_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
1259 const u32 *intspec, unsigned int intsize,
1260 irq_hw_number_t *out_hwirq, unsigned int *out_type)
1261{
1262 struct at91_gpio_chip *at91_gpio = d->host_data;
1263 int ret;
1264 int pin = at91_gpio->chip.base + intspec[0];
1265
1266 if (WARN_ON(intsize < 2))
1267 return -EINVAL;
1268 *out_hwirq = intspec[0];
1269 *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
1270
1271 ret = gpio_request(pin, ctrlr->full_name);
1272 if (ret)
1273 return ret;
1274
1275 ret = gpio_direction_input(pin);
1276 if (ret)
1277 return ret;
1278
1279 return 0;
1280}
1281
1258static struct irq_domain_ops at91_gpio_ops = { 1282static struct irq_domain_ops at91_gpio_ops = {
1259 .map = at91_gpio_irq_map, 1283 .map = at91_gpio_irq_map,
1260 .xlate = irq_domain_xlate_twocell, 1284 .xlate = at91_gpio_irq_domain_xlate,
1261}; 1285};
1262 1286
1263static int at91_gpio_of_irq_setup(struct device_node *node, 1287static int at91_gpio_of_irq_setup(struct device_node *node,