Commit fc78003e authored by Bin Liu's avatar Bin Liu Committed by Greg Kroah-Hartman

usb: musb: gadget: add usb-request tracepoints

Add usb_request tracepoints for gadget mode.
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 19ca682e
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "musb_core.h" #include "musb_core.h"
#include "musb_trace.h"
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -167,15 +168,7 @@ __acquires(ep->musb->lock) ...@@ -167,15 +168,7 @@ __acquires(ep->musb->lock)
if (!dma_mapping_error(&musb->g.dev, request->dma)) if (!dma_mapping_error(&musb->g.dev, request->dma))
unmap_dma_buffer(req, musb); unmap_dma_buffer(req, musb);
if (request->status == 0) trace_musb_req_gb(req);
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);
usb_gadget_giveback_request(&req->ep->end_point, &req->request); usb_gadget_giveback_request(&req->ep->end_point, &req->request);
spin_lock(&musb->lock); spin_lock(&musb->lock);
ep->busy = busy; ep->busy = busy;
...@@ -449,6 +442,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -449,6 +442,7 @@ void musb_g_tx(struct musb *musb, u8 epnum)
req = next_request(musb_ep); req = next_request(musb_ep);
request = &req->request; request = &req->request;
trace_musb_req_tx(req);
csr = musb_readw(epio, MUSB_TXCSR); csr = musb_readw(epio, MUSB_TXCSR);
musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); 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) ...@@ -847,6 +841,7 @@ void musb_g_rx(struct musb *musb, u8 epnum)
if (!req) if (!req)
return; return;
trace_musb_req_rx(req);
request = &req->request; request = &req->request;
csr = musb_readw(epio, MUSB_RXCSR); csr = musb_readw(epio, MUSB_RXCSR);
...@@ -892,11 +887,6 @@ void musb_g_rx(struct musb *musb, u8 epnum) ...@@ -892,11 +887,6 @@ void musb_g_rx(struct musb *musb, u8 epnum)
request->actual += musb_ep->dma->actual_len; 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) || \ #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) || \
defined(CONFIG_USB_UX500_DMA) defined(CONFIG_USB_UX500_DMA)
/* Autoclear doesn't clear RxPktRdy for short packets */ /* 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) ...@@ -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->epnum = musb_ep->current_epnum;
request->ep = musb_ep; request->ep = musb_ep;
trace_musb_req_alloc(request);
return &request->request; return &request->request;
} }
...@@ -1203,7 +1194,10 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) ...@@ -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) 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); static LIST_HEAD(buffers);
...@@ -1220,10 +1214,7 @@ struct free_record { ...@@ -1220,10 +1214,7 @@ struct free_record {
*/ */
void musb_ep_restart(struct musb *musb, struct musb_request *req) void musb_ep_restart(struct musb *musb, struct musb_request *req)
{ {
musb_dbg(musb, "<== %s request %p len %u on hw_ep%d", trace_musb_req_start(req);
req->tx ? "TX/IN" : "RX/OUT",
&req->request, req->request.length, req->epnum);
musb_ep_select(musb->mregs, req->epnum); musb_ep_select(musb->mregs, req->epnum);
if (req->tx) if (req->tx)
txstate(musb, req); txstate(musb, req);
...@@ -1254,7 +1245,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1254,7 +1245,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
if (request->ep != musb_ep) if (request->ep != musb_ep)
return -EINVAL; return -EINVAL;
musb_dbg(musb, "<== to %s request=%p", ep->name, req); trace_musb_req_enq(request);
/* request is mine now... */ /* request is mine now... */
request->request.actual = 0; request->request.actual = 0;
...@@ -1296,9 +1287,11 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) ...@@ -1296,9 +1287,11 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
int status = 0; int status = 0;
struct musb *musb = musb_ep->musb; 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; return -EINVAL;
trace_musb_req_deq(req);
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
list_for_each_entry(r, &musb_ep->req_list, list) { list_for_each_entry(r, &musb_ep->req_list, list) {
......
...@@ -212,6 +212,82 @@ DEFINE_EVENT(musb_urb, musb_urb_deq, ...@@ -212,6 +212,82 @@ DEFINE_EVENT(musb_urb, musb_urb_deq,
TP_ARGS(musb, urb) 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 */ #endif /* __MUSB_TRACE_H */
/* this part has to be here */ /* this part has to be here */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment