bcm53xx: support USB 2.0 controller on BCM53573
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.4 / 197-USB-bcma-add-USB-3.0-support.patch
index 8bc898dc0f480905f9bb6a26c93548203ea7e04c..c7b65867d88cdaf3f300b836a5cf2d94cb5d277b 100644 (file)
@@ -14,15 +14,15 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/usb/host/bcma-hcd.c
 +++ b/drivers/usb/host/bcma-hcd.c
-@@ -29,6 +29,7 @@
- #include <linux/of_gpio.h>
+@@ -30,6 +30,7 @@
+ #include <linux/of_platform.h>
  #include <linux/usb/ehci_pdriver.h>
  #include <linux/usb/ohci_pdriver.h>
 +#include <linux/usb/xhci_pdriver.h>
  
  MODULE_AUTHOR("Hauke Mehrtens");
  MODULE_DESCRIPTION("Common USB driver for BCMA Bus");
-@@ -38,6 +39,7 @@ struct bcma_hcd_device {
+@@ -42,6 +43,7 @@ struct bcma_hcd_device {
        struct bcma_device *core;
        struct platform_device *ehci_dev;
        struct platform_device *ohci_dev;
@@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        struct gpio_desc *gpio_desc;
  };
  
-@@ -245,6 +247,10 @@ static const struct usb_ehci_pdata ehci_
+@@ -319,6 +321,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,
-@@ -338,6 +344,165 @@ err_unregister_ohci_dev:
+@@ -412,6 +418,150 @@ err_unregister_ohci_dev:
        return err;
  }
  
@@ -75,6 +75,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      u32 cru_straps_ctrl;
 +
 +      if (chipinfo->id != BCMA_CHIP_ID_BCM4707 &&
++          chipinfo->id != BCMA_CHIP_ID_BCM47094 &&
 +          chipinfo->id != BCMA_CHIP_ID_BCM53018)
 +              return;
 +
@@ -99,7 +100,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      udelay(2);
 +
 +      if (chipinfo->id == BCMA_CHIP_ID_BCM53018 ||
-+          chipinfo->id == BCMA_CHIP_ID_BCM4707 && chipinfo->rev == 4) {
++          (chipinfo->id == BCMA_CHIP_ID_BCM4707 && (chipinfo->rev == 4 || chipinfo->rev == 6)) ||
++          chipinfo->id == BCMA_CHIP_ID_BCM47094) {
 +                      /* For NS-B0, USB3 PLL Block */
 +                      bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000);
 +                      iowrite32(0x587e8000, ccb->mii + 0x004);
@@ -187,12 +189,13 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +              iounmap(dmu);
 +}
 +
-+static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd)
-+{
-+      struct bcma_device *core = bcma_hcd->core;
-+
-+      bcma_core_enable(core, 0);
-+
+ static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd)
+ {
+       struct bcma_device *core = bcma_hcd->core;
+@@ -419,6 +569,14 @@ static int bcma_hcd_usb30_init(struct bc
+       bcma_core_enable(core, 0);
 +      bcma_hcd_usb30_phy_init(bcma_hcd);
 +
 +      bcma_hcd->xhci_dev = bcma_hcd_create_pdev(core, "xhci-hcd", core->addr,
@@ -201,25 +204,10 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      if (IS_ERR(bcma_hcd->ohci_dev))
 +              return PTR_ERR(bcma_hcd->ohci_dev);
 +
-+      return 0;
-+}
-+
- static int bcma_hcd_probe(struct bcma_device *core)
- {
-       int err;
-@@ -364,6 +529,11 @@ static int bcma_hcd_probe(struct bcma_de
-               if (err)
-                       return err;
-               break;
-+      case BCMA_CORE_NS_USB30:
-+              err = bcma_hcd_usb30_init(usb_dev);
-+              if (err)
-+                      return err;
-+              break;
-       default:
-               return -ENODEV;
-       }
-@@ -377,11 +547,14 @@ static void bcma_hcd_remove(struct bcma_
+       of_platform_default_populate(dev->of_node, NULL, dev);
+       return 0;
+@@ -471,11 +629,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;
@@ -234,11 +222,3 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  
        bcma_core_disable(dev, 0);
  }
-@@ -418,6 +591,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),
-+      BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB30, BCMA_ANY_REV, BCMA_ANY_CLASS),
-       {},
- };
- MODULE_DEVICE_TABLE(bcma, bcma_hcd_table);