Skip to content

Commit 3f097ad

Browse files
hal-fengvinodkoul
authored andcommitted
phy: starfive: jh7110-usb: Fix USB 2.0 host occasional detection failure
JH7110 USB 2.0 host fails to detect USB 2.0 devices occasionally. With a long time of debugging and testing, we found that setting Rx clock gating control signal to normal power consumption mode can solve this problem. Signed-off-by: Hal Feng <hal.feng@starfivetech.com> Link: https://lore.kernel.org/r/20250422101244.51686-1-hal.feng@starfivetech.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 9cf118a commit 3f097ad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/phy/starfive/phy-jh7110-usb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <linux/usb/of.h>
1919

2020
#define USB_125M_CLK_RATE 125000000
21+
#define USB_CLK_MODE_OFF 0x0
22+
#define USB_CLK_MODE_RX_NORMAL_PWR BIT(1)
2123
#define USB_LS_KEEPALIVE_OFF 0x4
2224
#define USB_LS_KEEPALIVE_ENABLE BIT(4)
2325

@@ -78,6 +80,7 @@ static int jh7110_usb2_phy_init(struct phy *_phy)
7880
{
7981
struct jh7110_usb2_phy *phy = phy_get_drvdata(_phy);
8082
int ret;
83+
unsigned int val;
8184

8285
ret = clk_set_rate(phy->usb_125m_clk, USB_125M_CLK_RATE);
8386
if (ret)
@@ -87,6 +90,10 @@ static int jh7110_usb2_phy_init(struct phy *_phy)
8790
if (ret)
8891
return ret;
8992

93+
val = readl(phy->regs + USB_CLK_MODE_OFF);
94+
val |= USB_CLK_MODE_RX_NORMAL_PWR;
95+
writel(val, phy->regs + USB_CLK_MODE_OFF);
96+
9097
return 0;
9198
}
9299

0 commit comments

Comments
 (0)