aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-06-21 16:47:05 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-06-21 16:47:05 +0000
commit71bc9bd7d481f39d28e5d7f13e8f797508958161 (patch)
tree8b86c05ad95baf5b1d532774afe463371f63a9c5 /target
parentdddec34af9292b3e0cb8e25edd08cdc4d961814c (diff)
downloadmaster-187ad058-71bc9bd7d481f39d28e5d7f13e8f797508958161.tar.gz
master-187ad058-71bc9bd7d481f39d28e5d7f13e8f797508958161.tar.bz2
master-187ad058-71bc9bd7d481f39d28e5d7f13e8f797508958161.zip
bcm53xx: respect ACTIVE_LOW when powering USB using GPIO
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46088 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/bcm53xx/patches-3.18/813-USB-bcma-fix-setting-VCC-GPIO-value.patch37
1 files changed, 28 insertions, 9 deletions
diff --git a/target/linux/bcm53xx/patches-3.18/813-USB-bcma-fix-setting-VCC-GPIO-value.patch b/target/linux/bcm53xx/patches-3.18/813-USB-bcma-fix-setting-VCC-GPIO-value.patch
index eb0b767cd3..71777816da 100644
--- a/target/linux/bcm53xx/patches-3.18/813-USB-bcma-fix-setting-VCC-GPIO-value.patch
+++ b/target/linux/bcm53xx/patches-3.18/813-USB-bcma-fix-setting-VCC-GPIO-value.patch
@@ -1,4 +1,4 @@
-From a9e32f77ff74492d79fe2e24f0418136acd8a680 Mon Sep 17 00:00:00 2001
+From bdc3b01d94b22f8b5f9621a1c37336e78f4f1bce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
Date: Sun, 21 Jun 2015 12:09:57 +0200
Subject: [PATCH] USB: bcma: fix setting VCC GPIO value
@@ -6,26 +6,45 @@ MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
-It wasn't working (on most of devices?) without setting GPIO direction.
+It wasn't working (on most of devices?) without setting GPIO direction
+and wasn't respecting ACTIVE_LOW flag.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
- drivers/usb/host/bcma-hcd.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ drivers/usb/host/bcma-hcd.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
-index f7a66b9..b31e3cc 100644
+index 8853ef7..d18ffdc 100644
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
-@@ -238,7 +238,7 @@ static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val)
+@@ -230,17 +230,22 @@ static void bcma_hcd_init_chip_arm(struct bcma_device *dev)
+
+ static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val)
+ {
++ enum of_gpio_flags of_flags;
+ int gpio;
+
+- gpio = of_get_named_gpio(dev->dev.of_node, "vcc-gpio", 0);
++ gpio = of_get_named_gpio_flags(dev->dev.of_node, "vcc-gpio", 0, &of_flags);
+ if (!gpio_is_valid(gpio))
+ return;
if (val) {
- gpio_request(gpio, "bcma-hcd-gpio");
+- gpio_request(gpio, "bcma-hcd-gpio");
- gpio_set_value(gpio, 1);
-+ gpio_direction_output(gpio, 1);
++ unsigned long flags = 0;
++ bool active_low = !!(of_flags & OF_GPIO_ACTIVE_LOW);
++
++ flags |= active_low ? GPIOF_ACTIVE_LOW : 0;
++ flags |= active_low ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH;
++ gpio_request_one(gpio, flags, "bcma-hcd-gpio");
} else {
- gpio_set_value(gpio, 0);
+- gpio_set_value(gpio, 0);
++ gpiod_set_value(gpio_to_desc(gpio), 0);
gpio_free(gpio);
+ }
+ }
--
1.8.4.5