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>
This commit is contained in:
Felix Fietkau 2018-03-09 18:22:18 +01:00
parent 643850f568
commit fa22714181

View 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;
@ -79,25 +79,22 @@
+ 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);
@ -105,11 +102,11 @@
- 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;
@ -117,7 +114,19 @@
- 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,