xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/usb/dwc3.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============================================================
2*4882a593SmuzhiyunSynopsys DesignWare Core SuperSpeed USB 3.0 Controller
3*4882a593Smuzhiyun===============================================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun:Author: Felipe Balbi <felipe.balbi@linux.intel.com>
6*4882a593Smuzhiyun:Date: April 2017
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunIntroduction
9*4882a593Smuzhiyun============
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunThe *Synopsys DesignWare Core SuperSpeed USB 3.0 Controller*
12*4882a593Smuzhiyun(hereinafter referred to as *DWC3*) is a USB SuperSpeed compliant
13*4882a593Smuzhiyuncontroller which can be configured in one of 4 ways:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun	1. Peripheral-only configuration
16*4882a593Smuzhiyun	2. Host-only configuration
17*4882a593Smuzhiyun	3. Dual-Role configuration
18*4882a593Smuzhiyun	4. Hub configuration
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunLinux currently supports several versions of this controller. In all
21*4882a593Smuzhiyunlikelyhood, the version in your SoC is already supported. At the time
22*4882a593Smuzhiyunof this writing, known tested versions range from 2.02a to 3.10a. As a
23*4882a593Smuzhiyunrule of thumb, anything above 2.02a should work reliably well.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunCurrently, we have many known users for this driver. In alphabetical
26*4882a593Smuzhiyunorder:
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun	1. Cavium
29*4882a593Smuzhiyun	2. Intel Corporation
30*4882a593Smuzhiyun	3. Qualcomm
31*4882a593Smuzhiyun	4. Rockchip
32*4882a593Smuzhiyun	5. ST
33*4882a593Smuzhiyun	6. Samsung
34*4882a593Smuzhiyun	7. Texas Instruments
35*4882a593Smuzhiyun	8. Xilinx
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunSummary of Features
38*4882a593Smuzhiyun======================
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunFor details about features supported by your version of DWC3, consult
41*4882a593Smuzhiyunyour IP team and/or *Synopsys DesignWare Core SuperSpeed USB 3.0
42*4882a593SmuzhiyunController Databook*. Following is a list of features supported by the
43*4882a593Smuzhiyundriver at the time of this writing:
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun	1. Up to 16 bidirectional endpoints (including the control
46*4882a593Smuzhiyun	   pipe - ep0)
47*4882a593Smuzhiyun	2. Flexible endpoint configuration
48*4882a593Smuzhiyun	3. Simultaneous IN and OUT transfer support
49*4882a593Smuzhiyun	4. Scatter-list support
50*4882a593Smuzhiyun	5. Up to 256 TRBs [#trb]_ per endpoint
51*4882a593Smuzhiyun	6. Support for all transfer types (*Control*, *Bulk*,
52*4882a593Smuzhiyun	   *Interrupt*, and *Isochronous*)
53*4882a593Smuzhiyun	7. SuperSpeed Bulk Streams
54*4882a593Smuzhiyun	8. Link Power Management
55*4882a593Smuzhiyun	9. Trace Events for debugging
56*4882a593Smuzhiyun	10. DebugFS [#debugfs]_ interface
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunThese features have all been exercised with many of the **in-tree**
59*4882a593Smuzhiyungadget drivers. We have verified both *ConfigFS* [#configfs]_ and
60*4882a593Smuzhiyunlegacy gadget drivers.
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunDriver Design
63*4882a593Smuzhiyun==============
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunThe DWC3 driver sits on the *drivers/usb/dwc3/* directory. All files
66*4882a593Smuzhiyunrelated to this driver are in this one directory. This makes it easy
67*4882a593Smuzhiyunfor new-comers to read the code and understand how it behaves.
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunBecause of DWC3's configuration flexibility, the driver is a little
70*4882a593Smuzhiyuncomplex in some places but it should be rather straightforward to
71*4882a593Smuzhiyununderstand.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunThe biggest part of the driver refers to the Gadget API.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunKnown Limitations
76*4882a593Smuzhiyun===================
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunLike any other HW, DWC3 has its own set of limitations. To avoid
79*4882a593Smuzhiyunconstant questions about such problems, we decided to document them
80*4882a593Smuzhiyunhere and have a single location to where we could point users.
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunOUT Transfer Size Requirements
83*4882a593Smuzhiyun---------------------------------
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunAccording to Synopsys Databook, all OUT transfer TRBs [#trb]_ must
86*4882a593Smuzhiyunhave their *size* field set to a value which is integer divisible by
87*4882a593Smuzhiyunthe endpoint's *wMaxPacketSize*. This means that *e.g.* in order to
88*4882a593Smuzhiyunreceive a Mass Storage *CBW* [#cbw]_, req->length must either be set
89*4882a593Smuzhiyunto a value that's divisible by *wMaxPacketSize* (1024 on SuperSpeed,
90*4882a593Smuzhiyun512 on HighSpeed, etc), or DWC3 driver must add a Chained TRB pointing
91*4882a593Smuzhiyunto a throw-away buffer for the remaining length. Without this, OUT
92*4882a593Smuzhiyuntransfers will **NOT** start.
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunNote that as of this writing, this won't be a problem because DWC3 is
95*4882a593Smuzhiyunfully capable of appending a chained TRB for the remaining length and
96*4882a593Smuzhiyuncompletely hide this detail from the gadget driver. It's still worth
97*4882a593Smuzhiyunmentioning because this seems to be the largest source of queries
98*4882a593Smuzhiyunabout DWC3 and *non-working transfers*.
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunTRB Ring Size Limitation
101*4882a593Smuzhiyun-------------------------
102*4882a593Smuzhiyun
103*4882a593SmuzhiyunWe, currently, have a hard limit of 256 TRBs [#trb]_ per endpoint,
104*4882a593Smuzhiyunwith the last TRB being a Link TRB [#link_trb]_ pointing back to the
105*4882a593Smuzhiyunfirst. This limit is arbitrary but it has the benefit of adding up to
106*4882a593Smuzhiyunexactly 4096 bytes, or 1 Page.
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunDWC3 driver will try its best to cope with more than 255 requests and,
109*4882a593Smuzhiyunfor the most part, it should work normally. However this is not
110*4882a593Smuzhiyunsomething that has been exercised very frequently. If you experience
111*4882a593Smuzhiyunany problems, see section **Reporting Bugs** below.
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunReporting Bugs
114*4882a593Smuzhiyun================
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunWhenever you encounter a problem with DWC3, first and foremost you
117*4882a593Smuzhiyunshould make sure that:
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun	1. You're running latest tag from `Linus' tree`_
120*4882a593Smuzhiyun	2. You can reproduce the error without any out-of-tree changes
121*4882a593Smuzhiyun	   to DWC3
122*4882a593Smuzhiyun	3. You have checked that it's not a fault on the host machine
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunAfter all these are verified, then here's how to capture enough
125*4882a593Smuzhiyuninformation so we can be of any help to you.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunRequired Information
128*4882a593Smuzhiyun---------------------
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunDWC3 relies exclusively on Trace Events for debugging. Everything is
131*4882a593Smuzhiyunexposed there, with some extra bits being exposed to DebugFS
132*4882a593Smuzhiyun[#debugfs]_.
133*4882a593Smuzhiyun
134*4882a593SmuzhiyunIn order to capture DWC3's Trace Events you should run the following
135*4882a593Smuzhiyuncommands **before** plugging the USB cable to a host machine:
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun.. code-block:: sh
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun		 # mkdir -p /d
140*4882a593Smuzhiyun		 # mkdir -p /t
141*4882a593Smuzhiyun		 # mount -t debugfs none /d
142*4882a593Smuzhiyun		 # mount -t tracefs none /t
143*4882a593Smuzhiyun		 # echo 81920 > /t/buffer_size_kb
144*4882a593Smuzhiyun		 # echo 1 > /t/events/dwc3/enable
145*4882a593Smuzhiyun
146*4882a593SmuzhiyunAfter this is done, you can connect your USB cable and reproduce the
147*4882a593Smuzhiyunproblem. As soon as the fault is reproduced, make a copy of files
148*4882a593Smuzhiyun``trace`` and ``regdump``, like so:
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun.. code-block:: sh
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun		# cp /t/trace /root/trace.txt
153*4882a593Smuzhiyun		# cat /d/*dwc3*/regdump > /root/regdump.txt
154*4882a593Smuzhiyun
155*4882a593SmuzhiyunMake sure to compress ``trace.txt`` and ``regdump.txt`` in a tarball
156*4882a593Smuzhiyunand email it to `me`_ with `linux-usb`_ in Cc. If you want to be extra
157*4882a593Smuzhiyunsure that I'll help you, write your subject line in the following
158*4882a593Smuzhiyunformat:
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun	**[BUG REPORT] usb: dwc3: Bug while doing XYZ**
161*4882a593Smuzhiyun
162*4882a593SmuzhiyunOn the email body, make sure to detail what you doing, which gadget
163*4882a593Smuzhiyundriver you were using, how to reproduce the problem, what SoC you're
164*4882a593Smuzhiyunusing, which OS (and its version) was running on the Host machine.
165*4882a593Smuzhiyun
166*4882a593SmuzhiyunWith all this information, we should be able to understand what's
167*4882a593Smuzhiyungoing on and be helpful to you.
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunDebugging
170*4882a593Smuzhiyun===========
171*4882a593Smuzhiyun
172*4882a593SmuzhiyunFirst and foremost a disclaimer::
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun  DISCLAIMER: The information available on DebugFS and/or TraceFS can
175*4882a593Smuzhiyun  change at any time at any Major Linux Kernel Release. If writing
176*4882a593Smuzhiyun  scripts, do **NOT** assume information to be available in the
177*4882a593Smuzhiyun  current format.
178*4882a593Smuzhiyun
179*4882a593SmuzhiyunWith that out of the way, let's carry on.
180*4882a593Smuzhiyun
181*4882a593SmuzhiyunIf you're willing to debug your own problem, you deserve a round of
182*4882a593Smuzhiyunapplause :-)
183*4882a593Smuzhiyun
184*4882a593SmuzhiyunAnyway, there isn't much to say here other than Trace Events will be
185*4882a593Smuzhiyunreally helpful in figuring out issues with DWC3. Also, access to
186*4882a593SmuzhiyunSynopsys Databook will be **really** valuable in this case.
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunA USB Sniffer can be helpful at times but it's not entirely required,
189*4882a593Smuzhiyunthere's a lot that can be understood without looking at the wire.
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunFeel free to email `me`_ and Cc `linux-usb`_ if you need any help.
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun``DebugFS``
194*4882a593Smuzhiyun-------------
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun``DebugFS`` is very good for gathering snapshots of what's going on
197*4882a593Smuzhiyunwith DWC3 and/or any endpoint.
198*4882a593Smuzhiyun
199*4882a593SmuzhiyunOn DWC3's ``DebugFS`` directory, you will find the following files and
200*4882a593Smuzhiyundirectories:
201*4882a593Smuzhiyun
202*4882a593Smuzhiyun``ep[0..15]{in,out}/``
203*4882a593Smuzhiyun``link_state``
204*4882a593Smuzhiyun``regdump``
205*4882a593Smuzhiyun``testmode``
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun``link_state``
208*4882a593Smuzhiyun``````````````
209*4882a593Smuzhiyun
210*4882a593SmuzhiyunWhen read, ``link_state`` will print out one of ``U0``, ``U1``,
211*4882a593Smuzhiyun``U2``, ``U3``, ``SS.Disabled``, ``RX.Detect``, ``SS.Inactive``,
212*4882a593Smuzhiyun``Polling``, ``Recovery``, ``Hot Reset``, ``Compliance``,
213*4882a593Smuzhiyun``Loopback``, ``Reset``, ``Resume`` or ``UNKNOWN link state``.
214*4882a593Smuzhiyun
215*4882a593SmuzhiyunThis file can also be written to in order to force link to one of the
216*4882a593Smuzhiyunstates above.
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun``regdump``
219*4882a593Smuzhiyun`````````````
220*4882a593Smuzhiyun
221*4882a593SmuzhiyunFile name is self-explanatory. When read, ``regdump`` will print out a
222*4882a593Smuzhiyunregister dump of DWC3. Note that this file can be grepped to find the
223*4882a593Smuzhiyuninformation you want.
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun``testmode``
226*4882a593Smuzhiyun``````````````
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunWhen read, ``testmode`` will print out a name of one of the specified
229*4882a593SmuzhiyunUSB 2.0 Testmodes (``test_j``, ``test_k``, ``test_se0_nak``,
230*4882a593Smuzhiyun``test_packet``, ``test_force_enable``) or the string ``no test`` in
231*4882a593Smuzhiyuncase no tests are currently being executed.
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunIn order to start any of these test modes, the same strings can be
234*4882a593Smuzhiyunwritten to the file and DWC3 will enter the requested test mode.
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun``ep[0..15]{in,out}``
238*4882a593Smuzhiyun``````````````````````
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunFor each endpoint we expose one directory following the naming
241*4882a593Smuzhiyunconvention ``ep$num$dir`` *(ep0in, ep0out, ep1in, ...)*. Inside each
242*4882a593Smuzhiyunof these directories you will find the following files:
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun``descriptor_fetch_queue``
245*4882a593Smuzhiyun``event_queue``
246*4882a593Smuzhiyun``rx_fifo_queue``
247*4882a593Smuzhiyun``rx_info_queue``
248*4882a593Smuzhiyun``rx_request_queue``
249*4882a593Smuzhiyun``transfer_type``
250*4882a593Smuzhiyun``trb_ring``
251*4882a593Smuzhiyun``tx_fifo_queue``
252*4882a593Smuzhiyun``tx_request_queue``
253*4882a593Smuzhiyun
254*4882a593SmuzhiyunWith access to Synopsys Databook, you can decode the information on
255*4882a593Smuzhiyunthem.
256*4882a593Smuzhiyun
257*4882a593Smuzhiyun``transfer_type``
258*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunWhen read, ``transfer_type`` will print out one of ``control``,
261*4882a593Smuzhiyun``bulk``, ``interrupt`` or ``isochronous`` depending on what the
262*4882a593Smuzhiyunendpoint descriptor says. If the endpoint hasn't been enabled yet, it
263*4882a593Smuzhiyunwill print ``--``.
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun``trb_ring``
266*4882a593Smuzhiyun~~~~~~~~~~~~~
267*4882a593Smuzhiyun
268*4882a593SmuzhiyunWhen read, ``trb_ring`` will print out details about all TRBs on the
269*4882a593Smuzhiyunring. It will also tell you where our enqueue and dequeue pointers are
270*4882a593Smuzhiyunlocated in the ring:
271*4882a593Smuzhiyun
272*4882a593Smuzhiyun.. code-block:: sh
273*4882a593Smuzhiyun
274*4882a593Smuzhiyun		buffer_addr,size,type,ioc,isp_imi,csp,chn,lst,hwo
275*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
276*4882a593Smuzhiyun		000000002c75c000,481,normal,1,0,1,0,0,0
277*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
278*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
279*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
280*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
281*4882a593Smuzhiyun		000000002c75c000,481,normal,1,0,1,0,0,0
282*4882a593Smuzhiyun		000000002c784000,481,normal,1,0,1,0,0,0
283*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
284*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
285*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
286*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
287*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
288*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
289*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
290*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
291*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
292*4882a593Smuzhiyun		000000002c784000,481,normal,1,0,1,0,0,0
293*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
294*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
295*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
296*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
297*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
298*4882a593Smuzhiyun		000000002c784000,481,normal,1,0,1,0,0,0
299*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
300*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
301*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
302*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
303*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
304*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
305*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
306*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
307*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
308*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
309*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
310*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
311*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
312*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
313*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
314*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
315*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
316*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
317*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
318*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
319*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
320*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
321*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
322*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
323*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
324*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
325*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
326*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
327*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
328*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
329*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
330*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
331*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
332*4882a593Smuzhiyun		000000002c784000,481,normal,1,0,1,0,0,0
333*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
334*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
335*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
336*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
337*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
338*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
339*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
340*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
341*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
342*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
343*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
344*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
345*4882a593Smuzhiyun		000000002c75c000,481,normal,1,0,1,0,0,0
346*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
347*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
348*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
349*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
350*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
351*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
352*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
353*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
354*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
355*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
356*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
357*4882a593Smuzhiyun		000000002c75c000,481,normal,1,0,1,0,0,0
358*4882a593Smuzhiyun		000000002c780000,481,normal,1,0,1,0,0,0
359*4882a593Smuzhiyun		000000002c784000,481,normal,1,0,1,0,0,0
360*4882a593Smuzhiyun		000000002c788000,481,normal,1,0,1,0,0,0
361*4882a593Smuzhiyun		000000002c78c000,481,normal,1,0,1,0,0,0
362*4882a593Smuzhiyun		000000002c790000,481,normal,1,0,1,0,0,0
363*4882a593Smuzhiyun		000000002c754000,481,normal,1,0,1,0,0,0
364*4882a593Smuzhiyun		000000002c758000,481,normal,1,0,1,0,0,0
365*4882a593Smuzhiyun		000000002c75c000,512,normal,1,0,1,0,0,1        D
366*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0       E
367*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
368*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
369*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
370*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
371*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
372*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
373*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
374*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
375*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
376*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
377*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
378*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
379*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
380*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
381*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
382*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
383*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
384*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
385*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
386*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
387*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
388*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
389*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
390*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
391*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
392*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
393*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
394*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
395*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
396*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
397*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
398*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
399*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
400*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
401*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
402*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
403*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
404*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
405*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
406*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
407*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
408*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
409*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
410*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
411*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
412*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
413*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
414*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
415*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
416*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
417*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
418*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
419*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
420*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
421*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
422*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
423*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
424*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
425*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
426*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
427*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
428*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
429*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
430*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
431*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
432*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
433*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
434*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
435*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
436*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
437*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
438*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
439*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
440*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
441*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
442*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
443*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
444*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
445*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
446*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
447*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
448*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
449*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
450*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
451*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
452*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
453*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
454*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
455*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
456*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
457*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
458*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
459*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
460*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
461*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
462*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
463*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
464*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
465*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
466*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
467*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
468*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
469*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
470*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
471*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
472*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
473*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
474*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
475*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
476*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
477*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
478*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
479*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
480*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
481*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
482*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
483*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
484*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
485*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
486*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
487*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
488*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
489*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
490*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
491*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
492*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
493*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
494*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
495*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
496*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
497*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
498*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
499*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
500*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
501*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
502*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
503*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
504*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
505*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
506*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
507*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
508*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
509*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
510*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
511*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
512*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
513*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
514*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
515*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
516*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
517*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
518*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
519*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
520*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
521*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
522*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
523*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
524*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
525*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
526*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
527*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
528*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
529*4882a593Smuzhiyun		0000000000000000,0,UNKNOWN,0,0,0,0,0,0
530*4882a593Smuzhiyun		00000000381ab000,0,link,0,0,0,0,0,1
531*4882a593Smuzhiyun
532*4882a593Smuzhiyun
533*4882a593SmuzhiyunTrace Events
534*4882a593Smuzhiyun-------------
535*4882a593Smuzhiyun
536*4882a593SmuzhiyunDWC3 also provides several trace events which help us gathering
537*4882a593Smuzhiyuninformation about the behavior of the driver during runtime.
538*4882a593Smuzhiyun
539*4882a593SmuzhiyunIn order to use these events, you must enable ``CONFIG_FTRACE`` in
540*4882a593Smuzhiyunyour kernel config.
541*4882a593Smuzhiyun
542*4882a593SmuzhiyunFor details about how enable DWC3 events, see section **Reporting
543*4882a593SmuzhiyunBugs**.
544*4882a593Smuzhiyun
545*4882a593SmuzhiyunThe following subsections will give details about each Event Class and
546*4882a593Smuzhiyuneach Event defined by DWC3.
547*4882a593Smuzhiyun
548*4882a593SmuzhiyunMMIO
549*4882a593Smuzhiyun```````
550*4882a593Smuzhiyun
551*4882a593SmuzhiyunIt is sometimes useful to look at every MMIO access when looking for
552*4882a593Smuzhiyunbugs. Because of that, DWC3 offers two Trace Events (one for
553*4882a593Smuzhiyundwc3_readl() and one for dwc3_writel()). ``TP_printk`` follows::
554*4882a593Smuzhiyun
555*4882a593Smuzhiyun  TP_printk("addr %p value %08x", __entry->base + __entry->offset,
556*4882a593Smuzhiyun  		__entry->value)
557*4882a593Smuzhiyun
558*4882a593SmuzhiyunInterrupt Events
559*4882a593Smuzhiyun````````````````
560*4882a593Smuzhiyun
561*4882a593SmuzhiyunEvery IRQ event can be logged and decoded into a human readable
562*4882a593Smuzhiyunstring. Because every event will be different, we don't give an
563*4882a593Smuzhiyunexample other than the ``TP_printk`` format used::
564*4882a593Smuzhiyun
565*4882a593Smuzhiyun  TP_printk("event (%08x): %s", __entry->event,
566*4882a593Smuzhiyun  		dwc3_decode_event(__entry->event, __entry->ep0state))
567*4882a593Smuzhiyun
568*4882a593SmuzhiyunControl Request
569*4882a593Smuzhiyun`````````````````
570*4882a593Smuzhiyun
571*4882a593SmuzhiyunEvery USB Control Request can be logged to the trace buffer. The
572*4882a593Smuzhiyunoutput format is::
573*4882a593Smuzhiyun
574*4882a593Smuzhiyun  TP_printk("%s", dwc3_decode_ctrl(__entry->bRequestType,
575*4882a593Smuzhiyun  				__entry->bRequest, __entry->wValue,
576*4882a593Smuzhiyun  				__entry->wIndex, __entry->wLength)
577*4882a593Smuzhiyun  )
578*4882a593Smuzhiyun
579*4882a593SmuzhiyunNote that Standard Control Requests will be decoded into
580*4882a593Smuzhiyunhuman-readable strings with their respective arguments. Class and
581*4882a593SmuzhiyunVendor requests will be printed out a sequence of 8 bytes in hex
582*4882a593Smuzhiyunformat.
583*4882a593Smuzhiyun
584*4882a593SmuzhiyunLifetime of a ``struct usb_request``
585*4882a593Smuzhiyun```````````````````````````````````````
586*4882a593Smuzhiyun
587*4882a593SmuzhiyunThe entire lifetime of a ``struct usb_request`` can be tracked on the
588*4882a593Smuzhiyuntrace buffer. We have one event for each of allocation, free,
589*4882a593Smuzhiyunqueueing, dequeueing, and giveback. Output format is::
590*4882a593Smuzhiyun
591*4882a593Smuzhiyun  TP_printk("%s: req %p length %u/%u %s%s%s ==> %d",
592*4882a593Smuzhiyun  	__get_str(name), __entry->req, __entry->actual, __entry->length,
593*4882a593Smuzhiyun  	__entry->zero ? "Z" : "z",
594*4882a593Smuzhiyun  	__entry->short_not_ok ? "S" : "s",
595*4882a593Smuzhiyun  	__entry->no_interrupt ? "i" : "I",
596*4882a593Smuzhiyun  	__entry->status
597*4882a593Smuzhiyun  )
598*4882a593Smuzhiyun
599*4882a593SmuzhiyunGeneric Commands
600*4882a593Smuzhiyun````````````````````
601*4882a593Smuzhiyun
602*4882a593SmuzhiyunWe can log and decode every Generic Command with its completion
603*4882a593Smuzhiyuncode. Format is::
604*4882a593Smuzhiyun
605*4882a593Smuzhiyun  TP_printk("cmd '%s' [%x] param %08x --> status: %s",
606*4882a593Smuzhiyun  	dwc3_gadget_generic_cmd_string(__entry->cmd),
607*4882a593Smuzhiyun  	__entry->cmd, __entry->param,
608*4882a593Smuzhiyun  	dwc3_gadget_generic_cmd_status_string(__entry->status)
609*4882a593Smuzhiyun  )
610*4882a593Smuzhiyun
611*4882a593SmuzhiyunEndpoint Commands
612*4882a593Smuzhiyun````````````````````
613*4882a593Smuzhiyun
614*4882a593SmuzhiyunEndpoints commands can also be logged together with completion
615*4882a593Smuzhiyuncode. Format is::
616*4882a593Smuzhiyun
617*4882a593Smuzhiyun  TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
618*4882a593Smuzhiyun  	__get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
619*4882a593Smuzhiyun  	__entry->cmd, __entry->param0,
620*4882a593Smuzhiyun  	__entry->param1, __entry->param2,
621*4882a593Smuzhiyun  	dwc3_ep_cmd_status_string(__entry->cmd_status)
622*4882a593Smuzhiyun  )
623*4882a593Smuzhiyun
624*4882a593SmuzhiyunLifetime of a ``TRB``
625*4882a593Smuzhiyun``````````````````````
626*4882a593Smuzhiyun
627*4882a593SmuzhiyunA ``TRB`` Lifetime is simple. We are either preparing a ``TRB`` or
628*4882a593Smuzhiyuncompleting it. With these two events, we can see how a ``TRB`` changes
629*4882a593Smuzhiyunover time. Format is::
630*4882a593Smuzhiyun
631*4882a593Smuzhiyun  TP_printk("%s: %d/%d trb %p buf %08x%08x size %s%d ctrl %08x (%c%c%c%c:%c%c:%s)",
632*4882a593Smuzhiyun  	__get_str(name), __entry->queued, __entry->allocated,
633*4882a593Smuzhiyun  	__entry->trb, __entry->bph, __entry->bpl,
634*4882a593Smuzhiyun  	({char *s;
635*4882a593Smuzhiyun  	int pcm = ((__entry->size >> 24) & 3) + 1;
636*4882a593Smuzhiyun  	switch (__entry->type) {
637*4882a593Smuzhiyun  	case USB_ENDPOINT_XFER_INT:
638*4882a593Smuzhiyun  	case USB_ENDPOINT_XFER_ISOC:
639*4882a593Smuzhiyun  		switch (pcm) {
640*4882a593Smuzhiyun  		case 1:
641*4882a593Smuzhiyun  			s = "1x ";
642*4882a593Smuzhiyun  			break;
643*4882a593Smuzhiyun  		case 2:
644*4882a593Smuzhiyun  			s = "2x ";
645*4882a593Smuzhiyun  			break;
646*4882a593Smuzhiyun  		case 3:
647*4882a593Smuzhiyun  			s = "3x ";
648*4882a593Smuzhiyun  			break;
649*4882a593Smuzhiyun  		}
650*4882a593Smuzhiyun  	default:
651*4882a593Smuzhiyun  		s = "";
652*4882a593Smuzhiyun  	} s; }),
653*4882a593Smuzhiyun  	DWC3_TRB_SIZE_LENGTH(__entry->size), __entry->ctrl,
654*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_HWO ? 'H' : 'h',
655*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_LST ? 'L' : 'l',
656*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_CHN ? 'C' : 'c',
657*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_CSP ? 'S' : 's',
658*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_ISP_IMI ? 'S' : 's',
659*4882a593Smuzhiyun  	__entry->ctrl & DWC3_TRB_CTRL_IOC ? 'C' : 'c',
660*4882a593Smuzhiyun      dwc3_trb_type_string(DWC3_TRBCTL_TYPE(__entry->ctrl))
661*4882a593Smuzhiyun  )
662*4882a593Smuzhiyun
663*4882a593SmuzhiyunLifetime of an Endpoint
664*4882a593Smuzhiyun```````````````````````
665*4882a593Smuzhiyun
666*4882a593SmuzhiyunAnd endpoint's lifetime is summarized with enable and disable
667*4882a593Smuzhiyunoperations, both of which can be traced. Format is::
668*4882a593Smuzhiyun
669*4882a593Smuzhiyun  TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c%c:%c:%c",
670*4882a593Smuzhiyun  	__get_str(name), __entry->maxpacket,
671*4882a593Smuzhiyun  	__entry->maxpacket_limit, __entry->max_streams,
672*4882a593Smuzhiyun  	__entry->maxburst, __entry->trb_enqueue,
673*4882a593Smuzhiyun  	__entry->trb_dequeue,
674*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_ENABLED ? 'E' : 'e',
675*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_STALL ? 'S' : 's',
676*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_WEDGE ? 'W' : 'w',
677*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b',
678*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
679*4882a593Smuzhiyun  	__entry->flags & DWC3_EP_END_TRANSFER_PENDING ? 'E' : 'e',
680*4882a593Smuzhiyun  	__entry->direction ? '<' : '>'
681*4882a593Smuzhiyun  )
682*4882a593Smuzhiyun
683*4882a593Smuzhiyun
684*4882a593SmuzhiyunStructures, Methods and Definitions
685*4882a593Smuzhiyun====================================
686*4882a593Smuzhiyun
687*4882a593Smuzhiyun.. kernel-doc:: drivers/usb/dwc3/core.h
688*4882a593Smuzhiyun   :doc: main data structures
689*4882a593Smuzhiyun   :internal:
690*4882a593Smuzhiyun
691*4882a593Smuzhiyun.. kernel-doc:: drivers/usb/dwc3/gadget.h
692*4882a593Smuzhiyun   :doc: gadget-only helpers
693*4882a593Smuzhiyun   :internal:
694*4882a593Smuzhiyun
695*4882a593Smuzhiyun.. kernel-doc:: drivers/usb/dwc3/gadget.c
696*4882a593Smuzhiyun   :doc: gadget-side implementation
697*4882a593Smuzhiyun   :internal:
698*4882a593Smuzhiyun
699*4882a593Smuzhiyun.. kernel-doc:: drivers/usb/dwc3/core.c
700*4882a593Smuzhiyun   :doc: core driver (probe, PM, etc)
701*4882a593Smuzhiyun   :internal:
702*4882a593Smuzhiyun
703*4882a593Smuzhiyun.. [#trb] Transfer Request Block
704*4882a593Smuzhiyun.. [#link_trb] Transfer Request Block pointing to another Transfer
705*4882a593Smuzhiyun	       Request Block.
706*4882a593Smuzhiyun.. [#debugfs] The Debug File System
707*4882a593Smuzhiyun.. [#configfs] The Config File System
708*4882a593Smuzhiyun.. [#cbw] Command Block Wrapper
709*4882a593Smuzhiyun.. _Linus' tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
710*4882a593Smuzhiyun.. _me: felipe.balbi@linux.intel.com
711*4882a593Smuzhiyun.. _linux-usb: linux-usb@vger.kernel.org
712