diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi index 72bc2a6..cb887a4 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi @@ -67,6 +67,22 @@ sda-gpios = <&gpio 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; scl-gpios = <&gpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + }; + +}; + +&gpio { + status = "okay"; }; &pcie0 { diff --git a/target/linux/ath79/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi index f127d4d..2512100 100644 --- a/target/linux/ath79/dts/qca953x.dtsi +++ b/target/linux/ath79/dts/qca953x.dtsi @@ -192,6 +192,10 @@ dr_mode = "host"; has-transaction-translator; + qca-force_host-mode; + qca-force-16bit-ptw; + qca-force-reset; + caps-offset = <0x100>; phy-names = "usb-phy"; diff --git a/target/linux/ath79/patches-4.19/999-fix-ath79-usb.patch b/target/linux/ath79/patches-4.19/999-fix-ath79-usb.patch new file mode 100644 index 0000000..b39c381 --- /dev/null +++ b/target/linux/ath79/patches-4.19/999-fix-ath79-usb.patch @@ -0,0 +1,76 @@ +--- linux-4.19.82/drivers/usb/host/ehci-hcd.c 2020-07-10 10:13:56.175458269 +0100 ++++ linux-4.19.82/drivers/usb/host/ehci-hcd.c 2020-07-10 10:28:38.829819627 +0100 +@@ -36,6 +36,9 @@ + #include + #endif + ++#include ++#include ++ + /*-------------------------------------------------------------------------*/ + + /* +@@ -231,6 +234,20 @@ + int retval; + u32 command = ehci_readl(ehci, &ehci->regs->command); + ++ if (ehci->qca_force_reset) { ++ ath79_device_reset_set(QCA953X_RESET_USBSUS_OVERRIDE); ++ udelay(1000); ++ ++ ath79_device_reset_clear(QCA953X_RESET_USB_PHY); ++ udelay(1000); ++ ++ ath79_device_reset_clear(QCA953X_RESET_USB_PHY_ANALOG); ++ udelay(1000); ++ ++ ath79_device_reset_clear(QCA953X_RESET_USB_HOST); ++ udelay(1000); ++ } ++ + /* If the EHCI debug controller is active, special care must be + * taken before and after a host controller reset */ + if (ehci->debug && !dbgp_reset_prep(ehci_to_hcd(ehci))) +@@ -694,6 +711,11 @@ + dbg_hcs_params(ehci, "reset"); + dbg_hcc_params(ehci, "reset"); + ++ printk(KERN_ERR "ehci_setup qca_force_host_mode=%d qca_force_16bit_ptw=%d qca_force_reset=%d\n", ++ ehci->qca_force_host_mode, ++ ehci->qca_force_16bit_ptw, ++ ehci->qca_force_reset); ++ + /* cache this readonly data; minimize chip reads */ + ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); + +--- linux-4.19.82/drivers/usb/host/ehci.h 2020-07-10 10:15:05.887961383 +0100 ++++ linux-4.19.82/drivers/usb/host/ehci.h 2020-07-10 10:15:26.068106999 +0100 +@@ -221,6 +221,7 @@ + unsigned ignore_oc:1; + unsigned qca_force_host_mode:1; + unsigned qca_force_16bit_ptw:1; /* force 16 bit UTMI */ ++ unsigned qca_force_reset:1; + + void (*reset_notifier)(struct usb_hcd *hcd); + +--- linux-4.19.82/drivers/usb/host/ehci-platform.c 2020-07-10 10:09:35.940579028 +0100 ++++ linux-4.19.82/drivers/usb/host/ehci-platform.c 2020-07-10 10:20:20.399229667 +0100 +@@ -191,6 +194,18 @@ + "has-transaction-translator")) + hcd->has_tt = 1; + ++ if (of_property_read_bool(dev->dev.of_node, ++ "qca-force_host-mode")) ++ ehci->qca_force_host_mode = 1; ++ ++ if (of_property_read_bool(dev->dev.of_node, ++ "qca-force-16bit-ptw")) ++ ehci->qca_force_16bit_ptw = 1; ++ ++ if (of_property_read_bool(dev->dev.of_node, ++ "qca-force-reset")) ++ ehci->qca_force_reset = 1; ++ + for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { + priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); + if (IS_ERR(priv->clks[clk])) {