History log of /linux-master/drivers/usb/dwc3/debug.h
Revision Date Author Comments
# 92c08a84 24-Mar-2023 Elson Roy Serrao <quic_eserrao@quicinc.com>

usb: dwc3: Add function suspend and function wakeup support

USB host sends function suspend and function resume notifications to
the interface through SET_FEATURE/CLEAR_FEATURE setup packets.
Add support to handle these packets by delegating the requests to
composite layer. Also add support to handle function wake notification
requests to exit from function suspend state.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com>
Link: https://lore.kernel.org/r/1679694482-16430-5-git-send-email-quic_eserrao@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be308d68 02-Feb-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: dwc3: fix memory leak with using debugfs_lookup()

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Note, the root dentry for the debugfs directory for the device needs to
be saved so we don't have to keep looking it up, which required a bit
more refactoring to properly create and remove it when needed.

Reported-by: Bruce Chen <bruce.chen@unisoc.com>
Reported-by: Cixi Geng <cixi.geng1@unisoc.com>
Tested-by: Cixi Geng <gengcixi@gmail.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20230202152820.2409908-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 37a136aa 20-Jul-2022 Michael Grzeschik <m.grzeschik@pengutronix.de>

usb: dwc3: debug: show events parameters in hex

Printing the event parameters in decimal is not useful.
Print them in hex and make it more practical.

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


# 5ff90af9 29-May-2021 Jack Pham <jackp@codeaurora.org>

usb: dwc3: debugfs: Add and remove endpoint dirs dynamically

The DWC3 DebugFS directory and files are currently created once
during probe. This includes creation of subdirectories for each
of the gadget's endpoints. This works fine for peripheral-only
controllers, as dwc3_core_init_mode() calls dwc3_gadget_init()
just prior to calling dwc3_debugfs_init().

However, for dual-role controllers, dwc3_core_init_mode() will
instead call dwc3_drd_init() which is problematic in a few ways.
First, the initial state must be determined, then dwc3_set_mode()
will have to schedule drd_work and by then dwc3_debugfs_init()
could have already been invoked. Even if the initial mode is
peripheral, dwc3_gadget_init() happens after the DebugFS files
are created, and worse so if the initial state is host and the
controller switches to peripheral much later. And secondly,
even if the gadget endpoints' debug entries were successfully
created, if the controller exits peripheral mode, its dwc3_eps
are freed so the debug files would now hold stale references.

So it is best if the DebugFS endpoint entries are created and
removed dynamically at the same time the underlying dwc3_eps are.
Do this by calling dwc3_debugfs_create_endpoint_dir() as each
endpoint is created, and conversely remove the DebugFS entry when
the endpoint is freed.

Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly")
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Link: https://lore.kernel.org/r/20210529192932.22912-1-jackp@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8d396bb0 29-May-2021 Jack Pham <jackp@codeaurora.org>

usb: dwc3: debugfs: Add and remove endpoint dirs dynamically

The DWC3 DebugFS directory and files are currently created once
during probe. This includes creation of subdirectories for each
of the gadget's endpoints. This works fine for peripheral-only
controllers, as dwc3_core_init_mode() calls dwc3_gadget_init()
just prior to calling dwc3_debugfs_init().

However, for dual-role controllers, dwc3_core_init_mode() will
instead call dwc3_drd_init() which is problematic in a few ways.
First, the initial state must be determined, then dwc3_set_mode()
will have to schedule drd_work and by then dwc3_debugfs_init()
could have already been invoked. Even if the initial mode is
peripheral, dwc3_gadget_init() happens after the DebugFS files
are created, and worse so if the initial state is host and the
controller switches to peripheral much later. And secondly,
even if the gadget endpoints' debug entries were successfully
created, if the controller exits peripheral mode, its dwc3_eps
are freed so the debug files would now hold stale references.

So it is best if the DebugFS endpoint entries are created and
removed dynamically at the same time the underlying dwc3_eps are.
Do this by calling dwc3_debugfs_create_endpoint_dir() as each
endpoint is created, and conversely remove the DebugFS entry when
the endpoint is freed.

Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Link: https://lore.kernel.org/r/20210529192932.22912-1-jackp@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6f26ebb7 28-Apr-2021 Jack Pham <jackp@codeaurora.org>

usb: dwc3: gadget: Rename EOPF event macros to Suspend

The device event corresponding to End of Periodic Frame is only
found on older IP revisions (2.10a and prior, according to a
cursory SNPS databook search). On revisions 2.30a and newer,
including DWC3.1, the same event value and corresponding DEVTEN
bit were repurposed to indicate that the link has gone into
suspend state (U3 or L2/L1).

EOPF events had never been enabled before in this driver, and
going forward we expect current and future DWC3-based devices
won't likely to be using such old DWC3 IP revisions either.
Hence rather than keeping the deprecated EOPF macro names let's
rename them to indicate their usage for suspend events.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Link: https://lore.kernel.org/r/20210428090111.3370-2-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>


# 035cbca1 12-Aug-2020 Felipe Balbi <balbi@kernel.org>

usb: dwc3: debug: fix checkpatch warning

no functional changes

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


# 27c7ab0f 12-Aug-2020 Felipe Balbi <balbi@kernel.org>

usb: dwc3: debug: fix sparse warning

Fix the following sparse warning:

drivers/usb/dwc3/trace.c: note: in included file (through drivers/usb/dwc3/trace.h):
drivers/usb/dwc3/debug.h:374:39: warning: cast to non-scalar

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>


# 140ca4cf 05-May-2020 Thinh Nguyen <Thinh.Nguyen@synopsys.com>

usb: dwc3: gadget: Handle stream transfers

Overview of stream transfer requirement:
* A transfer will have a set of TRBs of the same stream ID.
* A transfer is started with a stream ID in START_TRANSFER command.
* A new stream will only start when the previous completes.

Overview of stream events:
* A "prime" from host indicates that its endpoints are active
(buffers prepared and ready to receive/transmit data). The controller
automatically initiates stream if it sees this.
* A "NoStream" rejection event indicates that the host isn't ready.
Host will put the endpoint back to idle state. Device may need to
reinitiate the stream to start transfer again.
* A Stream Found event means host accepted device initiated stream.
Nothing needs to be done from driver.

To initiate a stream, the driver will issue START_TRANSFER command with
a stream ID. To reinitiate the stream, the driver must issue
END_TRANSFER and restart the transfer with START_TRANSFER command with
the same stream ID.

This implementation handles device-initated streams (e.g. UASP driver).
It also handles some hosts' quirky behavior where they only prime each
endpoint once.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.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>


# 42cd5ffe 10-Feb-2020 Colin Ian King <colin.king@canonical.com>

usb: dwc3: debug: fix string position formatting mixup with ret and len

Currently the string formatting is mixing up the offset of ret and
len. Re-work the code to use just len, remove ret and use scnprintf
instead of snprintf and len position accumulation where required.
Remove the -ve return check since scnprintf never returns a failure
-ve size. Also break overly long lines to clean up checkpatch
warnings.

Addresses-Coverity: ("Unused value")
Fixes: 1381a5113caf ("usb: dwc3: debug: purge usage of strcat")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# b32196e3 10-Feb-2020 Colin Ian King <colin.king@canonical.com>

usb: dwc3: debug: fix string position formatting mixup with ret and len

Currently the string formatting is mixing up the offset of ret and
len. Re-work the code to use just len, remove ret and use scnprintf
instead of snprintf and len position accumulation where required.
Remove the -ve return check since scnprintf never returns a failure
-ve size. Also break overly long lines to clean up checkpatch
warnings.

Addresses-Coverity: ("Unused value")
Fixes: 1381a5113caf ("usb: dwc3: debug: purge usage of strcat")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200210095139.328711-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 038761ce 22-Oct-2019 Thinh Nguyen <Thinh.Nguyen@synopsys.com>

usb: dwc3: debug: Remove newline printout

The newline from the unknown link state tracepoint doesn't follow the
other tracepoints, and it looks unsightly. Let's remove it.

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


# 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>


# dd24f9b6 25-Apr-2019 Thinh Nguyen <Thinh.Nguyen@synopsys.com>

usb: dwc3: debug: Print GET_STATUS(device) tracepoint

DWC3 is missing the printing of control request GET_STATUS(device)
tracepoint. This patch prints that.

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


# 1381a511 05-Feb-2019 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: purge usage of strcat

Now that buffer size is always passed around, we don't need to rely on
strcat anymore.

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>


# 0d36dede 07-Nov-2018 Thinh Nguyen <thinh.nguyen@synopsys.com>

usb: dwc3: debugfs: Properly print/set link state for HS

Highspeed device and below has different state names than superspeed and
higher. Add proper checks and printouts of link states for highspeed and
below.

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


# e1d542f7 11-Apr-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: decode uFrame from event too

XferNotReady and XferInProgress give us the uFrame number we're
currently in. Printing that out on tracepoints may help us find bugs
in transfer scheduling.

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


# b27972b5 06-Apr-2018 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: trace: print out event status too

This will make it easier to figure out the reason for the event. That
information really helps debugging certain problems.

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


# 0c5d2954 09-Nov-2017 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: decode a few more features

We were missing U1, U2 and LTM Enable features. Let's decode them.

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>


# 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>


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

usb: dwc3: trace: purge dwc3_trace()

Finally get rid of dwc3_trace() hack. If any other
message is truly needed, we should add proper
tracepoints for them instead of hacking around with
dwc3_trace() or similar.

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


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

usb: dwc3: don't compile dwc3_trace() unless CONFIG_FTRACE=y

We don't need dwc3_trace() unless we're building a
kernel with CONFIG_FTRACE. This patch reduces
dwc3.ko text size a bit while also removing overhead
of dwc3_trace() calls.

text data bss dec hex filename
50796 581 0 51377 c8b1 drivers/usb/dwc3/dwc3.o
43961 581 0 44542 adfe drivers/usb/dwc3/dwc3.o.patched

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>


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

usb: dwc3: debug: move dwc3_ep0_state_string() to debug.h

We will be using dwc3_ep0_state_string() from within
our tracepoints, so we need to move that helper to
debug.h in order for it to be accessible.

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


# 45a2af2f 25-Sep-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: decode control endpoint phase too

DWC3 can tell us which phase of a setup transfer
we're getting into. Let's decode it from the event
to make it easier to debug.

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


# 696fe69d 24-Aug-2016 Felipe Balbi <felipe.balbi@linux.intel.com>

usb: dwc3: debug: fix ep name on trace output

There was a typo when generating endpoint name which
would be very confusing when debugging. Fix it.

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>


# 4e9f3118 12-Apr-2016 Changbin Du <changbin.du@intel.com>

usb: dwc3: make dwc3_debugfs_init return value be void

Debugfs init failure is not so important. We can continue our job on
this failure. Also no break need for debugfs_create_file call failure.

Signed-off-by: Du, Changbin <changbin.du@intel.com>

[felipe.balbi@linux.intel.com :
- remove out-of-memory message, we get that from OOM.
- switch dev_err() to dev_dbg() ]

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.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>


# e996061b 19-Aug-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: debug: add dwc3_gadget_event_type_string

this new helper will return a pretty string for
DWC3 Gadget Events.

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


# 80977dc9 19-Aug-2014 Felipe Balbi <balbi@ti.com>

usb: dwc3: move all string helper functions to debug.h

Those functions are only using within debugging
messages, grouping them into debug.h makes sense.

While at that, also add missing multiple inclusion
guard.

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


# 5945f789 30-Jun-2013 Felipe Balbi <balbi@ti.com>

usb: dwc3: switch to GPL v2 only

This is a Linux-only driver which makes use
of GPL-only symbols. It makes no sense to
maintain Dual BSD/GPL licensing for this driver.

Considering that the amount of work to use this
driver in any different operating system would likely
be as large as developing the driver from scratch and
considering that we depend on GPL-only symbols, we
will switch over to a GPL v2-only license.

Cc: Anton Tikhomirov <av.tikhomirov@samsung.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 49a25cc9 30-Sep-2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>

usb: dwc: remove "All rights reserved" statement.

Some people think that this line is not compatible with the GPL. The
statement was required due to the Buenos Aires Convention and is now
deprecated. I remove it because it is said that it is pointless nowdays.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 72246da4 19-Aug-2011 Felipe Balbi <balbi@ti.com>

usb: Introduce DesignWare USB3 DRD Driver

The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.

Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.

The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.

More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.

While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.

[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>