Skip to contentSkip to conversation

usb: mtu3: return successful suspend status

PATCH New Chunfeng Yun 1 participant 2 messages Aug 26, 2021

Subsystems (4)
lore
Share & tools
lore

Chunfeng Yun

author maintainer
#0 lore raw

PATCH 1/2 usb: mtu3: return successful suspend status

Forgot 'return 0;' when suspend successfully, make the mistake when I split patches.

Fixes 6b587394c65c ("usb: mtu3: support suspend/resume for dual-role mode")
---
 drivers/usb/mtu3/mtu3_plat.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/mtu3/mtu3_plat.c +1 -0
index 81266f34986f..5b3f7f73cb40 100644
@@ -502,6 +502,7 @@ static int mtu3_suspend_common(struct device *dev, pm_message_t msg)
 	ssusb_phy_power_off(ssusb);
 	clk_bulk_disable_unprepare(BULK_CLKS_CNT, ssusb->clks);
 	ssusb_wakeup_set(ssusb, true);
+	return 0;
 
 sleep_err:
 	resume_ip_and_ports(ssusb, msg);
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH 2/2 usb: mtu3: fix random remote wakeup

Some platforms, e.g. 8183/8192, use low level latch way to keep wakeup signal, it may latch a wrong signal if debounce more time, and enable wakeup earlier.

                   ____________________
ip_sleep      ____/                    \__________
                           ___________________
wakeup_signal ____________/                   \______
                      _______________________________
wakeup_en     _______/
                      ^     ^
                      |(1)  |(2)

latch wakeup_signal mistakenly at (1), should latch it at (2);

Workaround: delay about 100us to enable wakeup, meanwhile decrease debounce time.

Fixes b1a344589eea ("usb: mtu3: support ip-sleep wakeup for MT8183")
---
 drivers/usb/mtu3/mtu3_host.c | 2 +-
 drivers/usb/mtu3/mtu3_plat.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/usb/mtu3/mtu3_host.c +1 -1
index 7d528f3c2482..f3903367a6a0 100644
@@ -62,7 +62,7 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable)
 	case SSUSB_UWK_V1_1:
 		reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
 		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
-		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
+		val = enable ? (WC0_IS_EN | WC0_IS_C(0x1)) : 0;
 		break;
 	case SSUSB_UWK_V1_2:
 		reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
drivers/usb/mtu3/mtu3_plat.c +3 -0
index 5b3f7f73cb40..f13531022f4a 100644
@@ -63,6 +63,9 @@ static int wait_for_ip_sleep(struct ssusb_mtk *ssusb)
 	if (ret) {
 		dev_err(ssusb->dev, "ip sleep failed!!!\n");
 		ret = -EBUSY;
+	} else {
+		/* workaround: avoid wrong wakeup signal latch for some soc */
+		usleep_range(100, 200);
 	}
 
 	return ret;
Signature · 1 line
2.18.0