Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
42cd5ff
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
connector
counter
cpufreq
cpuidle
crypto
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
ide
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
mtd
mux
net
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sfi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
uio
usb
atm
c67x00
cdns3
chipidea
class
common
core
dwc2
dwc3
Kconfig
Makefile
core.c
core.h
debug.h
debugfs.c
drd.c
dwc3-exynos.c
dwc3-haps.c
dwc3-keystone.c
dwc3-meson-g12a.c
dwc3-of-simple.c
dwc3-omap.c
dwc3-pci.c
dwc3-qcom.c
dwc3-st.c
ep0.c
gadget.c
gadget.h
host.c
io.h
trace.c
trace.h
ulpi.c
early
gadget
host
image
isp1760
misc
mon
mtu3
musb
phy
renesas_usbhs
roles
serial
storage
typec
usbip
Kconfig
Makefile
usb-skeleton.c
vfio
vhost
video
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
usb
/
dwc3
/
debug.h
Copy path
Blame
Blame
Latest commit
History
History
420 lines (392 loc) · 10.1 KB
Breadcrumbs
linux
/
drivers
/
usb
/
dwc3
/
debug.h
Top
File metadata and controls
Code
Blame
420 lines (392 loc) · 10.1 KB
Raw
// SPDX-License-Identifier: GPL-2.0 /** * debug.h - DesignWare USB3 DRD Controller Debug Header * * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com * * Authors: Felipe Balbi <balbi@ti.com>, * Sebastian Andrzej Siewior <bigeasy@linutronix.de> */ #ifndef __DWC3_DEBUG_H #define __DWC3_DEBUG_H #include "core.h" /** * dwc3_gadget_ep_cmd_string - returns endpoint command string * @cmd: command code */ static inline const char * dwc3_gadget_ep_cmd_string(u8 cmd) { switch (cmd) { case DWC3_DEPCMD_DEPSTARTCFG: return "Start New Configuration"; case DWC3_DEPCMD_ENDTRANSFER: return "End Transfer"; case DWC3_DEPCMD_UPDATETRANSFER: return "Update Transfer"; case DWC3_DEPCMD_STARTTRANSFER: return "Start Transfer"; case DWC3_DEPCMD_CLEARSTALL: return "Clear Stall"; case DWC3_DEPCMD_SETSTALL: return "Set Stall"; case DWC3_DEPCMD_GETEPSTATE: return "Get Endpoint State"; case DWC3_DEPCMD_SETTRANSFRESOURCE: return "Set Endpoint Transfer Resource"; case DWC3_DEPCMD_SETEPCONFIG: return "Set Endpoint Configuration"; default: return "UNKNOWN command"; } } /** * dwc3_gadget_generic_cmd_string - returns generic command string * @cmd: command code */ static inline const char * dwc3_gadget_generic_cmd_string(u8 cmd) { switch (cmd) { case DWC3_DGCMD_SET_LMP: return "Set LMP"; case DWC3_DGCMD_SET_PERIODIC_PAR: return "Set Periodic Parameters"; case DWC3_DGCMD_XMIT_FUNCTION: return "Transmit Function Wake Device Notification"; case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO: return "Set Scratchpad Buffer Array Address Lo"; case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI: return "Set Scratchpad Buffer Array Address Hi"; case DWC3_DGCMD_SELECTED_FIFO_FLUSH: return "Selected FIFO Flush"; case DWC3_DGCMD_ALL_FIFO_FLUSH: return "All FIFO Flush"; case DWC3_DGCMD_SET_ENDPOINT_NRDY: return "Set Endpoint NRDY"; case DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK: return "Run SoC Bus Loopback Test"; default: return "UNKNOWN"; } } /** * dwc3_gadget_link_string - returns link name * @link_state: link state code */ static inline const char * dwc3_gadget_link_string(enum dwc3_link_state link_state) { switch (link_state) { case DWC3_LINK_STATE_U0: return "U0"; case DWC3_LINK_STATE_U1: return "U1"; case DWC3_LINK_STATE_U2: return "U2"; case DWC3_LINK_STATE_U3: return "U3"; case DWC3_LINK_STATE_SS_DIS: return "SS.Disabled"; case DWC3_LINK_STATE_RX_DET: return "RX.Detect"; case DWC3_LINK_STATE_SS_INACT: return "SS.Inactive"; case DWC3_LINK_STATE_POLL: return "Polling"; case DWC3_LINK_STATE_RECOV: return "Recovery"; case DWC3_LINK_STATE_HRESET: return "Hot Reset"; case DWC3_LINK_STATE_CMPLY: return "Compliance"; case DWC3_LINK_STATE_LPBK: return "Loopback"; case DWC3_LINK_STATE_RESET: return "Reset"; case DWC3_LINK_STATE_RESUME: return "Resume"; default: return "UNKNOWN link state"; } } /** * dwc3_gadget_hs_link_string - returns highspeed and below link name * @link_state: link state code */ static inline const char * dwc3_gadget_hs_link_string(enum dwc3_link_state link_state) { switch (link_state) { case DWC3_LINK_STATE_U0: return "On"; case DWC3_LINK_STATE_U2: return "Sleep"; case DWC3_LINK_STATE_U3: return "Suspend"; case DWC3_LINK_STATE_SS_DIS: return "Disconnected"; case DWC3_LINK_STATE_RX_DET: return "Early Suspend"; case DWC3_LINK_STATE_RECOV: return "Recovery"; case DWC3_LINK_STATE_RESET: return "Reset"; case DWC3_LINK_STATE_RESUME: return "Resume"; default: return "UNKNOWN link state"; } } /** * dwc3_trb_type_string - returns TRB type as a string * @type: the type of the TRB */ static inline const char *dwc3_trb_type_string(unsigned int type) { switch (type) { case DWC3_TRBCTL_NORMAL: return "normal"; case DWC3_TRBCTL_CONTROL_SETUP: return "setup"; case DWC3_TRBCTL_CONTROL_STATUS2: return "status2"; case DWC3_TRBCTL_CONTROL_STATUS3: return "status3"; case DWC3_TRBCTL_CONTROL_DATA: return "data"; case DWC3_TRBCTL_ISOCHRONOUS_FIRST: return "isoc-first"; case DWC3_TRBCTL_ISOCHRONOUS: return "isoc"; case DWC3_TRBCTL_LINK_TRB: return "link"; default: return "UNKNOWN"; } } static inline const char *dwc3_ep0_state_string(enum dwc3_ep0_state state) { switch (state) { case EP0_UNCONNECTED: return "Unconnected"; case EP0_SETUP_PHASE: return "Setup Phase"; case EP0_DATA_PHASE: return "Data Phase"; case EP0_STATUS_PHASE: return "Status Phase"; default: return "UNKNOWN"; } } /** * dwc3_gadget_event_string - returns event name * @event: the event code */ static inline const char *dwc3_gadget_event_string(char *str, size_t size, const struct dwc3_event_devt *event) { enum dwc3_link_state state = event->event_info & DWC3_LINK_STATE_MASK; switch (event->type) { case DWC3_DEVICE_EVENT_DISCONNECT: snprintf(str, size, "Disconnect: [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_RESET: snprintf(str, size, "Reset [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_CONNECT_DONE: snprintf(str, size, "Connection Done [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE: snprintf(str, size, "Link Change [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_WAKEUP: snprintf(str, size, "WakeUp [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_EOPF: snprintf(str, size, "End-Of-Frame [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_SOF: snprintf(str, size, "Start-Of-Frame [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_ERRATIC_ERROR: snprintf(str, size, "Erratic Error [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_CMD_CMPL: snprintf(str, size, "Command Complete [%s]", dwc3_gadget_link_string(state)); break; case DWC3_DEVICE_EVENT_OVERFLOW: snprintf(str, size, "Overflow [%s]", dwc3_gadget_link_string(state)); break; default: snprintf(str, size, "UNKNOWN"); } return str; } /** * dwc3_ep_event_string - returns event name * @event: then event code */ static inline const char *dwc3_ep_event_string(char *str, size_t size, const struct dwc3_event_depevt *event, u32 ep0state) { u8 epnum = event->endpoint_number; size_t len; int status; len = scnprintf(str, size, "ep%d%s: ", epnum >> 1, (epnum & 1) ? "in" : "out"); status = event->status; switch (event->endpoint_event) { case DWC3_DEPEVT_XFERCOMPLETE: len += scnprintf(str + len, size - len, "Transfer Complete (%c%c%c)", status & DEPEVT_STATUS_SHORT ? 'S' : 's', status & DEPEVT_STATUS_IOC ? 'I' : 'i', status & DEPEVT_STATUS_LST ? 'L' : 'l'); if (epnum <= 1) scnprintf(str + len, size - len, " [%s]", dwc3_ep0_state_string(ep0state)); break; case DWC3_DEPEVT_XFERINPROGRESS: scnprintf(str + len, size - len, "Transfer In Progress [%d] (%c%c%c)", event->parameters, status & DEPEVT_STATUS_SHORT ? 'S' : 's', status & DEPEVT_STATUS_IOC ? 'I' : 'i', status & DEPEVT_STATUS_LST ? 'M' : 'm'); break; case DWC3_DEPEVT_XFERNOTREADY: len += scnprintf(str + len, size - len, "Transfer Not Ready [%d]%s", event->parameters, status & DEPEVT_STATUS_TRANSFER_ACTIVE ? " (Active)" : " (Not Active)"); /* Control Endpoints */ if (epnum <= 1) { int phase = DEPEVT_STATUS_CONTROL_PHASE(event->status); switch (phase) { case DEPEVT_STATUS_CONTROL_DATA: scnprintf(str + len, size - len, " [Data Phase]"); break; case DEPEVT_STATUS_CONTROL_STATUS: scnprintf(str + len, size - len, " [Status Phase]"); } } break; case DWC3_DEPEVT_RXTXFIFOEVT: scnprintf(str + len, size - len, "FIFO"); break; case DWC3_DEPEVT_STREAMEVT: status = event->status; switch (status) { case DEPEVT_STREAMEVT_FOUND: scnprintf(str + len, size - len, " Stream %d Found", event->parameters); break; case DEPEVT_STREAMEVT_NOTFOUND: default: scnprintf(str + len, size - len, " Stream Not Found"); break; } break; case DWC3_DEPEVT_EPCMDCMPLT: scnprintf(str + len, size - len, "Endpoint Command Complete"); break; default: scnprintf(str + len, size - len, "UNKNOWN"); } return str; } /** * dwc3_gadget_event_type_string - return event name * @event: the event code */ static inline const char *dwc3_gadget_event_type_string(u8 event) { switch (event) { case DWC3_DEVICE_EVENT_DISCONNECT: return "Disconnect"; case DWC3_DEVICE_EVENT_RESET: return "Reset"; case DWC3_DEVICE_EVENT_CONNECT_DONE: return "Connect Done"; case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE: return "Link Status Change"; case DWC3_DEVICE_EVENT_WAKEUP: return "Wake-Up"; case DWC3_DEVICE_EVENT_HIBER_REQ: return "Hibernation"; case DWC3_DEVICE_EVENT_EOPF: return "End of Periodic Frame"; case DWC3_DEVICE_EVENT_SOF: return "Start of Frame"; case DWC3_DEVICE_EVENT_ERRATIC_ERROR: return "Erratic Error"; case DWC3_DEVICE_EVENT_CMD_CMPL: return "Command Complete"; case DWC3_DEVICE_EVENT_OVERFLOW: return "Overflow"; default: return "UNKNOWN"; } } static inline const char *dwc3_decode_event(char *str, size_t size, u32 event, u32 ep0state) { const union dwc3_event evt = (union dwc3_event) event; if (evt.type.is_devspec) return dwc3_gadget_event_string(str, size, &evt.devt); else return dwc3_ep_event_string(str, size, &evt.depevt, ep0state); } static inline const char *dwc3_ep_cmd_status_string(int status) { switch (status) { case -ETIMEDOUT: return "Timed Out"; case 0: return "Successful"; case DEPEVT_TRANSFER_NO_RESOURCE: return "No Resource"; case DEPEVT_TRANSFER_BUS_EXPIRY: return "Bus Expiry"; default: return "UNKNOWN"; } } static inline const char *dwc3_gadget_generic_cmd_status_string(int status) { switch (status) { case -ETIMEDOUT: return "Timed Out"; case 0: return "Successful"; case 1: return "Error"; default: return "UNKNOWN"; } } #ifdef CONFIG_DEBUG_FS extern void dwc3_debugfs_init(struct dwc3 *); extern void dwc3_debugfs_exit(struct dwc3 *); #else static inline void dwc3_debugfs_init(struct dwc3 *d) { } static inline void dwc3_debugfs_exit(struct dwc3 *d) { } #endif #endif /* __DWC3_DEBUG_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
You can’t perform that action at this time.