brcm47xx: add initial support for kernel 3.9
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 250-bcma-add-gpio_to_irq.patch
1 --- a/drivers/bcma/driver_gpio.c
2 +++ b/drivers/bcma/driver_gpio.c
3 @@ -73,6 +73,16 @@ static void bcma_gpio_free(struct gpio_c
4         bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
5  }
6  
7 +static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
8 +{
9 +       struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
10 +
11 +       if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
12 +               return bcma_core_irq(cc->core);
13 +       else
14 +               return -EINVAL;
15 +}
16 +
17  int bcma_gpio_init(struct bcma_drv_cc *cc)
18  {
19         struct gpio_chip *chip = &cc->gpio;
20 @@ -85,6 +95,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
21         chip->set               = bcma_gpio_set_value;
22         chip->direction_input   = bcma_gpio_direction_input;
23         chip->direction_output  = bcma_gpio_direction_output;
24 +       chip->to_irq            = bcma_gpio_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 --- a/include/linux/bcma/bcma_driver_mips.h
29 +++ b/include/linux/bcma/bcma_driver_mips.h
30 @@ -42,13 +42,18 @@ struct bcma_drv_mips {
31  #ifdef CONFIG_BCMA_DRIVER_MIPS
32  extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
33  extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
34 +
35 +extern unsigned int bcma_core_irq(struct bcma_device *core);
36  #else
37  static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
38  static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
39 +
40 +static inline unsigned int bcma_core_irq(struct bcma_device *core)
41 +{
42 +       return 0;
43 +}
44  #endif
45  
46  extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
47  
48 -extern unsigned int bcma_core_irq(struct bcma_device *core);
49 -
50  #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */