usb: dwc3: remove trace_* APIs from dwc3 driver

Removed most of the trace_* APIs from dwc3 driver since tracepoints are not
supported in u-boot. Replaced some of the trace_* API with dev_dbg/dev/vdbg.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Review-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:
Kishon Vijay Abraham I 2015-02-23 18:39:53 +05:30 committed by Marek Vasut
parent 30c31d5897
commit 9de1115de7
4 changed files with 29 additions and 80 deletions

View file

@ -1,12 +1,9 @@
# define_trace.h needs to know how to find our header
CFLAGS_trace.o := -I$(src)
ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG
ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG
obj-$(CONFIG_USB_DWC3) += dwc3.o obj-$(CONFIG_USB_DWC3) += dwc3.o
dwc3-y := core.o debug.o trace.o dwc3-y := core.o debug.o
ifneq ($(filter y,$(CONFIG_USB_DWC3_HOST) $(CONFIG_USB_DWC3_DUAL_ROLE)),) ifneq ($(filter y,$(CONFIG_USB_DWC3_HOST) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
dwc3-y += host.o dwc3-y += host.o

View file

@ -64,7 +64,7 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
dep = dwc->eps[epnum]; dep = dwc->eps[epnum];
if (dep->flags & DWC3_EP_BUSY) { if (dep->flags & DWC3_EP_BUSY) {
dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name); dev_vdbg(dwc->dev, "%s still busy", dep->name);
return 0; return 0;
} }
@ -84,13 +84,10 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
params.param0 = upper_32_bits(dwc->ep0_trb_addr); params.param0 = upper_32_bits(dwc->ep0_trb_addr);
params.param1 = lower_32_bits(dwc->ep0_trb_addr); params.param1 = lower_32_bits(dwc->ep0_trb_addr);
trace_dwc3_prepare_trb(dep, trb);
ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
DWC3_DEPCMD_STARTTRANSFER, &params); DWC3_DEPCMD_STARTTRANSFER, &params);
if (ret < 0) { if (ret < 0) {
dwc3_trace(trace_dwc3_ep0, "%s STARTTRANSFER failed", dev_dbg(dwc->dev, "%s STARTTRANSFER failed", dep->name);
dep->name);
return ret; return ret;
} }
@ -155,8 +152,7 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,
if (dwc->ep0state == EP0_STATUS_PHASE) if (dwc->ep0state == EP0_STATUS_PHASE)
__dwc3_ep0_do_control_status(dwc, dwc->eps[direction]); __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
else else
dwc3_trace(trace_dwc3_ep0, dev_dbg(dwc->dev, "too early for delayed status");
"too early for delayed status");
return 0; return 0;
} }
@ -220,8 +216,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
if (!dep->endpoint.desc) { if (!dep->endpoint.desc) {
dwc3_trace(trace_dwc3_ep0, dev_dbg(dwc->dev, "trying to queue request %p to disabled %s",
"trying to queue request %p to disabled %s",
request, dep->name); request, dep->name);
ret = -ESHUTDOWN; ret = -ESHUTDOWN;
goto out; goto out;
@ -233,8 +228,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
goto out; goto out;
} }
dwc3_trace(trace_dwc3_ep0, dev_vdbg(dwc->dev, "queueing request %p to %s length %d state '%s'",
"queueing request %p to %s length %d state '%s'",
request, dep->name, request->length, request, dep->name, request->length,
dwc3_ep0_state_string(dwc->ep0state)); dwc3_ep0_state_string(dwc->ep0state));
@ -503,13 +497,12 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
addr = le16_to_cpu(ctrl->wValue); addr = le16_to_cpu(ctrl->wValue);
if (addr > 127) { if (addr > 127) {
dwc3_trace(trace_dwc3_ep0, "invalid device address %d", addr); dev_dbg(dwc->dev, "invalid device address %d", addr);
return -EINVAL; return -EINVAL;
} }
if (state == USB_STATE_CONFIGURED) { if (state == USB_STATE_CONFIGURED) {
dwc3_trace(trace_dwc3_ep0, dev_dbg(dwc->dev, "trying to set address when configured");
"trying to set address when configured");
return -EINVAL; return -EINVAL;
} }
@ -574,7 +567,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc3_writel(dwc->regs, DWC3_DCTL, reg);
dwc->resize_fifos = true; dwc->resize_fifos = true;
dwc3_trace(trace_dwc3_ep0, "resize FIFOs flag SET"); dev_dbg(dwc->dev, "resize FIFOs flag SET");
} }
break; break;
@ -698,35 +691,35 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
switch (ctrl->bRequest) { switch (ctrl->bRequest) {
case USB_REQ_GET_STATUS: case USB_REQ_GET_STATUS:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_GET_STATUS"); dev_vdbg(dwc->dev, "USB_REQ_GET_STATUS");
ret = dwc3_ep0_handle_status(dwc, ctrl); ret = dwc3_ep0_handle_status(dwc, ctrl);
break; break;
case USB_REQ_CLEAR_FEATURE: case USB_REQ_CLEAR_FEATURE:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_CLEAR_FEATURE"); dev_vdbg(dwc->dev, "USB_REQ_CLEAR_FEATURE");
ret = dwc3_ep0_handle_feature(dwc, ctrl, 0); ret = dwc3_ep0_handle_feature(dwc, ctrl, 0);
break; break;
case USB_REQ_SET_FEATURE: case USB_REQ_SET_FEATURE:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_FEATURE"); dev_vdbg(dwc->dev, "USB_REQ_SET_FEATURE");
ret = dwc3_ep0_handle_feature(dwc, ctrl, 1); ret = dwc3_ep0_handle_feature(dwc, ctrl, 1);
break; break;
case USB_REQ_SET_ADDRESS: case USB_REQ_SET_ADDRESS:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ADDRESS"); dev_vdbg(dwc->dev, "USB_REQ_SET_ADDRESS");
ret = dwc3_ep0_set_address(dwc, ctrl); ret = dwc3_ep0_set_address(dwc, ctrl);
break; break;
case USB_REQ_SET_CONFIGURATION: case USB_REQ_SET_CONFIGURATION:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_CONFIGURATION"); dev_vdbg(dwc->dev, "USB_REQ_SET_CONFIGURATION");
ret = dwc3_ep0_set_config(dwc, ctrl); ret = dwc3_ep0_set_config(dwc, ctrl);
break; break;
case USB_REQ_SET_SEL: case USB_REQ_SET_SEL:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_SEL"); dev_vdbg(dwc->dev, "USB_REQ_SET_SEL");
ret = dwc3_ep0_set_sel(dwc, ctrl); ret = dwc3_ep0_set_sel(dwc, ctrl);
break; break;
case USB_REQ_SET_ISOCH_DELAY: case USB_REQ_SET_ISOCH_DELAY:
dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY"); dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY");
ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
break; break;
default: default:
dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver"); dev_vdbg(dwc->dev, "Forwarding to gadget driver");
ret = dwc3_ep0_delegate_req(dwc, ctrl); ret = dwc3_ep0_delegate_req(dwc, ctrl);
break; break;
} }
@ -744,8 +737,6 @@ static void dwc3_ep0_inspect_setup(struct dwc3 *dwc,
if (!dwc->gadget_driver) if (!dwc->gadget_driver)
goto out; goto out;
trace_dwc3_ctrl_req(ctrl);
len = le16_to_cpu(ctrl->wLength); len = le16_to_cpu(ctrl->wLength);
if (!len) { if (!len) {
dwc->three_stage_setup = false; dwc->three_stage_setup = false;
@ -789,15 +780,13 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
trb = dwc->ep0_trb; trb = dwc->ep0_trb;
trace_dwc3_complete_trb(ep0, trb);
r = next_request(&ep0->request_list); r = next_request(&ep0->request_list);
if (!r) if (!r)
return; return;
status = DWC3_TRB_SIZE_TRBSTS(trb->size); status = DWC3_TRB_SIZE_TRBSTS(trb->size);
if (status == DWC3_TRBSTS_SETUP_PENDING) { if (status == DWC3_TRBSTS_SETUP_PENDING) {
dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); dev_dbg(dwc->dev, "Setup Pending received");
if (r) if (r)
dwc3_gadget_giveback(ep0, r, -ECONNRESET); dwc3_gadget_giveback(ep0, r, -ECONNRESET);
@ -855,8 +844,6 @@ static void dwc3_ep0_complete_status(struct dwc3 *dwc,
dep = dwc->eps[0]; dep = dwc->eps[0];
trb = dwc->ep0_trb; trb = dwc->ep0_trb;
trace_dwc3_complete_trb(dep, trb);
if (!list_empty(&dep->request_list)) { if (!list_empty(&dep->request_list)) {
r = next_request(&dep->request_list); r = next_request(&dep->request_list);
@ -868,7 +855,7 @@ static void dwc3_ep0_complete_status(struct dwc3 *dwc,
ret = dwc3_gadget_set_test_mode(dwc, dwc->test_mode_nr); ret = dwc3_gadget_set_test_mode(dwc, dwc->test_mode_nr);
if (ret < 0) { if (ret < 0) {
dwc3_trace(trace_dwc3_ep0, "Invalid Test #%d", dev_dbg(dwc->dev, "Invalid Test #%d",
dwc->test_mode_nr); dwc->test_mode_nr);
dwc3_ep0_stall_and_restart(dwc); dwc3_ep0_stall_and_restart(dwc);
return; return;
@ -877,7 +864,7 @@ static void dwc3_ep0_complete_status(struct dwc3 *dwc,
status = DWC3_TRB_SIZE_TRBSTS(trb->size); status = DWC3_TRB_SIZE_TRBSTS(trb->size);
if (status == DWC3_TRBSTS_SETUP_PENDING) if (status == DWC3_TRBSTS_SETUP_PENDING)
dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); dev_dbg(dwc->dev, "Setup Pending received");
dwc->ep0state = EP0_SETUP_PHASE; dwc->ep0state = EP0_SETUP_PHASE;
dwc3_ep0_out_start(dwc); dwc3_ep0_out_start(dwc);
@ -894,17 +881,17 @@ static void dwc3_ep0_xfer_complete(struct dwc3 *dwc,
switch (dwc->ep0state) { switch (dwc->ep0state) {
case EP0_SETUP_PHASE: case EP0_SETUP_PHASE:
dwc3_trace(trace_dwc3_ep0, "Setup Phase"); dev_vdbg(dwc->dev, "Setup Phase");
dwc3_ep0_inspect_setup(dwc, event); dwc3_ep0_inspect_setup(dwc, event);
break; break;
case EP0_DATA_PHASE: case EP0_DATA_PHASE:
dwc3_trace(trace_dwc3_ep0, "Data Phase"); dev_vdbg(dwc->dev, "Data Phase");
dwc3_ep0_complete_data(dwc, event); dwc3_ep0_complete_data(dwc, event);
break; break;
case EP0_STATUS_PHASE: case EP0_STATUS_PHASE:
dwc3_trace(trace_dwc3_ep0, "Status Phase"); dev_vdbg(dwc->dev, "Status Phase");
dwc3_ep0_complete_status(dwc, event); dwc3_ep0_complete_status(dwc, event);
break; break;
default: default:
@ -980,7 +967,7 @@ static int dwc3_ep0_start_control_status(struct dwc3_ep *dep)
static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep)
{ {
if (dwc->resize_fifos) { if (dwc->resize_fifos) {
dwc3_trace(trace_dwc3_ep0, "Resizing FIFOs"); dev_dbg(dwc->dev, "Resizing FIFOs");
dwc3_gadget_resize_tx_fifos(dwc); dwc3_gadget_resize_tx_fifos(dwc);
dwc->resize_fifos = 0; dwc->resize_fifos = 0;
} }
@ -1021,7 +1008,7 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
switch (event->status) { switch (event->status) {
case DEPEVT_STATUS_CONTROL_DATA: case DEPEVT_STATUS_CONTROL_DATA:
dwc3_trace(trace_dwc3_ep0, "Control Data"); dev_vdbg(dwc->dev, "Control Data");
/* /*
* We already have a DATA transfer in the controller's cache, * We already have a DATA transfer in the controller's cache,
@ -1035,8 +1022,7 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
if (dwc->ep0_expect_in != event->endpoint_number) { if (dwc->ep0_expect_in != event->endpoint_number) {
struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in]; struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in];
dwc3_trace(trace_dwc3_ep0, dev_vdbg(dwc->dev, "Wrong direction for Data phase");
"Wrong direction for Data phase");
dwc3_ep0_end_control_data(dwc, dep); dwc3_ep0_end_control_data(dwc, dep);
dwc3_ep0_stall_and_restart(dwc); dwc3_ep0_stall_and_restart(dwc);
return; return;
@ -1048,13 +1034,13 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
if (dwc->ep0_next_event != DWC3_EP0_NRDY_STATUS) if (dwc->ep0_next_event != DWC3_EP0_NRDY_STATUS)
return; return;
dwc3_trace(trace_dwc3_ep0, "Control Status"); dev_vdbg(dwc->dev, "Control Status");
dwc->ep0state = EP0_STATUS_PHASE; dwc->ep0state = EP0_STATUS_PHASE;
if (dwc->delayed_status) { if (dwc->delayed_status) {
WARN_ON_ONCE(event->endpoint_number != 1); WARN_ON_ONCE(event->endpoint_number != 1);
dwc3_trace(trace_dwc3_ep0, "Delayed Status"); dev_vdbg(dwc->dev, "Delayed Status");
return; return;
} }
@ -1067,7 +1053,7 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc,
{ {
u8 epnum = event->endpoint_number; u8 epnum = event->endpoint_number;
dwc3_trace(trace_dwc3_ep0, "%s while ep%d%s in state '%s'", dev_dbg(dwc->dev, "%s while ep%d%s in state '%s'",
dwc3_ep_event_string(event->endpoint_event), dwc3_ep_event_string(event->endpoint_event),
epnum >> 1, (epnum & 1) ? "in" : "out", epnum >> 1, (epnum & 1) ? "in" : "out",
dwc3_ep0_state_string(dwc->ep0state)); dwc3_ep0_state_string(dwc->ep0state));

View file

@ -265,7 +265,6 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n", dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n",
req, dep->name, req->request.actual, req, dep->name, req->request.actual,
req->request.length, status); req->request.length, status);
trace_dwc3_gadget_giveback(req);
spin_unlock(&dwc->lock); spin_unlock(&dwc->lock);
usb_gadget_giveback_request(&dep->endpoint, &req->request); usb_gadget_giveback_request(&dep->endpoint, &req->request);
@ -277,8 +276,6 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param)
u32 timeout = 500; u32 timeout = 500;
u32 reg; u32 reg;
trace_dwc3_gadget_generic_cmd(cmd, param);
dwc3_writel(dwc->regs, DWC3_DGCMDPAR, param); dwc3_writel(dwc->regs, DWC3_DGCMDPAR, param);
dwc3_writel(dwc->regs, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT); dwc3_writel(dwc->regs, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT);
@ -308,8 +305,6 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
u32 timeout = 500; u32 timeout = 500;
u32 reg; u32 reg;
trace_dwc3_gadget_ep_cmd(dep, cmd, params);
dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0); dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0);
dwc3_writel(dwc->regs, DWC3_DEPCMDPAR1(ep), params->param1); dwc3_writel(dwc->regs, DWC3_DEPCMDPAR1(ep), params->param1);
dwc3_writel(dwc->regs, DWC3_DEPCMDPAR2(ep), params->param2); dwc3_writel(dwc->regs, DWC3_DEPCMDPAR2(ep), params->param2);
@ -704,8 +699,6 @@ static struct usb_request *dwc3_gadget_ep_alloc_request(struct usb_ep *ep,
req->epnum = dep->number; req->epnum = dep->number;
req->dep = dep; req->dep = dep;
trace_dwc3_alloc_request(req);
return &req->request; return &req->request;
} }
@ -714,7 +707,6 @@ static void dwc3_gadget_ep_free_request(struct usb_ep *ep,
{ {
struct dwc3_request *req = to_dwc3_request(request); struct dwc3_request *req = to_dwc3_request(request);
trace_dwc3_free_request(req);
kfree(req); kfree(req);
} }
@ -796,8 +788,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id); trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id);
trb->ctrl |= DWC3_TRB_CTRL_HWO; trb->ctrl |= DWC3_TRB_CTRL_HWO;
trace_dwc3_prepare_trb(dep, trb);
} }
/* /*
@ -1150,7 +1140,6 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", dev_vdbg(dwc->dev, "queing request %p to %s length %d\n",
request, ep->name, request->length); request, ep->name, request->length);
trace_dwc3_ep_queue(req);
ret = __dwc3_gadget_ep_queue(dep, req); ret = __dwc3_gadget_ep_queue(dep, req);
@ -1172,8 +1161,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
trace_dwc3_ep_dequeue(req);
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
list_for_each_entry(r, &dep->request_list, list) { list_for_each_entry(r, &dep->request_list, list) {
@ -1771,8 +1758,6 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
unsigned int s_pkt = 0; unsigned int s_pkt = 0;
unsigned int trb_status; unsigned int trb_status;
trace_dwc3_complete_trb(dep, trb);
if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
/* /*
* We continue despite the error. There is not much we * We continue despite the error. There is not much we
@ -2529,8 +2514,6 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
static void dwc3_process_event_entry(struct dwc3 *dwc, static void dwc3_process_event_entry(struct dwc3 *dwc,
const union dwc3_event *event) const union dwc3_event *event)
{ {
trace_dwc3_event(event->raw);
/* Endpoint IRQ, handle it and return early */ /* Endpoint IRQ, handle it and return early */
if (event->type.is_devspec == 0) { if (event->type.is_devspec == 0) {
/* depevt */ /* depevt */

View file

@ -19,7 +19,6 @@
#define __DRIVERS_USB_DWC3_IO_H #define __DRIVERS_USB_DWC3_IO_H
#include <linux/io.h> #include <linux/io.h>
#include "trace.h"
#include "debug.h" #include "debug.h"
#include "core.h" #include "core.h"
@ -35,14 +34,6 @@ static inline u32 dwc3_readl(void __iomem *base, u32 offset)
*/ */
value = readl(base + offs); value = readl(base + offs);
/*
* When tracing we want to make it easy to find the correct address on
* documentation, so we revert it back to the proper addresses, the
* same way they are described on SNPS documentation
*/
dwc3_trace(trace_dwc3_readl, "addr %p value %08x",
base - DWC3_GLOBALS_REGS_START + offset, value);
return value; return value;
} }
@ -56,14 +47,6 @@ static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
* However, the offsets are given starting from xHCI address space. * However, the offsets are given starting from xHCI address space.
*/ */
writel(value, base + offs); writel(value, base + offs);
/*
* When tracing we want to make it easy to find the correct address on
* documentation, so we revert it back to the proper addresses, the
* same way they are described on SNPS documentation
*/
dwc3_trace(trace_dwc3_writel, "addr %p value %08x",
base - DWC3_GLOBALS_REGS_START + offset, value);
} }
#endif /* __DRIVERS_USB_DWC3_IO_H */ #endif /* __DRIVERS_USB_DWC3_IO_H */