diff options
author | Bin Liu <b-liu@ti.com> | 2016-06-30 13:12:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-16 19:23:57 -0400 |
commit | 8ccb49dd5cdeb7bc1c12580698ffec9619fea14d (patch) | |
tree | 33291a3b0bd953a512cac6ecdeb494660b33db41 | |
parent | 239d2218108a5af7f6ffbd0752677ab46f8705be (diff) |
usb: musb: cppi41: add dma channel tracepoints
Add tracepoints for cppi41 dma channels.
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/musb/musb_cppi41.c | 22 | ||||
-rw-r--r-- | 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 @@ | |||
7 | 7 | ||
8 | #include "cppi_dma.h" | 8 | #include "cppi_dma.h" |
9 | #include "musb_core.h" | 9 | #include "musb_core.h" |
10 | #include "musb_trace.h" | ||
10 | 11 | ||
11 | #define RNDIS_REG(x) (0x80 + ((x - 1) * 4)) | 12 | #define RNDIS_REG(x) (0x80 + ((x - 1) * 4)) |
12 | 13 | ||
@@ -126,6 +127,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
126 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; | 127 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; |
127 | musb_writew(epio, MUSB_TXCSR, csr); | 128 | musb_writew(epio, MUSB_TXCSR, csr); |
128 | } | 129 | } |
130 | |||
131 | trace_musb_cppi41_done(cppi41_channel); | ||
129 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); | 132 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); |
130 | } else { | 133 | } else { |
131 | /* next iteration, reload */ | 134 | /* next iteration, reload */ |
@@ -154,6 +157,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
154 | dma_desc->callback = cppi41_dma_callback; | 157 | dma_desc->callback = cppi41_dma_callback; |
155 | dma_desc->callback_param = &cppi41_channel->channel; | 158 | dma_desc->callback_param = &cppi41_channel->channel; |
156 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); | 159 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); |
160 | trace_musb_cppi41_cont(cppi41_channel); | ||
157 | dma_async_issue_pending(dc); | 161 | dma_async_issue_pending(dc); |
158 | 162 | ||
159 | if (!cppi41_channel->is_tx) { | 163 | if (!cppi41_channel->is_tx) { |
@@ -221,10 +225,7 @@ static void cppi41_dma_callback(void *private_data) | |||
221 | transferred = cppi41_channel->prog_len - txstate.residue; | 225 | transferred = cppi41_channel->prog_len - txstate.residue; |
222 | cppi41_channel->transferred += transferred; | 226 | cppi41_channel->transferred += transferred; |
223 | 227 | ||
224 | musb_dbg(musb, "DMA transfer done on hw_ep=%d bytes=%d/%d", | 228 | trace_musb_cppi41_gb(cppi41_channel); |
225 | hw_ep->epnum, cppi41_channel->transferred, | ||
226 | cppi41_channel->total_len); | ||
227 | |||
228 | update_rx_toggle(cppi41_channel); | 229 | update_rx_toggle(cppi41_channel); |
229 | 230 | ||
230 | if (cppi41_channel->transferred == cppi41_channel->total_len || | 231 | if (cppi41_channel->transferred == cppi41_channel->total_len || |
@@ -355,12 +356,6 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
355 | struct musb *musb = cppi41_channel->controller->musb; | 356 | struct musb *musb = cppi41_channel->controller->musb; |
356 | unsigned use_gen_rndis = 0; | 357 | unsigned use_gen_rndis = 0; |
357 | 358 | ||
358 | musb_dbg(musb, | ||
359 | "configure ep%d/%x packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d", | ||
360 | cppi41_channel->port_num, RNDIS_REG(cppi41_channel->port_num), | ||
361 | packet_sz, mode, (unsigned long long) dma_addr, | ||
362 | len, cppi41_channel->is_tx); | ||
363 | |||
364 | cppi41_channel->buf_addr = dma_addr; | 359 | cppi41_channel->buf_addr = dma_addr; |
365 | cppi41_channel->total_len = len; | 360 | cppi41_channel->total_len = len; |
366 | cppi41_channel->transferred = 0; | 361 | cppi41_channel->transferred = 0; |
@@ -412,6 +407,8 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
412 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); | 407 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); |
413 | cppi41_channel->channel.rx_packet_done = false; | 408 | cppi41_channel->channel.rx_packet_done = false; |
414 | 409 | ||
410 | trace_musb_cppi41_config(cppi41_channel); | ||
411 | |||
415 | save_rx_toggle(cppi41_channel); | 412 | save_rx_toggle(cppi41_channel); |
416 | dma_async_issue_pending(dc); | 413 | dma_async_issue_pending(dc); |
417 | return true; | 414 | return true; |
@@ -442,6 +439,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c, | |||
442 | cppi41_channel->hw_ep = hw_ep; | 439 | cppi41_channel->hw_ep = hw_ep; |
443 | cppi41_channel->is_allocated = 1; | 440 | cppi41_channel->is_allocated = 1; |
444 | 441 | ||
442 | trace_musb_cppi41_alloc(cppi41_channel); | ||
445 | return &cppi41_channel->channel; | 443 | return &cppi41_channel->channel; |
446 | } | 444 | } |
447 | 445 | ||
@@ -449,6 +447,7 @@ static void cppi41_dma_channel_release(struct dma_channel *channel) | |||
449 | { | 447 | { |
450 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 448 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; |
451 | 449 | ||
450 | trace_musb_cppi41_free(cppi41_channel); | ||
452 | if (cppi41_channel->is_allocated) { | 451 | if (cppi41_channel->is_allocated) { |
453 | cppi41_channel->is_allocated = 0; | 452 | cppi41_channel->is_allocated = 0; |
454 | channel->status = MUSB_DMA_STATUS_FREE; | 453 | channel->status = MUSB_DMA_STATUS_FREE; |
@@ -518,8 +517,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) | |||
518 | u16 csr; | 517 | u16 csr; |
519 | 518 | ||
520 | is_tx = cppi41_channel->is_tx; | 519 | is_tx = cppi41_channel->is_tx; |
521 | musb_dbg(musb, "abort channel=%d, is_tx=%d", | 520 | trace_musb_cppi41_abort(cppi41_channel); |
522 | cppi41_channel->port_num, is_tx); | ||
523 | 521 | ||
524 | if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) | 522 | if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) |
525 | return 0; | 523 | 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 @@ | |||
25 | #include <linux/tracepoint.h> | 25 | #include <linux/tracepoint.h> |
26 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
27 | #include "musb_core.h" | 27 | #include "musb_core.h" |
28 | #ifdef CONFIG_USB_TI_CPPI41_DMA | ||
29 | #include "cppi_dma.h" | ||
30 | #endif | ||
28 | 31 | ||
29 | #define MUSB_MSG_MAX 500 | 32 | #define MUSB_MSG_MAX 500 |
30 | 33 | ||
@@ -288,6 +291,73 @@ DEFINE_EVENT(musb_req, musb_req_deq, | |||
288 | TP_ARGS(req) | 291 | TP_ARGS(req) |
289 | ); | 292 | ); |
290 | 293 | ||
294 | #ifdef CONFIG_USB_TI_CPPI41_DMA | ||
295 | DECLARE_EVENT_CLASS(musb_cppi41, | ||
296 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
297 | TP_ARGS(ch), | ||
298 | TP_STRUCT__entry( | ||
299 | __field(struct cppi41_dma_channel *, ch) | ||
300 | __string(name, dev_name(ch->hw_ep->musb->controller)) | ||
301 | __field(u8, hwep) | ||
302 | __field(u8, port) | ||
303 | __field(u8, is_tx) | ||
304 | __field(u32, len) | ||
305 | __field(u32, prog_len) | ||
306 | __field(u32, xferred) | ||
307 | ), | ||
308 | TP_fast_assign( | ||
309 | __entry->ch = ch; | ||
310 | __assign_str(name, dev_name(ch->hw_ep->musb->controller)); | ||
311 | __entry->hwep = ch->hw_ep->epnum; | ||
312 | __entry->port = ch->port_num; | ||
313 | __entry->is_tx = ch->is_tx; | ||
314 | __entry->len = ch->total_len; | ||
315 | __entry->prog_len = ch->prog_len; | ||
316 | __entry->xferred = ch->transferred; | ||
317 | ), | ||
318 | TP_printk("%s: %p, hwep%d ch%d%s, prog_len %d, len %d/%d", | ||
319 | __get_str(name), __entry->ch, __entry->hwep, | ||
320 | __entry->port, __entry->is_tx ? "tx" : "rx", | ||
321 | __entry->prog_len, __entry->xferred, __entry->len | ||
322 | ) | ||
323 | ); | ||
324 | |||
325 | DEFINE_EVENT(musb_cppi41, musb_cppi41_done, | ||
326 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
327 | TP_ARGS(ch) | ||
328 | ); | ||
329 | |||
330 | DEFINE_EVENT(musb_cppi41, musb_cppi41_gb, | ||
331 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
332 | TP_ARGS(ch) | ||
333 | ); | ||
334 | |||
335 | DEFINE_EVENT(musb_cppi41, musb_cppi41_config, | ||
336 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
337 | TP_ARGS(ch) | ||
338 | ); | ||
339 | |||
340 | DEFINE_EVENT(musb_cppi41, musb_cppi41_cont, | ||
341 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
342 | TP_ARGS(ch) | ||
343 | ); | ||
344 | |||
345 | DEFINE_EVENT(musb_cppi41, musb_cppi41_alloc, | ||
346 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
347 | TP_ARGS(ch) | ||
348 | ); | ||
349 | |||
350 | DEFINE_EVENT(musb_cppi41, musb_cppi41_abort, | ||
351 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
352 | TP_ARGS(ch) | ||
353 | ); | ||
354 | |||
355 | DEFINE_EVENT(musb_cppi41, musb_cppi41_free, | ||
356 | TP_PROTO(struct cppi41_dma_channel *ch), | ||
357 | TP_ARGS(ch) | ||
358 | ); | ||
359 | #endif /* CONFIG_USB_TI_CPPI41_DMA */ | ||
360 | |||
291 | #endif /* __MUSB_TRACE_H */ | 361 | #endif /* __MUSB_TRACE_H */ |
292 | 362 | ||
293 | /* this part has to be here */ | 363 | /* this part has to be here */ |