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

usb: musb: add tracepoints for register access

This adds tracepoints to musb register read/write wrappers to get
trace log for register access.

The default tacepoint log prefix here would be musb_readX/writeX(),
which is not much helpful. So this patch let the tracepoints use
__buildin_return_address(0) to print the caller funciton name to
provide more context of the register access.
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 086b2882
......@@ -102,6 +102,7 @@
#include <linux/usb.h>
#include "musb_core.h"
#include "musb_trace.h"
#define TA_WAIT_BCON(m) max_t(int, (m)->a_wait_bcon, OTG_TIME_A_WAIT_BCON)
......@@ -258,31 +259,43 @@ static u32 musb_default_busctl_offset(u8 epnum, u16 offset)
static u8 musb_default_readb(const void __iomem *addr, unsigned offset)
{
return __raw_readb(addr + offset);
u8 data = __raw_readb(addr + offset);
trace_musb_readb(__builtin_return_address(0), addr, offset, data);
return data;
}
static void musb_default_writeb(void __iomem *addr, unsigned offset, u8 data)
{
trace_musb_writeb(__builtin_return_address(0), addr, offset, data);
__raw_writeb(data, addr + offset);
}
static u16 musb_default_readw(const void __iomem *addr, unsigned offset)
{
return __raw_readw(addr + offset);
u16 data = __raw_readw(addr + offset);
trace_musb_readw(__builtin_return_address(0), addr, offset, data);
return data;
}
static void musb_default_writew(void __iomem *addr, unsigned offset, u16 data)
{
trace_musb_writew(__builtin_return_address(0), addr, offset, data);
__raw_writew(data, addr + offset);
}
static u32 musb_default_readl(const void __iomem *addr, unsigned offset)
{
return __raw_readl(addr + offset);
u32 data = __raw_readl(addr + offset);
trace_musb_readl(__builtin_return_address(0), addr, offset, data);
return data;
}
static void musb_default_writel(void __iomem *addr, unsigned offset, u32 data)
{
trace_musb_writel(__builtin_return_address(0), addr, offset, data);
__raw_writel(data, addr + offset);
}
......
......@@ -41,6 +41,93 @@ TRACE_EVENT(musb_log,
TP_printk("%s: %s", __get_str(name), __get_str(msg))
);
DECLARE_EVENT_CLASS(musb_regb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u8, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %02x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regb, musb_readb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regb, musb_writeb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data)
);
DECLARE_EVENT_CLASS(musb_regw,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u16, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %04x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regw, musb_readw,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regw, musb_writew,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data)
);
DECLARE_EVENT_CLASS(musb_regl,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u32, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %08x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regl, musb_readl,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regl, musb_writel,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data)
);
#endif /* __MUSB_TRACE_H */
/* 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