cleanup basefiles
[openwrt/staging/yousong.git] / target / linux / lantiq / patches-3.6 / 0100-MIPS-lantiq-external-interrupt-units-not-loaded-prop.patch
1 From b27b8f1bd7d46f1affc9a2bc4142e248411c1afa Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Mon, 22 Oct 2012 17:42:48 +0200
4 Subject: [PATCH 100/113] MIPS: lantiq: external interrupt units not loaded
5 properly
6
7 The code references the wrong device node causing the number of EIU pins to
8 be wrong.
9
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12 arch/mips/lantiq/irq.c | 2 +-
13 drivers/pinctrl/pinctrl-xway.c | 15 +++++++++++++++
14 2 files changed, 16 insertions(+), 1 deletion(-)
15
16 diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
17 index f36acd1..8e55622 100644
18 --- a/arch/mips/lantiq/irq.c
19 +++ b/arch/mips/lantiq/irq.c
20 @@ -343,7 +343,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
21 eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu");
22 if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
23 /* find out how many external irq sources we have */
24 - const __be32 *count = of_get_property(node,
25 + const __be32 *count = of_get_property(eiu_node,
26 "lantiq,count", NULL);
27
28 if (count)
29 diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
30 index b9bcaec..ea5e017 100644
31 --- a/drivers/pinctrl/pinctrl-xway.c
32 +++ b/drivers/pinctrl/pinctrl-xway.c
33 @@ -14,6 +14,7 @@
34 #include <linux/of_platform.h>
35 #include <linux/of_address.h>
36 #include <linux/of_gpio.h>
37 +#include <linux/of_irq.h>
38 #include <linux/ioport.h>
39 #include <linux/io.h>
40 #include <linux/device.h>
41 @@ -618,6 +619,19 @@ static void xway_gpio_free(struct gpio_chip *chip, unsigned offset)
42 pinctrl_free_gpio(gpio);
43 }
44
45 +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
46 +{
47 + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev);
48 + struct resource res;
49 + int i;
50 +
51 + for (i = 0; i < info->num_exin; i++)
52 + if (offset == info->exin[i])
53 + if (of_irq_to_resource(chip->dev->of_node, i, &res))
54 + return res.start;
55 + return 0;
56 +}
57 +
58 static struct gpio_chip xway_chip = {
59 .label = "gpio-xway",
60 .direction_input = xway_gpio_dir_in,
61 @@ -626,6 +640,7 @@ static struct gpio_chip xway_chip = {
62 .set = xway_gpio_set,
63 .request = xway_gpio_req,
64 .free = xway_gpio_free,
65 + .to_irq = xway_gpio_to_irq,
66 .base = -1,
67 };
68
69 --
70 1.7.10.4
71