aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-01-28 07:01:09 +0000
committerRafał Miłecki <zajec5@gmail.com>2016-01-28 07:01:09 +0000
commit80bd8f3d09eb6b29378b0010fae0cdab2f3565dc (patch)
tree886e839e293d5442be2ff3e0bd5ab0d4d810ff9b /target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch
parente9479e62b02b38b5895d6cbb9e2cc530eccf18c4 (diff)
downloadupstream-80bd8f3d09eb6b29378b0010fae0cdab2f3565dc.tar.gz
upstream-80bd8f3d09eb6b29378b0010fae0cdab2f3565dc.tar.bz2
upstream-80bd8f3d09eb6b29378b0010fae0cdab2f3565dc.zip
bcm53xx: use two upstream USB bcma patches
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48517
Diffstat (limited to 'target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch')
-rw-r--r--target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch b/target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch
new file mode 100644
index 0000000000..36ce273e3d
--- /dev/null
+++ b/target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch
@@ -0,0 +1,116 @@
+From adbff3a4f93d8501e8ae11906268e21b086d57ed Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Sat, 5 Dec 2015 13:15:07 +0100
+Subject: [PATCH] USB: bcma: separate code initializing USB 2.0 core
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This splits one big probing function into two smaller ones. The main one
+is now responsible for the generic stuff: allocating memory & enabling
+power using GPIO. The new one contains code that is specific to the USB
+2.0 bcma core.
+This will allow adding support for the USB 3.0 bcma core (handling XHCI)
+in the future.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/bcma-hcd.c | 59 ++++++++++++++++++++++++++++++---------------
+ 1 file changed, 39 insertions(+), 20 deletions(-)
+
+--- a/drivers/usb/host/bcma-hcd.c
++++ b/drivers/usb/host/bcma-hcd.c
+@@ -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;
+ struct gpio_desc *gpio_desc;
+@@ -288,31 +289,16 @@ err_alloc:
+ return ERR_PTR(ret);
+ }
+
+-static int bcma_hcd_probe(struct bcma_device *dev)
++static int bcma_hcd_usb20_init(struct bcma_hcd_device *usb_dev)
+ {
+- int err;
++ struct bcma_device *dev = usb_dev->core;
++ struct bcma_chipinfo *chipinfo = &dev->bus->chipinfo;
+ u32 ohci_addr;
+- struct bcma_hcd_device *usb_dev;
+- struct bcma_chipinfo *chipinfo;
+-
+- chipinfo = &dev->bus->chipinfo;
+-
+- /* TODO: Probably need checks here; is the core connected? */
++ int err;
+
+ if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
+ return -EOPNOTSUPP;
+
+- usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
+- GFP_KERNEL);
+- if (!usb_dev)
+- return -ENOMEM;
+-
+- 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);
+@@ -345,7 +331,6 @@ static int bcma_hcd_probe(struct bcma_de
+ goto err_unregister_ohci_dev;
+ }
+
+- bcma_set_drvdata(dev, usb_dev);
+ return 0;
+
+ err_unregister_ohci_dev:
+@@ -353,6 +338,40 @@ err_unregister_ohci_dev:
+ return err;
+ }
+
++static int bcma_hcd_probe(struct bcma_device *core)
++{
++ int err;
++ struct bcma_hcd_device *usb_dev;
++
++ /* TODO: Probably need checks here; is the core connected? */
++
++ usb_dev = devm_kzalloc(&core->dev, sizeof(struct bcma_hcd_device),
++ GFP_KERNEL);
++ if (!usb_dev)
++ return -ENOMEM;
++ usb_dev->core = core;
++
++ if (core->dev.of_node)
++ usb_dev->gpio_desc = devm_get_gpiod_from_child(&core->dev, "vcc",
++ &core->dev.of_node->fwnode);
++ if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
++ gpiod_direction_output(usb_dev->gpio_desc, 1);
++
++ switch (core->id.id) {
++ case BCMA_CORE_USB20_HOST:
++ case BCMA_CORE_NS_USB20:
++ err = bcma_hcd_usb20_init(usb_dev);
++ if (err)
++ return err;
++ break;
++ default:
++ return -ENODEV;
++ }
++
++ bcma_set_drvdata(core, usb_dev);
++ return 0;
++}
++
+ static void bcma_hcd_remove(struct bcma_device *dev)
+ {
+ struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);