]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - drivers/usb/dwc3/trace.h
usb: dwc3: add dwc3 folder from linux kernel to u-boot
[karo-tx-uboot.git] / drivers / usb / dwc3 / trace.h
1 /**
2  * trace.h - DesignWare USB3 DRD Controller Trace Support
3  *
4  * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5  *
6  * Author: Felipe Balbi <balbi@ti.com>
7  *
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.
11  *
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.
16  */
17
18 #undef TRACE_SYSTEM
19 #define TRACE_SYSTEM dwc3
20
21 #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
22 #define __DWC3_TRACE_H
23
24 #include <linux/types.h>
25 #include <linux/tracepoint.h>
26 #include <asm/byteorder.h>
27 #include "core.h"
28 #include "debug.h"
29
30 DECLARE_EVENT_CLASS(dwc3_log_msg,
31         TP_PROTO(struct va_format *vaf),
32         TP_ARGS(vaf),
33         TP_STRUCT__entry(__dynamic_array(char, msg, DWC3_MSG_MAX)),
34         TP_fast_assign(
35                 vsnprintf(__get_str(msg), DWC3_MSG_MAX, vaf->fmt, *vaf->va);
36         ),
37         TP_printk("%s", __get_str(msg))
38 );
39
40 DEFINE_EVENT(dwc3_log_msg, dwc3_readl,
41         TP_PROTO(struct va_format *vaf),
42         TP_ARGS(vaf)
43 );
44
45 DEFINE_EVENT(dwc3_log_msg, dwc3_writel,
46         TP_PROTO(struct va_format *vaf),
47         TP_ARGS(vaf)
48 );
49
50 DEFINE_EVENT(dwc3_log_msg, dwc3_ep0,
51         TP_PROTO(struct va_format *vaf),
52         TP_ARGS(vaf)
53 );
54
55 DECLARE_EVENT_CLASS(dwc3_log_event,
56         TP_PROTO(u32 event),
57         TP_ARGS(event),
58         TP_STRUCT__entry(
59                 __field(u32, event)
60         ),
61         TP_fast_assign(
62                 __entry->event = event;
63         ),
64         TP_printk("event %08x", __entry->event)
65 );
66
67 DEFINE_EVENT(dwc3_log_event, dwc3_event,
68         TP_PROTO(u32 event),
69         TP_ARGS(event)
70 );
71
72 DECLARE_EVENT_CLASS(dwc3_log_ctrl,
73         TP_PROTO(struct usb_ctrlrequest *ctrl),
74         TP_ARGS(ctrl),
75         TP_STRUCT__entry(
76                 __field(__u8, bRequestType)
77                 __field(__u8, bRequest)
78                 __field(__le16, wValue)
79                 __field(__le16, wIndex)
80                 __field(__le16, wLength)
81         ),
82         TP_fast_assign(
83                 __entry->bRequestType = ctrl->bRequestType;
84                 __entry->bRequest = ctrl->bRequest;
85                 __entry->wValue = ctrl->wValue;
86                 __entry->wIndex = ctrl->wIndex;
87                 __entry->wLength = ctrl->wLength;
88         ),
89         TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
90                 __entry->bRequestType, __entry->bRequest,
91                 le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex),
92                 le16_to_cpu(__entry->wLength)
93         )
94 );
95
96 DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
97         TP_PROTO(struct usb_ctrlrequest *ctrl),
98         TP_ARGS(ctrl)
99 );
100
101 DECLARE_EVENT_CLASS(dwc3_log_request,
102         TP_PROTO(struct dwc3_request *req),
103         TP_ARGS(req),
104         TP_STRUCT__entry(
105                 __dynamic_array(char, name, DWC3_MSG_MAX)
106                 __field(struct dwc3_request *, req)
107                 __field(unsigned, actual)
108                 __field(unsigned, length)
109                 __field(int, status)
110         ),
111         TP_fast_assign(
112                 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name);
113                 __entry->req = req;
114                 __entry->actual = req->request.actual;
115                 __entry->length = req->request.length;
116                 __entry->status = req->request.status;
117         ),
118         TP_printk("%s: req %p length %u/%u ==> %d",
119                 __get_str(name), __entry->req, __entry->actual, __entry->length,
120                 __entry->status
121         )
122 );
123
124 DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
125         TP_PROTO(struct dwc3_request *req),
126         TP_ARGS(req)
127 );
128
129 DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
130         TP_PROTO(struct dwc3_request *req),
131         TP_ARGS(req)
132 );
133
134 DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
135         TP_PROTO(struct dwc3_request *req),
136         TP_ARGS(req)
137 );
138
139 DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
140         TP_PROTO(struct dwc3_request *req),
141         TP_ARGS(req)
142 );
143
144 DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
145         TP_PROTO(struct dwc3_request *req),
146         TP_ARGS(req)
147 );
148
149 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
150         TP_PROTO(unsigned int cmd, u32 param),
151         TP_ARGS(cmd, param),
152         TP_STRUCT__entry(
153                 __field(unsigned int, cmd)
154                 __field(u32, param)
155         ),
156         TP_fast_assign(
157                 __entry->cmd = cmd;
158                 __entry->param = param;
159         ),
160         TP_printk("cmd '%s' [%d] param %08x",
161                 dwc3_gadget_generic_cmd_string(__entry->cmd),
162                 __entry->cmd, __entry->param
163         )
164 );
165
166 DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
167         TP_PROTO(unsigned int cmd, u32 param),
168         TP_ARGS(cmd, param)
169 );
170
171 DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
172         TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
173                 struct dwc3_gadget_ep_cmd_params *params),
174         TP_ARGS(dep, cmd, params),
175         TP_STRUCT__entry(
176                 __dynamic_array(char, name, DWC3_MSG_MAX)
177                 __field(unsigned int, cmd)
178                 __field(u32, param0)
179                 __field(u32, param1)
180                 __field(u32, param2)
181         ),
182         TP_fast_assign(
183                 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
184                 __entry->cmd = cmd;
185                 __entry->param0 = params->param0;
186                 __entry->param1 = params->param1;
187                 __entry->param2 = params->param2;
188         ),
189         TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x",
190                 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
191                 __entry->cmd, __entry->param0,
192                 __entry->param1, __entry->param2
193         )
194 );
195
196 DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
197         TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
198                 struct dwc3_gadget_ep_cmd_params *params),
199         TP_ARGS(dep, cmd, params)
200 );
201
202 DECLARE_EVENT_CLASS(dwc3_log_trb,
203         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
204         TP_ARGS(dep, trb),
205         TP_STRUCT__entry(
206                 __dynamic_array(char, name, DWC3_MSG_MAX)
207                 __field(struct dwc3_trb *, trb)
208                 __field(u32, bpl)
209                 __field(u32, bph)
210                 __field(u32, size)
211                 __field(u32, ctrl)
212         ),
213         TP_fast_assign(
214                 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
215                 __entry->trb = trb;
216                 __entry->bpl = trb->bpl;
217                 __entry->bph = trb->bph;
218                 __entry->size = trb->size;
219                 __entry->ctrl = trb->ctrl;
220         ),
221         TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x",
222                 __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
223                 __entry->size, __entry->ctrl
224         )
225 );
226
227 DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
228         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
229         TP_ARGS(dep, trb)
230 );
231
232 DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
233         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
234         TP_ARGS(dep, trb)
235 );
236
237 #endif /* __DWC3_TRACE_H */
238
239 /* this part has to be here */
240
241 #undef TRACE_INCLUDE_PATH
242 #define TRACE_INCLUDE_PATH .
243
244 #undef TRACE_INCLUDE_FILE
245 #define TRACE_INCLUDE_FILE trace
246
247 #include <trace/define_trace.h>