From 8ccb49dd5cdeb7bc1c12580698ffec9619fea14d Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Thu, 30 Jun 2016 12:12:30 -0500 Subject: [PATCH] usb: musb: cppi41: add dma channel tracepoints Add tracepoints for cppi41 dma channels. Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_cppi41.c | 22 +++++------ drivers/usb/musb/musb_trace.h | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 12 deletions(-) diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 602a230af655..d4d7c56b48c7 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -7,6 +7,7 @@ #include "cppi_dma.h" #include "musb_core.h" +#include "musb_trace.h" #define RNDIS_REG(x) (0x80 + ((x - 1) * 4)) @@ -126,6 +127,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; musb_writew(epio, MUSB_TXCSR, csr); } + + trace_musb_cppi41_done(cppi41_channel); musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); } else { /* next iteration, reload */ @@ -154,6 +157,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) dma_desc->callback = cppi41_dma_callback; dma_desc->callback_param = &cppi41_channel->channel; cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); + trace_musb_cppi41_cont(cppi41_channel); dma_async_issue_pending(dc); if (!cppi41_channel->is_tx) { @@ -221,10 +225,7 @@ static void cppi41_dma_callback(void *private_data) transferred = cppi41_channel->prog_len - txstate.residue; cppi41_channel->transferred += transferred; - musb_dbg(musb, "DMA transfer done on hw_ep=%d bytes=%d/%d", - hw_ep->epnum, cppi41_channel->transferred, - cppi41_channel->total_len); - + trace_musb_cppi41_gb(cppi41_channel); update_rx_toggle(cppi41_channel); if (cppi41_channel->transferred == cppi41_channel->total_len || @@ -355,12 +356,6 @@ static bool cppi41_configure_channel(struct dma_channel *channel, struct musb *musb = cppi41_channel->controller->musb; unsigned use_gen_rndis = 0; - musb_dbg(musb, - "configure ep%d/%x packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d", - cppi41_channel->port_num, RNDIS_REG(cppi41_channel->port_num), - packet_sz, mode, (unsigned long long) dma_addr, - len, cppi41_channel->is_tx); - cppi41_channel->buf_addr = dma_addr; cppi41_channel->total_len = len; cppi41_channel->transferred = 0; @@ -412,6 +407,8 @@ static bool cppi41_configure_channel(struct dma_channel *channel, cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); cppi41_channel->channel.rx_packet_done = false; + trace_musb_cppi41_config(cppi41_channel); + save_rx_toggle(cppi41_channel); dma_async_issue_pending(dc); return true; @@ -442,6 +439,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c, cppi41_channel->hw_ep = hw_ep; cppi41_channel->is_allocated = 1; + trace_musb_cppi41_alloc(cppi41_channel); return &cppi41_channel->channel; } @@ -449,6 +447,7 @@ static void cppi41_dma_channel_release(struct dma_channel *channel) { struct cppi41_dma_channel *cppi41_channel = channel->private_data; + trace_musb_cppi41_free(cppi41_channel); if (cppi41_channel->is_allocated) { cppi41_channel->is_allocated = 0; channel->status = MUSB_DMA_STATUS_FREE; @@ -518,8 +517,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) u16 csr; is_tx = cppi41_channel->is_tx; - musb_dbg(musb, "abort channel=%d, is_tx=%d", - cppi41_channel->port_num, is_tx); + trace_musb_cppi41_abort(cppi41_channel); if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) return 0; diff --git a/drivers/usb/musb/musb_trace.h b/drivers/usb/musb/musb_trace.h index 27d1a9b3efc8..f031c9e74322 100644 --- a/drivers/usb/musb/musb_trace.h +++ b/drivers/usb/musb/musb_trace.h @@ -25,6 +25,9 @@ #include #include #include "musb_core.h" +#ifdef CONFIG_USB_TI_CPPI41_DMA +#include "cppi_dma.h" +#endif #define MUSB_MSG_MAX 500 @@ -288,6 +291,73 @@ DEFINE_EVENT(musb_req, musb_req_deq, TP_ARGS(req) ); +#ifdef CONFIG_USB_TI_CPPI41_DMA +DECLARE_EVENT_CLASS(musb_cppi41, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch), + TP_STRUCT__entry( + __field(struct cppi41_dma_channel *, ch) + __string(name, dev_name(ch->hw_ep->musb->controller)) + __field(u8, hwep) + __field(u8, port) + __field(u8, is_tx) + __field(u32, len) + __field(u32, prog_len) + __field(u32, xferred) + ), + TP_fast_assign( + __entry->ch = ch; + __assign_str(name, dev_name(ch->hw_ep->musb->controller)); + __entry->hwep = ch->hw_ep->epnum; + __entry->port = ch->port_num; + __entry->is_tx = ch->is_tx; + __entry->len = ch->total_len; + __entry->prog_len = ch->prog_len; + __entry->xferred = ch->transferred; + ), + TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d", + __get_str(name), __entry->ch, __entry->hwep, + __entry->port, __entry->is_tx ? "tx" : "rx", + __entry->prog_len, __entry->xferred, __entry->len + ) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_done, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_gb, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_config, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_cont, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_alloc, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_abort, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); + +DEFINE_EVENT(musb_cppi41, musb_cppi41_free, + TP_PROTO(struct cppi41_dma_channel *ch), + TP_ARGS(ch) +); +#endif /* CONFIG_USB_TI_CPPI41_DMA */ + #endif /* __MUSB_TRACE_H */ /* this part has to be here */ -- 2.20.1