mirror of https://github.com/torvalds/linux.git
usb: chipidea: add tracepoint support for udc
Add basic tracepoint support for udc driver. Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
This commit is contained in:
parent
1bc514dfd1
commit
b4c5d446a6
|
|
@ -1,8 +1,11 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# 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
|
obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
|
||||||
|
|
||||||
ci_hdrc-y := core.o otg.o debug.o ulpi.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_CHIPIDEA_HOST) += host.o
|
||||||
ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
|
ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
/*
|
||||||
|
* Chipidea Device Mode Trace Support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 NXP
|
||||||
|
*
|
||||||
|
* Author: Peter Chen <peter.chen@nxp.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Trace support header file for device mode
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 NXP
|
||||||
|
*
|
||||||
|
* Author: Peter Chen <peter.chen@nxp.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
|
#define TRACE_SYSTEM chipidea
|
||||||
|
|
||||||
|
#if !defined(__LINUX_CHIPIDEA_TRACE) || defined(TRACE_HEADER_MULTI_READ)
|
||||||
|
#define __LINUX_CHIPIDEA_TRACE
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/tracepoint.h>
|
||||||
|
#include <linux/usb/chipidea.h>
|
||||||
|
#include "ci.h"
|
||||||
|
#include "udc.h"
|
||||||
|
|
||||||
|
#define CHIPIDEA_MSG_MAX 500
|
||||||
|
|
||||||
|
void ci_log(struct ci_hdrc *ci, const char *fmt, ...);
|
||||||
|
|
||||||
|
TRACE_EVENT(ci_log,
|
||||||
|
TP_PROTO(struct ci_hdrc *ci, struct va_format *vaf),
|
||||||
|
TP_ARGS(ci, vaf),
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__string(name, dev_name(ci->dev))
|
||||||
|
__dynamic_array(char, msg, CHIPIDEA_MSG_MAX)
|
||||||
|
),
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_str(name, dev_name(ci->dev));
|
||||||
|
vsnprintf(__get_str(msg), CHIPIDEA_MSG_MAX, vaf->fmt, *vaf->va);
|
||||||
|
),
|
||||||
|
TP_printk("%s: %s", __get_str(name), __get_str(msg))
|
||||||
|
);
|
||||||
|
|
||||||
|
DECLARE_EVENT_CLASS(ci_log_trb,
|
||||||
|
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
|
||||||
|
TP_ARGS(hwep, hwreq, td),
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__string(name, hwep->name)
|
||||||
|
__field(struct td_node *, td)
|
||||||
|
__field(struct usb_request *, req)
|
||||||
|
__field(dma_addr_t, dma)
|
||||||
|
__field(s32, td_remaining_size)
|
||||||
|
__field(u32, next)
|
||||||
|
__field(u32, token)
|
||||||
|
__field(u32, type)
|
||||||
|
),
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_str(name, hwep->name);
|
||||||
|
__entry->req = &hwreq->req;
|
||||||
|
__entry->td = td;
|
||||||
|
__entry->dma = td->dma;
|
||||||
|
__entry->td_remaining_size = td->td_remaining_size;
|
||||||
|
__entry->next = td->ptr->next;
|
||||||
|
__entry->token = td->ptr->token;
|
||||||
|
__entry->type = usb_endpoint_type(hwep->ep.desc);
|
||||||
|
),
|
||||||
|
TP_printk("%s: req: %p, td: %p, td_dma_address: %pad, remaining_size: %d, "
|
||||||
|
"next: %x, total bytes: %d, status: %lx",
|
||||||
|
__get_str(name), __entry->req, __entry->td, &__entry->dma,
|
||||||
|
__entry->td_remaining_size, __entry->next,
|
||||||
|
(int)((__entry->token & TD_TOTAL_BYTES) >> __ffs(TD_TOTAL_BYTES)),
|
||||||
|
__entry->token & TD_STATUS
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
DEFINE_EVENT(ci_log_trb, ci_prepare_td,
|
||||||
|
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
|
||||||
|
TP_ARGS(hwep, hwreq, td)
|
||||||
|
);
|
||||||
|
|
||||||
|
DEFINE_EVENT(ci_log_trb, ci_complete_td,
|
||||||
|
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
|
||||||
|
TP_ARGS(hwep, hwreq, td)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif /* __LINUX_CHIPIDEA_TRACE */
|
||||||
|
|
||||||
|
/* this part must be outside header guard */
|
||||||
|
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#define TRACE_INCLUDE_PATH .
|
||||||
|
|
||||||
|
#undef TRACE_INCLUDE_FILE
|
||||||
|
#define TRACE_INCLUDE_FILE trace
|
||||||
|
|
||||||
|
#include <trace/define_trace.h>
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
#include "otg.h"
|
#include "otg.h"
|
||||||
#include "otg_fsm.h"
|
#include "otg_fsm.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
/* control endpoint description */
|
/* control endpoint description */
|
||||||
static const struct usb_endpoint_descriptor
|
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)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
firstnode = list_first_entry(&hwreq->tds, struct td_node, td);
|
|
||||||
|
|
||||||
lastnode = list_entry(hwreq->tds.prev,
|
lastnode = list_entry(hwreq->tds.prev,
|
||||||
struct td_node, td);
|
struct td_node, td);
|
||||||
|
|
||||||
lastnode->ptr->next = cpu_to_le32(TD_TERMINATE);
|
lastnode->ptr->next = cpu_to_le32(TD_TERMINATE);
|
||||||
if (!hwreq->req.no_interrupt)
|
if (!hwreq->req.no_interrupt)
|
||||||
lastnode->ptr->token |= cpu_to_le32(TD_IOC);
|
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();
|
wmb();
|
||||||
|
|
||||||
hwreq->req.actual = 0;
|
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) {
|
list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
|
||||||
tmptoken = le32_to_cpu(node->ptr->token);
|
tmptoken = le32_to_cpu(node->ptr->token);
|
||||||
|
trace_ci_complete_td(hwep, hwreq, node);
|
||||||
if ((TD_STATUS_ACTIVE & tmptoken) != 0) {
|
if ((TD_STATUS_ACTIVE & tmptoken) != 0) {
|
||||||
int n = hw_ep_bit(hwep->num, hwep->dir);
|
int n = hw_ep_bit(hwep->num, hwep->dir);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue