linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Peter Chen <peter.chen@nxp.com>, Pawel Laszczak <pawell@cadence.com>
Cc: "felipe.balbi@linux.intel.com" <felipe.balbi@linux.intel.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jbergsagel@ti.com" <jbergsagel@ti.com>,
	"nsekhar@ti.com" <nsekhar@ti.com>, "nm@ti.com" <nm@ti.com>,
	Suresh Punnoose <sureshp@cadence.com>,
	Rahul Kumar <kurahul@cadence.com>
Subject: Re: [PATCH] usb:cdns3: Fix for CV CH9 running with g_zero driver.
Date: Tue, 8 Oct 2019 12:43:18 +0300	[thread overview]
Message-ID: <0b3cd2c4-c9dc-f88a-965d-357b9f34cec3@ti.com> (raw)
In-Reply-To: <VI1PR04MB53276319AB49C454A7A0318B8B9A0@VI1PR04MB5327.eurprd04.prod.outlook.com>

Peter,

On 08/10/2019 11:44, Peter Chen wrote:
>   
>>>> Endpoint can defer transition to Halted state if endpoint has pending
>>>> requests.
>>>
>>> The implementation of halt handling is a little complicated, you may
>>> consider return -EAGAIN for functional stall through usb_ep_set_halt
>> >from function driver if the requests are pending, it doesn't need to
>>> defer such kinds of functional stall.
>>
>> Yes, I remember your suggestion regarding using EAGAIN, but f_mass_storage
>> Driver simple check the status and try to stall endpoint again after 100 ms.
>>
>> What if Command Verifier ask for endpoint status before this time, or if the transfer
>> will not be finished on time ? Then the CV test may fail.
>>
>> So solution from this patch should be more certain.
>>
> 
> Your description is reasonable, since I have not met this issue, I would like
> to know more about it:
> It occurs at CV9 or MSC test? For CV9 test, it may not try to stall non-ep0.
> Which test case was failed?

Since g_zero was used it would be CV9.

cheers,
-roger

> 
> Peter
> 
>>>
>>> Peter
>>>> Patch add additional condition that allows to return correct endpoint
>>>> status during Get Endpoint Status request even if the halting
>>>> endpoint is in progress.
>>>>
>>>> Reported-by: Rahul Kumar <kurahul@cadence.com>
>>>> Signed-off-by: Rahul Kumar <kurahul@cadence.com>
>>>> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
>>>> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
>>>> ---
>>>>   drivers/usb/cdns3/ep0.c | 10 ++++++++--
>>>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index
>>>> 44f652e8b5a2..10ae03430f34 100644
>>>> --- a/drivers/usb/cdns3/ep0.c
>>>> +++ b/drivers/usb/cdns3/ep0.c
>>>> @@ -234,9 +234,11 @@ static int cdns3_req_ep0_set_address(struct
>>>> cdns3_device *priv_dev,  static int cdns3_req_ep0_get_status(struct
>> cdns3_device *priv_dev,
>>>>   				    struct usb_ctrlrequest *ctrl)  {
>>>> +	struct cdns3_endpoint *priv_ep;
>>>>   	__le16 *response_pkt;
>>>>   	u16 usb_status = 0;
>>>>   	u32 recip;
>>>> +	u8 index;
>>>>
>>>>   	recip = ctrl->bRequestType & USB_RECIP_MASK;
>>>>
>>>> @@ -262,9 +264,13 @@ static int cdns3_req_ep0_get_status(struct
>> cdns3_device *priv_dev,
>>>>   	case USB_RECIP_INTERFACE:
>>>>   		return cdns3_ep0_delegate_req(priv_dev, ctrl);
>>>>   	case USB_RECIP_ENDPOINT:
>>>> -		/* check if endpoint is stalled */
>>>> +		index = cdns3_ep_addr_to_index(ctrl->wIndex);
>>>> +		priv_ep = priv_dev->eps[index];
>>>> +
>>>> +		/* check if endpoint is stalled or stall is pending */
>>>>   		cdns3_select_ep(priv_dev, ctrl->wIndex);
>>>> -		if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)))
>>>> +		if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)) ||
>>>> +		    (priv_ep->flags & EP_STALL_PENDING))
>>>>   			usb_status =  BIT(USB_ENDPOINT_HALT);
>>>>   		break;
>>>>   	default:
>>>> --
>>>> 2.17.1
>>>>
>>>
>>> --
>>>
>>> Thanks,
>>> Peter Chen
>>
>> Regards,
>> Pawel

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  reply	other threads:[~2019-10-08  9:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  6:39 [PATCH] usb:cdns3: Fix for CV CH9 running with g_zero driver Pawel Laszczak
2019-10-07  8:40 ` Roger Quadros
2019-10-08  6:56 ` Peter Chen
2019-10-08  7:57   ` Pawel Laszczak
2019-10-08  8:44     ` Peter Chen
2019-10-08  9:43       ` Roger Quadros [this message]
2019-10-08 12:58   ` Felipe Balbi
2019-10-09  2:28     ` Peter Chen
2019-10-09  3:58     ` Pawel Laszczak
2019-10-09 13:50       ` Roger Quadros
2019-10-10 10:17         ` Felipe Balbi

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=0b3cd2c4-c9dc-f88a-965d-357b9f34cec3@ti.com \
    --to=rogerq@ti.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbergsagel@ti.com \
    --cc=kurahul@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=nsekhar@ti.com \
    --cc=pawell@cadence.com \
    --cc=peter.chen@nxp.com \
    --cc=sureshp@cadence.com \
    /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;
as well as URLs for NNTP newsgroup(s).