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