1 Subject: [PATCH] bcma-hcd: add support for controlling bus power through GPIO
3 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
5 --- a/drivers/usb/host/bcma-hcd.c
6 +++ b/drivers/usb/host/bcma-hcd.c
8 #include <linux/platform_device.h>
9 #include <linux/module.h>
10 #include <linux/slab.h>
11 +#include <linux/of.h>
12 +#include <linux/of_gpio.h>
13 #include <linux/usb/ehci_pdriver.h>
14 #include <linux/usb/ohci_pdriver.h>
16 @@ -205,7 +207,38 @@ static void bcma_hcd_init_chip_arm(struc
20 +static void bcma_hci_platform_power_gpio(struct platform_device *dev, bool val)
24 + gpio = of_get_named_gpio(dev->dev.of_node, "vcc-gpio", 0);
25 + if (!gpio_is_valid(gpio))
29 + gpio_request(gpio, "bcma-hcd-gpio");
30 + gpio_set_value(gpio, 1);
32 + gpio_set_value(gpio, 0);
37 +static int bcma_hci_platform_power_on(struct platform_device *dev)
39 + bcma_hci_platform_power_gpio(dev, true);
43 +static void bcma_hci_platform_power_off(struct platform_device *dev)
45 + bcma_hci_platform_power_gpio(dev, false);
48 static const struct usb_ehci_pdata ehci_pdata = {
49 + .power_on = bcma_hci_platform_power_on,
50 + .power_suspend = bcma_hci_platform_power_off,
51 + .power_off = bcma_hci_platform_power_off,
54 static const struct usb_ohci_pdata ohci_pdata = {
55 @@ -233,6 +266,7 @@ static struct platform_device *bcma_hcd_
57 hci_dev->dev.parent = &dev->dev;
58 hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask;
59 + hci_dev->dev.of_node = dev->dev.of_node;
61 ret = platform_device_add_resources(hci_dev, hci_res,