usb: chipidea: add tracepoint support for udc
Subsystems (2)
PATCH 1/1 usb: chipidea: add tracepoint support for udc
Add basic tracepoint support for udc driver.
Reviewed-by Jun Li <[email protected]>
Signed-off-by Peter Chen <[email protected]>
--- drivers/usb/chipidea/Makefile | 5 +- drivers/usb/chipidea/trace.c | 23 +++++++++ drivers/usb/chipidea/trace.h | 91 +++++++++++++++++++++++++++++++++++ drivers/usb/chipidea/udc.c | 10 +++- 4 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/chipidea/trace.c create mode 100644 drivers/usb/chipidea/trace.h
drivers/usb/chipidea/Makefile +4 -1
@@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 + +# define_trace.h needs to know how to find our header +CFLAGS_trace.o := -I$(src) obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o ci_hdrc-y := core.o otg.o debug.o ulpi.o -ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o +ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o trace.o ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
drivers/usb/chipidea/trace.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Chipidea Device Mode Trace Support +* +* Copyright (C) 2020 NXP +* +* Author: Peter Chen <[email protected]> +*/ + +#define CREATE_TRACE_POINTS +#include "trace.h" + +void ci_log (struct ci_hdrc *ci,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; +trace_ci_log (ci, &vaf); +va_end (args); +}
drivers/usb/chipidea/trace.h new file +91 -0
91 lines not on this page · raw message
drivers/usb/chipidea/udc.c +8 -2
@@ -26,6 +26,7 @@#include "bits.h" #include "otg.h" #include "otg_fsm.h" +#include "trace.h" /* control endpoint description */ static const struct usb_endpoint_descriptor
@@ -569,14 +570,18 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)if (ret)return ret; - firstnode = list_first_entry(&hwreq->tds, struct td_node, td); - lastnode =list_entry (hwreq->tds.prev, struct td_node, td); lastnode->ptr->next =cpu_to_le32 (TD_TERMINATE );if (!hwreq->req.no_interrupt) lastnode->ptr->token |=cpu_to_le32 (TD_IOC ); + +list_for_each_entry_safe (firstnode, lastnode, &hwreq->tds, td) +trace_ci_prepare_td (hwep, hwreq, firstnode); + + firstnode = list_first_entry(&hwreq->tds, struct td_node, td); +wmb (); hwreq->req.actual =0 ;
@@ -671,6 +676,7 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)list_for_each_entry_safe (node, tmpnode, &hwreq->tds, td) { tmptoken =le32_to_cpu (node->ptr->token); +trace_ci_complete_td (hwep, hwreq, node);if ((TD_STATUS_ACTIVE & tmptoken) !=0 ) {int n =hw_ep_bit (hwep->num, hwep->dir);
Signature · 1 line
2.17.1