--- zzzz-none-000/linux-4.9.279/drivers/usb/host/xhci-hub.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/drivers/usb/host/xhci-hub.c 2023-02-08 11:43: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) @@ -1123,7 +1128,22 @@ * However, hub_wq will ignore the roothub events until * the roothub is registered. */ +#if defined (CONFIG_AVM_KERNEL) + { + /* 20170911 AVM/VGJ USB3 ports switchable - only ports 2 and 3 are relevant */ + const int port_bit = (wIndex < 3) ? wIndex : 0; + temp |= PORT_POWER; + /* 20180719 AVM/VGJ make sure selected USB3 ports are enabled */ + if ((hcd->speed == HCD_USB3) && (usb3port_config & port_bit)) { + xhci_warn(xhci, "AVM: enable USB3 bus#%d port#%d config=%x temp=%x\n", hcd->self.busnum, wIndex, usb3port_config, temp); + xhci_set_link_state(xhci, port_array, wIndex, USB_SS_PORT_LS_RX_DETECT); + } + + 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);