aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-05-23 07:02:33 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-20 05:32:40 -0400
commit0933df159c5c82f97c6bb811b149fa1158a26087 (patch)
tree4961d2b608d9804c972167909adbb78cde3f9d11
parentf6bb225bb3ca7988ff373c62cc298e56cae1eee5 (diff)
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>
-rw-r--r--drivers/usb/dwc3/debug.h16
-rw-r--r--drivers/usb/dwc3/gadget.c8
-rw-r--r--drivers/usb/dwc3/trace.h15
3 files changed, 30 insertions, 9 deletions
diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
index e3e0b4111c53..8eed4c7cc76b 100644
--- a/drivers/usb/dwc3/debug.h
+++ b/drivers/usb/dwc3/debug.h
@@ -280,6 +280,22 @@ static inline const char *dwc3_decode_event(u32 event)
280 return dwc3_ep_event_string(&evt.depevt); 280 return dwc3_ep_event_string(&evt.depevt);
281} 281}
282 282
283static inline const char *dwc3_ep_cmd_status_string(int status)
284{
285 switch (status) {
286 case -ETIMEDOUT:
287 return "Timed Out";
288 case 0:
289 return "Successful";
290 case DEPEVT_TRANSFER_NO_RESOURCE:
291 return "No Resource";
292 case DEPEVT_TRANSFER_BUS_EXPIRY:
293 return "Bus Expiry";
294 default:
295 return "UNKNOWN";
296 }
297}
298
283void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...); 299void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...);
284 300
285#ifdef CONFIG_DEBUG_FS 301#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 25170fd5fbd4..42eefd7c99ef 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -248,11 +248,10 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
248 u32 timeout = 500; 248 u32 timeout = 500;
249 u32 reg; 249 u32 reg;
250 250
251 int cmd_status = 0;
251 int susphy = false; 252 int susphy = false;
252 int ret = -EINVAL; 253 int ret = -EINVAL;
253 254
254 trace_dwc3_gadget_ep_cmd(dep, cmd, params);
255
256 /* 255 /*
257 * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if 256 * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if
258 * we're issuing an endpoint command, we must check if 257 * we're issuing an endpoint command, we must check if
@@ -292,7 +291,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
292 do { 291 do {
293 reg = dwc3_readl(dep->regs, DWC3_DEPCMD); 292 reg = dwc3_readl(dep->regs, DWC3_DEPCMD);
294 if (!(reg & DWC3_DEPCMD_CMDACT)) { 293 if (!(reg & DWC3_DEPCMD_CMDACT)) {
295 int cmd_status = DWC3_DEPCMD_STATUS(reg); 294 cmd_status = DWC3_DEPCMD_STATUS(reg);
296 295
297 dwc3_trace(trace_dwc3_gadget, 296 dwc3_trace(trace_dwc3_gadget,
298 "Command Complete --> %d", 297 "Command Complete --> %d",
@@ -333,8 +332,11 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
333 dwc3_trace(trace_dwc3_gadget, 332 dwc3_trace(trace_dwc3_gadget,
334 "Command Timed Out"); 333 "Command Timed Out");
335 ret = -ETIMEDOUT; 334 ret = -ETIMEDOUT;
335 cmd_status = -ETIMEDOUT;
336 } 336 }
337 337
338 trace_dwc3_gadget_ep_cmd(dep, cmd, params, cmd_status);
339
338 if (unlikely(susphy)) { 340 if (unlikely(susphy)) {
339 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 341 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
340 reg |= DWC3_GUSB2PHYCFG_SUSPHY; 342 reg |= DWC3_GUSB2PHYCFG_SUSPHY;
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index 2389dd864ffb..040f28b27d56 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -190,14 +190,15 @@ DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
190 190
191DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, 191DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
192 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, 192 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
193 struct dwc3_gadget_ep_cmd_params *params), 193 struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
194 TP_ARGS(dep, cmd, params), 194 TP_ARGS(dep, cmd, params, cmd_status),
195 TP_STRUCT__entry( 195 TP_STRUCT__entry(
196 __dynamic_array(char, name, DWC3_MSG_MAX) 196 __dynamic_array(char, name, DWC3_MSG_MAX)
197 __field(unsigned int, cmd) 197 __field(unsigned int, cmd)
198 __field(u32, param0) 198 __field(u32, param0)
199 __field(u32, param1) 199 __field(u32, param1)
200 __field(u32, param2) 200 __field(u32, param2)
201 __field(int, cmd_status)
201 ), 202 ),
202 TP_fast_assign( 203 TP_fast_assign(
203 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); 204 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
@@ -205,18 +206,20 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
205 __entry->param0 = params->param0; 206 __entry->param0 = params->param0;
206 __entry->param1 = params->param1; 207 __entry->param1 = params->param1;
207 __entry->param2 = params->param2; 208 __entry->param2 = params->param2;
209 __entry->cmd_status = cmd_status;
208 ), 210 ),
209 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x", 211 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
210 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), 212 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
211 __entry->cmd, __entry->param0, 213 __entry->cmd, __entry->param0,
212 __entry->param1, __entry->param2 214 __entry->param1, __entry->param2,
215 dwc3_ep_cmd_status_string(__entry->cmd_status)
213 ) 216 )
214); 217);
215 218
216DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd, 219DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
217 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, 220 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
218 struct dwc3_gadget_ep_cmd_params *params), 221 struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
219 TP_ARGS(dep, cmd, params) 222 TP_ARGS(dep, cmd, params, cmd_status)
220); 223);
221 224
222DECLARE_EVENT_CLASS(dwc3_log_trb, 225DECLARE_EVENT_CLASS(dwc3_log_trb,