Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] usb: dwc3: gadget: Do link recovery for SS and SSP
@ 2019-11-27 22:24 Thinh Nguyen
  2019-12-10 12:55 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Thinh Nguyen @ 2019-11-27 22:24 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, linux-usb; +Cc: John Youn, Thinh Nguyen

The controller always supports link recovery for device in SS and SSP.
Remove the speed limit check. Also, when the device is in RESUME or
RESET state, it means the controller received the resume/reset request.
The driver must send the link recovery to acknowledge the request. They
are valid states for the driver to send link recovery.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 7f97856e6b20..08bb26fe9fd4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1709,7 +1709,6 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
 	u32			reg;
 
 	u8			link_state;
-	u8			speed;
 
 	/*
 	 * According to the Databook Remote wakeup request should
@@ -1719,16 +1718,13 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
 	 */
 	reg = dwc3_readl(dwc->regs, DWC3_DSTS);
 
-	speed = reg & DWC3_DSTS_CONNECTSPD;
-	if ((speed == DWC3_DSTS_SUPERSPEED) ||
-	    (speed == DWC3_DSTS_SUPERSPEED_PLUS))
-		return 0;
-
 	link_state = DWC3_DSTS_USBLNKST(reg);
 
 	switch (link_state) {
+	case DWC3_LINK_STATE_RESET:
 	case DWC3_LINK_STATE_RX_DET:	/* in HS, means Early Suspend */
 	case DWC3_LINK_STATE_U3:	/* in HS, means SUSPEND */
+	case DWC3_LINK_STATE_RESUME:
 		break;
 	default:
 		return -EINVAL;
-- 
2.11.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: Do link recovery for SS and SSP
  2019-11-27 22:24 [PATCH] usb: dwc3: gadget: Do link recovery for SS and SSP Thinh Nguyen
@ 2019-12-10 12:55 ` Felipe Balbi
  2019-12-11  2:28   ` Thinh Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2019-12-10 12:55 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, linux-usb; +Cc: John Youn, Thinh Nguyen

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

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

> The controller always supports link recovery for device in SS and SSP.
> Remove the speed limit check. Also, when the device is in RESUME or
> RESET state, it means the controller received the resume/reset request.
> The driver must send the link recovery to acknowledge the request. They
> are valid states for the driver to send link recovery.
>
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>

Care to add a Fixes tag?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: Do link recovery for SS and SSP
  2019-12-10 12:55 ` Felipe Balbi
@ 2019-12-11  2:28   ` Thinh Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thinh Nguyen @ 2019-12-11  2:28 UTC (permalink / raw)
  To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb; +Cc: John Youn

Felipe Balbi wrote:
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>
>> The controller always supports link recovery for device in SS and SSP.
>> Remove the speed limit check. Also, when the device is in RESUME or
>> RESET state, it means the controller received the resume/reset request.
>> The driver must send the link recovery to acknowledge the request. They
>> are valid states for the driver to send link recovery.
>>
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> Care to add a Fixes tag?
>

Sure. I just resent it.

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 22:24 [PATCH] usb: dwc3: gadget: Do link recovery for SS and SSP Thinh Nguyen
2019-12-10 12:55 ` Felipe Balbi
2019-12-11  2:28   ` Thinh Nguyen

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git