2 * musb_trace.h - MUSB Controller Trace Support
4 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
6 * Author: Bin Liu <b-liu@ti.com>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 of
10 * the License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
19 #define TRACE_SYSTEM musb
21 #if !defined(__MUSB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
22 #define __MUSB_TRACE_H
24 #include <linux/types.h>
25 #include <linux/tracepoint.h>
26 #include <linux/usb.h>
27 #include "musb_core.h"
28 #ifdef CONFIG_USB_TI_CPPI41_DMA
32 #define MUSB_MSG_MAX 500
35 TP_PROTO(struct musb *musb, struct va_format *vaf),
38 __string(name, dev_name(musb->controller))
39 __dynamic_array(char, msg, MUSB_MSG_MAX)
42 __assign_str(name, dev_name(musb->controller));
43 vsnprintf(__get_str(msg), MUSB_MSG_MAX, vaf->fmt, *vaf->va);
45 TP_printk("%s: %s", __get_str(name), __get_str(msg))
48 DECLARE_EVENT_CLASS(musb_regb,
49 TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
50 TP_ARGS(caller, addr, offset, data),
52 __field(void *, caller)
53 __field(const void *, addr)
54 __field(unsigned int, offset)
58 __entry->caller = caller;
60 __entry->offset = offset;
63 TP_printk("%pS: %p + %04x: %02x",
64 __entry->caller, __entry->addr, __entry->offset, __entry->data)
67 DEFINE_EVENT(musb_regb, musb_readb,
68 TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
69 TP_ARGS(caller, addr, offset, data)
72 DEFINE_EVENT(musb_regb, musb_writeb,
73 TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
74 TP_ARGS(caller, addr, offset, data)
77 DECLARE_EVENT_CLASS(musb_regw,
78 TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
79 TP_ARGS(caller, addr, offset, data),
81 __field(void *, caller)
82 __field(const void *, addr)
83 __field(unsigned int, offset)
87 __entry->caller = caller;
89 __entry->offset = offset;
92 TP_printk("%pS: %p + %04x: %04x",
93 __entry->caller, __entry->addr, __entry->offset, __entry->data)
96 DEFINE_EVENT(musb_regw, musb_readw,
97 TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
98 TP_ARGS(caller, addr, offset, data)
101 DEFINE_EVENT(musb_regw, musb_writew,
102 TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
103 TP_ARGS(caller, addr, offset, data)
106 DECLARE_EVENT_CLASS(musb_regl,
107 TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
108 TP_ARGS(caller, addr, offset, data),
110 __field(void *, caller)
111 __field(const void *, addr)
112 __field(unsigned int, offset)
116 __entry->caller = caller;
117 __entry->addr = addr;
118 __entry->offset = offset;
119 __entry->data = data;
121 TP_printk("%pS: %p + %04x: %08x",
122 __entry->caller, __entry->addr, __entry->offset, __entry->data)
125 DEFINE_EVENT(musb_regl, musb_readl,
126 TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
127 TP_ARGS(caller, addr, offset, data)
130 DEFINE_EVENT(musb_regl, musb_writel,
131 TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
132 TP_ARGS(caller, addr, offset, data)
135 TRACE_EVENT(musb_isr,
136 TP_PROTO(struct musb *musb),
139 __string(name, dev_name(musb->controller))
145 __assign_str(name, dev_name(musb->controller));
146 __entry->int_usb = musb->int_usb;
147 __entry->int_tx = musb->int_tx;
148 __entry->int_rx = musb->int_rx;
150 TP_printk("%s: usb %02x, tx %04x, rx %04x",
151 __get_str(name), __entry->int_usb,
152 __entry->int_tx, __entry->int_rx
156 DECLARE_EVENT_CLASS(musb_urb,
157 TP_PROTO(struct musb *musb, struct urb *urb),
160 __string(name, dev_name(musb->controller))
161 __field(struct urb *, urb)
162 __field(unsigned int, pipe)
164 __field(unsigned int, flag)
165 __field(u32, buf_len)
166 __field(u32, actual_len)
169 __assign_str(name, dev_name(musb->controller));
171 __entry->pipe = urb->pipe;
172 __entry->status = urb->status;
173 __entry->flag = urb->transfer_flags;
174 __entry->buf_len = urb->transfer_buffer_length;
175 __entry->actual_len = urb->actual_length;
177 TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d",
178 __get_str(name), __entry->urb,
179 usb_pipedevice(__entry->pipe),
180 usb_pipeendpoint(__entry->pipe),
181 usb_pipein(__entry->pipe) ? "in" : "out",
183 __entry->actual_len, __entry->buf_len,
188 DEFINE_EVENT(musb_urb, musb_urb_start,
189 TP_PROTO(struct musb *musb, struct urb *urb),
193 DEFINE_EVENT(musb_urb, musb_urb_gb,
194 TP_PROTO(struct musb *musb, struct urb *urb),
198 DEFINE_EVENT(musb_urb, musb_urb_rx,
199 TP_PROTO(struct musb *musb, struct urb *urb),
203 DEFINE_EVENT(musb_urb, musb_urb_tx,
204 TP_PROTO(struct musb *musb, struct urb *urb),
208 DEFINE_EVENT(musb_urb, musb_urb_enq,
209 TP_PROTO(struct musb *musb, struct urb *urb),
213 DEFINE_EVENT(musb_urb, musb_urb_deq,
214 TP_PROTO(struct musb *musb, struct urb *urb),
218 DECLARE_EVENT_CLASS(musb_req,
219 TP_PROTO(struct musb_request *req),
222 __field(struct usb_request *, req)
226 __field(unsigned int, buf_len)
227 __field(unsigned int, actual_len)
228 __field(unsigned int, zero)
229 __field(unsigned int, short_not_ok)
230 __field(unsigned int, no_interrupt)
233 __entry->req = &req->request;
234 __entry->is_tx = req->tx;
235 __entry->epnum = req->epnum;
236 __entry->status = req->request.status;
237 __entry->buf_len = req->request.length;
238 __entry->actual_len = req->request.actual;
239 __entry->zero = req->request.zero;
240 __entry->short_not_ok = req->request.short_not_ok;
241 __entry->no_interrupt = req->request.no_interrupt;
243 TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d",
244 __entry->req, __entry->epnum,
245 __entry->is_tx ? "tx/IN" : "rx/OUT",
246 __entry->zero ? "Z" : "z",
247 __entry->short_not_ok ? "S" : "s",
248 __entry->no_interrupt ? "I" : "i",
249 __entry->actual_len, __entry->buf_len,
254 DEFINE_EVENT(musb_req, musb_req_gb,
255 TP_PROTO(struct musb_request *req),
259 DEFINE_EVENT(musb_req, musb_req_tx,
260 TP_PROTO(struct musb_request *req),
264 DEFINE_EVENT(musb_req, musb_req_rx,
265 TP_PROTO(struct musb_request *req),
269 DEFINE_EVENT(musb_req, musb_req_alloc,
270 TP_PROTO(struct musb_request *req),
274 DEFINE_EVENT(musb_req, musb_req_free,
275 TP_PROTO(struct musb_request *req),
279 DEFINE_EVENT(musb_req, musb_req_start,
280 TP_PROTO(struct musb_request *req),
284 DEFINE_EVENT(musb_req, musb_req_enq,
285 TP_PROTO(struct musb_request *req),
289 DEFINE_EVENT(musb_req, musb_req_deq,
290 TP_PROTO(struct musb_request *req),
294 #ifdef CONFIG_USB_TI_CPPI41_DMA
295 DECLARE_EVENT_CLASS(musb_cppi41,
296 TP_PROTO(struct cppi41_dma_channel *ch),
299 __field(struct cppi41_dma_channel *, ch)
300 __string(name, dev_name(ch->hw_ep->musb->controller))
305 __field(u32, prog_len)
306 __field(u32, xferred)
310 __assign_str(name, dev_name(ch->hw_ep->musb->controller));
311 __entry->hwep = ch->hw_ep->epnum;
312 __entry->port = ch->port_num;
313 __entry->is_tx = ch->is_tx;
314 __entry->len = ch->total_len;
315 __entry->prog_len = ch->prog_len;
316 __entry->xferred = ch->transferred;
318 TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d",
319 __get_str(name), __entry->ch, __entry->hwep,
320 __entry->port, __entry->is_tx ? "tx" : "rx",
321 __entry->prog_len, __entry->xferred, __entry->len
325 DEFINE_EVENT(musb_cppi41, musb_cppi41_done,
326 TP_PROTO(struct cppi41_dma_channel *ch),
330 DEFINE_EVENT(musb_cppi41, musb_cppi41_gb,
331 TP_PROTO(struct cppi41_dma_channel *ch),
335 DEFINE_EVENT(musb_cppi41, musb_cppi41_config,
336 TP_PROTO(struct cppi41_dma_channel *ch),
340 DEFINE_EVENT(musb_cppi41, musb_cppi41_cont,
341 TP_PROTO(struct cppi41_dma_channel *ch),
345 DEFINE_EVENT(musb_cppi41, musb_cppi41_alloc,
346 TP_PROTO(struct cppi41_dma_channel *ch),
350 DEFINE_EVENT(musb_cppi41, musb_cppi41_abort,
351 TP_PROTO(struct cppi41_dma_channel *ch),
355 DEFINE_EVENT(musb_cppi41, musb_cppi41_free,
356 TP_PROTO(struct cppi41_dma_channel *ch),
359 #endif /* CONFIG_USB_TI_CPPI41_DMA */
361 #endif /* __MUSB_TRACE_H */
363 /* this part has to be here */
365 #undef TRACE_INCLUDE_PATH
366 #define TRACE_INCLUDE_PATH .
368 #undef TRACE_INCLUDE_FILE
369 #define TRACE_INCLUDE_FILE musb_trace
371 #include <trace/define_trace.h>