--- zzzz-none-000/linux-4.4.271/drivers/usb/host/xhci-hub.c 2021-06-03 06:22:09.000000000 +0000 +++ dakota-7530ac-750/linux-4.4.271/drivers/usb/host/xhci-hub.c 2023-01-11 09:25:42.000000000 +0000 @@ -27,6 +27,11 @@ #include "xhci.h" #include "xhci-trace.h" +#if defined (CONFIG_AVM_KERNEL) +/* 20160219 AVM/VGJ 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) @@ -1099,8 +1104,21 @@ * However, hub_wq will ignore the roothub events until * the roothub is registered. */ - writel(temp | PORT_POWER, port_array[wIndex]); +#if defined (CONFIG_AVM_KERNEL) + { + /* 20170811 AVM/VGJ USB3 ports switchable */ + const int port_bit = (hcd->self.busnum < 3)? 1: 2; + temp |= PORT_POWER; + 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); + } + writel(temp, port_array[wIndex]); + } +#else + writel(temp | PORT_POWER, port_array[wIndex]); +#endif temp = readl(port_array[wIndex]); xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp);