]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
usb: dwc3: debug: decode control endpoint phase too
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Sep 2016 09:54:04 +0000 (12:54 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 31 Oct 2016 09:15:36 +0000 (11:15 +0200)
DWC3 can tell us which phase of a setup transfer
we're getting into. Let's decode it from the event
to make it easier to debug.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/debug.h

index 99fa8b8b06fe79d71b87faa00e85bcef3aefc8b3..18e4c09ae286b0f1ad61e374d5e74946ec557053 100644 (file)
@@ -1041,6 +1041,7 @@ struct dwc3_event_depevt {
 /* Control-only Status */
 #define DEPEVT_STATUS_CONTROL_DATA     1
 #define DEPEVT_STATUS_CONTROL_STATUS   2
+#define DEPEVT_STATUS_CONTROL_PHASE(n) ((n) & 3)
 
 /* In response to Start Transfer */
 #define DEPEVT_TRANSFER_NO_RESOURCE    1
index 33ab2a203c1bdc4a9d42d7bed9869ad83d2b4cb8..fe8abee315511c4f3a9185822ad48d00d606206a 100644 (file)
@@ -207,6 +207,19 @@ dwc3_ep_event_string(const struct dwc3_event_depevt *event)
                strcat(str, "Transfer Not Ready");
                status = event->status & DEPEVT_STATUS_TRANSFER_ACTIVE;
                strcat(str, status ? " (Active)" : " (Not Active)");
+
+               /* Control Endpoints */
+               if (epnum <= 1) {
+                       int phase = DEPEVT_STATUS_CONTROL_PHASE(event->status);
+
+                       switch (phase) {
+                       case DEPEVT_STATUS_CONTROL_DATA:
+                               strcat(str, " [Data Phase]");
+                               break;
+                       case DEPEVT_STATUS_CONTROL_STATUS:
+                               strcat(str, " [Status Phase]");
+                       }
+               }
                break;
        case DWC3_DEPEVT_RXTXFIFOEVT:
                strcat(str, "FIFO");