--- zzzz-none-000/linux-5.4.213/drivers/usb/host/xhci-hub.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/drivers/usb/host/xhci-hub.c 2024-05-29 11:20:02.000000000 +0000 @@ -15,6 +15,11 @@ #include "xhci.h" #include "xhci-trace.h" +#if defined(CONFIG_AVM_ENHANCED) +/* 20239421 AVM/WKR 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) @@ -1383,7 +1388,22 @@ * However, hub_wq will ignore the roothub events until * the roothub is registered. */ +#if defined(CONFIG_AVM_ENHANCED) + { + /* 20239421 AVM/WKR USB3 ports switchable */ + const int port_bit = (hcd->self.busnum < 3) ? 1 : 2; + + if ((hcd->speed == HCD_USB3) && !(usb3port_config & port_bit)) { + xhci_info(xhci, "AVM: disable USB3 bus#%d port#%d config=%x\n", + hcd->self.busnum, wIndex, usb3port_config); + xhci_set_port_power(xhci, hcd, wIndex, false, &flags); + } else { + xhci_set_port_power(xhci, hcd, wIndex, true, &flags); + } + } +#else xhci_set_port_power(xhci, hcd, wIndex, true, &flags); +#endif break; case USB_PORT_FEAT_RESET: temp = (temp | PORT_RESET);