Commit 8ccb49dd authored by Bin Liu's avatar Bin Liu Committed by Greg Kroah-Hartman

usb: musb: cppi41: add dma channel tracepoints

Add tracepoints for cppi41 dma channels.
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 239d2218
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "cppi_dma.h" #include "cppi_dma.h"
#include "musb_core.h" #include "musb_core.h"
#include "musb_trace.h"
#define RNDIS_REG(x) (0x80 + ((x - 1) * 4)) #define RNDIS_REG(x) (0x80 + ((x - 1) * 4))
...@@ -126,6 +127,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) ...@@ -126,6 +127,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel)
csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY;
musb_writew(epio, MUSB_TXCSR, csr); musb_writew(epio, MUSB_TXCSR, csr);
} }
trace_musb_cppi41_done(cppi41_channel);
musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx);
} else { } else {
/* next iteration, reload */ /* next iteration, reload */
...@@ -154,6 +157,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) ...@@ -154,6 +157,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel)
dma_desc->callback = cppi41_dma_callback; dma_desc->callback = cppi41_dma_callback;
dma_desc->callback_param = &cppi41_channel->channel; dma_desc->callback_param = &cppi41_channel->channel;
cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
trace_musb_cppi41_cont(cppi41_channel);
dma_async_issue_pending(dc); dma_async_issue_pending(dc);
if (!cppi41_channel->is_tx) { if (!cppi41_channel->is_tx) {
...@@ -221,10 +225,7 @@ static void cppi41_dma_callback(void *private_data) ...@@ -221,10 +225,7 @@ static void cppi41_dma_callback(void *private_data)
transferred = cppi41_channel->prog_len - txstate.residue; transferred = cppi41_channel->prog_len - txstate.residue;
cppi41_channel->transferred += transferred; cppi41_channel->transferred += transferred;
musb_dbg(musb, "DMA transfer done on hw_ep=%d bytes=%d/%d", trace_musb_cppi41_gb(cppi41_channel);
hw_ep->epnum, cppi41_channel->transferred,
cppi41_channel->total_len);
update_rx_toggle(cppi41_channel); update_rx_toggle(cppi41_channel);
if (cppi41_channel->transferred == cppi41_channel->total_len || if (cppi41_channel->transferred == cppi41_channel->total_len ||
...@@ -355,12 +356,6 @@ static bool cppi41_configure_channel(struct dma_channel *channel, ...@@ -355,12 +356,6 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
struct musb *musb = cppi41_channel->controller->musb; struct musb *musb = cppi41_channel->controller->musb;
unsigned use_gen_rndis = 0; 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->buf_addr = dma_addr;
cppi41_channel->total_len = len; cppi41_channel->total_len = len;
cppi41_channel->transferred = 0; cppi41_channel->transferred = 0;
...@@ -412,6 +407,8 @@ static bool cppi41_configure_channel(struct dma_channel *channel, ...@@ -412,6 +407,8 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
cppi41_channel->channel.rx_packet_done = false; cppi41_channel->channel.rx_packet_done = false;
trace_musb_cppi41_config(cppi41_channel);
save_rx_toggle(cppi41_channel); save_rx_toggle(cppi41_channel);
dma_async_issue_pending(dc); dma_async_issue_pending(dc);
return true; return true;
...@@ -442,6 +439,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c, ...@@ -442,6 +439,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c,
cppi41_channel->hw_ep = hw_ep; cppi41_channel->hw_ep = hw_ep;
cppi41_channel->is_allocated = 1; cppi41_channel->is_allocated = 1;
trace_musb_cppi41_alloc(cppi41_channel);
return &cppi41_channel->channel; return &cppi41_channel->channel;
} }
...@@ -449,6 +447,7 @@ static void cppi41_dma_channel_release(struct dma_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; struct cppi41_dma_channel *cppi41_channel = channel->private_data;
trace_musb_cppi41_free(cppi41_channel);
if (cppi41_channel->is_allocated) { if (cppi41_channel->is_allocated) {
cppi41_channel->is_allocated = 0; cppi41_channel->is_allocated = 0;
channel->status = MUSB_DMA_STATUS_FREE; channel->status = MUSB_DMA_STATUS_FREE;
...@@ -518,8 +517,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) ...@@ -518,8 +517,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
u16 csr; u16 csr;
is_tx = cppi41_channel->is_tx; is_tx = cppi41_channel->is_tx;
musb_dbg(musb, "abort channel=%d, is_tx=%d", trace_musb_cppi41_abort(cppi41_channel);
cppi41_channel->port_num, is_tx);
if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)
return 0; return 0;
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#include <linux/usb.h> #include <linux/usb.h>
#include "musb_core.h" #include "musb_core.h"
#ifdef CONFIG_USB_TI_CPPI41_DMA
#include "cppi_dma.h"
#endif
#define MUSB_MSG_MAX 500 #define MUSB_MSG_MAX 500
...@@ -288,6 +291,73 @@ DEFINE_EVENT(musb_req, musb_req_deq, ...@@ -288,6 +291,73 @@ DEFINE_EVENT(musb_req, musb_req_deq,
TP_ARGS(req) 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 */ #endif /* __MUSB_TRACE_H */
/* this part has to be here */ /* this part has to be here */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment