Skip to content

Commit b1d94b8

Browse files
authored
Merge pull request torvalds#185 from vamrs-feng/pr_usb_suspend
rk356x: fix usb wake-up problem with u2phy0_host
2 parents ed204f7 + daed0fe commit b1d94b8

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3s.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@
574574
};
575575

576576
&u2phy0_host {
577-
disable_wakeup;
578577
status = "okay";
579578
};
580579

arch/arm64/boot/dts/rockchip/rk3566-rock-3c.dts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,6 @@
885885

886886
&u2phy0_host {
887887
phy-supply = <&vcc5v0_host>;
888-
disable_wakeup;
889888
status = "okay";
890889
};
891890

drivers/phy/rockchip/phy-rockchip-inno-usb2.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct rockchip_chg_det_reg {
165165
*/
166166
struct rockchip_usb2phy_port_cfg {
167167
struct usb2phy_reg phy_sus;
168+
struct usb2phy_reg phy_sus_host_port;
168169
struct usb2phy_reg pipe_phystatus;
169170
struct usb2phy_reg bvalid_det_en;
170171
struct usb2phy_reg bvalid_det_st;
@@ -300,7 +301,6 @@ struct rockchip_usb2phy_port {
300301
struct wake_lock wakelock;
301302
enum usb_otg_state state;
302303
enum usb_dr_mode mode;
303-
bool disable_wakeup;
304304
};
305305

306306
/**
@@ -2378,7 +2378,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
23782378
}
23792379

23802380
rport->phy = phy;
2381-
rport->disable_wakeup = of_property_read_bool(child_np, "disable_wakeup");
23822381
phy_set_drvdata(rport->phy, rport);
23832382

23842383
/* initialize otg/host port separately */
@@ -2973,6 +2972,7 @@ static int rockchip_usb2phy_pm_suspend(struct device *dev)
29732972
unsigned int index;
29742973
int ret = 0;
29752974
bool wakeup_enable = false;
2975+
struct regmap *base = get_reg_base(rphy);
29762976

29772977
if (device_may_wakeup(rphy->dev))
29782978
wakeup_enable = true;
@@ -3025,10 +3025,17 @@ static int rockchip_usb2phy_pm_suspend(struct device *dev)
30253025
dev_err(rphy->dev, "disable usb vbus irq\n");
30263026
}
30273027

3028-
/* activate the linestate to detect the next interrupt. */
30293028
mutex_lock(&rport->mutex);
3030-
// Only enable interrupt during suspend if no disable_wakeup was defined
3031-
ret = rockchip_usb2phy_enable_line_irq(rphy, rport, !rport->disable_wakeup);
3029+
/* because if suspend host-post can prevent suspend, so may changed phy_sus in suspend. */
3030+
if (rphy->phy_cfg->reg == 0xfe8a0000 && rport->port_id == USB2PHY_PORT_HOST) {
3031+
ret = property_enable(base, &rport->port_cfg->phy_sus_host_port, true);
3032+
if (ret) {
3033+
dev_err(rphy->dev, "failed to enable suspend host port\n");
3034+
return ret;
3035+
}
3036+
}
3037+
/* activate the linestate to detect the next interrupt. */
3038+
ret = rockchip_usb2phy_enable_line_irq(rphy, rport, true);
30323039
mutex_unlock(&rport->mutex);
30333040
if (ret) {
30343041
dev_err(rphy->dev, "failed to enable linestate irq\n");
@@ -3769,6 +3776,7 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
37693776
[USB2PHY_PORT_HOST] = {
37703777
/* Select suspend control from controller */
37713778
.phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d2 },
3779+
.phy_sus_host_port = { 0x0004, 8, 0, 0x1d2, 0x1d1 },
37723780
.ls_det_en = { 0x0080, 1, 1, 0, 1 },
37733781
.ls_det_st = { 0x0084, 1, 1, 0, 1 },
37743782
.ls_det_clr = { 0x0088, 1, 1, 0, 1 },

0 commit comments

Comments
 (0)