History log of /linux-master/drivers/usb/dwc3/trace.h
Revision Date Author Comments
# f09d24aa 26-Feb-2023 Linyu Yuan <quic_linyyuan@quicinc.com>

usb: dwc3: change some trace event __dynamic_array() to __get_buf()

some __dynamic_array() buffer will only used at trace event output time,
change to __get_buf() which will allocate tempary trace seq buffer for
output purpose.

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/1677465850-1396-4-git-send-email-quic_linyyuan@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 808e8bff 20-Jul-2022 Michael Grzeschik <m.grzeschik@pengutronix.de>

usb: dwc3: trace: add Start of Frame Number to trace event

Having the Start of Frame Number in the trace data is useful for debugging.
This patch adds the (micro)frame number in which the last packet of the
TRB's buffer was transmitted or received to the trace output.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220720215113.1058313-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ab00a41e 26-May-2021 Mayank Rana <mrana@codeaurora.org>

usb: dwc3: trace: Remove unused fields in dwc3_log_trb

Commit 0bd0f6d201eb ("usb: dwc3: gadget: remove allocated/queued request
tracking") removed the allocated & queued fields from struct dwc3_ep
but neglected to also remove them from the dwc3_log_trb event class's
TP_STRUCT definition which are now unused. Remove them to save eight
bytes per trace event entry.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Link: https://lore.kernel.org/r/20210527012924.3596-1-jackp@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 27088e00 29-Mar-2021 Aditya Srivastava <yashsri421@gmail.com>

usb: dwc3: fix incorrect kernel-doc comment syntax in files

The opening comment mark '/**' is used for highlighting the beginning of
kernel-doc comments.
There are certain files in drivers/usb/dwc3, which follow this syntax,
but the content inside does not comply with kernel-doc.
Such lines were probably not meant for kernel-doc parsing, but are parsed
due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
causes unexpected warnings from kernel-doc.

E.g., presence of kernel-doc like comment in drivers/usb/dwc3/io.h at
header causes this warnings by kernel-doc:
"warning: expecting prototype for h(). Prototype was for __DRIVERS_USB_DWC3_IO_H() instead"

Similarly for other files too.

Provide a simple fix by replacing such occurrences with general comment
format, i.e. '/*', to prevent kernel-doc from parsing it.

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Link: https://lore.kernel.org/r/20210329135108.27128-1-yashsri421@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3fc63d07 24-Mar-2021 Thinh Nguyen <Thinh.Nguyen@synopsys.com>

usb: dwc3: trace: Print register read and write offset

Currently dwc3 only prints the virtual address of a register when doing
register read/write. However, these hashed addresses are difficult to read.
Also, since we use %p, we may get some useless (___ptrval___) prints if the
address is not randomized enough. Let's include the register offset to help
read the register read and write tracepoints.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/cb38aa7dec109a8965691b53039a8b317d026189.1616636706.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 159fdf29 12-Aug-2020 Felipe Balbi <balbi@kernel.org>

usb: dwc3: trace: fix checkpatch warnings

no functional changes

Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 10623b87 11-Jul-2020 Alexander A. Klimov <grandmaster@al2klimov.de>

usb: dwc3: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Link: https://lore.kernel.org/r/20200711135804.19735-1-grandmaster@al2klimov.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b33f69f5 28-Mar-2020 Nishad Kamdar <nishadkamdar@gmail.com>

USB: dwc3: Use the correct style for SPDX License Identifier

This patch corrects the SPDX License Identifier style in
header files related to DesignWare USB3 DRD Core Support.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 30ad6273 29-Jan-2020 Felipe Balbi <balbi@kernel.org>

usb: dwc3: trace: print enqueue/dequeue pointers too

By printing enqueue/dequeue pointers, we can make sure that our TRB
handling is correct. We've had a recent situation where we were not
always dequeueing all TRBs in an SG list and this helped figure out
what the problem was.

Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 91f255a2 25-Aug-2019 Pawel Laszczak <pawell@cadence.com>

usb: common: Separated decoding functions from dwc3 driver.

Patch moves some decoding functions from driver/usb/dwc3/debug.h driver
to driver/usb/common/debug.c file. These moved functions include:
dwc3_decode_get_status
dwc3_decode_set_clear_feature
dwc3_decode_set_address
dwc3_decode_get_set_descriptor
dwc3_decode_get_configuration
dwc3_decode_set_configuration
dwc3_decode_get_intf
dwc3_decode_set_intf
dwc3_decode_synch_frame
dwc3_decode_set_sel
dwc3_decode_set_isoch_delay
dwc3_decode_ctrl

These functions are used also in inroduced cdns3 driver.

All functions prefixes were changed from dwc3 to usb.
Also, function's parameters has been extended according to the name
of fields in standard SETUP packet.
Additionally, patch adds usb_decode_ctrl function to
include/linux/usb/ch9.h file.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 332694f8 04-Jul-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "usb:gadget Separated decoding functions from dwc3 driver."

This reverts commit 3db1b636c07e15ff7410db782832dc2e7ffd2bce.

It's broken.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3db1b636 02-Jul-2019 Pawel Laszczak <pawell@cadence.com>

usb:gadget Separated decoding functions from dwc3 driver.

Patch moves some decoding functions from driver/usb/dwc3/debug.h driver
to driver/usb/gadget/debug.c file. These moved functions include:
dwc3_decode_get_status
dwc3_decode_set_clear_feature
dwc3_decode_set_address
dwc3_decode_get_set_descriptor
dwc3_decode_get_configuration
dwc3_decode_set_configuration
dwc3_decode_get_intf
dwc3_decode_set_intf
dwc3_decode_synch_frame
dwc3_decode_set_sel
dwc3_decode_set_isoch_delay
dwc3_decode_ctrl

These functions are used also in inroduced cdns3 driver.

All functions prefixes were changed from dwc3 to usb.
Also, function's parameters has been extended according to the name
of fields in standard SETUP packet.
Additionally, patch adds usb_decode_ctrl function to
include/linux/usb/gadget.h file.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 7790b355 04-Feb-2019 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: pass trace buffer size to decoding functions

Instead of assuming that our buffer is big enough, let's pass the
buffer size around so printing functions can make sure they won't
overflow the buffer.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 3aec9915 21-Jan-2019 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING

Now that we modified the code to fix a race condition, it's clear that
DWC3_EP_END_TRANSFER_PENDING is unnecessary, considering that
DWC3_EP_TRANSFER_STARTED will remain set until End Transfer completes.

Tested-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 54d48183 03-Dec-2018 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

usb: dwc3: trace: add missing break statement to make compiler happy

The missed break statement in the outer switch makes the code fall through
always and thus always same value will be printed.

Besides that, compiler warns about missed fall through marker:

drivers/usb/dwc3/./trace.h: In function ‘trace_raw_output_dwc3_log_trb’:
drivers/usb/dwc3/./trace.h:246:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
switch (pcm) {
^~~~~~

Add the missing break statement to work correctly without compilation
warnings.

Fixes: fa8d965d736b ("usb: dwc3: trace: pretty print high-bandwidth transfers too")
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 15172652 14-Aug-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: log ep commands in hex

They are much more useful in hexadecimal than in decimal. Moreover,
generic commands are already logged in hex.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 4d588a14 29-Mar-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: remove duplicated missed isoc handling

Now, this part of the code is duplicated and brings no extra value to
the driver. Let's remove it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 5f2e7975 29-Mar-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: remove DWC3_EP_BUSY flag

It has no use anymore.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 0bd0f6d2 26-Mar-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: remove allocated/queued request tracking

That has never proven useful in any way. Just remove it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 204ec1af 30-Nov-2017 Vincent Pelletier <plr.vincent@gmail.com>

usb: dwc3: Make sparse a bit happier

Fixes the following warnings:
drivers/usb/dwc3/io.h:43:31: warning: incorrect type in argument 1 (different address spaces)
drivers/usb/dwc3/io.h:43:31: expected void *base
drivers/usb/dwc3/io.h:43:31: got void [noderef] <asn:2>*
drivers/usb/dwc3/io.h:62:32: warning: incorrect type in argument 1 (different address spaces)
drivers/usb/dwc3/io.h:62:32: expected void *base
drivers/usb/dwc3/io.h:62:32: got void [noderef] <asn:2>*

This fixes the noisiest ones as they get emitted multiple times.
A few warnings remain, for which the proper fix is less clear.

No behaviour change is expected.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# b5ea4757 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: dwc3: Remove redundant license text

Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# af32423a 26-Apr-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: decode ctrl request

Instead of *always* dumping raw ctrl bytes, let's decode standard
requests which will make the lives of those debugging DWC3 quite a bit
easier.

Output will now look like so:

irq/34-dwc3-1594 [000] d..1 107.573081: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 107.573694: dwc3_ctrl_req: Set Address(Addr = 01)
irq/34-dwc3-1594 [000] d..1 107.588319: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 107.588816: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
irq/34-dwc3-1594 [000] d..1 107.589191: dwc3_ctrl_req: Set Configuration(Config = 3)
irq/34-dwc3-1594 [000] d..1 107.589846: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 5)
irq/34-dwc3-1594 [000] d..1 107.590146: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 22)
irq/34-dwc3-1594 [000] d..1 107.590546: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
irq/34-dwc3-1594 [000] d..1 107.590840: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 69)
irq/34-dwc3-1594 [000] d..1 107.591138: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 9)
irq/34-dwc3-1594 [000] d..1 107.591541: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 32)
irq/34-dwc3-1594 [000] d..1 107.591834: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 114.701005: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 114.721080: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 114.722709: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 114.728979: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 114.730544: dwc3_ctrl_req: Get Device Qualifier Descriptor(Index = 0, Length = 10)
irq/34-dwc3-1594 [000] d..1 115.776018: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9)
irq/34-dwc3-1594 [000] d..1 115.776760: dwc3_ctrl_req: Set Configuration(Config = 0)
irq/34-dwc3-1594 [000] d..1 115.777676: dwc3_ctrl_req: Get Configuration(Length = 1)
irq/34-dwc3-1594 [000] d..1 115.924797: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18)
irq/34-dwc3-1594 [000] d..1 115.929025: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
irq/34-dwc3-1594 [000] d..1 115.929566: dwc3_ctrl_req: Get String Descriptor(Index = 1, Length = 500)
irq/34-dwc3-1594 [000] d..1 115.930911: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
irq/34-dwc3-1594 [000] d..1 115.931528: dwc3_ctrl_req: Get String Descriptor(Index = 2, Length = 500)
irq/34-dwc3-1594 [000] d..1 115.932950: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500)
irq/34-dwc3-1594 [000] d..1 115.933533: dwc3_ctrl_req: Get String Descriptor(Index = 3, Length = 500)

Note that Class and Vendor requests won't be decoded for obvious
reasons. Those will be printed as a raw sequence of bytes.

This patch has been tested against a normal host (both Linux and
Windows) and USB30CV Chapter 9 tests.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 3587f36a 28-Apr-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: remove static char buffer from dwc3_decode_event()

Instead, we can require caller to pass a buffer for the function to
use. This cleans things quite a bit.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# e42f09b8 27-Apr-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: rely on __string() and __assign_str()

Instead of going for a 512 byte buffer and using snprintf(), let's
rely on helps __string() and __assign_str() where possible.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# b5c7ed5c 31-Mar-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: expose dwc3_trb_type_string()

That helper can be used from our tracepoint interface with very minor
edits. Let's do so.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# aad7c259 22-Mar-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: change format for string to cmd trace

a %x is much easier for a human to parse when reading tracepoint
output. Let's change it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 05428ba9 28-Feb-2017 Lu Baolu <baolu.lu@linux.intel.com>

usb: dwc3: remove dwc3_log_msg trace class

dwc3_log_msg trace class isn't used any more. Suggest to remove it.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 2870e501 03-Nov-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: add a tracepoint for ep enable/disable

instead of using a simple trace_printk() wrapper,
let's add an actual tracepoint and print further
details about the endpoint being operated upon.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 4dd5a69e 30-Sep-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: add a proper tracepoint for reg accessors

We want to reduce the usage of dwc3_trace() in favor
of proper tracepoints which can be enabled/disabled
by the user. Let's start with our register
accessors.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# fa8d965d 28-Sep-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: pretty print high-bandwidth transfers too

In case of periodic transfers, let's pretty print
the size field as a multiplier followed by length,
such as :

3x 1024

instead of:

33555456

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 43c96be1 26-Sep-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: print out ep0state also from XferComplete

With this extra piece of information, it will be
easier to find mismatches between driver and HW.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 68d34c8a 30-May-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: keep track of allocated and queued reqs

We will be using this information to change how we
figure out when we need LST bit. For now, just
update our counters.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 96bedb63 23-May-2016 John Youn <johnyoun@synopsys.com>

usb: dwc3: Endianness issue on dwc3_log_ctrl

Sparse complains even though it looks ok. Probably it cannot detect that
the wValue, wIndex, and wLength are declared __le16 due to the macro
magic.

Redeclare them as CPU endianness and make the conversion on assignment.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 71f7e702 23-May-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: gadget: improve gcmd trace

Just like we did for endpoint commands, let's have a
single trace output for the command and its
status. This will improve trace readability

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 0933df15 23-May-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: print ep cmd status with a single trace

Instead of printing command's status with a separate
trace printout, let's print it within a single call.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# f75cacc4 23-May-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: fully decode IRQ events

This will make it more human-friendly to read trace
output from dwc3.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 22f2c619 20-May-2016 Janusz Dziedzic <januszx.dziedzic@linux.intel.com>

usb: dwc3: trace: pretty-print TRB's ctrl field

Improve trb tracing by showing trb flags, interrupts
trb type.

trb flags:
- h - hardware owner of descriptor
- l - last TRB
- c - chain buffers
- s - continue on short packet

interrupt flags:
- s - interrupt on short packet
- c - interrupt on complete

Capital letter means that bit is set, while
lowercase letter means bit is cleared.

Signed-off-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 46a01427 03-Dec-2015 Felipe Balbi <balbi@ti.com>

usb: dwc3: trace: show request flags

struct usb_request have 3 flags which might be
important to know about during debug. This patch
shows each of the 3 flags as a single letter:

z -> for zero
s -> short not okay
i -> interrupt

A capital letter means the feature is enabled
while a lower case letter means it is disabled;

Thus 'zsI' indicates that a ZLP is not needed,
that we can accept a short packet and interrupt
for this request should be enabled.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# 6bac4ff0 27-Jan-2015 Felipe Balbi <balbi@ti.com>

usb: dwc3: trace: add trace logs for core and gadget

Sometimes we want to just print a formatted
string without passing any extra data. The
following will be used for removing reliance
on dev_vdbg() from dwc3.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# a4722fd3 20-Nov-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: trace: don't save pointers

There was another instance where we were
holding pointers which could be long gone.

Fix that by caching only values pointed to
by such pointer.

Because no crash has been observed, this patch
will be sent on v3.19 merge window, instead of
-rc.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# dab716cd 24-Sep-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: trace: remove unnecessary newline character

tracing infrastructure already adds those for us.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# 4ac4fc93 17-Sep-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: trace: don't dereference pointers

The way trace works is that it won't decode strings
until we read the actual trace. Because of that, we
can't make assumptions of pointers still being valid
at the time we read the trace. In order to avoid that,
just copy all fields from every struct pointer we need
for our traces.

Ths patch fixes the following bug:

[ 2940.039229] Unable to handle kernel paging request at virtual address 814efa9e
[ 2940.046904] pgd = ec3dc000
[ 2940.049737] [814efa9e] *pgd=00000000
[ 2940.053552] Internal error: Oops: 5 [#1] SMP ARM
[ 2940.058379] Modules linked in: usb_f_acm u_serial g_serial usb_f_uac2 libcomposite configfs xhci_hcd dwc3 udc_core matrix_keypad dwc3_omap lis3lv02d_i2c lis3lv02d input_polldev [last unloaded: g_audio]
[ 2940.077238] CPU: 0 PID: 3020 Comm: tail Tainted: G W
3.17.0-rc5-dirty #1097
[ 2940.085596] task: ed1b1040 ti: ed07c000 task.ti: ed07c000
[ 2940.091258] PC is at strnlen+0x18/0x68
[ 2940.095177] LR is at 0xfffffffe
[ 2940.098454] pc : [<c0356df8>] lr : [<fffffffe>] psr: a0000013
[ 2940.098454] sp : ed07ddb0 ip : ed07ddc0 fp : ed07ddbc
[ 2940.110445] r10: c070ff70 r9 : ed07de70 r8 : 00000000
[ 2940.115906] r7 : 814efa9e r6 : ffffffff r5 : ed4b6087 r4 : ed4b50c7
[ 2940.122726] r3 : 00000000 r2 : 814efa9e r1 : ffffffff r0 : 814efa9e
[ 2940.129546] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 2940.137000] Control: 10c5387d Table: ac3dc059 DAC: 00000015
[ 2940.143006] Process tail (pid: 3020, stack limit = 0xed07c248)
[ 2940.149098] Stack: (0xed07ddb0 to 0xed07e000)
[ 2940.153660] dda0: ed07dde4 ed07ddc0 c0359628 c0356dec
[ 2940.162203] ddc0: 00000000 ed4b50c7 bf03ae9c ed4b6087 bf03ae9e 00000002 ed07de3c ed07dde8
[ 2940.170740] dde0: c035ab50 c0359600 ffffffff ffffffff ff0a0000 ffffffff ed07de30 ed4b5088
[ 2940.179275] de00: ed4b50c7 00000fc0 ff0a0004 ffffffff ed4b5088 ed4b5088 00000000 00001000
[ 2940.187810] de20: 00001008 00000fc0 ed4b5088 00000000 ed07de68 ed07de40 c00f1e64 c035a9c4
[ 2940.196341] de40: bf03dae0 ed07de70 ed4b4000 ec25b280 ed4b4000 ec25b280 bf03dae0 ed07de9c
[ 2940.204886] de60: ed07de78 bf033324 c00f1e0c bf03ae9c 814efa9e ed428bc0 814eca3e 00000000
[ 2940.213428] de80: 814eba3e ed4b4000 03bd1201 c0c34790 ed07ded4 ed07dea0 c00edc0c bf0332d0
[ 2940.221994] dea0: 000002c7 ed07df10 ed07decc ed07deb8 ed4b4000 0000209c ec278ac0 00000000
[ 2940.230536] dec0: 00002000 ec0db340 ed07def4 ed07ded8 c00ee7ec c00eda90 c00ee7b0 ec278ac0
[ 2940.239075] dee0: ed4b4000 000002d5 ed07df44 ed07def8 c018b8d0 c00ee7bc c0166d3c ec278af0
[ 2940.247621] df00: 0001f090 ed07df78 000002c7 00000000 000002c8 00000000 00000000 ec0db340
[ 2940.256173] df20: 0001f090 ed07df78 ec0db340 00002000 0001f090 00000000 ed07df74 ed07df48
[ 2940.264729] df40: c0166e98 c018b5f4 00000001 c018535c 000168c1 00000000 ec0db340 ec0db340
[ 2940.273284] df60: 00002000 0001f090 ed07dfa4 ed07df78 c01675c4 c0166e0c 000168c1 00000000
[ 2940.281829] df80: 00002000 0000000a 0001f090 00000003 c000f064 ed07c000 00000000 ed07dfa8
[ 2940.290365] dfa0: c000ede0 c0167584 00002000 0000000a 00000003 0001f090 00002000 00000000
[ 2940.298909] dfc0: 00002000 0000000a 0001f090 00000003 7fffe000 0001e1e0 00002004 0000002f
[ 2940.307445] dfe0: 00000000 beed38ec 000104c8 b6e6397c 40000010 00000003 00000000 00000000
[ 2940.315992] [<c0356df8>] (strnlen) from [<c0359628>] (string.isra.8+0x34/0xe8)
[ 2940.323534] [<c0359628>] (string.isra.8) from [<c035ab50>] (vsnprintf+0x198/0x3fc)
[ 2940.331461] [<c035ab50>] (vsnprintf) from [<c00f1e64>] (trace_seq_printf+0x68/0x94)
[ 2940.339494] [<c00f1e64>] (trace_seq_printf) from [<bf033324>] (ftrace_raw_output_dwc3_log_request+0x60/0x78 [dwc3])
[ 2940.350424] [<bf033324>] (ftrace_raw_output_dwc3_log_request [dwc3]) from [<c00edc0c>] (print_trace_line+0x188/0x418)
[ 2940.361507] [<c00edc0c>] (print_trace_line) from [<c00ee7ec>] (s_show+0x3c/0x12c)
[ 2940.369330] [<c00ee7ec>] (s_show) from [<c018b8d0>] (seq_read+0x2e8/0x4a0)
[ 2940.376519] [<c018b8d0>] (seq_read) from [<c0166e98>] (vfs_read+0x98/0x158)
[ 2940.383796] [<c0166e98>] (vfs_read) from [<c01675c4>] (SyS_read+0x4c/0xa0)
[ 2940.390981] [<c01675c4>] (SyS_read) from [<c000ede0>] (ret_fast_syscall+0x0/0x48)
[ 2940.398792] Code: e24cb004 e3510000 e241e001 0a000011 (e5d01000)
[ 2940.406980] ---[ end trace d8b38370fbb531f3 ]---

Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2c4cbe6e5 30-Apr-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: add tracepoints to aid debugging

When we're debugging hard-to-reproduce and time-sensitive
use cases, printk() poses too much overhead. That's when
the kernel's tracing infrastructure comes into play.

This patch implements a few initial tracepoints for the
dwc3 driver. More traces can be added as necessary in order
to ease the task of debugging dwc3.

Reviewed-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>