1 // SPDX-License-Identifier: GPL-2.0
3 * musb_trace.h - MUSB Controller Trace Support
5 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
7 * Author: Bin Liu <b-liu@ti.com>
11 #define TRACE_SYSTEM musb
13 #if !defined(__MUSB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
14 #define __MUSB_TRACE_H
16 #include <linux/types.h>
17 #include <linux/tracepoint.h>
18 #include <linux/usb.h>
19 #include "musb_core.h"
20 #ifdef CONFIG_USB_TI_CPPI41_DMA
24 #define MUSB_MSG_MAX 500
27 TP_PROTO(struct musb
*musb
, struct va_format
*vaf
),
30 __string(name
, dev_name(musb
->controller
))
31 __dynamic_array(char, msg
, MUSB_MSG_MAX
)
34 __assign_str(name
, dev_name(musb
->controller
));
35 vsnprintf(__get_str(msg
), MUSB_MSG_MAX
, vaf
->fmt
, *vaf
->va
);
37 TP_printk("%s: %s", __get_str(name
), __get_str(msg
))
40 DECLARE_EVENT_CLASS(musb_regb
,
41 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u8 data
),
42 TP_ARGS(caller
, addr
, offset
, data
),
44 __field(void *, caller
)
45 __field(const void *, addr
)
46 __field(unsigned int, offset
)
50 __entry
->caller
= caller
;
52 __entry
->offset
= offset
;
55 TP_printk("%pS: %p + %04x: %02x",
56 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
59 DEFINE_EVENT(musb_regb
, musb_readb
,
60 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u8 data
),
61 TP_ARGS(caller
, addr
, offset
, data
)
64 DEFINE_EVENT(musb_regb
, musb_writeb
,
65 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u8 data
),
66 TP_ARGS(caller
, addr
, offset
, data
)
69 DECLARE_EVENT_CLASS(musb_regw
,
70 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u16 data
),
71 TP_ARGS(caller
, addr
, offset
, data
),
73 __field(void *, caller
)
74 __field(const void *, addr
)
75 __field(unsigned int, offset
)
79 __entry
->caller
= caller
;
81 __entry
->offset
= offset
;
84 TP_printk("%pS: %p + %04x: %04x",
85 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
88 DEFINE_EVENT(musb_regw
, musb_readw
,
89 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u16 data
),
90 TP_ARGS(caller
, addr
, offset
, data
)
93 DEFINE_EVENT(musb_regw
, musb_writew
,
94 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u16 data
),
95 TP_ARGS(caller
, addr
, offset
, data
)
98 DECLARE_EVENT_CLASS(musb_regl
,
99 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u32 data
),
100 TP_ARGS(caller
, addr
, offset
, data
),
102 __field(void *, caller
)
103 __field(const void *, addr
)
104 __field(unsigned int, offset
)
108 __entry
->caller
= caller
;
109 __entry
->addr
= addr
;
110 __entry
->offset
= offset
;
111 __entry
->data
= data
;
113 TP_printk("%pS: %p + %04x: %08x",
114 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
117 DEFINE_EVENT(musb_regl
, musb_readl
,
118 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u32 data
),
119 TP_ARGS(caller
, addr
, offset
, data
)
122 DEFINE_EVENT(musb_regl
, musb_writel
,
123 TP_PROTO(void *caller
, const void *addr
, unsigned int offset
, u32 data
),
124 TP_ARGS(caller
, addr
, offset
, data
)
127 TRACE_EVENT(musb_isr
,
128 TP_PROTO(struct musb
*musb
),
131 __string(name
, dev_name(musb
->controller
))
137 __assign_str(name
, dev_name(musb
->controller
));
138 __entry
->int_usb
= musb
->int_usb
;
139 __entry
->int_tx
= musb
->int_tx
;
140 __entry
->int_rx
= musb
->int_rx
;
142 TP_printk("%s: usb %02x, tx %04x, rx %04x",
143 __get_str(name
), __entry
->int_usb
,
144 __entry
->int_tx
, __entry
->int_rx
148 DECLARE_EVENT_CLASS(musb_urb
,
149 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
152 __string(name
, dev_name(musb
->controller
))
153 __field(struct urb
*, urb
)
154 __field(unsigned int, pipe
)
156 __field(unsigned int, flag
)
157 __field(u32
, buf_len
)
158 __field(u32
, actual_len
)
161 __assign_str(name
, dev_name(musb
->controller
));
163 __entry
->pipe
= urb
->pipe
;
164 __entry
->status
= urb
->status
;
165 __entry
->flag
= urb
->transfer_flags
;
166 __entry
->buf_len
= urb
->transfer_buffer_length
;
167 __entry
->actual_len
= urb
->actual_length
;
169 TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d",
170 __get_str(name
), __entry
->urb
,
171 usb_pipedevice(__entry
->pipe
),
172 usb_pipeendpoint(__entry
->pipe
),
173 usb_pipein(__entry
->pipe
) ? "in" : "out",
175 __entry
->actual_len
, __entry
->buf_len
,
180 DEFINE_EVENT(musb_urb
, musb_urb_start
,
181 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
185 DEFINE_EVENT(musb_urb
, musb_urb_gb
,
186 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
190 DEFINE_EVENT(musb_urb
, musb_urb_rx
,
191 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
195 DEFINE_EVENT(musb_urb
, musb_urb_tx
,
196 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
200 DEFINE_EVENT(musb_urb
, musb_urb_enq
,
201 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
205 DEFINE_EVENT(musb_urb
, musb_urb_deq
,
206 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
210 DECLARE_EVENT_CLASS(musb_req
,
211 TP_PROTO(struct musb_request
*req
),
214 __field(struct usb_request
*, req
)
218 __field(unsigned int, buf_len
)
219 __field(unsigned int, actual_len
)
220 __field(unsigned int, zero
)
221 __field(unsigned int, short_not_ok
)
222 __field(unsigned int, no_interrupt
)
225 __entry
->req
= &req
->request
;
226 __entry
->is_tx
= req
->tx
;
227 __entry
->epnum
= req
->epnum
;
228 __entry
->status
= req
->request
.status
;
229 __entry
->buf_len
= req
->request
.length
;
230 __entry
->actual_len
= req
->request
.actual
;
231 __entry
->zero
= req
->request
.zero
;
232 __entry
->short_not_ok
= req
->request
.short_not_ok
;
233 __entry
->no_interrupt
= req
->request
.no_interrupt
;
235 TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d",
236 __entry
->req
, __entry
->epnum
,
237 __entry
->is_tx
? "tx/IN" : "rx/OUT",
238 __entry
->zero
? "Z" : "z",
239 __entry
->short_not_ok
? "S" : "s",
240 __entry
->no_interrupt
? "I" : "i",
241 __entry
->actual_len
, __entry
->buf_len
,
246 DEFINE_EVENT(musb_req
, musb_req_gb
,
247 TP_PROTO(struct musb_request
*req
),
251 DEFINE_EVENT(musb_req
, musb_req_tx
,
252 TP_PROTO(struct musb_request
*req
),
256 DEFINE_EVENT(musb_req
, musb_req_rx
,
257 TP_PROTO(struct musb_request
*req
),
261 DEFINE_EVENT(musb_req
, musb_req_alloc
,
262 TP_PROTO(struct musb_request
*req
),
266 DEFINE_EVENT(musb_req
, musb_req_free
,
267 TP_PROTO(struct musb_request
*req
),
271 DEFINE_EVENT(musb_req
, musb_req_start
,
272 TP_PROTO(struct musb_request
*req
),
276 DEFINE_EVENT(musb_req
, musb_req_enq
,
277 TP_PROTO(struct musb_request
*req
),
281 DEFINE_EVENT(musb_req
, musb_req_deq
,
282 TP_PROTO(struct musb_request
*req
),
286 #ifdef CONFIG_USB_TI_CPPI41_DMA
287 DECLARE_EVENT_CLASS(musb_cppi41
,
288 TP_PROTO(struct cppi41_dma_channel
*ch
),
291 __field(struct cppi41_dma_channel
*, ch
)
292 __string(name
, dev_name(ch
->hw_ep
->musb
->controller
))
297 __field(u32
, prog_len
)
298 __field(u32
, xferred
)
302 __assign_str(name
, dev_name(ch
->hw_ep
->musb
->controller
));
303 __entry
->hwep
= ch
->hw_ep
->epnum
;
304 __entry
->port
= ch
->port_num
;
305 __entry
->is_tx
= ch
->is_tx
;
306 __entry
->len
= ch
->total_len
;
307 __entry
->prog_len
= ch
->prog_len
;
308 __entry
->xferred
= ch
->transferred
;
310 TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d",
311 __get_str(name
), __entry
->ch
, __entry
->hwep
,
312 __entry
->port
, __entry
->is_tx
? "tx" : "rx",
313 __entry
->prog_len
, __entry
->xferred
, __entry
->len
317 DEFINE_EVENT(musb_cppi41
, musb_cppi41_done
,
318 TP_PROTO(struct cppi41_dma_channel
*ch
),
322 DEFINE_EVENT(musb_cppi41
, musb_cppi41_gb
,
323 TP_PROTO(struct cppi41_dma_channel
*ch
),
327 DEFINE_EVENT(musb_cppi41
, musb_cppi41_config
,
328 TP_PROTO(struct cppi41_dma_channel
*ch
),
332 DEFINE_EVENT(musb_cppi41
, musb_cppi41_cont
,
333 TP_PROTO(struct cppi41_dma_channel
*ch
),
337 DEFINE_EVENT(musb_cppi41
, musb_cppi41_alloc
,
338 TP_PROTO(struct cppi41_dma_channel
*ch
),
342 DEFINE_EVENT(musb_cppi41
, musb_cppi41_abort
,
343 TP_PROTO(struct cppi41_dma_channel
*ch
),
347 DEFINE_EVENT(musb_cppi41
, musb_cppi41_free
,
348 TP_PROTO(struct cppi41_dma_channel
*ch
),
351 #endif /* CONFIG_USB_TI_CPPI41_DMA */
353 #endif /* __MUSB_TRACE_H */
355 /* this part has to be here */
357 #undef TRACE_INCLUDE_PATH
358 #define TRACE_INCLUDE_PATH .
360 #undef TRACE_INCLUDE_FILE
361 #define TRACE_INCLUDE_FILE musb_trace
363 #include <trace/define_trace.h>