xref: /openbmc/linux/drivers/usb/dwc3/debug.h (revision 5b628549)
1 // SPDX-License-Identifier: GPL-2.0
2 /**
3  * debug.h - DesignWare USB3 DRD Controller Debug Header
4  *
5  * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
6  *
7  * Authors: Felipe Balbi <balbi@ti.com>,
8  *	    Sebastian Andrzej Siewior <bigeasy@linutronix.de>
9  */
10 
11 #ifndef __DWC3_DEBUG_H
12 #define __DWC3_DEBUG_H
13 
14 #include "core.h"
15 
16 /**
17  * dwc3_gadget_ep_cmd_string - returns endpoint command string
18  * @cmd: command code
19  */
20 static inline const char *
21 dwc3_gadget_ep_cmd_string(u8 cmd)
22 {
23 	switch (cmd) {
24 	case DWC3_DEPCMD_DEPSTARTCFG:
25 		return "Start New Configuration";
26 	case DWC3_DEPCMD_ENDTRANSFER:
27 		return "End Transfer";
28 	case DWC3_DEPCMD_UPDATETRANSFER:
29 		return "Update Transfer";
30 	case DWC3_DEPCMD_STARTTRANSFER:
31 		return "Start Transfer";
32 	case DWC3_DEPCMD_CLEARSTALL:
33 		return "Clear Stall";
34 	case DWC3_DEPCMD_SETSTALL:
35 		return "Set Stall";
36 	case DWC3_DEPCMD_GETEPSTATE:
37 		return "Get Endpoint State";
38 	case DWC3_DEPCMD_SETTRANSFRESOURCE:
39 		return "Set Endpoint Transfer Resource";
40 	case DWC3_DEPCMD_SETEPCONFIG:
41 		return "Set Endpoint Configuration";
42 	default:
43 		return "UNKNOWN command";
44 	}
45 }
46 
47 /**
48  * dwc3_gadget_generic_cmd_string - returns generic command string
49  * @cmd: command code
50  */
51 static inline const char *
52 dwc3_gadget_generic_cmd_string(u8 cmd)
53 {
54 	switch (cmd) {
55 	case DWC3_DGCMD_SET_LMP:
56 		return "Set LMP";
57 	case DWC3_DGCMD_SET_PERIODIC_PAR:
58 		return "Set Periodic Parameters";
59 	case DWC3_DGCMD_XMIT_FUNCTION:
60 		return "Transmit Function Wake Device Notification";
61 	case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO:
62 		return "Set Scratchpad Buffer Array Address Lo";
63 	case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI:
64 		return "Set Scratchpad Buffer Array Address Hi";
65 	case DWC3_DGCMD_SELECTED_FIFO_FLUSH:
66 		return "Selected FIFO Flush";
67 	case DWC3_DGCMD_ALL_FIFO_FLUSH:
68 		return "All FIFO Flush";
69 	case DWC3_DGCMD_SET_ENDPOINT_NRDY:
70 		return "Set Endpoint NRDY";
71 	case DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK:
72 		return "Run SoC Bus Loopback Test";
73 	default:
74 		return "UNKNOWN";
75 	}
76 }
77 
78 /**
79  * dwc3_gadget_link_string - returns link name
80  * @link_state: link state code
81  */
82 static inline const char *
83 dwc3_gadget_link_string(enum dwc3_link_state link_state)
84 {
85 	switch (link_state) {
86 	case DWC3_LINK_STATE_U0:
87 		return "U0";
88 	case DWC3_LINK_STATE_U1:
89 		return "U1";
90 	case DWC3_LINK_STATE_U2:
91 		return "U2";
92 	case DWC3_LINK_STATE_U3:
93 		return "U3";
94 	case DWC3_LINK_STATE_SS_DIS:
95 		return "SS.Disabled";
96 	case DWC3_LINK_STATE_RX_DET:
97 		return "RX.Detect";
98 	case DWC3_LINK_STATE_SS_INACT:
99 		return "SS.Inactive";
100 	case DWC3_LINK_STATE_POLL:
101 		return "Polling";
102 	case DWC3_LINK_STATE_RECOV:
103 		return "Recovery";
104 	case DWC3_LINK_STATE_HRESET:
105 		return "Hot Reset";
106 	case DWC3_LINK_STATE_CMPLY:
107 		return "Compliance";
108 	case DWC3_LINK_STATE_LPBK:
109 		return "Loopback";
110 	case DWC3_LINK_STATE_RESET:
111 		return "Reset";
112 	case DWC3_LINK_STATE_RESUME:
113 		return "Resume";
114 	default:
115 		return "UNKNOWN link state\n";
116 	}
117 }
118 
119 /**
120  * dwc3_gadget_hs_link_string - returns highspeed and below link name
121  * @link_state: link state code
122  */
123 static inline const char *
124 dwc3_gadget_hs_link_string(enum dwc3_link_state link_state)
125 {
126 	switch (link_state) {
127 	case DWC3_LINK_STATE_U0:
128 		return "On";
129 	case DWC3_LINK_STATE_U2:
130 		return "Sleep";
131 	case DWC3_LINK_STATE_U3:
132 		return "Suspend";
133 	case DWC3_LINK_STATE_SS_DIS:
134 		return "Disconnected";
135 	case DWC3_LINK_STATE_RX_DET:
136 		return "Early Suspend";
137 	case DWC3_LINK_STATE_RECOV:
138 		return "Recovery";
139 	case DWC3_LINK_STATE_RESET:
140 		return "Reset";
141 	case DWC3_LINK_STATE_RESUME:
142 		return "Resume";
143 	default:
144 		return "UNKNOWN link state\n";
145 	}
146 }
147 
148 /**
149  * dwc3_trb_type_string - returns TRB type as a string
150  * @type: the type of the TRB
151  */
152 static inline const char *dwc3_trb_type_string(unsigned int type)
153 {
154 	switch (type) {
155 	case DWC3_TRBCTL_NORMAL:
156 		return "normal";
157 	case DWC3_TRBCTL_CONTROL_SETUP:
158 		return "setup";
159 	case DWC3_TRBCTL_CONTROL_STATUS2:
160 		return "status2";
161 	case DWC3_TRBCTL_CONTROL_STATUS3:
162 		return "status3";
163 	case DWC3_TRBCTL_CONTROL_DATA:
164 		return "data";
165 	case DWC3_TRBCTL_ISOCHRONOUS_FIRST:
166 		return "isoc-first";
167 	case DWC3_TRBCTL_ISOCHRONOUS:
168 		return "isoc";
169 	case DWC3_TRBCTL_LINK_TRB:
170 		return "link";
171 	default:
172 		return "UNKNOWN";
173 	}
174 }
175 
176 static inline const char *dwc3_ep0_state_string(enum dwc3_ep0_state state)
177 {
178 	switch (state) {
179 	case EP0_UNCONNECTED:
180 		return "Unconnected";
181 	case EP0_SETUP_PHASE:
182 		return "Setup Phase";
183 	case EP0_DATA_PHASE:
184 		return "Data Phase";
185 	case EP0_STATUS_PHASE:
186 		return "Status Phase";
187 	default:
188 		return "UNKNOWN";
189 	}
190 }
191 
192 /**
193  * dwc3_gadget_event_string - returns event name
194  * @event: the event code
195  */
196 static inline const char *dwc3_gadget_event_string(char *str, size_t size,
197 		const struct dwc3_event_devt *event)
198 {
199 	enum dwc3_link_state state = event->event_info & DWC3_LINK_STATE_MASK;
200 
201 	switch (event->type) {
202 	case DWC3_DEVICE_EVENT_DISCONNECT:
203 		snprintf(str, size, "Disconnect: [%s]",
204 				dwc3_gadget_link_string(state));
205 		break;
206 	case DWC3_DEVICE_EVENT_RESET:
207 		snprintf(str, size, "Reset [%s]",
208 				dwc3_gadget_link_string(state));
209 		break;
210 	case DWC3_DEVICE_EVENT_CONNECT_DONE:
211 		snprintf(str, size, "Connection Done [%s]",
212 				dwc3_gadget_link_string(state));
213 		break;
214 	case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE:
215 		snprintf(str, size, "Link Change [%s]",
216 				dwc3_gadget_link_string(state));
217 		break;
218 	case DWC3_DEVICE_EVENT_WAKEUP:
219 		snprintf(str, size, "WakeUp [%s]",
220 				dwc3_gadget_link_string(state));
221 		break;
222 	case DWC3_DEVICE_EVENT_EOPF:
223 		snprintf(str, size, "End-Of-Frame [%s]",
224 				dwc3_gadget_link_string(state));
225 		break;
226 	case DWC3_DEVICE_EVENT_SOF:
227 		snprintf(str, size, "Start-Of-Frame [%s]",
228 				dwc3_gadget_link_string(state));
229 		break;
230 	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
231 		snprintf(str, size, "Erratic Error [%s]",
232 				dwc3_gadget_link_string(state));
233 		break;
234 	case DWC3_DEVICE_EVENT_CMD_CMPL:
235 		snprintf(str, size, "Command Complete [%s]",
236 				dwc3_gadget_link_string(state));
237 		break;
238 	case DWC3_DEVICE_EVENT_OVERFLOW:
239 		snprintf(str, size, "Overflow [%s]",
240 				dwc3_gadget_link_string(state));
241 		break;
242 	default:
243 		snprintf(str, size, "UNKNOWN");
244 	}
245 
246 	return str;
247 }
248 
249 static inline void dwc3_decode_get_status(__u8 t, __u16 i, __u16 l, char *str,
250 		size_t size)
251 {
252 	switch (t & USB_RECIP_MASK) {
253 	case USB_RECIP_INTERFACE:
254 		snprintf(str, size, "Get Interface Status(Intf = %d, Length = %d)",
255 				i, l);
256 		break;
257 	case USB_RECIP_ENDPOINT:
258 		snprintf(str, size, "Get Endpoint Status(ep%d%s)",
259 			i & ~USB_DIR_IN,
260 			i & USB_DIR_IN ? "in" : "out");
261 		break;
262 	}
263 }
264 
265 static inline void dwc3_decode_set_clear_feature(__u8 t, __u8 b, __u16 v,
266 		__u16 i, char *str, size_t size)
267 {
268 	switch (t & USB_RECIP_MASK) {
269 	case USB_RECIP_DEVICE:
270 		snprintf(str, size, "%s Device Feature(%s%s)",
271 			b == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set",
272 			({char *s;
273 				switch (v) {
274 				case USB_DEVICE_SELF_POWERED:
275 					s = "Self Powered";
276 					break;
277 				case USB_DEVICE_REMOTE_WAKEUP:
278 					s = "Remote Wakeup";
279 					break;
280 				case USB_DEVICE_TEST_MODE:
281 					s = "Test Mode";
282 					break;
283 				case USB_DEVICE_U1_ENABLE:
284 					s = "U1 Enable";
285 					break;
286 				case USB_DEVICE_U2_ENABLE:
287 					s = "U2 Enable";
288 					break;
289 				case USB_DEVICE_LTM_ENABLE:
290 					s = "LTM Enable";
291 					break;
292 				default:
293 					s = "UNKNOWN";
294 				} s; }),
295 			v == USB_DEVICE_TEST_MODE ?
296 			({ char *s;
297 				switch (i) {
298 				case TEST_J:
299 					s = ": TEST_J";
300 					break;
301 				case TEST_K:
302 					s = ": TEST_K";
303 					break;
304 				case TEST_SE0_NAK:
305 					s = ": TEST_SE0_NAK";
306 					break;
307 				case TEST_PACKET:
308 					s = ": TEST_PACKET";
309 					break;
310 				case TEST_FORCE_EN:
311 					s = ": TEST_FORCE_EN";
312 					break;
313 				default:
314 					s = ": UNKNOWN";
315 				} s; }) : "");
316 		break;
317 	case USB_RECIP_INTERFACE:
318 		snprintf(str, size, "%s Interface Feature(%s)",
319 			b == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set",
320 			v == USB_INTRF_FUNC_SUSPEND ?
321 			"Function Suspend" : "UNKNOWN");
322 		break;
323 	case USB_RECIP_ENDPOINT:
324 		snprintf(str, size, "%s Endpoint Feature(%s ep%d%s)",
325 			b == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set",
326 			v == USB_ENDPOINT_HALT ? "Halt" : "UNKNOWN",
327 			i & ~USB_DIR_IN,
328 			i & USB_DIR_IN ? "in" : "out");
329 		break;
330 	}
331 }
332 
333 static inline void dwc3_decode_set_address(__u16 v, char *str, size_t size)
334 {
335 	snprintf(str, size, "Set Address(Addr = %02x)", v);
336 }
337 
338 static inline void dwc3_decode_get_set_descriptor(__u8 t, __u8 b, __u16 v,
339 		__u16 i, __u16 l, char *str, size_t size)
340 {
341 	snprintf(str, size, "%s %s Descriptor(Index = %d, Length = %d)",
342 		b == USB_REQ_GET_DESCRIPTOR ? "Get" : "Set",
343 		({ char *s;
344 			switch (v >> 8) {
345 			case USB_DT_DEVICE:
346 				s = "Device";
347 				break;
348 			case USB_DT_CONFIG:
349 				s = "Configuration";
350 				break;
351 			case USB_DT_STRING:
352 				s = "String";
353 				break;
354 			case USB_DT_INTERFACE:
355 				s = "Interface";
356 				break;
357 			case USB_DT_ENDPOINT:
358 				s = "Endpoint";
359 				break;
360 			case USB_DT_DEVICE_QUALIFIER:
361 				s = "Device Qualifier";
362 				break;
363 			case USB_DT_OTHER_SPEED_CONFIG:
364 				s = "Other Speed Config";
365 				break;
366 			case USB_DT_INTERFACE_POWER:
367 				s = "Interface Power";
368 				break;
369 			case USB_DT_OTG:
370 				s = "OTG";
371 				break;
372 			case USB_DT_DEBUG:
373 				s = "Debug";
374 				break;
375 			case USB_DT_INTERFACE_ASSOCIATION:
376 				s = "Interface Association";
377 				break;
378 			case USB_DT_BOS:
379 				s = "BOS";
380 				break;
381 			case USB_DT_DEVICE_CAPABILITY:
382 				s = "Device Capability";
383 				break;
384 			case USB_DT_PIPE_USAGE:
385 				s = "Pipe Usage";
386 				break;
387 			case USB_DT_SS_ENDPOINT_COMP:
388 				s = "SS Endpoint Companion";
389 				break;
390 			case USB_DT_SSP_ISOC_ENDPOINT_COMP:
391 				s = "SSP Isochronous Endpoint Companion";
392 				break;
393 			default:
394 				s = "UNKNOWN";
395 				break;
396 			} s; }), v & 0xff, l);
397 }
398 
399 
400 static inline void dwc3_decode_get_configuration(__u16 l, char *str,
401 		size_t size)
402 {
403 	snprintf(str, size, "Get Configuration(Length = %d)", l);
404 }
405 
406 static inline void dwc3_decode_set_configuration(__u8 v, char *str, size_t size)
407 {
408 	snprintf(str, size, "Set Configuration(Config = %d)", v);
409 }
410 
411 static inline void dwc3_decode_get_intf(__u16 i, __u16 l, char *str,
412 		size_t size)
413 {
414 	snprintf(str, size, "Get Interface(Intf = %d, Length = %d)", i, l);
415 }
416 
417 static inline void dwc3_decode_set_intf(__u8 v, __u16 i, char *str, size_t size)
418 {
419 	snprintf(str, size, "Set Interface(Intf = %d, Alt.Setting = %d)", i, v);
420 }
421 
422 static inline void dwc3_decode_synch_frame(__u16 i, __u16 l, char *str,
423 		size_t size)
424 {
425 	snprintf(str, size, "Synch Frame(Endpoint = %d, Length = %d)", i, l);
426 }
427 
428 static inline void dwc3_decode_set_sel(__u16 l, char *str, size_t size)
429 {
430 	snprintf(str, size, "Set SEL(Length = %d)", l);
431 }
432 
433 static inline void dwc3_decode_set_isoch_delay(__u8 v, char *str, size_t size)
434 {
435 	snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", v);
436 }
437 
438 /**
439  * dwc3_decode_ctrl - returns a string represetion of ctrl request
440  */
441 static inline const char *dwc3_decode_ctrl(char *str, size_t size,
442 		__u8 bRequestType, __u8 bRequest, __u16 wValue, __u16 wIndex,
443 		__u16 wLength)
444 {
445 	switch (bRequest) {
446 	case USB_REQ_GET_STATUS:
447 		dwc3_decode_get_status(bRequestType, wIndex, wLength, str,
448 				size);
449 		break;
450 	case USB_REQ_CLEAR_FEATURE:
451 	case USB_REQ_SET_FEATURE:
452 		dwc3_decode_set_clear_feature(bRequestType, bRequest, wValue,
453 				wIndex, str, size);
454 		break;
455 	case USB_REQ_SET_ADDRESS:
456 		dwc3_decode_set_address(wValue, str, size);
457 		break;
458 	case USB_REQ_GET_DESCRIPTOR:
459 	case USB_REQ_SET_DESCRIPTOR:
460 		dwc3_decode_get_set_descriptor(bRequestType, bRequest, wValue,
461 				wIndex, wLength, str, size);
462 		break;
463 	case USB_REQ_GET_CONFIGURATION:
464 		dwc3_decode_get_configuration(wLength, str, size);
465 		break;
466 	case USB_REQ_SET_CONFIGURATION:
467 		dwc3_decode_set_configuration(wValue, str, size);
468 		break;
469 	case USB_REQ_GET_INTERFACE:
470 		dwc3_decode_get_intf(wIndex, wLength, str, size);
471 		break;
472 	case USB_REQ_SET_INTERFACE:
473 		dwc3_decode_set_intf(wValue, wIndex, str, size);
474 		break;
475 	case USB_REQ_SYNCH_FRAME:
476 		dwc3_decode_synch_frame(wIndex, wLength, str, size);
477 		break;
478 	case USB_REQ_SET_SEL:
479 		dwc3_decode_set_sel(wLength, str, size);
480 		break;
481 	case USB_REQ_SET_ISOCH_DELAY:
482 		dwc3_decode_set_isoch_delay(wValue, str, size);
483 		break;
484 	default:
485 		snprintf(str, size, "%02x %02x %02x %02x %02x %02x %02x %02x",
486 			bRequestType, bRequest,
487 			cpu_to_le16(wValue) & 0xff,
488 			cpu_to_le16(wValue) >> 8,
489 			cpu_to_le16(wIndex) & 0xff,
490 			cpu_to_le16(wIndex) >> 8,
491 			cpu_to_le16(wLength) & 0xff,
492 			cpu_to_le16(wLength) >> 8);
493 	}
494 
495 	return str;
496 }
497 
498 /**
499  * dwc3_ep_event_string - returns event name
500  * @event: then event code
501  */
502 static inline const char *dwc3_ep_event_string(char *str, size_t size,
503 		const struct dwc3_event_depevt *event, u32 ep0state)
504 {
505 	u8 epnum = event->endpoint_number;
506 	size_t len;
507 	int status;
508 	int ret;
509 
510 	ret = snprintf(str, size, "ep%d%s: ", epnum >> 1,
511 			(epnum & 1) ? "in" : "out");
512 	if (ret < 0)
513 		return "UNKNOWN";
514 
515 	status = event->status;
516 
517 	switch (event->endpoint_event) {
518 	case DWC3_DEPEVT_XFERCOMPLETE:
519 		len = strlen(str);
520 		snprintf(str + len, size - len, "Transfer Complete (%c%c%c)",
521 				status & DEPEVT_STATUS_SHORT ? 'S' : 's',
522 				status & DEPEVT_STATUS_IOC ? 'I' : 'i',
523 				status & DEPEVT_STATUS_LST ? 'L' : 'l');
524 
525 		len = strlen(str);
526 
527 		if (epnum <= 1)
528 			snprintf(str + len, size - len, " [%s]",
529 					dwc3_ep0_state_string(ep0state));
530 		break;
531 	case DWC3_DEPEVT_XFERINPROGRESS:
532 		len = strlen(str);
533 
534 		snprintf(str + len, size - len, "Transfer In Progress [%d] (%c%c%c)",
535 				event->parameters,
536 				status & DEPEVT_STATUS_SHORT ? 'S' : 's',
537 				status & DEPEVT_STATUS_IOC ? 'I' : 'i',
538 				status & DEPEVT_STATUS_LST ? 'M' : 'm');
539 		break;
540 	case DWC3_DEPEVT_XFERNOTREADY:
541 		len = strlen(str);
542 
543 		snprintf(str + len, size - len, "Transfer Not Ready [%d]%s",
544 				event->parameters,
545 				status & DEPEVT_STATUS_TRANSFER_ACTIVE ?
546 				" (Active)" : " (Not Active)");
547 
548 		len = strlen(str);
549 
550 		/* Control Endpoints */
551 		if (epnum <= 1) {
552 			int phase = DEPEVT_STATUS_CONTROL_PHASE(event->status);
553 
554 			switch (phase) {
555 			case DEPEVT_STATUS_CONTROL_DATA:
556 				snprintf(str + ret, size - ret,
557 						" [Data Phase]");
558 				break;
559 			case DEPEVT_STATUS_CONTROL_STATUS:
560 				snprintf(str + ret, size - ret,
561 						" [Status Phase]");
562 			}
563 		}
564 		break;
565 	case DWC3_DEPEVT_RXTXFIFOEVT:
566 		snprintf(str + ret, size - ret, "FIFO");
567 		break;
568 	case DWC3_DEPEVT_STREAMEVT:
569 		status = event->status;
570 
571 		switch (status) {
572 		case DEPEVT_STREAMEVT_FOUND:
573 			snprintf(str + ret, size - ret, " Stream %d Found",
574 					event->parameters);
575 			break;
576 		case DEPEVT_STREAMEVT_NOTFOUND:
577 		default:
578 			snprintf(str + ret, size - ret, " Stream Not Found");
579 			break;
580 		}
581 
582 		break;
583 	case DWC3_DEPEVT_EPCMDCMPLT:
584 		snprintf(str + ret, size - ret, "Endpoint Command Complete");
585 		break;
586 	default:
587 		snprintf(str, size, "UNKNOWN");
588 	}
589 
590 	return str;
591 }
592 
593 /**
594  * dwc3_gadget_event_type_string - return event name
595  * @event: the event code
596  */
597 static inline const char *dwc3_gadget_event_type_string(u8 event)
598 {
599 	switch (event) {
600 	case DWC3_DEVICE_EVENT_DISCONNECT:
601 		return "Disconnect";
602 	case DWC3_DEVICE_EVENT_RESET:
603 		return "Reset";
604 	case DWC3_DEVICE_EVENT_CONNECT_DONE:
605 		return "Connect Done";
606 	case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE:
607 		return "Link Status Change";
608 	case DWC3_DEVICE_EVENT_WAKEUP:
609 		return "Wake-Up";
610 	case DWC3_DEVICE_EVENT_HIBER_REQ:
611 		return "Hibernation";
612 	case DWC3_DEVICE_EVENT_EOPF:
613 		return "End of Periodic Frame";
614 	case DWC3_DEVICE_EVENT_SOF:
615 		return "Start of Frame";
616 	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
617 		return "Erratic Error";
618 	case DWC3_DEVICE_EVENT_CMD_CMPL:
619 		return "Command Complete";
620 	case DWC3_DEVICE_EVENT_OVERFLOW:
621 		return "Overflow";
622 	default:
623 		return "UNKNOWN";
624 	}
625 }
626 
627 static inline const char *dwc3_decode_event(char *str, size_t size, u32 event,
628 		u32 ep0state)
629 {
630 	const union dwc3_event evt = (union dwc3_event) event;
631 
632 	if (evt.type.is_devspec)
633 		return dwc3_gadget_event_string(str, size, &evt.devt);
634 	else
635 		return dwc3_ep_event_string(str, size, &evt.depevt, ep0state);
636 }
637 
638 static inline const char *dwc3_ep_cmd_status_string(int status)
639 {
640 	switch (status) {
641 	case -ETIMEDOUT:
642 		return "Timed Out";
643 	case 0:
644 		return "Successful";
645 	case DEPEVT_TRANSFER_NO_RESOURCE:
646 		return "No Resource";
647 	case DEPEVT_TRANSFER_BUS_EXPIRY:
648 		return "Bus Expiry";
649 	default:
650 		return "UNKNOWN";
651 	}
652 }
653 
654 static inline const char *dwc3_gadget_generic_cmd_status_string(int status)
655 {
656 	switch (status) {
657 	case -ETIMEDOUT:
658 		return "Timed Out";
659 	case 0:
660 		return "Successful";
661 	case 1:
662 		return "Error";
663 	default:
664 		return "UNKNOWN";
665 	}
666 }
667 
668 
669 #ifdef CONFIG_DEBUG_FS
670 extern void dwc3_debugfs_init(struct dwc3 *);
671 extern void dwc3_debugfs_exit(struct dwc3 *);
672 #else
673 static inline void dwc3_debugfs_init(struct dwc3 *d)
674 {  }
675 static inline void dwc3_debugfs_exit(struct dwc3 *d)
676 {  }
677 #endif
678 #endif /* __DWC3_DEBUG_H */
679