--- zzzz-none-000/linux-3.10.107/drivers/usb/host/xhci-hub.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/drivers/usb/host/xhci-hub.c 2021-11-10 11:53:55.000000000 +0000 @@ -25,6 +25,11 @@ #include "xhci.h" +#if defined(CONFIG_ARCH_IPQ806X_DT) || defined (CONFIG_VR9) +/* 20150211 AVM/WK USB3 ports switchable */ +extern int usb3port_config; +#endif + #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \ PORT_RC | PORT_PLC | PORT_PE) @@ -837,8 +842,25 @@ * However, khubd will ignore the roothub events until * the roothub is registered. */ - xhci_writel(xhci, temp | PORT_POWER, - port_array[wIndex]); + + /* 20150211 AVM/WK USB3 ports switchable */ + temp |= PORT_POWER; + +#if defined(CONFIG_ARCH_IPQ806X_DT) || defined (CONFIG_VR9) + { + +#if defined(CONFIG_ARCH_IPQ806X_DT) + const int port_bit = (hcd->self.busnum < 3)? 1: 2; +#else + const int port_bit = (wIndex == 0)? 1: 2; +#endif + if ((hcd->speed == HCD_USB3) && !(usb3port_config & port_bit) ) { + temp &= ~PORT_POWER; + printk (KERN_INFO "AVM: disable USB3 bus#%d port#%d config=%x\n", hcd->self.busnum, wIndex, usb3port_config); + } + } +#endif + xhci_writel(xhci, temp, port_array[wIndex]); temp = xhci_readl(xhci, port_array[wIndex]); xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp);