diff options
author | Bin Liu <b-liu@ti.com> | 2016-06-30 20:12:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-17 02:23:57 +0300 |
commit | 19ca682e03fbf0349e6c6ef76c786136176d3ca6 (patch) | |
tree | c069f92d63ba128a2611dc13ed0a0e250e87cfea /drivers | |
parent | cfb9a1bc6e65c6093ed5ac4f1c0cc20a9f25d597 (diff) | |
download | linux-19ca682e03fbf0349e6c6ef76c786136176d3ca6.tar.xz |
usb: musb: host: add urb tracepoints
Add urb tracepoints for host mode.
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/musb/musb_host.c | 34 | ||||
-rw-r--r-- | drivers/usb/musb/musb_trace.h | 63 |
2 files changed, 71 insertions, 26 deletions
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 7601adae1ecc..53bc4ceefe89 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -44,6 +44,7 @@ #include "musb_core.h" #include "musb_host.h" +#include "musb_trace.h" /* MUSB HOST status 22-mar-2006 * @@ -225,8 +226,6 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh) void *buf = urb->transfer_buffer; u32 offset = 0; struct musb_hw_ep *hw_ep = qh->hw_ep; - unsigned pipe = urb->pipe; - u8 address = usb_pipedevice(pipe); int epnum = hw_ep->epnum; /* initialize software qh state */ @@ -254,16 +253,7 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh) len = urb->transfer_buffer_length - urb->actual_length; } - musb_dbg(musb, "qh %p urb %p dev%d ep%d%s%s, hw_ep %d, %p/%d", - qh, urb, address, qh->epnum, - is_in ? "in" : "out", - ({char *s; switch (qh->type) { - case USB_ENDPOINT_XFER_CONTROL: s = ""; break; - case USB_ENDPOINT_XFER_BULK: s = "-bulk"; break; - case USB_ENDPOINT_XFER_ISOC: s = "-iso"; break; - default: s = "-intr"; break; - } s; }), - epnum, buf + offset, len); + trace_musb_urb_start(musb, urb); /* Configure endpoint */ musb_ep_set_qh(hw_ep, is_in, qh); @@ -314,13 +304,7 @@ static void musb_giveback(struct musb *musb, struct urb *urb, int status) __releases(musb->lock) __acquires(musb->lock) { - musb_dbg(musb, "complete %p %pF (%d), dev%d ep%d%s, %d/%d", - urb, urb->complete, status, - usb_pipedevice(urb->pipe), - usb_pipeendpoint(urb->pipe), - usb_pipein(urb->pipe) ? "in" : "out", - urb->actual_length, urb->transfer_buffer_length - ); + trace_musb_urb_gb(musb, urb); usb_hcd_unlink_urb_from_ep(musb->hcd, urb); spin_unlock(&musb->lock); @@ -1296,6 +1280,7 @@ void musb_host_tx(struct musb *musb, u8 epnum) pipe = urb->pipe; dma = is_dma_capable() ? hw_ep->tx_channel : NULL; + trace_musb_urb_tx(musb, urb); musb_dbg(musb, "OUT/TX%d end, csr %04x%s", epnum, tx_csr, dma ? ", dma" : ""); @@ -1853,9 +1838,7 @@ void musb_host_rx(struct musb *musb, u8 epnum) pipe = urb->pipe; - musb_dbg(musb, "<== hw %d rxcsr %04x, urb actual %d (+dma %zu)", - epnum, rx_csr, urb->actual_length, - dma ? dma->actual_len : 0); + trace_musb_urb_rx(musb, urb); /* check for errors, concurrent stall & unlink is not really * handled yet! */ @@ -2208,6 +2191,8 @@ static int musb_urb_enqueue( if (!is_host_active(musb) || !musb->is_active) return -ENODEV; + trace_musb_urb_enq(musb, urb); + spin_lock_irqsave(&musb->lock, flags); ret = usb_hcd_link_urb_to_ep(hcd, urb); qh = ret ? NULL : hep->hcpriv; @@ -2444,10 +2429,7 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) int is_in = usb_pipein(urb->pipe); int ret; - musb_dbg(musb, "urb=%p, dev%d ep%d%s", urb, - usb_pipedevice(urb->pipe), - usb_pipeendpoint(urb->pipe), - is_in ? "in" : "out"); + trace_musb_urb_deq(musb, urb); spin_lock_irqsave(&musb->lock, flags); ret = usb_hcd_check_unlink_urb(hcd, urb, status); diff --git a/drivers/usb/musb/musb_trace.h b/drivers/usb/musb/musb_trace.h index 98acc1e0a7a0..39258f6fdde8 100644 --- a/drivers/usb/musb/musb_trace.h +++ b/drivers/usb/musb/musb_trace.h @@ -23,6 +23,7 @@ #include <linux/types.h> #include <linux/tracepoint.h> +#include <linux/usb.h> #include "musb_core.h" #define MUSB_MSG_MAX 500 @@ -149,6 +150,68 @@ TRACE_EVENT(musb_isr, ) ); +DECLARE_EVENT_CLASS(musb_urb, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb), + TP_STRUCT__entry( + __string(name, dev_name(musb->controller)) + __field(struct urb *, urb) + __field(unsigned int, pipe) + __field(int, status) + __field(unsigned int, flag) + __field(u32, buf_len) + __field(u32, actual_len) + ), + TP_fast_assign( + __assign_str(name, dev_name(musb->controller)); + __entry->urb = urb; + __entry->pipe = urb->pipe; + __entry->status = urb->status; + __entry->flag = urb->transfer_flags; + __entry->buf_len = urb->transfer_buffer_length; + __entry->actual_len = urb->actual_length; + ), + TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d", + __get_str(name), __entry->urb, + usb_pipedevice(__entry->pipe), + usb_pipeendpoint(__entry->pipe), + usb_pipein(__entry->pipe) ? "in" : "out", + __entry->flag, + __entry->actual_len, __entry->buf_len, + __entry->status + ) +); + +DEFINE_EVENT(musb_urb, musb_urb_start, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + +DEFINE_EVENT(musb_urb, musb_urb_gb, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + +DEFINE_EVENT(musb_urb, musb_urb_rx, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + +DEFINE_EVENT(musb_urb, musb_urb_tx, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + +DEFINE_EVENT(musb_urb, musb_urb_enq, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + +DEFINE_EVENT(musb_urb, musb_urb_deq, + TP_PROTO(struct musb *musb, struct urb *urb), + TP_ARGS(musb, urb) +); + #endif /* __MUSB_TRACE_H */ /* this part has to be here */ |