From fa22714181de40648d9680f6d5d9d4f03547ccc1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 9 Mar 2018 18:22:18 +0100 Subject: [PATCH] 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 --- ...usb-chipidea-AR933x-platform-support.patch | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/target/linux/ar71xx/patches-4.9/920-usb-chipidea-AR933x-platform-support.patch b/target/linux/ar71xx/patches-4.9/920-usb-chipidea-AR933x-platform-support.patch index 740ffec4ac9..fc6a088932a 100644 --- a/target/linux/ar71xx/patches-4.9/920-usb-chipidea-AR933x-platform-support.patch +++ b/target/linux/ar71xx/patches-4.9/920-usb-chipidea-AR933x-platform-support.patch @@ -29,7 +29,7 @@ #include #include -@@ -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, -- 2.30.2