USB: dwc3: Add debug support for DWC3 driver
Add support for DWC3 driver to dump requests in SW queue
list, requests queued to USB HW and trb list as well. Also
add support for logging endpoint events through debugfs.
Example:
To capture 2 in endpoint events
echo -n 4 > /sys/module/dwc3/parameters/ep_addr_txdbg_mask
To capture 3 out endpoint events
echo -n 8 > /sys/module/dwc3/parameters/ep_addr_rxdbg_mask
To print debug log events on endpoints
cat /sys/kernel/debug/dwc3/events
To dump requests in SW queue list for 6 out endpoint
echo 6 0 > /sys/kernel/debug/dwc3/requests
cat /sys/kernel/debug/dwc3/requests
To dump requests queued to USB HW for 8 in endpoint
echo 8 1 > /sys/kernel/debug/dwc3/queued_reqs
cat /sys/kernel/debug/dwc3/queued_reqs
To dump TRBs for 9 in endpoint
echo 9 1 > /sys/kernel/debug/dwc3/trbs
cat /sys/kernel/debug/dwc3/trbs
Change-Id: I84e963b8299a1af76de9a35a6ea46ec34b9fe79e
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 1512513..a1d7a87 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -53,6 +53,7 @@
#include "core.h"
#include "gadget.h"
#include "io.h"
+#include "debug.h"
static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep);
static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
@@ -741,6 +742,7 @@
dwc->ep0_next_event = DWC3_EP0_NRDY_DATA;
}
+ dbg_setup(0x00, ctrl);
if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD)
ret = dwc3_ep0_std_request(dwc, ctrl);
else
@@ -849,6 +851,7 @@
if (status == DWC3_TRBSTS_SETUP_PENDING)
dev_dbg(dwc->dev, "Setup Pending received\n");
+ dbg_print(dep->number, "DONE", status, "STATUS");
dwc->ep0state = EP0_SETUP_PHASE;
dwc3_ep0_out_start(dwc);
}
@@ -931,6 +934,7 @@
req->request.length, DWC3_TRBCTL_CONTROL_DATA);
}
+ dbg_queue(dep->number, &req->request, ret);
WARN_ON(ret < 0);
}
@@ -948,13 +952,16 @@
static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep)
{
+ int ret;
if (dwc->resize_fifos) {
dev_dbg(dwc->dev, "starting to resize fifos\n");
dwc3_gadget_resize_tx_fifos(dwc);
dwc->resize_fifos = 0;
}
- WARN_ON(dwc3_ep0_start_control_status(dep));
+ ret = dwc3_ep0_start_control_status(dep);
+ dbg_print(dep->number, "QUEUE", ret, "STATUS");
+ WARN_ON(ret);
}
static void dwc3_ep0_do_control_status(struct dwc3 *dwc,