ar71xx: fix double registration of usb host mode devices, add usb client support for qca955x

Only register the chipidea usb device if the strapping option indicates
device mode. If not, use the regular ehci platform driver.

Add qca955x device mode support, tested on 8devices Rambutan.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
master
Felix Fietkau 7 years ago
parent 643850f568
commit fa22714181
  1. 43
      target/linux/ar71xx/patches-4.9/920-usb-chipidea-AR933x-platform-support.patch

@ -29,7 +29,7 @@
#include <asm/mach-ath79/ath79.h> #include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.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)); &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
} }
@ -46,7 +46,7 @@
+ iounmap(usb_ctrl_base); + 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; + struct ci_hdrc_platform_data ci_pdata;
+ enum usb_dr_mode dr_mode; + enum usb_dr_mode dr_mode;
@ -79,25 +79,22 @@
+ platform_device_register_simple("usb_phy_generic", + platform_device_register_simple("usb_phy_generic",
+ PLATFORM_DEVID_AUTO, NULL, 0); + 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) + if (!host_mode)
+ return; + ath79_usb_register("ci_hdrc", -1,
+ + AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
+ ath79_usb_register("ehci-platform", -1, + irq, &ci_pdata, sizeof(ci_pdata));
+ AR934X_EHCI_BASE, AR934X_EHCI_SIZE, + else
+ ATH79_CPU_IRQ(3), + ath79_usb_register("ehci-platform", -1,
+ &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); + AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
+ irq, &ath79_ehci_pdata_v2,
+ sizeof(ath79_ehci_pdata_v2));
+ +
+} +}
+ +
static void __init ar933x_usb_setup(void) static void __init ar933x_usb_setup(void)
{ {
ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE); 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); ath79_device_reset_clear(AR933X_RESET_USB_PHY);
mdelay(10); mdelay(10);
@ -105,11 +102,11 @@
- AR933X_EHCI_BASE, AR933X_EHCI_SIZE, - AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
- ATH79_CPU_IRQ(3), - ATH79_CPU_IRQ(3),
- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - &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) 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) if (ath79_soc_rev >= 3)
ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier; ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
@ -117,7 +114,19 @@
- AR934X_EHCI_BASE, AR934X_EHCI_SIZE, - AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
- ATH79_CPU_IRQ(3), - ATH79_CPU_IRQ(3),
- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - &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) 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,

Loading…
Cancel
Save