diff options
author | Bin Liu <b-liu@ti.com> | 2016-06-30 12:12:27 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-17 08:23:57 +0900 |
commit | fc78003e5345a3c0b8461dbb75190693407ae2ca (patch) | |
tree | b40bdcda14ea8d96580d7590a17f9848c256627b | |
parent | 19ca682e03fbf0349e6c6ef76c786136176d3ca6 (diff) |
usb: musb: gadget: add usb-request tracepoints
Add usb_request tracepoints for gadget mode.
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 35 | ||||
-rw-r--r-- | drivers/usb/musb/musb_trace.h | 76 |
2 files changed, 90 insertions, 21 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 9616059b6a3d..6d1e975e9605 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -44,6 +44,7 @@ #include <linux/slab.h> #include "musb_core.h" +#include "musb_trace.h" /* ----------------------------------------------------------------------- */ @@ -167,15 +168,7 @@ __acquires(ep->musb->lock) if (!dma_mapping_error(&musb->g.dev, request->dma)) unmap_dma_buffer(req, musb); - if (request->status == 0) - musb_dbg(musb, "%s done request %p, %d/", - ep->end_point.name, request, - req->request.actual, req->request.length); - else - musb_dbg(musb, "%s request %p, %d/%d fault %d", - ep->end_point.name, request, - req->request.actual, req->request.length, - request->status); + trace_musb_req_gb(req); usb_gadget_giveback_request(&req->ep->end_point, &req->request); spin_lock(&musb->lock); ep->busy = busy; @@ -449,6 +442,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) req = next_request(musb_ep); request = &req->request; + trace_musb_req_tx(req); csr = musb_readw(epio, MUSB_TXCSR); musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); @@ -847,6 +841,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) if (!req) return; + trace_musb_req_rx(req); request = &req->request; csr = musb_readw(epio, MUSB_RXCSR); @@ -892,11 +887,6 @@ void musb_g_rx(struct musb *musb, u8 epnum) request->actual += musb_ep->dma->actual_len; - musb_dbg(musb, "RXCSR%d %04x, dma off, %04x, len %zu, req %p", - epnum, csr, - musb_readw(epio, MUSB_RXCSR), - musb_ep->dma->actual_len, request); - #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) || \ defined(CONFIG_USB_UX500_DMA) /* Autoclear doesn't clear RxPktRdy for short packets */ @@ -1194,6 +1184,7 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) request->epnum = musb_ep->current_epnum; request->ep = musb_ep; + trace_musb_req_alloc(request); return &request->request; } @@ -1203,7 +1194,10 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) */ void musb_free_request(struct usb_ep *ep, struct usb_request *req) { - kfree(to_musb_request(req)); + struct musb_request *request = to_musb_request(req); + + trace_musb_req_free(request); + kfree(request); } static LIST_HEAD(buffers); @@ -1220,10 +1214,7 @@ struct free_record { */ void musb_ep_restart(struct musb *musb, struct musb_request *req) { - musb_dbg(musb, "<== %s request %p len %u on hw_ep%d", - req->tx ? "TX/IN" : "RX/OUT", - &req->request, req->request.length, req->epnum); - + trace_musb_req_start(req); musb_ep_select(musb->mregs, req->epnum); if (req->tx) txstate(musb, req); @@ -1254,7 +1245,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, if (request->ep != musb_ep) return -EINVAL; - musb_dbg(musb, "<== to %s request=%p", ep->name, req); + trace_musb_req_enq(request); /* request is mine now... */ request->request.actual = 0; @@ -1296,9 +1287,11 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) int status = 0; struct musb *musb = musb_ep->musb; - if (!ep || !request || to_musb_request(request)->ep != musb_ep) + if (!ep || !request || req->ep != musb_ep) return -EINVAL; + trace_musb_req_deq(req); + spin_lock_irqsave(&musb->lock, flags); list_for_each_entry(r, &musb_ep->req_list, list) { diff --git a/drivers/usb/musb/musb_trace.h b/drivers/usb/musb/musb_trace.h index 39258f6fdde8..27d1a9b3efc8 100644 --- a/drivers/usb/musb/musb_trace.h +++ b/drivers/usb/musb/musb_trace.h @@ -212,6 +212,82 @@ DEFINE_EVENT(musb_urb, musb_urb_deq, TP_ARGS(musb, urb) ); +DECLARE_EVENT_CLASS(musb_req, + TP_PROTO(struct musb_request *req), + TP_ARGS(req), + TP_STRUCT__entry( + __field(struct usb_request *, req) + __field(u8, is_tx) + __field(u8, epnum) + __field(int, status) + __field(unsigned int, buf_len) + __field(unsigned int, actual_len) + __field(unsigned int, zero) + __field(unsigned int, short_not_ok) + __field(unsigned int, no_interrupt) + ), + TP_fast_assign( + __entry->req = &req->request; + __entry->is_tx = req->tx; + __entry->epnum = req->epnum; + __entry->status = req->request.status; + __entry->buf_len = req->request.length; + __entry->actual_len = req->request.actual; + __entry->zero = req->request.zero; + __entry->short_not_ok = req->request.short_not_ok; + __entry->no_interrupt = req->request.no_interrupt; + ), + TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d", + __entry->req, __entry->epnum, + __entry->is_tx ? "tx/IN" : "rx/OUT", + __entry->zero ? "Z" : "z", + __entry->short_not_ok ? "S" : "s", + __entry->no_interrupt ? "I" : "i", + __entry->actual_len, __entry->buf_len, + __entry->status + ) +); + +DEFINE_EVENT(musb_req, musb_req_gb, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_tx, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_rx, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_alloc, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_free, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_start, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_enq, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + +DEFINE_EVENT(musb_req, musb_req_deq, + TP_PROTO(struct musb_request *req), + TP_ARGS(req) +); + #endif /* __MUSB_TRACE_H */ /* this part has to be here */ |