ar71xx: fix double registration of usb host mode devices, add usb client support...
[openwrt/staging/hauke.git] / target / linux / ar71xx / patches-4.9 / 920-usb-chipidea-AR933x-platform-support.patch
index 740ffec4ac96ddd9be74e005ba2101b5eaa13969..fc6a088932a1995a076e2c23dd0b74b4db6d7862 100644 (file)
@@ -29,7 +29,7 @@
  
  #include <asm/mach-ath79/ath79.h>
  #include <asm/mach-ath79/ar71xx_regs.h>
-@@ -170,6 +173,67 @@ static void __init ar913x_usb_setup(void
+@@ -170,6 +173,64 @@ static void __init ar913x_usb_setup(void
                           &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  }
  
@@ -46,7 +46,7 @@
 +      iounmap(usb_ctrl_base);
 +}
 +
-+static void __init ar9xxx_ci_usb_setup(void)
++static void __init ar9xxx_ci_usb_setup(int irq)
 +{
 +      struct ci_hdrc_platform_data ci_pdata;
 +      enum usb_dr_mode dr_mode;
 +      platform_device_register_simple("usb_phy_generic",
 +                                      PLATFORM_DEVID_AUTO, NULL, 0);
 +
-+      ath79_usb_register("ci_hdrc", -1,
-+                         AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
-+                         ATH79_CPU_IRQ(3),
-+                         &ci_pdata, sizeof(ci_pdata));
-+
 +      if (!host_mode)
-+              return;
-+
-+      ath79_usb_register("ehci-platform", -1,
-+                         AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
-+                         ATH79_CPU_IRQ(3),
-+                         &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
++              ath79_usb_register("ci_hdrc", -1,
++                                 AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
++                                 irq, &ci_pdata, sizeof(ci_pdata));
++      else
++              ath79_usb_register("ehci-platform", -1,
++                                 AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
++                                 irq, &ath79_ehci_pdata_v2,
++                                 sizeof(ath79_ehci_pdata_v2));
 +
 +}
 +
  static void __init ar933x_usb_setup(void)
  {
        ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
-@@ -181,10 +245,7 @@ static void __init ar933x_usb_setup(void
+@@ -181,10 +242,7 @@ static void __init ar933x_usb_setup(void
        ath79_device_reset_clear(AR933X_RESET_USB_PHY);
        mdelay(10);
  
 -                         AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
 -                         ATH79_CPU_IRQ(3),
 -                         &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
-+      ar9xxx_ci_usb_setup();
++      ar9xxx_ci_usb_setup(ATH79_CPU_IRQ(3));
  }
  
  static void enable_tx_tx_idp_violation_fix(unsigned base)
-@@ -230,10 +291,7 @@ static void __init ar934x_usb_setup(void
+@@ -230,10 +288,7 @@ static void __init ar934x_usb_setup(void
        if (ath79_soc_rev >= 3)
                ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
  
 -                         AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
 -                         ATH79_CPU_IRQ(3),
 -                         &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
-+      ar9xxx_ci_usb_setup();
++      ar9xxx_ci_usb_setup(ATH79_CPU_IRQ(3));
  }
  
  static void __init qca953x_usb_setup(void)
+@@ -285,10 +340,7 @@ static void __init qca955x_usb_setup(voi
+ {
+       ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier;
+-      ath79_usb_register("ehci-platform", 0,
+-                         QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
+-                         ATH79_IP3_IRQ(0),
+-                         &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
++      ar9xxx_ci_usb_setup(ATH79_IP3_IRQ(0));
+       ath79_usb_register("ehci-platform", 1,
+                          QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE,