From b99d3659b309b358e5b789e644b046d6721c9da4 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Thu, 30 Jun 2016 12:12:22 -0500 Subject: usb: musb: switch dev_dbg to tracepoints Switch dev_dbg() to tracepoint debug musb_dbg(). Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_cppi41.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/usb/musb/musb_cppi41.c') diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index e499b862a946..f7bad723be24 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -96,8 +96,8 @@ static void update_rx_toggle(struct cppi41_dma_channel *cppi41_channel) if (!toggle && toggle == cppi41_channel->usb_toggle) { csr |= MUSB_RXCSR_H_DATATOGGLE | MUSB_RXCSR_H_WR_DATATOGGLE; musb_writew(cppi41_channel->hw_ep->regs, MUSB_RXCSR, csr); - dev_dbg(cppi41_channel->controller->musb->controller, - "Restoring DATA1 toggle.\n"); + musb_dbg(cppi41_channel->controller->musb, + "Restoring DATA1 toggle."); } cppi41_channel->usb_toggle = toggle; @@ -240,7 +240,7 @@ static void cppi41_dma_callback(void *private_data) transferred = cppi41_channel->prog_len - txstate.residue; cppi41_channel->transferred += transferred; - dev_dbg(musb->controller, "DMA transfer done on hw_ep=%d bytes=%d/%d\n", + musb_dbg(musb, "DMA transfer done on hw_ep=%d bytes=%d/%d", hw_ep->epnum, cppi41_channel->transferred, cppi41_channel->total_len); @@ -374,8 +374,8 @@ static bool cppi41_configure_channel(struct dma_channel *channel, struct musb *musb = cppi41_channel->controller->musb; unsigned use_gen_rndis = 0; - dev_dbg(musb->controller, - "configure ep%d/%x packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d\n", + 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); @@ -537,7 +537,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) u16 csr; is_tx = cppi41_channel->is_tx; - dev_dbg(musb->controller, "abort channel=%d, is_tx=%d\n", + musb_dbg(musb, "abort channel=%d, is_tx=%d", cppi41_channel->port_num, is_tx); if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) -- cgit v1.2.3-73-gaa49b From 239d2218108a5af7f6ffbd0752677ab46f8705be Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Thu, 30 Jun 2016 12:12:29 -0500 Subject: usb: musb: cppi41: move struct cppi41_dma_channel to header Move struct cppi41_dma_channel to the header file so other modules can use it. Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/cppi_dma.h | 23 ++++++++++++++++++++++- drivers/usb/musb/musb_cppi41.c | 21 +-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'drivers/usb/musb/musb_cppi41.c') diff --git a/drivers/usb/musb/cppi_dma.h b/drivers/usb/musb/cppi_dma.h index 40c31cecc8b7..7fdfb71a8f09 100644 --- a/drivers/usb/musb/cppi_dma.h +++ b/drivers/usb/musb/cppi_dma.h @@ -7,9 +7,10 @@ #include #include #include +#include -#include "musb_dma.h" #include "musb_core.h" +#include "musb_dma.h" /* CPPI RX/TX state RAM */ @@ -123,4 +124,24 @@ struct cppi { /* CPPI IRQ handler */ extern irqreturn_t cppi_interrupt(int, void *); +struct cppi41_dma_channel { + struct dma_channel channel; + struct cppi41_dma_controller *controller; + struct musb_hw_ep *hw_ep; + struct dma_chan *dc; + dma_cookie_t cookie; + u8 port_num; + u8 is_tx; + u8 is_allocated; + u8 usb_toggle; + + dma_addr_t buf_addr; + u32 total_len; + u32 prog_len; + u32 transferred; + u32 packet_sz; + struct list_head tx_check; + int tx_zlp; +}; + #endif /* end of ifndef _CPPI_DMA_H_ */ diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index f7bad723be24..602a230af655 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -5,6 +5,7 @@ #include #include +#include "cppi_dma.h" #include "musb_core.h" #define RNDIS_REG(x) (0x80 + ((x - 1) * 4)) @@ -22,26 +23,6 @@ #define USB_CTRL_AUTOREQ 0xd0 #define USB_TDOWN 0xd8 -struct cppi41_dma_channel { - struct dma_channel channel; - struct cppi41_dma_controller *controller; - struct musb_hw_ep *hw_ep; - struct dma_chan *dc; - dma_cookie_t cookie; - u8 port_num; - u8 is_tx; - u8 is_allocated; - u8 usb_toggle; - - dma_addr_t buf_addr; - u32 total_len; - u32 prog_len; - u32 transferred; - u32 packet_sz; - struct list_head tx_check; - int tx_zlp; -}; - #define MUSB_DMA_NUM_CHANNELS 15 struct cppi41_dma_controller { -- cgit v1.2.3-73-gaa49b From 8ccb49dd5cdeb7bc1c12580698ffec9619fea14d Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Thu, 30 Jun 2016 12:12:30 -0500 Subject: 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(-) (limited to 'drivers/usb/musb/musb_cppi41.c') 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 */ -- cgit v1.2.3-73-gaa49b