brcm47xx: add initial support for kernel 3.9
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 251-ssb-add-gpio_to_irq.patch
1 --- a/drivers/ssb/driver_gpio.c
2 +++ b/drivers/ssb/driver_gpio.c
3 @@ -74,6 +74,16 @@ static void ssb_gpio_chipco_free(struct
4         ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0);
5  }
6  
7 +static int ssb_gpio_chipco_to_irq(struct gpio_chip *chip, unsigned gpio)
8 +{
9 +       struct ssb_bus *bus = ssb_gpio_get_bus(chip);
10 +
11 +       if (bus->bustype == SSB_BUSTYPE_SSB)
12 +               return ssb_mips_irq(bus->chipco.dev) + 2;
13 +       else
14 +               return -EINVAL;
15 +}
16 +
17  static int ssb_gpio_chipco_init(struct ssb_bus *bus)
18  {
19         struct gpio_chip *chip = &bus->gpio;
20 @@ -86,6 +96,7 @@ static int ssb_gpio_chipco_init(struct s
21         chip->set               = ssb_gpio_chipco_set_value;
22         chip->direction_input   = ssb_gpio_chipco_direction_input;
23         chip->direction_output  = ssb_gpio_chipco_direction_output;
24 +       chip->to_irq            = ssb_gpio_chipco_to_irq;
25         chip->ngpio             = 16;
26         /* There is just one SoC in one device and its GPIO addresses should be
27          * deterministic to address them more easily. The other buses could get
28 @@ -134,6 +145,16 @@ static int ssb_gpio_extif_direction_outp
29         return 0;
30  }
31  
32 +static int ssb_gpio_extif_to_irq(struct gpio_chip *chip, unsigned gpio)
33 +{
34 +       struct ssb_bus *bus = ssb_gpio_get_bus(chip);
35 +
36 +       if (bus->bustype == SSB_BUSTYPE_SSB)
37 +               return ssb_mips_irq(bus->extif.dev) + 2;
38 +       else
39 +               return -EINVAL;
40 +}
41 +
42  static int ssb_gpio_extif_init(struct ssb_bus *bus)
43  {
44         struct gpio_chip *chip = &bus->gpio;
45 @@ -144,6 +165,7 @@ static int ssb_gpio_extif_init(struct ss
46         chip->set               = ssb_gpio_extif_set_value;
47         chip->direction_input   = ssb_gpio_extif_direction_input;
48         chip->direction_output  = ssb_gpio_extif_direction_output;
49 +       chip->to_irq            = ssb_gpio_extif_to_irq;
50         chip->ngpio             = 5;
51         /* There is just one SoC in one device and its GPIO addresses should be
52          * deterministic to address them more easily. The other buses could get
53 --- a/include/linux/ssb/ssb_driver_mips.h
54 +++ b/include/linux/ssb/ssb_driver_mips.h
55 @@ -45,6 +45,11 @@ void ssb_mipscore_init(struct ssb_mipsco
56  {
57  }
58  
59 +static inline unsigned int ssb_mips_irq(struct ssb_device *dev)
60 +{
61 +       return 0;
62 +}
63 +
64  #endif /* CONFIG_SSB_DRIVER_MIPS */
65  
66  #endif /* LINUX_SSB_MIPSCORE_H_ */