mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	balbi@kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 17/19] usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer
Date: Mon, 28 Nov 2022 12:41:17 -0500	[thread overview]
Message-ID: <20221128174120.1442235-17-sashal@kernel.org> (raw)
In-Reply-To: <20221128174120.1442235-1-sashal@kernel.org>

From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

[ Upstream commit 3aa07f72894d209fcf922ad686cbb28cf005aaad ]

If there's a disconnection while operating in eSS, there may be a delay
in VBUS drop response from the connector. In that case, the internal
link state may drop to operate in usb2 speed while the controller thinks
the VBUS is still high. The driver must make sure to disable
GUSB2PHYCFG.SUSPHY when sending endpoint command while in usb2 speed.
The End Transfer command may be called, and only that command needs to
go through at this point. Let's keep it simple and unconditionally
disable GUSB2PHYCFG.SUSPHY whenever we issue the command.

This scenario is not seen in real hardware. In a rare case, our
prototype type-c controller/interface may have a slow response
triggerring this issue.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/5651117207803c26e2f22ddf4e5ce9e865dcf7c7.1668045468.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 347ba7e4bd81..d48c52c21145 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -291,7 +291,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
 	 *
 	 * DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2
 	 */
-	if (dwc->gadget->speed <= USB_SPEED_HIGH) {
+	if (dwc->gadget->speed <= USB_SPEED_HIGH ||
+	    DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_ENDTRANSFER) {
 		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
 		if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
 			saved_config |= DWC3_GUSB2PHYCFG_SUSPHY;
-- 
2.35.1


  parent reply	other threads:[~2022-11-28 17:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 17:41 [PATCH AUTOSEL 5.10 01/19] arm64: dts: rockchip: keep I2S1 disabled for GPIO function on ROCK Pi 4 series Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 02/19] arm: dts: rockchip: fix node name for hym8563 rtc Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 03/19] ARM: dts: rockchip: fix ir-receiver node names Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 04/19] arm64: " Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 05/19] ARM: dts: rockchip: rk3188: fix lcdc1-rgb24 node name Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 06/19] ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 07/19] ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 08/19] ASoC: wm8962: Wait for updated value of WM8962_CLOCKING1 register Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 09/19] ARM: dts: rockchip: disable arm_global_timer on rk3066 and rk3188 Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 10/19] 9p/fd: Use P9_HDRSZ for header size Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 11/19] regulator: slg51000: Wait after asserting CS pin Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 12/19] ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 13/19] btrfs: send: avoid unaligned encoded writes when attempting to clone range Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 14/19] ASoC: soc-pcm: Add NULL check in BE reparenting Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 15/19] regulator: twl6030: fix get status of twl6032 regulators Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 16/19] fbcon: Use kzalloc() in fbcon_prepare_logo() Sasha Levin
2022-11-28 17:41 ` Sasha Levin [this message]
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 18/19] 9p/xen: check logical size for buffer size Sasha Levin
2022-11-28 17:41 ` [PATCH AUTOSEL 5.10 19/19] net: usb: qmi_wwan: add u-blox 0x1342 composition Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221128174120.1442235-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®