aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-4.3
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm53xx/patches-4.3')
-rw-r--r--target/linux/bcm53xx/patches-4.3/186-USB-bcma-switch-to-GPIO-descriptor-for-power-control.patch75
-rw-r--r--target/linux/bcm53xx/patches-4.3/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch8
-rw-r--r--target/linux/bcm53xx/patches-4.3/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch22
-rw-r--r--target/linux/bcm53xx/patches-4.3/197-USB-bcma-add-USB-3.0-support.patch16
-rw-r--r--target/linux/bcm53xx/patches-4.3/198-USB-bcma-fix-setting-VCC-GPIO-value.patch54
5 files changed, 102 insertions, 73 deletions
diff --git a/target/linux/bcm53xx/patches-4.3/186-USB-bcma-switch-to-GPIO-descriptor-for-power-control.patch b/target/linux/bcm53xx/patches-4.3/186-USB-bcma-switch-to-GPIO-descriptor-for-power-control.patch
new file mode 100644
index 0000000000..5031886f00
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.3/186-USB-bcma-switch-to-GPIO-descriptor-for-power-control.patch
@@ -0,0 +1,75 @@
+From 0cb136f9882e4649ad6160bb7b48955ff728888c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Sun, 1 Nov 2015 08:17:21 +0100
+Subject: [PATCH V2] USB: bcma: switch to GPIO descriptor for power control
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So far we were using simple (legacy) GPIO functions & some poor logic to
+control power. It got many drawbacks: we were ignoring OF flags
+(GPIO_ACTIVE_LOW), we were not setting direction to output and we were
+assuming gpio_request success all the time.
+Fix it by switching to gpiod functions and adding appropriate checks.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+---
+ drivers/usb/host/bcma-hcd.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
+index 5398e3d..291aaa2 100644
+--- a/drivers/usb/host/bcma-hcd.c
++++ b/drivers/usb/host/bcma-hcd.c
+@@ -21,6 +21,7 @@
+ */
+ #include <linux/bcma/bcma.h>
+ #include <linux/delay.h>
++#include <linux/gpio/consumer.h>
+ #include <linux/platform_device.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+@@ -36,6 +37,7 @@ MODULE_LICENSE("GPL");
+ struct bcma_hcd_device {
+ struct platform_device *ehci_dev;
+ struct platform_device *ohci_dev;
++ struct gpio_desc *gpio_desc;
+ };
+
+ /* Wait for bitmask in a register to get set or cleared.
+@@ -228,19 +230,12 @@ static void bcma_hcd_init_chip_arm(struct bcma_device *dev)
+
+ static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val)
+ {
+- int gpio;
++ struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);
+
+- gpio = of_get_named_gpio(dev->dev.of_node, "vcc-gpio", 0);
+- if (!gpio_is_valid(gpio))
++ if (IS_ERR_OR_NULL(usb_dev->gpio_desc))
+ return;
+
+- if (val) {
+- gpio_request(gpio, "bcma-hcd-gpio");
+- gpio_set_value(gpio, 1);
+- } else {
+- gpio_set_value(gpio, 0);
+- gpio_free(gpio);
+- }
++ gpiod_set_value(usb_dev->gpio_desc, val);
+ }
+
+ static const struct usb_ehci_pdata ehci_pdata = {
+@@ -314,7 +309,11 @@ static int bcma_hcd_probe(struct bcma_device *dev)
+ if (!usb_dev)
+ return -ENOMEM;
+
+- bcma_hci_platform_power_gpio(dev, true);
++ if (dev->dev.of_node)
++ usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
++ &dev->dev.of_node->fwnode);
++ if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
++ gpiod_direction_output(usb_dev->gpio_desc, 1);
+
+ switch (dev->id.id) {
+ case BCMA_CORE_NS_USB20:
diff --git a/target/linux/bcm53xx/patches-4.3/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch b/target/linux/bcm53xx/patches-4.3/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
index 1e28857655..17a9260d80 100644
--- a/target/linux/bcm53xx/patches-4.3/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
+++ b/target/linux/bcm53xx/patches-4.3/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
@@ -18,7 +18,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
-@@ -249,7 +249,10 @@ static const struct usb_ehci_pdata ehci_
+@@ -244,7 +244,10 @@ static const struct usb_ehci_pdata ehci_
static const struct usb_ohci_pdata ohci_pdata = {
};
@@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
{
struct platform_device *hci_dev;
struct resource hci_res[2];
-@@ -264,8 +267,7 @@ static struct platform_device *bcma_hcd_
+@@ -259,8 +262,7 @@ static struct platform_device *bcma_hcd_
hci_res[1].start = dev->irq;
hci_res[1].flags = IORESOURCE_IRQ;
@@ -40,7 +40,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
if (!hci_dev)
return ERR_PTR(-ENOMEM);
-@@ -276,12 +278,8 @@ static struct platform_device *bcma_hcd_
+@@ -271,12 +273,8 @@ static struct platform_device *bcma_hcd_
ARRAY_SIZE(hci_res));
if (ret)
goto err_alloc;
@@ -55,7 +55,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
if (ret)
goto err_alloc;
ret = platform_device_add(hci_dev);
-@@ -334,11 +332,15 @@ static int bcma_hcd_probe(struct bcma_de
+@@ -333,11 +331,15 @@ static int bcma_hcd_probe(struct bcma_de
&& chipinfo->rev == 0)
ohci_addr = 0x18009000;
diff --git a/target/linux/bcm53xx/patches-4.3/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch b/target/linux/bcm53xx/patches-4.3/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch
index d636e86046..262192b7bf 100644
--- a/target/linux/bcm53xx/patches-4.3/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch
+++ b/target/linux/bcm53xx/patches-4.3/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch
@@ -17,15 +17,15 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
-@@ -34,6 +34,7 @@ MODULE_DESCRIPTION("Common USB driver fo
+@@ -35,6 +35,7 @@ MODULE_DESCRIPTION("Common USB driver fo
MODULE_LICENSE("GPL");
struct bcma_hcd_device {
+ struct bcma_device *core;
struct platform_device *ehci_dev;
struct platform_device *ohci_dev;
- };
-@@ -293,27 +294,16 @@ err_alloc:
+ struct gpio_desc *gpio_desc;
+@@ -288,31 +289,16 @@ err_alloc:
return ERR_PTR(ret);
}
@@ -52,12 +52,16 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
- if (!usb_dev)
- return -ENOMEM;
-
-- bcma_hci_platform_power_gpio(dev, true);
+- if (dev->dev.of_node)
+- usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
+- &dev->dev.of_node->fwnode);
+- if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
+- gpiod_direction_output(usb_dev->gpio_desc, 1);
-
switch (dev->id.id) {
case BCMA_CORE_NS_USB20:
bcma_hcd_init_chip_arm(dev);
-@@ -346,7 +336,6 @@ static int bcma_hcd_probe(struct bcma_de
+@@ -345,7 +331,6 @@ static int bcma_hcd_probe(struct bcma_de
goto err_unregister_ohci_dev;
}
@@ -65,7 +69,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
return 0;
err_unregister_ohci_dev:
-@@ -354,6 +343,36 @@ err_unregister_ohci_dev:
+@@ -353,6 +338,40 @@ err_unregister_ohci_dev:
return err;
}
@@ -82,7 +86,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ return -ENOMEM;
+ usb_dev->core = dev;
+
-+ bcma_hci_platform_power_gpio(dev, true);
++ if (dev->dev.of_node)
++ usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
++ &dev->dev.of_node->fwnode);
++ if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
++ gpiod_direction_output(usb_dev->gpio_desc, 1);
+
+ switch (dev->id.id) {
+ case BCMA_CORE_USB20_HOST:
diff --git a/target/linux/bcm53xx/patches-4.3/197-USB-bcma-add-USB-3.0-support.patch b/target/linux/bcm53xx/patches-4.3/197-USB-bcma-add-USB-3.0-support.patch
index f477a1b65d..34ab858b4d 100644
--- a/target/linux/bcm53xx/patches-4.3/197-USB-bcma-add-USB-3.0-support.patch
+++ b/target/linux/bcm53xx/patches-4.3/197-USB-bcma-add-USB-3.0-support.patch
@@ -14,7 +14,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
-@@ -28,6 +28,7 @@
+@@ -29,6 +29,7 @@
#include <linux/of_gpio.h>
#include <linux/usb/ehci_pdriver.h>
#include <linux/usb/ohci_pdriver.h>
@@ -22,15 +22,15 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
MODULE_AUTHOR("Hauke Mehrtens");
MODULE_DESCRIPTION("Common USB driver for BCMA Bus");
-@@ -37,6 +38,7 @@ struct bcma_hcd_device {
+@@ -38,6 +39,7 @@ struct bcma_hcd_device {
struct bcma_device *core;
struct platform_device *ehci_dev;
struct platform_device *ohci_dev;
+ struct platform_device *xhci_dev;
+ struct gpio_desc *gpio_desc;
};
- /* Wait for bitmask in a register to get set or cleared.
-@@ -250,6 +252,10 @@ static const struct usb_ehci_pdata ehci_
+@@ -245,6 +247,10 @@ static const struct usb_ehci_pdata ehci_
static const struct usb_ohci_pdata ohci_pdata = {
};
@@ -41,7 +41,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev,
const char *name, u32 addr,
const void *data,
-@@ -343,6 +349,216 @@ err_unregister_ohci_dev:
+@@ -338,6 +344,216 @@ err_unregister_ohci_dev:
return err;
}
@@ -258,7 +258,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
static int bcma_hcd_probe(struct bcma_device *dev)
{
int err;
-@@ -365,6 +581,11 @@ static int bcma_hcd_probe(struct bcma_de
+@@ -364,6 +580,11 @@ static int bcma_hcd_probe(struct bcma_de
if (err)
return err;
break;
@@ -270,7 +270,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
default:
return -ENODEV;
}
-@@ -378,11 +599,14 @@ static void bcma_hcd_remove(struct bcma_
+@@ -377,11 +598,14 @@ static void bcma_hcd_remove(struct bcma_
struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);
struct platform_device *ohci_dev = usb_dev->ohci_dev;
struct platform_device *ehci_dev = usb_dev->ehci_dev;
@@ -285,7 +285,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
bcma_core_disable(dev, 0);
}
-@@ -419,6 +643,7 @@ static int bcma_hcd_resume(struct bcma_d
+@@ -418,6 +642,7 @@ static int bcma_hcd_resume(struct bcma_d
static const struct bcma_device_id bcma_hcd_table[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS),
diff --git a/target/linux/bcm53xx/patches-4.3/198-USB-bcma-fix-setting-VCC-GPIO-value.patch b/target/linux/bcm53xx/patches-4.3/198-USB-bcma-fix-setting-VCC-GPIO-value.patch
deleted file mode 100644
index 75932937c0..0000000000
--- a/target/linux/bcm53xx/patches-4.3/198-USB-bcma-fix-setting-VCC-GPIO-value.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 7572673e06393b117f87b20b82be0518634d7042 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 v3 6/6] usb: bcma: fix setting VCC GPIO value
-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
-and wasn't respecting ACTIVE_LOW flag.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/usb/host/bcma-hcd.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
---- a/drivers/usb/host/bcma-hcd.c
-+++ b/drivers/usb/host/bcma-hcd.c
-@@ -26,6 +26,7 @@
- #include <linux/slab.h>
- #include <linux/of.h>
- #include <linux/of_gpio.h>
-+#include <linux/gpio/consumer.h>
- #include <linux/usb/ehci_pdriver.h>
- #include <linux/usb/ohci_pdriver.h>
- #include <linux/usb/xhci_pdriver.h>
-@@ -231,17 +232,22 @@ static void bcma_hcd_init_chip_arm(struc
-
- 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_set_value(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);
-+ gpiod_set_value(gpio_to_desc(gpio), 0);
- gpio_free(gpio);
- }
- }