Loading Documentation/devicetree/bindings/mailbox/qcom-tcs.txt +17 −11 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ PROPERTIES: ACTIVE_TCS CONTROL_TCS - Cell #2 (Number of TCS): <u32> - label: Usage: optional Value type: <string> Definition: Name for the mailbox. The name would be used in trace logs. EXAMPLE 1: Loading @@ -92,6 +96,7 @@ Second tuple: 0x179E0000 + 0xD00 = 0x179E0D00 apps_rsc: mailbox@179e000 { compatible = "qcom,tcs_drv"; label = "apps_rsc"; reg = <0x179E0000 0x10000>, <0x179E0D00 0x3000>; interrupts = <0 5 0>; #mbox-cells = <1>; Loading @@ -111,6 +116,7 @@ Second tuple: 0xAF20000 + 0x1C00 disp_rsc: mailbox@af20000 { status = "disabled"; label = "disp_rsc"; compatible = "qcom,tcs-drv"; reg = <0xAF20000 0x10000>, <0xAF21C00 0x3000>; interrupts = <0 129 0>; Loading drivers/mailbox/qti-tcs.c +20 −10 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct tcs_mbox { /* One per MBOX controller */ struct tcs_drv { const char *name; void *base; /* start address of the RSC's registers */ void *reg_base; /* start address for DRV specific register */ int drv_id; Loading Loading @@ -385,7 +386,8 @@ static irqreturn_t tcs_irq_handler(int irq, void *p) mbox_chan_received_data(resp->chan, resp->msg); } trace_rpmh_notify_irq(m, resp->msg->payload[0].addr, resp->err); trace_rpmh_notify_irq(drv->name, m, resp->msg->payload[0].addr, resp->err); /* Notify the client that this request is completed. */ send_tcs_response(resp); Loading @@ -401,7 +403,9 @@ static irqreturn_t tcs_irq_handler(int irq, void *p) static inline void mbox_notify_tx_done(struct mbox_chan *chan, struct tcs_mbox_msg *msg, int m, int err) { trace_rpmh_notify(m, msg->payload[0].addr, err); struct tcs_drv *drv = container_of(chan->mbox, struct tcs_drv, mbox); trace_rpmh_notify(drv->name, m, msg->payload[0].addr, err); mbox_chan_txdone(chan, err); } Loading Loading @@ -467,7 +471,7 @@ static void tcs_notify_timeout(struct work_struct *work) mbox_notify_tx_done(chan, msg, -1, err); } static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, static void __tcs_buffer_write(struct tcs_drv *drv, int d, int m, int n, struct tcs_mbox_msg *msg, bool trigger) { u32 cmd_msgid = 0; Loading @@ -476,6 +480,7 @@ static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, u32 enable = TCS_AMC_MODE_ENABLE; struct tcs_cmd *cmd; int i; void __iomem *base = drv->reg_base; /* We have homologous command set i.e pure read or write, not a mix */ cmd_msgid = CMD_MSGID_LEN; Loading @@ -492,8 +497,8 @@ static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, write_tcs_reg(base, TCS_DRV_CMD_MSGID, m, n + i, cmd_msgid); write_tcs_reg(base, TCS_DRV_CMD_ADDR, m, n + i, cmd->addr); write_tcs_reg(base, TCS_DRV_CMD_DATA, m, n + i, cmd->data); trace_rpmh_send_msg(base, m, n + i, cmd_msgid, cmd->addr, cmd->data, cmd->complete); trace_rpmh_send_msg(drv->name, m, n + i, cmd_msgid, cmd->addr, cmd->data, cmd->complete, trigger); } /* Write the send-after-prev completion bits for the batch */ Loading Loading @@ -716,7 +721,7 @@ static int tcs_mbox_write(struct mbox_chan *chan, struct tcs_mbox_msg *msg, } /* Write to the TCS or AMC */ __tcs_buffer_write(drv->reg_base, d, m, n, msg, trigger); __tcs_buffer_write(drv, d, m, n, msg, trigger); /* Schedule a timeout response, incase there is no actual response */ if (trigger) Loading Loading @@ -826,15 +831,16 @@ static int tcs_mbox_invalidate(struct mbox_chan *chan) return 0; } static void __tcs_write_hidden(void *base, int d, struct tcs_mbox_msg *msg) static void __tcs_write_hidden(struct tcs_drv *drv, int d, struct tcs_mbox_msg *msg) { int i; void __iomem *addr = base + TCS_HIDDEN_CMD0_DRV_DATA; void __iomem *addr = drv->base + TCS_HIDDEN_CMD0_DRV_DATA; for (i = 0; i < msg->num_payload; i++) { /* Only data is write capable */ writel_relaxed(cpu_to_le32(msg->payload[i].data), addr); trace_rpmh_control_msg(addr, msg->payload[i].data); trace_rpmh_control_msg(drv->name, msg->payload[i].data); addr += TCS_HIDDEN_CMD_SHIFT; } } Loading @@ -855,7 +861,7 @@ static int tcs_control_write(struct mbox_chan *chan, struct tcs_mbox_msg *msg) } spin_lock(&tcs->tcs_lock); __tcs_write_hidden(tcs->drv->base, drv->drv_id, msg); __tcs_write_hidden(tcs->drv, drv->drv_id, msg); spin_unlock(&tcs->tcs_lock); return 0; Loading Loading @@ -1073,6 +1079,10 @@ static int tcs_drv_probe(struct platform_device *pdev) drv->num_tcs = st; drv->pdev = pdev; drv->name = of_get_property(pdev->dev.of_node, "label", NULL); if (!drv->name) drv->name = dev_name(&pdev->dev); ret = tcs_response_pool_init(drv); if (ret) return ret; Loading include/trace/events/rpmh.h +26 −23 Original line number Diff line number Diff line /* Copyright (c) 2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -20,86 +20,89 @@ DECLARE_EVENT_CLASS(rpmh_ack_recvd, TP_PROTO(int m, u32 addr, int errno), TP_PROTO(const char *s, int m, u32 addr, int errno), TP_ARGS(m, addr, errno), TP_ARGS(s, m, addr, errno), TP_STRUCT__entry( __field(const char *, name) __field(int, m) __field(u32, addr) __field(int, errno) ), TP_fast_assign( __entry->name = s; __entry->m = m; __entry->addr = addr; __entry->errno = errno; ), TP_printk("ack: tcs-m:%d addr: 0x%08x errno: %d", __entry->m, __entry->addr, __entry->errno) TP_printk("%s: ack: tcs-m:%d addr: 0x%08x errno: %d", __entry->name, __entry->m, __entry->addr, __entry->errno) ); DEFINE_EVENT(rpmh_ack_recvd, rpmh_notify_irq, TP_PROTO(int m, u32 addr, int err), TP_ARGS(m, addr, err) TP_PROTO(const char *s, int m, u32 addr, int err), TP_ARGS(s, m, addr, err) ); DEFINE_EVENT(rpmh_ack_recvd, rpmh_notify, TP_PROTO(int m, u32 addr, int err), TP_ARGS(m, addr, err) TP_PROTO(const char *s, int m, u32 addr, int err), TP_ARGS(s, m, addr, err) ); TRACE_EVENT(rpmh_send_msg, TP_PROTO(void *b, int m, int n, u32 h, u32 a, u32 v, bool c), TP_PROTO(const char *s, int m, int n, u32 h, u32 a, u32 v, bool c, bool t), TP_ARGS(b, m, n, h, a, v, c), TP_ARGS(s, m, n, h, a, v, c, t), TP_STRUCT__entry( __field(void *, base) __field(const char*, name) __field(int, m) __field(int, n) __field(u32, hdr) __field(u32, addr) __field(u32, data) __field(bool, complete) __field(bool, trigger) ), TP_fast_assign( __entry->base = b; __entry->name = s; __entry->m = m; __entry->n = n; __entry->hdr = h; __entry->addr = a; __entry->data = v; __entry->complete = c; __entry->trigger = t; ), TP_printk("msg: base: 0x%p tcs(m): %d cmd(n): %d msgid: 0x%08x addr: 0x%08x data: 0x%08x complete: %d", __entry->base + (672 * __entry->m) + (20 * __entry->n), __entry->m, __entry->n, __entry->hdr, __entry->addr, __entry->data, __entry->complete) TP_printk("%s: send-msg: tcs(m): %d cmd(n): %d msgid: 0x%08x addr: 0x%08x data: 0x%08x complete: %d trigger: %d", __entry->name, __entry->m, __entry->n, __entry->hdr, __entry->addr, __entry->data, __entry->complete, __entry->trigger) ); TRACE_EVENT(rpmh_control_msg, TP_PROTO(void *r, u32 v), TP_PROTO(const char *s, u32 v), TP_ARGS(r, v), TP_ARGS(s, v), TP_STRUCT__entry( __field(void *, reg) __field(const char *, name) __field(u32, data) ), TP_fast_assign( __entry->reg = r; __entry->name = s; __entry->data = v; ), TP_printk("ctrl-msg: reg: 0x%p data: 0x%08x", __entry->reg, __entry->data) TP_printk("%s: ctrl-msg: data: 0x%08x", __entry->name, __entry->data) ); #endif /* _TRACE_RPMH_H */ Loading Loading
Documentation/devicetree/bindings/mailbox/qcom-tcs.txt +17 −11 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ PROPERTIES: ACTIVE_TCS CONTROL_TCS - Cell #2 (Number of TCS): <u32> - label: Usage: optional Value type: <string> Definition: Name for the mailbox. The name would be used in trace logs. EXAMPLE 1: Loading @@ -92,6 +96,7 @@ Second tuple: 0x179E0000 + 0xD00 = 0x179E0D00 apps_rsc: mailbox@179e000 { compatible = "qcom,tcs_drv"; label = "apps_rsc"; reg = <0x179E0000 0x10000>, <0x179E0D00 0x3000>; interrupts = <0 5 0>; #mbox-cells = <1>; Loading @@ -111,6 +116,7 @@ Second tuple: 0xAF20000 + 0x1C00 disp_rsc: mailbox@af20000 { status = "disabled"; label = "disp_rsc"; compatible = "qcom,tcs-drv"; reg = <0xAF20000 0x10000>, <0xAF21C00 0x3000>; interrupts = <0 129 0>; Loading
drivers/mailbox/qti-tcs.c +20 −10 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ struct tcs_mbox { /* One per MBOX controller */ struct tcs_drv { const char *name; void *base; /* start address of the RSC's registers */ void *reg_base; /* start address for DRV specific register */ int drv_id; Loading Loading @@ -385,7 +386,8 @@ static irqreturn_t tcs_irq_handler(int irq, void *p) mbox_chan_received_data(resp->chan, resp->msg); } trace_rpmh_notify_irq(m, resp->msg->payload[0].addr, resp->err); trace_rpmh_notify_irq(drv->name, m, resp->msg->payload[0].addr, resp->err); /* Notify the client that this request is completed. */ send_tcs_response(resp); Loading @@ -401,7 +403,9 @@ static irqreturn_t tcs_irq_handler(int irq, void *p) static inline void mbox_notify_tx_done(struct mbox_chan *chan, struct tcs_mbox_msg *msg, int m, int err) { trace_rpmh_notify(m, msg->payload[0].addr, err); struct tcs_drv *drv = container_of(chan->mbox, struct tcs_drv, mbox); trace_rpmh_notify(drv->name, m, msg->payload[0].addr, err); mbox_chan_txdone(chan, err); } Loading Loading @@ -467,7 +471,7 @@ static void tcs_notify_timeout(struct work_struct *work) mbox_notify_tx_done(chan, msg, -1, err); } static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, static void __tcs_buffer_write(struct tcs_drv *drv, int d, int m, int n, struct tcs_mbox_msg *msg, bool trigger) { u32 cmd_msgid = 0; Loading @@ -476,6 +480,7 @@ static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, u32 enable = TCS_AMC_MODE_ENABLE; struct tcs_cmd *cmd; int i; void __iomem *base = drv->reg_base; /* We have homologous command set i.e pure read or write, not a mix */ cmd_msgid = CMD_MSGID_LEN; Loading @@ -492,8 +497,8 @@ static void __tcs_buffer_write(void __iomem *base, int d, int m, int n, write_tcs_reg(base, TCS_DRV_CMD_MSGID, m, n + i, cmd_msgid); write_tcs_reg(base, TCS_DRV_CMD_ADDR, m, n + i, cmd->addr); write_tcs_reg(base, TCS_DRV_CMD_DATA, m, n + i, cmd->data); trace_rpmh_send_msg(base, m, n + i, cmd_msgid, cmd->addr, cmd->data, cmd->complete); trace_rpmh_send_msg(drv->name, m, n + i, cmd_msgid, cmd->addr, cmd->data, cmd->complete, trigger); } /* Write the send-after-prev completion bits for the batch */ Loading Loading @@ -716,7 +721,7 @@ static int tcs_mbox_write(struct mbox_chan *chan, struct tcs_mbox_msg *msg, } /* Write to the TCS or AMC */ __tcs_buffer_write(drv->reg_base, d, m, n, msg, trigger); __tcs_buffer_write(drv, d, m, n, msg, trigger); /* Schedule a timeout response, incase there is no actual response */ if (trigger) Loading Loading @@ -826,15 +831,16 @@ static int tcs_mbox_invalidate(struct mbox_chan *chan) return 0; } static void __tcs_write_hidden(void *base, int d, struct tcs_mbox_msg *msg) static void __tcs_write_hidden(struct tcs_drv *drv, int d, struct tcs_mbox_msg *msg) { int i; void __iomem *addr = base + TCS_HIDDEN_CMD0_DRV_DATA; void __iomem *addr = drv->base + TCS_HIDDEN_CMD0_DRV_DATA; for (i = 0; i < msg->num_payload; i++) { /* Only data is write capable */ writel_relaxed(cpu_to_le32(msg->payload[i].data), addr); trace_rpmh_control_msg(addr, msg->payload[i].data); trace_rpmh_control_msg(drv->name, msg->payload[i].data); addr += TCS_HIDDEN_CMD_SHIFT; } } Loading @@ -855,7 +861,7 @@ static int tcs_control_write(struct mbox_chan *chan, struct tcs_mbox_msg *msg) } spin_lock(&tcs->tcs_lock); __tcs_write_hidden(tcs->drv->base, drv->drv_id, msg); __tcs_write_hidden(tcs->drv, drv->drv_id, msg); spin_unlock(&tcs->tcs_lock); return 0; Loading Loading @@ -1073,6 +1079,10 @@ static int tcs_drv_probe(struct platform_device *pdev) drv->num_tcs = st; drv->pdev = pdev; drv->name = of_get_property(pdev->dev.of_node, "label", NULL); if (!drv->name) drv->name = dev_name(&pdev->dev); ret = tcs_response_pool_init(drv); if (ret) return ret; Loading
include/trace/events/rpmh.h +26 −23 Original line number Diff line number Diff line /* Copyright (c) 2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -20,86 +20,89 @@ DECLARE_EVENT_CLASS(rpmh_ack_recvd, TP_PROTO(int m, u32 addr, int errno), TP_PROTO(const char *s, int m, u32 addr, int errno), TP_ARGS(m, addr, errno), TP_ARGS(s, m, addr, errno), TP_STRUCT__entry( __field(const char *, name) __field(int, m) __field(u32, addr) __field(int, errno) ), TP_fast_assign( __entry->name = s; __entry->m = m; __entry->addr = addr; __entry->errno = errno; ), TP_printk("ack: tcs-m:%d addr: 0x%08x errno: %d", __entry->m, __entry->addr, __entry->errno) TP_printk("%s: ack: tcs-m:%d addr: 0x%08x errno: %d", __entry->name, __entry->m, __entry->addr, __entry->errno) ); DEFINE_EVENT(rpmh_ack_recvd, rpmh_notify_irq, TP_PROTO(int m, u32 addr, int err), TP_ARGS(m, addr, err) TP_PROTO(const char *s, int m, u32 addr, int err), TP_ARGS(s, m, addr, err) ); DEFINE_EVENT(rpmh_ack_recvd, rpmh_notify, TP_PROTO(int m, u32 addr, int err), TP_ARGS(m, addr, err) TP_PROTO(const char *s, int m, u32 addr, int err), TP_ARGS(s, m, addr, err) ); TRACE_EVENT(rpmh_send_msg, TP_PROTO(void *b, int m, int n, u32 h, u32 a, u32 v, bool c), TP_PROTO(const char *s, int m, int n, u32 h, u32 a, u32 v, bool c, bool t), TP_ARGS(b, m, n, h, a, v, c), TP_ARGS(s, m, n, h, a, v, c, t), TP_STRUCT__entry( __field(void *, base) __field(const char*, name) __field(int, m) __field(int, n) __field(u32, hdr) __field(u32, addr) __field(u32, data) __field(bool, complete) __field(bool, trigger) ), TP_fast_assign( __entry->base = b; __entry->name = s; __entry->m = m; __entry->n = n; __entry->hdr = h; __entry->addr = a; __entry->data = v; __entry->complete = c; __entry->trigger = t; ), TP_printk("msg: base: 0x%p tcs(m): %d cmd(n): %d msgid: 0x%08x addr: 0x%08x data: 0x%08x complete: %d", __entry->base + (672 * __entry->m) + (20 * __entry->n), __entry->m, __entry->n, __entry->hdr, __entry->addr, __entry->data, __entry->complete) TP_printk("%s: send-msg: tcs(m): %d cmd(n): %d msgid: 0x%08x addr: 0x%08x data: 0x%08x complete: %d trigger: %d", __entry->name, __entry->m, __entry->n, __entry->hdr, __entry->addr, __entry->data, __entry->complete, __entry->trigger) ); TRACE_EVENT(rpmh_control_msg, TP_PROTO(void *r, u32 v), TP_PROTO(const char *s, u32 v), TP_ARGS(r, v), TP_ARGS(s, v), TP_STRUCT__entry( __field(void *, reg) __field(const char *, name) __field(u32, data) ), TP_fast_assign( __entry->reg = r; __entry->name = s; __entry->data = v; ), TP_printk("ctrl-msg: reg: 0x%p data: 0x%08x", __entry->reg, __entry->data) TP_printk("%s: ctrl-msg: data: 0x%08x", __entry->name, __entry->data) ); #endif /* _TRACE_RPMH_H */ Loading