linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
@ 2019-11-28 11:21 Minas Harutyunyan
  2019-12-10 12:53 ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: Minas Harutyunyan @ 2019-11-28 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Minas Harutyunyan, linux-usb
  Cc: John Youn, stable

SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
GET_STATUS handling provided not correct data on DATA Stage.
Issue seen when gadget's dr_mode set to "otg" mode and connected
to MacOS.
Both are fixed and tested using USBCV Ch.9 tests.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/gadget.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6be10e496e10..3a6176c22371 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1632,6 +1632,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
 	struct dwc2_hsotg_ep *ep0 = hsotg->eps_out[0];
 	struct dwc2_hsotg_ep *ep;
 	__le16 reply;
+	u16 status;
 	int ret;
 
 	dev_dbg(hsotg->dev, "%s: USB_REQ_GET_STATUS\n", __func__);
@@ -1643,11 +1644,10 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
 
 	switch (ctrl->bRequestType & USB_RECIP_MASK) {
 	case USB_RECIP_DEVICE:
-		/*
-		 * bit 0 => self powered
-		 * bit 1 => remote wakeup
-		 */
-		reply = cpu_to_le16(0);
+		status = 1 << USB_DEVICE_SELF_POWERED;
+		status |= hsotg->remote_wakeup_allowed <<
+			  USB_DEVICE_REMOTE_WAKEUP;
+		reply = cpu_to_le16(status);
 		break;
 
 	case USB_RECIP_INTERFACE:
@@ -1758,7 +1758,10 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
 	case USB_RECIP_DEVICE:
 		switch (wValue) {
 		case USB_DEVICE_REMOTE_WAKEUP:
-			hsotg->remote_wakeup_allowed = 1;
+			if (set)
+				hsotg->remote_wakeup_allowed = 1;
+			else
+				hsotg->remote_wakeup_allowed = 0;
 			break;
 
 		case USB_DEVICE_TEST_MODE:
@@ -1768,16 +1771,17 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
 				return -EINVAL;
 
 			hsotg->test_mode = wIndex >> 8;
-			ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
-			if (ret) {
-				dev_err(hsotg->dev,
-					"%s: failed to send reply\n", __func__);
-				return ret;
-			}
 			break;
 		default:
 			return -ENOENT;
 		}
+
+		ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
+		if (ret) {
+			dev_err(hsotg->dev,
+				"%s: failed to send reply\n", __func__);
+			return ret;
+		}
 		break;
 
 	case USB_RECIP_ENDPOINT:
-- 
2.11.0


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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2019-11-28 11:21 [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows Minas Harutyunyan
@ 2019-12-10 12:53 ` Felipe Balbi
  2019-12-10 14:19   ` Minas Harutyunyan
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2019-12-10 12:53 UTC (permalink / raw)
  To: Minas Harutyunyan, Greg Kroah-Hartman, Minas Harutyunyan, linux-usb
  Cc: John Youn, stable

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


Hi,

Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:

> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
> GET_STATUS handling provided not correct data on DATA Stage.
> Issue seen when gadget's dr_mode set to "otg" mode and connected
> to MacOS.
> Both are fixed and tested using USBCV Ch.9 tests.
>
> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>

do you want to add a Fixes tag here?

-- 
balbi

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

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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2019-12-10 12:53 ` Felipe Balbi
@ 2019-12-10 14:19   ` Minas Harutyunyan
  2019-12-13 11:54     ` Minas Harutyunyan
  0 siblings, 1 reply; 7+ messages in thread
From: Minas Harutyunyan @ 2019-12-10 14:19 UTC (permalink / raw)
  To: Felipe Balbi, Minas Harutyunyan, Greg Kroah-Hartman, linux-usb
  Cc: John Youn, stable

Hi Felipe,

On 12/10/2019 4:53 PM, Felipe Balbi wrote:
> 
> Hi,
> 
> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
> 
>> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
>> GET_STATUS handling provided not correct data on DATA Stage.
>> Issue seen when gadget's dr_mode set to "otg" mode and connected
>> to MacOS.
>> Both are fixed and tested using USBCV Ch.9 tests.
>>
>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> 
> do you want to add a Fixes tag here?

Fixes: fa389a6d7726 ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")

Thanks,
Minas

> 

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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2019-12-10 14:19   ` Minas Harutyunyan
@ 2019-12-13 11:54     ` Minas Harutyunyan
  2020-02-04 11:45       ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Minas Harutyunyan @ 2019-12-13 11:54 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, linux-usb; +Cc: John Youn, stable

Hi Felipe,

On 12/10/2019 6:19 PM, Minas Harutyunyan wrote:
> Hi Felipe,
> 
> On 12/10/2019 4:53 PM, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>
>>> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
>>> GET_STATUS handling provided not correct data on DATA Stage.
>>> Issue seen when gadget's dr_mode set to "otg" mode and connected
>>> to MacOS.
>>> Both are fixed and tested using USBCV Ch.9 tests.
>>>
>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>
>> do you want to add a Fixes tag here?
> 
> Fixes: fa389a6d7726 ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")
> 
Got tested tag by issue reported.

Tested-By: Jack Mitchell <ml@embed.me.uk>


Should I resubmit patch as v2 with added "Fixes" and "Tested-by" tags.

> Thanks,
> Minas
> 
>>

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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2019-12-13 11:54     ` Minas Harutyunyan
@ 2020-02-04 11:45       ` John Keeping
  2020-02-04 11:50         ` Minas Harutyunyan
  0 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2020-02-04 11:45 UTC (permalink / raw)
  To: Minas Harutyunyan
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, John Youn, stable

Hi Minas,

On Fri, 13 Dec 2019 11:54:11 +0000
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> wrote:
> On 12/10/2019 6:19 PM, Minas Harutyunyan wrote:
> > On 12/10/2019 4:53 PM, Felipe Balbi wrote:  
> >> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
> >>  
> >>> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
> >>> GET_STATUS handling provided not correct data on DATA Stage.
> >>> Issue seen when gadget's dr_mode set to "otg" mode and connected
> >>> to MacOS.
> >>> Both are fixed and tested using USBCV Ch.9 tests.
> >>>
> >>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>  
> >>
> >> do you want to add a Fixes tag here?  
> > 
> > Fixes: fa389a6d7726 ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")
> >   
> Got tested tag by issue reported.
> 
> Tested-By: Jack Mitchell <ml@embed.me.uk>
> 
> Should I resubmit patch as v2 with added "Fixes" and "Tested-by" tags.

Was this patch ever picked up?  I don't see it in current next.

Given Felipe's message [1], I guess it might have got lost.

Would you mind resending?

[1] https://lore.kernel.org/linux-usb/875zhd6pw0.fsf@kernel.org/


Thanks,
John

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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2020-02-04 11:45       ` John Keeping
@ 2020-02-04 11:50         ` Minas Harutyunyan
  2020-02-04 15:04           ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Minas Harutyunyan @ 2020-02-04 11:50 UTC (permalink / raw)
  To: John Keeping, Minas Harutyunyan
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, John Youn, stable

Hi John,


On 2/4/2020 3:45 PM, John Keeping wrote:
> Hi Minas,
> 
> On Fri, 13 Dec 2019 11:54:11 +0000
> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> wrote:
>> On 12/10/2019 6:19 PM, Minas Harutyunyan wrote:
>>> On 12/10/2019 4:53 PM, Felipe Balbi wrote:
>>>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>>>   
>>>>> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
>>>>> GET_STATUS handling provided not correct data on DATA Stage.
>>>>> Issue seen when gadget's dr_mode set to "otg" mode and connected
>>>>> to MacOS.
>>>>> Both are fixed and tested using USBCV Ch.9 tests.
>>>>>
>>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>>>
>>>> do you want to add a Fixes tag here?
>>>
>>> Fixes: fa389a6d7726 ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")
>>>    
>> Got tested tag by issue reported.
>>
>> Tested-By: Jack Mitchell <ml@embed.me.uk>
>>
>> Should I resubmit patch as v2 with added "Fixes" and "Tested-by" tags.
> 
> Was this patch ever picked up?  I don't see it in current next.
> 
Yes, it picked up by Felipe. It under testing/fixes

https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/commit/?h=testing/fixes&id=6de1e301b9cf8eb023357586ab8b02edda07320b

Thanks,
Minas

> Given Felipe's message [1], I guess it might have got lost.
> 
> Would you mind resending?
> 
> [1] https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_linux-2Dusb_875zhd6pw0.fsf-40kernel.org_&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=6z9Al9FrHR_ZqbbtSAsD16pvOL2S3XHxQnSzq8kusyI&m=D4RlPf0cgyzMpc-hKhI1giEWZJGcxNJFJWC5xjDVyoI&s=pw7tlVwt7OpHtYj_WpGG3K9WTodfF6FUWvyHoJ4__co&e=
> 
> 
> Thanks,
> John
> 

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

* Re: [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
  2020-02-04 11:50         ` Minas Harutyunyan
@ 2020-02-04 15:04           ` John Keeping
  0 siblings, 0 replies; 7+ messages in thread
From: John Keeping @ 2020-02-04 15:04 UTC (permalink / raw)
  To: Minas Harutyunyan
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, John Youn, stable

On Tue, 4 Feb 2020 11:50:12 +0000
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> wrote:

> On 2/4/2020 3:45 PM, John Keeping wrote:
> > On Fri, 13 Dec 2019 11:54:11 +0000
> > Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> wrote:  
> >> On 12/10/2019 6:19 PM, Minas Harutyunyan wrote:  
> >>> On 12/10/2019 4:53 PM, Felipe Balbi wrote:  
> >>>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
> >>>>     
> >>>>> SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
> >>>>> GET_STATUS handling provided not correct data on DATA Stage.
> >>>>> Issue seen when gadget's dr_mode set to "otg" mode and connected
> >>>>> to MacOS.
> >>>>> Both are fixed and tested using USBCV Ch.9 tests.
> >>>>>
> >>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>  
> >>>>
> >>>> do you want to add a Fixes tag here?  
> >>>
> >>> Fixes: fa389a6d7726 ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")
> >>>      
> >> Got tested tag by issue reported.
> >>
> >> Tested-By: Jack Mitchell <ml@embed.me.uk>
> >>
> >> Should I resubmit patch as v2 with added "Fixes" and "Tested-by" tags.  
> > 
> > Was this patch ever picked up?  I don't see it in current next.
> >   
> Yes, it picked up by Felipe. It under testing/fixes
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/commit/?h=testing/fixes&id=6de1e301b9cf8eb023357586ab8b02edda07320b

Thanks!  I'll try to remember to look there next time.


Sorry for the noise,
John

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

end of thread, other threads:[~2020-02-04 15:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 11:21 [PATCH] usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows Minas Harutyunyan
2019-12-10 12:53 ` Felipe Balbi
2019-12-10 14:19   ` Minas Harutyunyan
2019-12-13 11:54     ` Minas Harutyunyan
2020-02-04 11:45       ` John Keeping
2020-02-04 11:50         ` Minas Harutyunyan
2020-02-04 15:04           ` John Keeping

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).