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 __iomem
*addr
,
42 unsigned int offset
, u8 data
),
43 TP_ARGS(caller
, addr
, offset
, data
),
45 __field(void *, caller
)
46 __field(const void __iomem
*, addr
)
47 __field(unsigned int, offset
)
51 __entry
->caller
= caller
;
53 __entry
->offset
= offset
;
56 TP_printk("%pS: %p + %04x: %02x",
57 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
60 DEFINE_EVENT(musb_regb
, musb_readb
,
61 TP_PROTO(void *caller
, const void __iomem
*addr
,
62 unsigned int offset
, u8 data
),
63 TP_ARGS(caller
, addr
, offset
, data
)
66 DEFINE_EVENT(musb_regb
, musb_writeb
,
67 TP_PROTO(void *caller
, const void __iomem
*addr
,
68 unsigned int offset
, u8 data
),
69 TP_ARGS(caller
, addr
, offset
, data
)
72 DECLARE_EVENT_CLASS(musb_regw
,
73 TP_PROTO(void *caller
, const void __iomem
*addr
,
74 unsigned int offset
, u16 data
),
75 TP_ARGS(caller
, addr
, offset
, data
),
77 __field(void *, caller
)
78 __field(const void __iomem
*, addr
)
79 __field(unsigned int, offset
)
83 __entry
->caller
= caller
;
85 __entry
->offset
= offset
;
88 TP_printk("%pS: %p + %04x: %04x",
89 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
92 DEFINE_EVENT(musb_regw
, musb_readw
,
93 TP_PROTO(void *caller
, const void __iomem
*addr
,
94 unsigned int offset
, u16 data
),
95 TP_ARGS(caller
, addr
, offset
, data
)
98 DEFINE_EVENT(musb_regw
, musb_writew
,
99 TP_PROTO(void *caller
, const void __iomem
*addr
,
100 unsigned int offset
, u16 data
),
101 TP_ARGS(caller
, addr
, offset
, data
)
104 DECLARE_EVENT_CLASS(musb_regl
,
105 TP_PROTO(void *caller
, const void __iomem
*addr
,
106 unsigned int offset
, u32 data
),
107 TP_ARGS(caller
, addr
, offset
, data
),
109 __field(void *, caller
)
110 __field(const void __iomem
*, addr
)
111 __field(unsigned int, offset
)
115 __entry
->caller
= caller
;
116 __entry
->addr
= addr
;
117 __entry
->offset
= offset
;
118 __entry
->data
= data
;
120 TP_printk("%pS: %p + %04x: %08x",
121 __entry
->caller
, __entry
->addr
, __entry
->offset
, __entry
->data
)
124 DEFINE_EVENT(musb_regl
, musb_readl
,
125 TP_PROTO(void *caller
, const void __iomem
*addr
,
126 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 __iomem
*addr
,
132 unsigned int offset
, u32 data
),
133 TP_ARGS(caller
, addr
, offset
, data
)
136 TRACE_EVENT(musb_isr
,
137 TP_PROTO(struct musb
*musb
),
140 __string(name
, dev_name(musb
->controller
))
146 __assign_str(name
, dev_name(musb
->controller
));
147 __entry
->int_usb
= musb
->int_usb
;
148 __entry
->int_tx
= musb
->int_tx
;
149 __entry
->int_rx
= musb
->int_rx
;
151 TP_printk("%s: usb %02x, tx %04x, rx %04x",
152 __get_str(name
), __entry
->int_usb
,
153 __entry
->int_tx
, __entry
->int_rx
157 DECLARE_EVENT_CLASS(musb_urb
,
158 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
161 __string(name
, dev_name(musb
->controller
))
162 __field(struct urb
*, urb
)
163 __field(unsigned int, pipe
)
165 __field(unsigned int, flag
)
166 __field(u32
, buf_len
)
167 __field(u32
, actual_len
)
170 __assign_str(name
, dev_name(musb
->controller
));
172 __entry
->pipe
= urb
->pipe
;
173 __entry
->status
= urb
->status
;
174 __entry
->flag
= urb
->transfer_flags
;
175 __entry
->buf_len
= urb
->transfer_buffer_length
;
176 __entry
->actual_len
= urb
->actual_length
;
178 TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d",
179 __get_str(name
), __entry
->urb
,
180 usb_pipedevice(__entry
->pipe
),
181 usb_pipeendpoint(__entry
->pipe
),
182 usb_pipein(__entry
->pipe
) ? "in" : "out",
184 __entry
->actual_len
, __entry
->buf_len
,
189 DEFINE_EVENT(musb_urb
, musb_urb_start
,
190 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
194 DEFINE_EVENT(musb_urb
, musb_urb_gb
,
195 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
199 DEFINE_EVENT(musb_urb
, musb_urb_rx
,
200 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
204 DEFINE_EVENT(musb_urb
, musb_urb_tx
,
205 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
209 DEFINE_EVENT(musb_urb
, musb_urb_enq
,
210 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
214 DEFINE_EVENT(musb_urb
, musb_urb_deq
,
215 TP_PROTO(struct musb
*musb
, struct urb
*urb
),
219 DECLARE_EVENT_CLASS(musb_req
,
220 TP_PROTO(struct musb_request
*req
),
223 __field(struct usb_request
*, req
)
227 __field(unsigned int, buf_len
)
228 __field(unsigned int, actual_len
)
229 __field(unsigned int, zero
)
230 __field(unsigned int, short_not_ok
)
231 __field(unsigned int, no_interrupt
)
234 __entry
->req
= &req
->request
;
235 __entry
->is_tx
= req
->tx
;
236 __entry
->epnum
= req
->epnum
;
237 __entry
->status
= req
->request
.status
;
238 __entry
->buf_len
= req
->request
.length
;
239 __entry
->actual_len
= req
->request
.actual
;
240 __entry
->zero
= req
->request
.zero
;
241 __entry
->short_not_ok
= req
->request
.short_not_ok
;
242 __entry
->no_interrupt
= req
->request
.no_interrupt
;
244 TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d",
245 __entry
->req
, __entry
->epnum
,
246 __entry
->is_tx
? "tx/IN" : "rx/OUT",
247 __entry
->zero
? "Z" : "z",
248 __entry
->short_not_ok
? "S" : "s",
249 __entry
->no_interrupt
? "I" : "i",
250 __entry
->actual_len
, __entry
->buf_len
,
255 DEFINE_EVENT(musb_req
, musb_req_gb
,
256 TP_PROTO(struct musb_request
*req
),
260 DEFINE_EVENT(musb_req
, musb_req_tx
,
261 TP_PROTO(struct musb_request
*req
),
265 DEFINE_EVENT(musb_req
, musb_req_rx
,
266 TP_PROTO(struct musb_request
*req
),
270 DEFINE_EVENT(musb_req
, musb_req_alloc
,
271 TP_PROTO(struct musb_request
*req
),
275 DEFINE_EVENT(musb_req
, musb_req_free
,
276 TP_PROTO(struct musb_request
*req
),
280 DEFINE_EVENT(musb_req
, musb_req_start
,
281 TP_PROTO(struct musb_request
*req
),
285 DEFINE_EVENT(musb_req
, musb_req_enq
,
286 TP_PROTO(struct musb_request
*req
),
290 DEFINE_EVENT(musb_req
, musb_req_deq
,
291 TP_PROTO(struct musb_request
*req
),
295 #ifdef CONFIG_USB_TI_CPPI41_DMA
296 DECLARE_EVENT_CLASS(musb_cppi41
,
297 TP_PROTO(struct cppi41_dma_channel
*ch
),
300 __field(struct cppi41_dma_channel
*, ch
)
301 __string(name
, dev_name(ch
->hw_ep
->musb
->controller
))
306 __field(u32
, prog_len
)
307 __field(u32
, xferred
)
311 __assign_str(name
, dev_name(ch
->hw_ep
->musb
->controller
));
312 __entry
->hwep
= ch
->hw_ep
->epnum
;
313 __entry
->port
= ch
->port_num
;
314 __entry
->is_tx
= ch
->is_tx
;
315 __entry
->len
= ch
->total_len
;
316 __entry
->prog_len
= ch
->prog_len
;
317 __entry
->xferred
= ch
->transferred
;
319 TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d",
320 __get_str(name
), __entry
->ch
, __entry
->hwep
,
321 __entry
->port
, __entry
->is_tx
? "tx" : "rx",
322 __entry
->prog_len
, __entry
->xferred
, __entry
->len
326 DEFINE_EVENT(musb_cppi41
, musb_cppi41_done
,
327 TP_PROTO(struct cppi41_dma_channel
*ch
),
331 DEFINE_EVENT(musb_cppi41
, musb_cppi41_gb
,
332 TP_PROTO(struct cppi41_dma_channel
*ch
),
336 DEFINE_EVENT(musb_cppi41
, musb_cppi41_config
,
337 TP_PROTO(struct cppi41_dma_channel
*ch
),
341 DEFINE_EVENT(musb_cppi41
, musb_cppi41_cont
,
342 TP_PROTO(struct cppi41_dma_channel
*ch
),
346 DEFINE_EVENT(musb_cppi41
, musb_cppi41_alloc
,
347 TP_PROTO(struct cppi41_dma_channel
*ch
),
351 DEFINE_EVENT(musb_cppi41
, musb_cppi41_abort
,
352 TP_PROTO(struct cppi41_dma_channel
*ch
),
356 DEFINE_EVENT(musb_cppi41
, musb_cppi41_free
,
357 TP_PROTO(struct cppi41_dma_channel
*ch
),
360 #endif /* CONFIG_USB_TI_CPPI41_DMA */
362 #endif /* __MUSB_TRACE_H */
364 /* this part has to be here */
366 #undef TRACE_INCLUDE_PATH
367 #define TRACE_INCLUDE_PATH .
369 #undef TRACE_INCLUDE_FILE
370 #define TRACE_INCLUDE_FILE musb_trace
372 #include <trace/define_trace.h>