summaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3/ep0.c
diff options
context:
space:
mode:
authorPawel Laszczak <pawell@cadence.com>2019-10-07 07:39:11 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-07 12:56:26 +0200
commit623170ff59710474d2db3dfb0ebb7577f44abd33 (patch)
tree88d548317f37b3756cc33e701f6d0a02fb8268d5 /drivers/usb/cdns3/ep0.c
parentd819f6584c201b7797daa33f0cff7247be14f2a8 (diff)
downloadlinux-623170ff59710474d2db3dfb0ebb7577f44abd33.tar.gz
linux-623170ff59710474d2db3dfb0ebb7577f44abd33.tar.bz2
linux-623170ff59710474d2db3dfb0ebb7577f44abd33.zip
usb:cdns3: Fix for CV CH9 running with g_zero driver.
Patch fixes issue with Halt Endnpoint Test observed during using g_zero driver as DUT. Bug occurred only on some testing board. Endpoint can defer transition to Halted state if endpoint has pending requests. 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") Tested-by: Roger Quadros <rogerq@ti.com> Link: https://lore.kernel.org/r/1570430355-26118-1-git-send-email-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3/ep0.c')
-rw-r--r--drivers/usb/cdns3/ep0.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
index 0445da0a5a0c..e71240b386b4 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: