OSDN Git Service

usb: dwc3: Add error print messages
authorMayank Rana <mrana@codeaurora.org>
Tue, 8 Jul 2014 00:07:16 +0000 (17:07 -0700)
committerDavid Keitel <dkeitel@codeaurora.org>
Tue, 22 Mar 2016 18:06:37 +0000 (11:06 -0700)
There is a possible race that arises when gadget events are processed
before the resume routine has disabled the USB2 PHY autosuspend. Some
of the gadget events issue endpoint commands which may time out since
the PHY is still autosuspended. Add error messages to help debug
these failurs.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
drivers/usb/dwc3/gadget.c

index 9a2adb8..33c16b6 100644 (file)
@@ -367,6 +367,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
                if (!timeout) {
                        dwc3_trace(trace_dwc3_gadget,
                                        "Command Timed Out");
+                       dev_err(dwc->dev, "%s command timeout for %s\n",
+                               dwc3_gadget_ep_cmd_string(cmd), dep->name);
+                       WARN_ON_ONCE(1);
                        return -ETIMEDOUT;
                }
 
@@ -529,22 +532,30 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
 
        if (!(dep->flags & DWC3_EP_ENABLED)) {
                ret = dwc3_gadget_start_config(dwc, dep);
-               if (ret)
+               if (ret) {
+                       dev_err(dwc->dev, "start_config() failed for %s\n",
+                                                               dep->name);
                        return ret;
+               }
        }
 
        ret = dwc3_gadget_set_ep_config(dwc, dep, desc, comp_desc, ignore,
                        restore);
-       if (ret)
+       if (ret) {
+               dev_err(dwc->dev, "set_ep_config() failed for %s\n", dep->name);
                return ret;
+       }
 
        if (!(dep->flags & DWC3_EP_ENABLED)) {
                struct dwc3_trb *trb_st_hw;
                struct dwc3_trb *trb_link;
 
                ret = dwc3_gadget_set_xfer_resource(dwc, dep);
-               if (ret)
+               if (ret) {
+                       dev_err(dwc->dev, "set_xfer_resource() failed for %s\n",
+                                                               dep->name);
                        return ret;
+               }
 
                dep->endpoint.desc = desc;
                dep->comp_desc = comp_desc;