]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
phy: k1-usb: add disconnect function support
authorYixun Lan <dlan@kernel.org>
Mon, 16 Feb 2026 15:26:53 +0000 (23:26 +0800)
committerVinod Koul <vkoul@kernel.org>
Fri, 27 Feb 2026 14:57:00 +0000 (20:27 +0530)
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: fe4bc1a08638 ("phy: spacemit: support K1 USB2.0 PHY controller")
Signed-off-by: Yixun Lan <dlan@kernel.org>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://patch.msgid.link/20260216152653.25244-1-dlan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/spacemit/phy-k1-usb2.c

index 34206138001250a11fccf904693e7a3acc17ff7d..9215d0b223b2d697327388f044448eb61c5306d8 100644 (file)
@@ -48,6 +48,9 @@
 #define  PHY_CLK_HSTXP_EN              BIT(3)          /* clock hstxp enable */
 #define  PHY_HSTXP_MODE                        BIT(4)          /* 0: force en_txp to be 1; 1: no force */
 
+#define PHY_K1_HS_HOST_DISC            0x40
+#define  PHY_K1_HS_HOST_DISC_CLR               BIT(0)
+
 #define PHY_PLL_DIV_CFG                        0x98
 #define  PHY_FDIV_FRACT_8_15           GENMASK(7, 0)
 #define  PHY_FDIV_FRACT_16_19          GENMASK(11, 8)
@@ -142,9 +145,20 @@ static int spacemit_usb2phy_exit(struct phy *phy)
        return 0;
 }
 
+static int spacemit_usb2phy_disconnect(struct phy *phy, int port)
+{
+       struct spacemit_usb2phy *sphy = phy_get_drvdata(phy);
+
+       regmap_update_bits(sphy->regmap_base, PHY_K1_HS_HOST_DISC,
+                          PHY_K1_HS_HOST_DISC_CLR, PHY_K1_HS_HOST_DISC_CLR);
+
+       return 0;
+}
+
 static const struct phy_ops spacemit_usb2phy_ops = {
        .init = spacemit_usb2phy_init,
        .exit = spacemit_usb2phy_exit,
+       .disconnect = spacemit_usb2phy_disconnect,
        .owner = THIS_MODULE,
 };