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

usb: phy: msm: Handle disconnect events

Put the transceiver in non-driving mode. Otherwise host
may not detect soft-disconnection.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Ivan T. Ivanov and committed by
Felipe Balbi
349907c2 30bf8667

+18
+18
drivers/usb/phy/phy-msm-usb.c
··· 235 235 } 236 236 } 237 237 238 + static int msm_phy_notify_disconnect(struct usb_phy *phy, 239 + enum usb_device_speed speed) 240 + { 241 + int val; 242 + 243 + /* 244 + * Put the transceiver in non-driving mode. Otherwise host 245 + * may not detect soft-disconnection. 246 + */ 247 + val = ulpi_read(phy, ULPI_FUNC_CTRL); 248 + val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; 249 + val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; 250 + ulpi_write(phy, val, ULPI_FUNC_CTRL); 251 + 252 + return 0; 253 + } 254 + 238 255 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) 239 256 { 240 257 int ret; ··· 1643 1626 1644 1627 phy->init = msm_phy_init; 1645 1628 phy->set_power = msm_otg_set_power; 1629 + phy->notify_disconnect = msm_phy_notify_disconnect; 1646 1630 1647 1631 phy->io_ops = &msm_otg_io_ops; 1648 1632