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 TRACE_EVENT(musb_state,
41 TP_PROTO(struct musb *musb, u8 devctl, const char *desc),
42 TP_ARGS(musb, devctl, desc),
44 __string(name, dev_name(musb->controller))
49 __assign_str(name, dev_name(musb->controller));
50 __entry->devctl = devctl;
51 __assign_str(desc, desc);
53 TP_printk("%s: devctl: %02x %s", __get_str(name), __entry->devctl,
57 DECLARE_EVENT_CLASS(musb_regb,
58 TP_PROTO(void *caller, const void __iomem *addr,
59 unsigned int offset, u8 data),
60 TP_ARGS(caller, addr, offset, data),
62 __field(void *, caller)
63 __field(const void __iomem *, addr)
64 __field(unsigned int, offset)
68 __entry->caller = caller;
70 __entry->offset = offset;
73 TP_printk("%pS: %p + %04x: %02x",
74 __entry->caller, __entry->addr, __entry->offset, __entry->data)
77 DEFINE_EVENT(musb_regb, musb_readb,
78 TP_PROTO(void *caller, const void __iomem *addr,
79 unsigned int offset, u8 data),
80 TP_ARGS(caller, addr, offset, data)
83 DEFINE_EVENT(musb_regb, musb_writeb,
84 TP_PROTO(void *caller, const void __iomem *addr,
85 unsigned int offset, u8 data),
86 TP_ARGS(caller, addr, offset, data)
89 DECLARE_EVENT_CLASS(musb_regw,
90 TP_PROTO(void *caller, const void __iomem *addr,
91 unsigned int offset, u16 data),
92 TP_ARGS(caller, addr, offset, data),
94 __field(void *, caller)
95 __field(const void __iomem *, addr)
96 __field(unsigned int, offset)
100 __entry->caller = caller;
101 __entry->addr = addr;
102 __entry->offset = offset;
103 __entry->data = data;
105 TP_printk("%pS: %p + %04x: %04x",
106 __entry->caller, __entry->addr, __entry->offset, __entry->data)
109 DEFINE_EVENT(musb_regw, musb_readw,
110 TP_PROTO(void *caller, const void __iomem *addr,
111 unsigned int offset, u16 data),
112 TP_ARGS(caller, addr, offset, data)
115 DEFINE_EVENT(musb_regw, musb_writew,
116 TP_PROTO(void *caller, const void __iomem *addr,
117 unsigned int offset, u16 data),
118 TP_ARGS(caller, addr, offset, data)
121 DECLARE_EVENT_CLASS(musb_regl,
122 TP_PROTO(void *caller, const void __iomem *addr,
123 unsigned int offset, u32 data),
124 TP_ARGS(caller, addr, offset, data),
126 __field(void *, caller)
127 __field(const void __iomem *, addr)
128 __field(unsigned int, offset)
132 __entry->caller = caller;
133 __entry->addr = addr;
134 __entry->offset = offset;
135 __entry->data = data;
137 TP_printk("%pS: %p + %04x: %08x",
138 __entry->caller, __entry->addr, __entry->offset, __entry->data)
141 DEFINE_EVENT(musb_regl, musb_readl,
142 TP_PROTO(void *caller, const void __iomem *addr,
143 unsigned int offset, u32 data),
144 TP_ARGS(caller, addr, offset, data)
147 DEFINE_EVENT(musb_regl, musb_writel,
148 TP_PROTO(void *caller, const void __iomem *addr,
149 unsigned int offset, u32 data),
150 TP_ARGS(caller, addr, offset, data)
153 TRACE_EVENT(musb_isr,
154 TP_PROTO(struct musb *musb),
157 __string(name, dev_name(musb->controller))
163 __assign_str(name, dev_name(musb->controller));
164 __entry->int_usb = musb->int_usb;
165 __entry->int_tx = musb->int_tx;
166 __entry->int_rx = musb->int_rx;
168 TP_printk("%s: usb %02x, tx %04x, rx %04x",
169 __get_str(name), __entry->int_usb,
170 __entry->int_tx, __entry->int_rx
174 DECLARE_EVENT_CLASS(musb_urb,
175 TP_PROTO(struct musb *musb, struct urb *urb),
178 __string(name, dev_name(musb->controller))
179 __field(struct urb *, urb)
180 __field(unsigned int, pipe)
182 __field(unsigned int, flag)
183 __field(u32, buf_len)
184 __field(u32, actual_len)
187 __assign_str(name, dev_name(musb->controller));
189 __entry->pipe = urb->pipe;
190 __entry->status = urb->status;
191 __entry->flag = urb->transfer_flags;
192 __entry->buf_len = urb->transfer_buffer_length;
193 __entry->actual_len = urb->actual_length;
195 TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d",
196 __get_str(name), __entry->urb,
197 usb_pipedevice(__entry->pipe),
198 usb_pipeendpoint(__entry->pipe),
199 usb_pipein(__entry->pipe) ? "in" : "out",
201 __entry->actual_len, __entry->buf_len,
206 DEFINE_EVENT(musb_urb, musb_urb_start,
207 TP_PROTO(struct musb *musb, struct urb *urb),
211 DEFINE_EVENT(musb_urb, musb_urb_gb,
212 TP_PROTO(struct musb *musb, struct urb *urb),
216 DEFINE_EVENT(musb_urb, musb_urb_rx,
217 TP_PROTO(struct musb *musb, struct urb *urb),
221 DEFINE_EVENT(musb_urb, musb_urb_tx,
222 TP_PROTO(struct musb *musb, struct urb *urb),
226 DEFINE_EVENT(musb_urb, musb_urb_enq,
227 TP_PROTO(struct musb *musb, struct urb *urb),
231 DEFINE_EVENT(musb_urb, musb_urb_deq,
232 TP_PROTO(struct musb *musb, struct urb *urb),
236 DECLARE_EVENT_CLASS(musb_req,
237 TP_PROTO(struct musb_request *req),
240 __field(struct usb_request *, req)
244 __field(unsigned int, buf_len)
245 __field(unsigned int, actual_len)
246 __field(unsigned int, zero)
247 __field(unsigned int, short_not_ok)
248 __field(unsigned int, no_interrupt)
251 __entry->req = &req->request;
252 __entry->is_tx = req->tx;
253 __entry->epnum = req->epnum;
254 __entry->status = req->request.status;
255 __entry->buf_len = req->request.length;
256 __entry->actual_len = req->request.actual;
257 __entry->zero = req->request.zero;
258 __entry->short_not_ok = req->request.short_not_ok;
259 __entry->no_interrupt = req->request.no_interrupt;
261 TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d",
262 __entry->req, __entry->epnum,
263 __entry->is_tx ? "tx/IN" : "rx/OUT",
264 __entry->zero ? "Z" : "z",
265 __entry->short_not_ok ? "S" : "s",
266 __entry->no_interrupt ? "I" : "i",
267 __entry->actual_len, __entry->buf_len,
272 DEFINE_EVENT(musb_req, musb_req_gb,
273 TP_PROTO(struct musb_request *req),
277 DEFINE_EVENT(musb_req, musb_req_tx,
278 TP_PROTO(struct musb_request *req),
282 DEFINE_EVENT(musb_req, musb_req_rx,
283 TP_PROTO(struct musb_request *req),
287 DEFINE_EVENT(musb_req, musb_req_alloc,
288 TP_PROTO(struct musb_request *req),
292 DEFINE_EVENT(musb_req, musb_req_free,
293 TP_PROTO(struct musb_request *req),
297 DEFINE_EVENT(musb_req, musb_req_start,
298 TP_PROTO(struct musb_request *req),
302 DEFINE_EVENT(musb_req, musb_req_enq,
303 TP_PROTO(struct musb_request *req),
307 DEFINE_EVENT(musb_req, musb_req_deq,
308 TP_PROTO(struct musb_request *req),
312 #ifdef CONFIG_USB_TI_CPPI41_DMA
313 DECLARE_EVENT_CLASS(musb_cppi41,
314 TP_PROTO(struct cppi41_dma_channel *ch),
317 __field(struct cppi41_dma_channel *, ch)
318 __string(name, dev_name(ch->hw_ep->musb->controller))
323 __field(u32, prog_len)
324 __field(u32, xferred)
328 __assign_str(name, dev_name(ch->hw_ep->musb->controller));
329 __entry->hwep = ch->hw_ep->epnum;
330 __entry->port = ch->port_num;
331 __entry->is_tx = ch->is_tx;
332 __entry->len = ch->total_len;
333 __entry->prog_len = ch->prog_len;
334 __entry->xferred = ch->transferred;
336 TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d",
337 __get_str(name), __entry->ch, __entry->hwep,
338 __entry->port, __entry->is_tx ? "tx" : "rx",
339 __entry->prog_len, __entry->xferred, __entry->len
343 DEFINE_EVENT(musb_cppi41, musb_cppi41_done,
344 TP_PROTO(struct cppi41_dma_channel *ch),
348 DEFINE_EVENT(musb_cppi41, musb_cppi41_gb,
349 TP_PROTO(struct cppi41_dma_channel *ch),
353 DEFINE_EVENT(musb_cppi41, musb_cppi41_config,
354 TP_PROTO(struct cppi41_dma_channel *ch),
358 DEFINE_EVENT(musb_cppi41, musb_cppi41_cont,
359 TP_PROTO(struct cppi41_dma_channel *ch),
363 DEFINE_EVENT(musb_cppi41, musb_cppi41_alloc,
364 TP_PROTO(struct cppi41_dma_channel *ch),
368 DEFINE_EVENT(musb_cppi41, musb_cppi41_abort,
369 TP_PROTO(struct cppi41_dma_channel *ch),
373 DEFINE_EVENT(musb_cppi41, musb_cppi41_free,
374 TP_PROTO(struct cppi41_dma_channel *ch),
377 #endif /* CONFIG_USB_TI_CPPI41_DMA */
379 #endif /* __MUSB_TRACE_H */
381 /* this part has to be here */
383 #undef TRACE_INCLUDE_PATH
384 #define TRACE_INCLUDE_PATH .
386 #undef TRACE_INCLUDE_FILE
387 #define TRACE_INCLUDE_FILE musb_trace
389 #include <trace/define_trace.h>