fa817897136d367adf71f11dde8213ee025e8bd5
[openwrt.git] / target / linux / ar71xx / patches-3.3 / 511-MIPS-ath79-add-ath79_set_usb_power_gpio.patch
1 --- a/arch/mips/ath79/dev-usb.c
2 +++ b/arch/mips/ath79/dev-usb.c
3 @@ -15,6 +15,7 @@
4  #include <linux/init.h>
5  #include <linux/delay.h>
6  #include <linux/irq.h>
7 +#include <linux/gpio.h>
8  #include <linux/dma-mapping.h>
9  #include <linux/platform_device.h>
10  #include <linux/usb/ehci_pdriver.h>
11 @@ -236,3 +237,26 @@ void __init ath79_register_usb(void)
12         else
13                 BUG();
14  }
15 +
16 +void __init ath79_set_usb_power_gpio(unsigned int gpio, unsigned long flags,
17 +                                    const char *label)
18 +{
19 +       int err;
20 +
21 +       err = gpio_request_one(gpio, flags, label);
22 +       if (err) {
23 +               pr_err("ath79: can't setup GPIO%u (%s), err=%d\n",
24 +                       gpio, label, err);
25 +               return;
26 +       }
27 +
28 +       err = gpio_export(gpio, false);
29 +       if (err) {
30 +               pr_err("ath79: can't export GPIO%u (%s), err=%d\n",
31 +                       gpio, label, err);
32 +       }
33 +
34 +       return;
35 +}
36 +
37 +
38 --- a/arch/mips/ath79/dev-usb.h
39 +++ b/arch/mips/ath79/dev-usb.h
40 @@ -13,5 +13,7 @@
41  #define _ATH79_DEV_USB_H
42  
43  void ath79_register_usb(void);
44 +void ath79_set_usb_power_gpio(unsigned int gpio, unsigned long flags,
45 +                             const char *label);
46  
47  #endif /* _ATH79_DEV_USB_H */