@@ -165,6 +165,7 @@ struct rockchip_chg_det_reg {
165165 */
166166struct 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