Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / usb / musb / musb_trace.h
blob380ebc77eab1f5e664443f7a41096ee58f99a5aa
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
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>
8 */
10 #undef TRACE_SYSTEM
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
21 #include "cppi_dma.h"
22 #endif
24 #define MUSB_MSG_MAX 500
26 TRACE_EVENT(musb_log,
27 TP_PROTO(struct musb *musb, struct va_format *vaf),
28 TP_ARGS(musb, vaf),
29 TP_STRUCT__entry(
30 __string(name, dev_name(musb->controller))
31 __dynamic_array(char, msg, MUSB_MSG_MAX)
33 TP_fast_assign(
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),
44 TP_STRUCT__entry(
45 __field(void *, caller)
46 __field(const void __iomem *, addr)
47 __field(unsigned int, offset)
48 __field(u8, data)
50 TP_fast_assign(
51 __entry->caller = caller;
52 __entry->addr = addr;
53 __entry->offset = offset;
54 __entry->data = data;
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),
76 TP_STRUCT__entry(
77 __field(void *, caller)
78 __field(const void __iomem *, addr)
79 __field(unsigned int, offset)
80 __field(u16, data)
82 TP_fast_assign(
83 __entry->caller = caller;
84 __entry->addr = addr;
85 __entry->offset = offset;
86 __entry->data = data;
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),
108 TP_STRUCT__entry(
109 __field(void *, caller)
110 __field(const void __iomem *, addr)
111 __field(unsigned int, offset)
112 __field(u32, data)
114 TP_fast_assign(
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),
138 TP_ARGS(musb),
139 TP_STRUCT__entry(
140 __string(name, dev_name(musb->controller))
141 __field(u8, int_usb)
142 __field(u16, int_tx)
143 __field(u16, int_rx)
145 TP_fast_assign(
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),
159 TP_ARGS(musb, urb),
160 TP_STRUCT__entry(
161 __string(name, dev_name(musb->controller))
162 __field(struct urb *, urb)
163 __field(unsigned int, pipe)
164 __field(int, status)
165 __field(unsigned int, flag)
166 __field(u32, buf_len)
167 __field(u32, actual_len)
169 TP_fast_assign(
170 __assign_str(name, dev_name(musb->controller));
171 __entry->urb = urb;
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",
183 __entry->flag,
184 __entry->actual_len, __entry->buf_len,
185 __entry->status
189 DEFINE_EVENT(musb_urb, musb_urb_start,
190 TP_PROTO(struct musb *musb, struct urb *urb),
191 TP_ARGS(musb, urb)
194 DEFINE_EVENT(musb_urb, musb_urb_gb,
195 TP_PROTO(struct musb *musb, struct urb *urb),
196 TP_ARGS(musb, urb)
199 DEFINE_EVENT(musb_urb, musb_urb_rx,
200 TP_PROTO(struct musb *musb, struct urb *urb),
201 TP_ARGS(musb, urb)
204 DEFINE_EVENT(musb_urb, musb_urb_tx,
205 TP_PROTO(struct musb *musb, struct urb *urb),
206 TP_ARGS(musb, urb)
209 DEFINE_EVENT(musb_urb, musb_urb_enq,
210 TP_PROTO(struct musb *musb, struct urb *urb),
211 TP_ARGS(musb, urb)
214 DEFINE_EVENT(musb_urb, musb_urb_deq,
215 TP_PROTO(struct musb *musb, struct urb *urb),
216 TP_ARGS(musb, urb)
219 DECLARE_EVENT_CLASS(musb_req,
220 TP_PROTO(struct musb_request *req),
221 TP_ARGS(req),
222 TP_STRUCT__entry(
223 __field(struct usb_request *, req)
224 __field(u8, is_tx)
225 __field(u8, epnum)
226 __field(int, status)
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)
233 TP_fast_assign(
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,
251 __entry->status
255 DEFINE_EVENT(musb_req, musb_req_gb,
256 TP_PROTO(struct musb_request *req),
257 TP_ARGS(req)
260 DEFINE_EVENT(musb_req, musb_req_tx,
261 TP_PROTO(struct musb_request *req),
262 TP_ARGS(req)
265 DEFINE_EVENT(musb_req, musb_req_rx,
266 TP_PROTO(struct musb_request *req),
267 TP_ARGS(req)
270 DEFINE_EVENT(musb_req, musb_req_alloc,
271 TP_PROTO(struct musb_request *req),
272 TP_ARGS(req)
275 DEFINE_EVENT(musb_req, musb_req_free,
276 TP_PROTO(struct musb_request *req),
277 TP_ARGS(req)
280 DEFINE_EVENT(musb_req, musb_req_start,
281 TP_PROTO(struct musb_request *req),
282 TP_ARGS(req)
285 DEFINE_EVENT(musb_req, musb_req_enq,
286 TP_PROTO(struct musb_request *req),
287 TP_ARGS(req)
290 DEFINE_EVENT(musb_req, musb_req_deq,
291 TP_PROTO(struct musb_request *req),
292 TP_ARGS(req)
295 #ifdef CONFIG_USB_TI_CPPI41_DMA
296 DECLARE_EVENT_CLASS(musb_cppi41,
297 TP_PROTO(struct cppi41_dma_channel *ch),
298 TP_ARGS(ch),
299 TP_STRUCT__entry(
300 __field(struct cppi41_dma_channel *, ch)
301 __string(name, dev_name(ch->hw_ep->musb->controller))
302 __field(u8, hwep)
303 __field(u8, port)
304 __field(u8, is_tx)
305 __field(u32, len)
306 __field(u32, prog_len)
307 __field(u32, xferred)
309 TP_fast_assign(
310 __entry->ch = ch;
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),
328 TP_ARGS(ch)
331 DEFINE_EVENT(musb_cppi41, musb_cppi41_gb,
332 TP_PROTO(struct cppi41_dma_channel *ch),
333 TP_ARGS(ch)
336 DEFINE_EVENT(musb_cppi41, musb_cppi41_config,
337 TP_PROTO(struct cppi41_dma_channel *ch),
338 TP_ARGS(ch)
341 DEFINE_EVENT(musb_cppi41, musb_cppi41_cont,
342 TP_PROTO(struct cppi41_dma_channel *ch),
343 TP_ARGS(ch)
346 DEFINE_EVENT(musb_cppi41, musb_cppi41_alloc,
347 TP_PROTO(struct cppi41_dma_channel *ch),
348 TP_ARGS(ch)
351 DEFINE_EVENT(musb_cppi41, musb_cppi41_abort,
352 TP_PROTO(struct cppi41_dma_channel *ch),
353 TP_ARGS(ch)
356 DEFINE_EVENT(musb_cppi41, musb_cppi41_free,
357 TP_PROTO(struct cppi41_dma_channel *ch),
358 TP_ARGS(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>