bcm53xx: use two upstream USB bcma patches
authorRafał Miłecki <zajec5@gmail.com>
Thu, 28 Jan 2016 07:01:09 +0000 (07:01 +0000)
committerRafał Miłecki <zajec5@gmail.com>
Thu, 28 Jan 2016 07:01:09 +0000 (07:01 +0000)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 48517

target/linux/bcm53xx/patches-4.4/081-0001-USB-bcma-make-helper-creating-platform-dev-more-gene.patch [new file with mode: 0644]
target/linux/bcm53xx/patches-4.4/081-0002-USB-bcma-separate-code-initializing-USB-2.0-core.patch [new file with mode: 0644]
target/linux/bcm53xx/patches-4.4/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch [deleted file]
target/linux/bcm53xx/patches-4.4/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch [deleted file]
target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch
target/linux/bcm53xx/patches-4.4/810-USB-bcma-use-simpler-devm_gpiod_get.patch

diff --git a/target/linux/bcm53xx/patches-4.4/081-0001-USB-bcma-make-helper-creating-platform-dev-more-gene.patch b/target/linux/bcm53xx/patches-4.4/081-0001-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
new file mode 100644 (file)
index 0000000..320b6dd
--- /dev/null
@@ -0,0 +1,77 @@
+From 352d9e2ee85b43170388599a17cd7b219f270163 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:06 +0100
+Subject: [PATCH] USB: bcma: make helper creating platform dev more generic
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Having "bool ohci" argument in bcma_hcd_create_pdev function limited it
+to support two cases only (OHCI and EHCI) and put too much logic in it.
+Lets make caller pass all required data. This adds few extra arguments
+to the function call but will allow us to reuse this code and handle
+more cases in the future (e.g. add XHCI support).
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/bcma-hcd.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+--- a/drivers/usb/host/bcma-hcd.c
++++ b/drivers/usb/host/bcma-hcd.c
+@@ -244,7 +244,10 @@ static const struct usb_ehci_pdata ehci_
+ static const struct usb_ohci_pdata ohci_pdata = {
+ };
+-static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr)
++static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev,
++                                                  const char *name, u32 addr,
++                                                  const void *data,
++                                                  size_t size)
+ {
+       struct platform_device *hci_dev;
+       struct resource hci_res[2];
+@@ -259,8 +262,7 @@ static struct platform_device *bcma_hcd_
+       hci_res[1].start = dev->irq;
+       hci_res[1].flags = IORESOURCE_IRQ;
+-      hci_dev = platform_device_alloc(ohci ? "ohci-platform" :
+-                                      "ehci-platform" , 0);
++      hci_dev = platform_device_alloc(name, 0);
+       if (!hci_dev)
+               return ERR_PTR(-ENOMEM);
+@@ -271,12 +273,8 @@ static struct platform_device *bcma_hcd_
+                                           ARRAY_SIZE(hci_res));
+       if (ret)
+               goto err_alloc;
+-      if (ohci)
+-              ret = platform_device_add_data(hci_dev, &ohci_pdata,
+-                                             sizeof(ohci_pdata));
+-      else
+-              ret = platform_device_add_data(hci_dev, &ehci_pdata,
+-                                             sizeof(ehci_pdata));
++      if (data)
++              ret = platform_device_add_data(hci_dev, data, size);
+       if (ret)
+               goto err_alloc;
+       ret = platform_device_add(hci_dev);
+@@ -333,11 +331,15 @@ static int bcma_hcd_probe(struct bcma_de
+           && chipinfo->rev == 0)
+               ohci_addr = 0x18009000;
+-      usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr);
++      usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, "ohci-platform",
++                                               ohci_addr, &ohci_pdata,
++                                               sizeof(ohci_pdata));
+       if (IS_ERR(usb_dev->ohci_dev))
+               return PTR_ERR(usb_dev->ohci_dev);
+-      usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr);
++      usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, "ehci-platform",
++                                               dev->addr, &ehci_pdata,
++                                               sizeof(ehci_pdata));
+       if (IS_ERR(usb_dev->ehci_dev)) {
+               err = PTR_ERR(usb_dev->ehci_dev);
+               goto err_unregister_ohci_dev;
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 (file)
index 0000000..36ce273
--- /dev/null
@@ -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);
diff --git a/target/linux/bcm53xx/patches-4.4/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch b/target/linux/bcm53xx/patches-4.4/195-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
deleted file mode 100644 (file)
index 17a9260..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From c7c7bf7fcbacadac7781783de25fe1e13e2a2c35 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Tue, 16 Jun 2015 12:33:46 +0200
-Subject: [PATCH v3 3/6] usb: bcma: make helper creating platform dev more
- generic
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Having "bool ohci" argument bounded us to two cases only and didn't
-allow re-using this code for XHCI.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/usb/host/bcma-hcd.c | 24 +++++++++++++-----------
- 1 file changed, 13 insertions(+), 11 deletions(-)
-
---- a/drivers/usb/host/bcma-hcd.c
-+++ b/drivers/usb/host/bcma-hcd.c
-@@ -244,7 +244,10 @@ static const struct usb_ehci_pdata ehci_
- static const struct usb_ohci_pdata ohci_pdata = {
- };
--static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr)
-+static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev,
-+                                                  const char *name, u32 addr,
-+                                                  const void *data,
-+                                                  size_t size)
- {
-       struct platform_device *hci_dev;
-       struct resource hci_res[2];
-@@ -259,8 +262,7 @@ static struct platform_device *bcma_hcd_
-       hci_res[1].start = dev->irq;
-       hci_res[1].flags = IORESOURCE_IRQ;
--      hci_dev = platform_device_alloc(ohci ? "ohci-platform" :
--                                      "ehci-platform" , 0);
-+      hci_dev = platform_device_alloc(name, 0);
-       if (!hci_dev)
-               return ERR_PTR(-ENOMEM);
-@@ -271,12 +273,8 @@ static struct platform_device *bcma_hcd_
-                                           ARRAY_SIZE(hci_res));
-       if (ret)
-               goto err_alloc;
--      if (ohci)
--              ret = platform_device_add_data(hci_dev, &ohci_pdata,
--                                             sizeof(ohci_pdata));
--      else
--              ret = platform_device_add_data(hci_dev, &ehci_pdata,
--                                             sizeof(ehci_pdata));
-+      if (data)
-+              ret = platform_device_add_data(hci_dev, data, size);
-       if (ret)
-               goto err_alloc;
-       ret = platform_device_add(hci_dev);
-@@ -333,11 +331,15 @@ static int bcma_hcd_probe(struct bcma_de
-           && chipinfo->rev == 0)
-               ohci_addr = 0x18009000;
--      usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr);
-+      usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, "ohci-platform",
-+                                               ohci_addr, &ohci_pdata,
-+                                               sizeof(ohci_pdata));
-       if (IS_ERR(usb_dev->ohci_dev))
-               return PTR_ERR(usb_dev->ohci_dev);
--      usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr);
-+      usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, "ehci-platform",
-+                                               dev->addr, &ehci_pdata,
-+                                               sizeof(ehci_pdata));
-       if (IS_ERR(usb_dev->ehci_dev)) {
-               err = PTR_ERR(usb_dev->ehci_dev);
-               goto err_unregister_ohci_dev;
diff --git a/target/linux/bcm53xx/patches-4.4/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch b/target/linux/bcm53xx/patches-4.4/196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch
deleted file mode 100644 (file)
index 262192b..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-From fa5622c2fadae573dd6b0f5bffe436b230b411f6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Tue, 16 Jun 2015 12:52:07 +0200
-Subject: [PATCH v3 4/6] usb: bcma: use separated function for USB 2.0
- initialization
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This will allow adding USB 3.0 (XHCI) support cleanly.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/usb/host/bcma-hcd.c | 51 +++++++++++++++++++++++++++++++--------------
- 1 file changed, 35 insertions(+), 16 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 *dev)
-+{
-+      int err;
-+      struct bcma_hcd_device *usb_dev;
-+
-+      /* TODO: Probably need checks here; is the core connected? */
-+
-+      usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
-+                             GFP_KERNEL);
-+      if (!usb_dev)
-+              return -ENOMEM;
-+      usb_dev->core = dev;
-+
-+      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:
-+      case BCMA_CORE_NS_USB20:
-+              err = bcma_hcd_usb20_init(usb_dev);
-+              if (err)
-+                      return err;
-+              break;
-+      default:
-+              return -ENODEV;
-+      }
-+
-+      bcma_set_drvdata(dev, usb_dev);
-+      return 0;
-+}
-+
- static void bcma_hcd_remove(struct bcma_device *dev)
- {
-       struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);
index 34ab858..9c0e696 100644 (file)
@@ -255,7 +255,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      return 0;
 +}
 +
- static int bcma_hcd_probe(struct bcma_device *dev)
+ static int bcma_hcd_probe(struct bcma_device *core)
  {
        int err;
 @@ -364,6 +580,11 @@ static int bcma_hcd_probe(struct bcma_de
index ec6ef9e..fd2e38a 100644 (file)
@@ -13,11 +13,11 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 --- a/drivers/usb/host/bcma-hcd.c
 +++ b/drivers/usb/host/bcma-hcd.c
 @@ -568,8 +568,7 @@ static int bcma_hcd_probe(struct bcma_de
-       usb_dev->core = dev;
+       usb_dev->core = core;
  
-       if (dev->dev.of_node)
--              usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
--                                                             &dev->dev.of_node->fwnode);
+       if (core->dev.of_node)
+-              usb_dev->gpio_desc = devm_get_gpiod_from_child(&core->dev, "vcc",
+-                                                             &core->dev.of_node->fwnode);
 +              usb_dev->gpio_desc = devm_gpiod_get(&dev->dev, "vcc", 0);
        if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
                gpiod_direction_output(usb_dev->gpio_desc, 1);