Skip to content

Commit f0cf0a8

Browse files
Yixun Lanvinodkoul
authored andcommitted
phy: k1-usb: add disconnect function support
A disconnect status BIT of USB2 PHY need to be cleared, otherwise it will fail to work properly during next connection when devices connect to roothub directly. Fixes: fe4bc1a ("phy: spacemit: support K1 USB2.0 PHY controller") Signed-off-by: Yixun Lan <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent a258d84 commit f0cf0a8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/phy/spacemit/phy-k1-usb2.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
#define PHY_CLK_HSTXP_EN BIT(3) /* clock hstxp enable */
4949
#define PHY_HSTXP_MODE BIT(4) /* 0: force en_txp to be 1; 1: no force */
5050

51+
#define PHY_K1_HS_HOST_DISC 0x40
52+
#define PHY_K1_HS_HOST_DISC_CLR BIT(0)
53+
5154
#define PHY_PLL_DIV_CFG 0x98
5255
#define PHY_FDIV_FRACT_8_15 GENMASK(7, 0)
5356
#define PHY_FDIV_FRACT_16_19 GENMASK(11, 8)
@@ -142,9 +145,20 @@ static int spacemit_usb2phy_exit(struct phy *phy)
142145
return 0;
143146
}
144147

148+
static int spacemit_usb2phy_disconnect(struct phy *phy, int port)
149+
{
150+
struct spacemit_usb2phy *sphy = phy_get_drvdata(phy);
151+
152+
regmap_update_bits(sphy->regmap_base, PHY_K1_HS_HOST_DISC,
153+
PHY_K1_HS_HOST_DISC_CLR, PHY_K1_HS_HOST_DISC_CLR);
154+
155+
return 0;
156+
}
157+
145158
static const struct phy_ops spacemit_usb2phy_ops = {
146159
.init = spacemit_usb2phy_init,
147160
.exit = spacemit_usb2phy_exit,
161+
.disconnect = spacemit_usb2phy_disconnect,
148162
.owner = THIS_MODULE,
149163
};
150164

0 commit comments

Comments
 (0)