|
10 | 10 | #include <linux/clk.h>
|
11 | 11 | #include <linux/err.h>
|
12 | 12 | #include <linux/io.h>
|
| 13 | +#include <linux/mfd/syscon.h> |
13 | 14 | #include <linux/module.h>
|
14 | 15 | #include <linux/phy/phy.h>
|
15 | 16 | #include <linux/platform_device.h>
|
| 17 | +#include <linux/regmap.h> |
16 | 18 | #include <linux/usb/of.h>
|
17 | 19 |
|
18 | 20 | #define USB_125M_CLK_RATE 125000000
|
19 | 21 | #define USB_LS_KEEPALIVE_OFF 0x4
|
20 | 22 | #define USB_LS_KEEPALIVE_ENABLE BIT(4)
|
21 | 23 |
|
| 24 | +#define USB_PDRSTN_SPLIT BIT(17) |
| 25 | +#define SYSCON_USB_SPLIT_OFFSET 0x18 |
| 26 | + |
22 | 27 | struct jh7110_usb2_phy {
|
23 | 28 | struct phy *phy;
|
24 | 29 | void __iomem *regs;
|
| 30 | + struct regmap *sys_syscon; |
25 | 31 | struct clk *usb_125m_clk;
|
26 | 32 | struct clk *app_125m;
|
27 | 33 | enum phy_mode mode;
|
@@ -61,6 +67,10 @@ static int usb2_phy_set_mode(struct phy *_phy,
|
61 | 67 | usb2_set_ls_keepalive(phy, (mode != PHY_MODE_USB_DEVICE));
|
62 | 68 | }
|
63 | 69 |
|
| 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 | + |
64 | 74 | return 0;
|
65 | 75 | }
|
66 | 76 |
|
@@ -129,6 +139,12 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev)
|
129 | 139 | phy_set_drvdata(phy->phy, phy);
|
130 | 140 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
|
131 | 141 |
|
| 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 | + |
132 | 148 | return PTR_ERR_OR_ZERO(phy_provider);
|
133 | 149 | }
|
134 | 150 |
|
|
0 commit comments