--- zzzz-none-000/linux-4.1.52/drivers/usb/host/xhci-hub.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/drivers/usb/host/xhci-hub.c 2022-03-02 11:37:13.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) @@ -968,8 +973,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) + { + /* 20170316 AVM/VGJ USB3 ports switchable */ + const int port_bit = (wIndex == 0)? 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); @@ -1150,6 +1168,13 @@ break; } if ((temp & mask) != 0 || +#ifdef CONFIG_BCM_KF_USB_HOSTS + /* when in compliance mode no change events are generated + * this check is needed for compliance mode quirk to bring + * port out of compliance mode + */ + ((temp & PORT_PLS_MASK) == USB_SS_PORT_LS_COMP_MOD) || +#endif (bus_state->port_c_suspend & 1 << i) || (bus_state->resume_done[i] && time_after_eq( jiffies, bus_state->resume_done[i]))) { @@ -1167,7 +1192,7 @@ return status ? retval : 0; } -#ifdef CONFIG_PM +#if defined(CONFIG_PM) int xhci_bus_suspend(struct usb_hcd *hcd) {