Skip to content

Commit e10c52e

Browse files
jan-kiszkavinodkoul
authored andcommitted
phy: starfive: jh7110-usb: Fix link configuration to controller
In order to connect the USB 2.0 PHY to its controller, we also need to set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot versions did that, but upstream firmware does not, and the kernel must not rely on such behavior anyway. Failing to set this left the USB gadget port invisible to connected hosts behind. Link: https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_syscon__section_b3l_fqs_wsb [1] Fixes: 16d3a71 ("phy: starfive: Add JH7110 USB 2.0 PHY driver") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20241015070444.20972-2-minda.chen@starfivetech.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 031b46b commit e10c52e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@
1010
#include <linux/clk.h>
1111
#include <linux/err.h>
1212
#include <linux/io.h>
13+
#include <linux/mfd/syscon.h>
1314
#include <linux/module.h>
1415
#include <linux/phy/phy.h>
1516
#include <linux/platform_device.h>
17+
#include <linux/regmap.h>
1618
#include <linux/usb/of.h>
1719

1820
#define USB_125M_CLK_RATE 125000000
1921
#define USB_LS_KEEPALIVE_OFF 0x4
2022
#define USB_LS_KEEPALIVE_ENABLE BIT(4)
2123

24+
#define USB_PDRSTN_SPLIT BIT(17)
25+
#define SYSCON_USB_SPLIT_OFFSET 0x18
26+
2227
struct jh7110_usb2_phy {
2328
struct phy *phy;
2429
void __iomem *regs;
30+
struct regmap *sys_syscon;
2531
struct clk *usb_125m_clk;
2632
struct clk *app_125m;
2733
enum phy_mode mode;
@@ -61,6 +67,10 @@ static int usb2_phy_set_mode(struct phy *_phy,
6167
usb2_set_ls_keepalive(phy, (mode != PHY_MODE_USB_DEVICE));
6268
}
6369

70+
/* Connect usb 2.0 phy mode */
71+
regmap_update_bits(phy->sys_syscon, SYSCON_USB_SPLIT_OFFSET,
72+
USB_PDRSTN_SPLIT, USB_PDRSTN_SPLIT);
73+
6474
return 0;
6575
}
6676

@@ -129,6 +139,12 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev)
129139
phy_set_drvdata(phy->phy, phy);
130140
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
131141

142+
phy->sys_syscon =
143+
syscon_regmap_lookup_by_compatible("starfive,jh7110-sys-syscon");
144+
if (IS_ERR(phy->sys_syscon))
145+
return dev_err_probe(dev, PTR_ERR(phy->sys_syscon),
146+
"Failed to get sys-syscon\n");
147+
132148
return PTR_ERR_OR_ZERO(phy_provider);
133149
}
134150

0 commit comments

Comments
 (0)