Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: usb: disable COMMONONN for dual mode

The COMMONONN bit suspends the phy when the port is put into a suspend
state. However when the phy is shared between host and device in dual
mode, this no longer works cleanly as there is no synchronization between
the two.

Fixes: 5095d045a962 ("phy: usb: Turn off phy when port is in suspend")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20241010185344.859865-1-justin.chen@broadcom.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Justin Chen and committed by
Vinod Koul
1e48fd05 2d0f973b

+9 -3
+9 -3
drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
··· 153 153 } else { 154 154 USB_CTRL_SET(ctrl, USB_PM, XHC_SOFT_RESETB); 155 155 /* Required for COMMONONN to be set */ 156 - USB_XHCI_GBL_UNSET(xhci_gbl, GUSB2PHYCFG, U2_FREECLK_EXISTS); 156 + if (params->supported_port_modes != USB_CTLR_MODE_DRD) 157 + USB_XHCI_GBL_UNSET(xhci_gbl, GUSB2PHYCFG, 158 + U2_FREECLK_EXISTS); 157 159 } 158 160 } 159 161 ··· 330 328 /* 1 millisecond - for USB clocks to settle down */ 331 329 usleep_range(1000, 2000); 332 330 333 - /* Disable PHY when port is suspended */ 334 - USB_CTRL_SET(ctrl, P0_U2PHY_CFG1, COMMONONN); 331 + /* 332 + * Disable PHY when port is suspended 333 + * Does not work in DRD mode 334 + */ 335 + if (params->supported_port_modes != USB_CTLR_MODE_DRD) 336 + USB_CTRL_SET(ctrl, P0_U2PHY_CFG1, COMMONONN); 335 337 336 338 usb_wake_enable_7216(params, false); 337 339 usb_init_common(params);