* [PATCH v1, 0/1] soc: mediatek: cmdq: add cmdq_pkt_poll_addr function @ 2022-01-20 7:43 Yongqiang Niu 2022-01-20 7:43 ` [PATCH v1, 1/1] " Yongqiang Niu 0 siblings, 1 reply; 3+ messages in thread From: Yongqiang Niu @ 2022-01-20 7:43 UTC (permalink / raw) To: Chun-Kuang Hu Cc: Rob Herring, Matthias Brugger, Philipp Zabel, David Airlie, Daniel Vetter, Jassi Brar, Yongqiang Niu, Fabien Parent, Dennis YC Hsieh, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, dri-devel, Project_Global_Chrome_Upstream_Group, Hsin-Yi Wang add cmdq_pkt_poll_addr function mtk18742 (1): soc: mediatek: cmdq: add cmdq_pkt_poll_addr function drivers/soc/mediatek/mtk-cmdq-helper.c | 39 ++++++++++++++++++++++++ include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + include/linux/soc/mediatek/mtk-cmdq.h | 2 ++ 3 files changed, 42 insertions(+) -- 2.25.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1, 1/1] soc: mediatek: cmdq: add cmdq_pkt_poll_addr function 2022-01-20 7:43 [PATCH v1, 0/1] soc: mediatek: cmdq: add cmdq_pkt_poll_addr function Yongqiang Niu @ 2022-01-20 7:43 ` Yongqiang Niu 2022-01-21 2:08 ` CK Hu 0 siblings, 1 reply; 3+ messages in thread From: Yongqiang Niu @ 2022-01-20 7:43 UTC (permalink / raw) To: Chun-Kuang Hu Cc: Rob Herring, Matthias Brugger, Philipp Zabel, David Airlie, Daniel Vetter, Jassi Brar, Yongqiang Niu, Fabien Parent, Dennis YC Hsieh, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, dri-devel, Project_Global_Chrome_Upstream_Group, Hsin-Yi Wang, mtk18742 From: mtk18742 <moudy.ho@mediatek.com> add cmdq_pkt_poll_addr function in cmdq helper functions Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com> --- drivers/soc/mediatek/mtk-cmdq-helper.c | 39 ++++++++++++++++++++++++ include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + include/linux/soc/mediatek/mtk-cmdq.h | 2 ++ 3 files changed, 42 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 3c8e4212d941..6c5cfb284140 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -344,6 +344,45 @@ int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) } EXPORT_SYMBOL(cmdq_pkt_set_event); +s32 cmdq_pkt_poll_addr(struct cmdq_pkt *pkt, u32 value, u32 addr, u32 mask, u8 reg_gpr) +{ + struct cmdq_instruction inst = { {0} }; + + s32 err; + + if (mask != 0xffffffff) { + inst.op = CMDQ_CODE_MASK; + inst.mask = ~mask; + err = cmdq_pkt_append_command(pkt, inst); + if (err != 0) + return err; + + addr = addr | 0x1; + } + + /* Move extra handle APB address to GPR */ + inst.op = CMDQ_CODE_MOVE; + inst.value = addr; + inst.sop = reg_gpr; + inst.dst_t = 1; + err = cmdq_pkt_append_command(pkt, inst); + if (err != 0) + pr_err("%s fail append command move addr to reg err:%d", + __func__, err); + + inst.op = CMDQ_CODE_POLL; + inst.value = value; + inst.sop = reg_gpr; + inst.dst_t = 1; + err = cmdq_pkt_append_command(pkt, inst); + if (err != 0) + pr_err("%s fail append command poll err:%d", + __func__, err); + + return err; +} +EXPORT_SYMBOL(cmdq_pkt_poll_addr); + int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value) { diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h index 44365aab043c..a27329fd7c7f 100644 --- a/include/linux/mailbox/mtk-cmdq-mailbox.h +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h @@ -54,6 +54,7 @@ */ enum cmdq_code { CMDQ_CODE_MASK = 0x02, + CMDQ_CODE_MOVE = 0x02, CMDQ_CODE_WRITE = 0x04, CMDQ_CODE_POLL = 0x08, CMDQ_CODE_JUMP = 0x10, diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index ac6b5f3cba95..28dc5ce0ff03 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -280,4 +280,6 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, void *data); +s32 cmdq_pkt_poll_addr(struct cmdq_pkt *pkt, u32 value, u32 addr, u32 mask, u8 reg_gpr); + #endif /* __MTK_CMDQ_H__ */ -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1, 1/1] soc: mediatek: cmdq: add cmdq_pkt_poll_addr function 2022-01-20 7:43 ` [PATCH v1, 1/1] " Yongqiang Niu @ 2022-01-21 2:08 ` CK Hu 0 siblings, 0 replies; 3+ messages in thread From: CK Hu @ 2022-01-21 2:08 UTC (permalink / raw) To: Yongqiang Niu, Chun-Kuang Hu Cc: devicetree, Project_Global_Chrome_Upstream_Group, David Airlie, Jassi Brar, linux-kernel, dri-devel, Dennis YC Hsieh, Fabien Parent, Rob Herring, linux-mediatek, Hsin-Yi Wang, Matthias Brugger, mtk18742, linux-arm-kernel Hi, Yongqiang: On Thu, 2022-01-20 at 15:43 +0800, Yongqiang Niu wrote: > From: mtk18742 <moudy.ho@mediatek.com> > > add cmdq_pkt_poll_addr function in cmdq helper functions > > Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com> > --- > drivers/soc/mediatek/mtk-cmdq-helper.c | 39 > ++++++++++++++++++++++++ > include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + > include/linux/soc/mediatek/mtk-cmdq.h | 2 ++ > 3 files changed, 42 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c > b/drivers/soc/mediatek/mtk-cmdq-helper.c > index 3c8e4212d941..6c5cfb284140 100644 > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > @@ -344,6 +344,45 @@ int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 > event) > } > EXPORT_SYMBOL(cmdq_pkt_set_event); > > +s32 cmdq_pkt_poll_addr(struct cmdq_pkt *pkt, u32 value, u32 addr, > u32 mask, u8 reg_gpr) > +{ > + struct cmdq_instruction inst = { {0} }; > + > + s32 err; > + > + if (mask != 0xffffffff) { > + inst.op = CMDQ_CODE_MASK; > + inst.mask = ~mask; > + err = cmdq_pkt_append_command(pkt, inst); > + if (err != 0) > + return err; > + > + addr = addr | 0x1; > + } > + > + /* Move extra handle APB address to GPR */ > + inst.op = CMDQ_CODE_MOVE; > + inst.value = addr; > + inst.sop = reg_gpr; > + inst.dst_t = 1; > + err = cmdq_pkt_append_command(pkt, inst); > + if (err != 0) > + pr_err("%s fail append command move addr to reg > err:%d", > + __func__, err); cmdq_pkt_assign() could assign a value to GPR, so remove this part. > + > + inst.op = CMDQ_CODE_POLL; > + inst.value = value; > + inst.sop = reg_gpr; > + inst.dst_t = 1; > + err = cmdq_pkt_append_command(pkt, inst); > + if (err != 0) > + pr_err("%s fail append command poll err:%d", > + __func__, err); > + > + return err; > +} > +EXPORT_SYMBOL(cmdq_pkt_poll_addr); > + > int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, > u16 offset, u32 value) > { > diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h > b/include/linux/mailbox/mtk-cmdq-mailbox.h > index 44365aab043c..a27329fd7c7f 100644 > --- a/include/linux/mailbox/mtk-cmdq-mailbox.h > +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h > @@ -54,6 +54,7 @@ > */ > enum cmdq_code { > CMDQ_CODE_MASK = 0x02, > + CMDQ_CODE_MOVE = 0x02, > CMDQ_CODE_WRITE = 0x04, > CMDQ_CODE_POLL = 0x08, > CMDQ_CODE_JUMP = 0x10, > diff --git a/include/linux/soc/mediatek/mtk-cmdq.h > b/include/linux/soc/mediatek/mtk-cmdq.h > index ac6b5f3cba95..28dc5ce0ff03 100644 > --- a/include/linux/soc/mediatek/mtk-cmdq.h > +++ b/include/linux/soc/mediatek/mtk-cmdq.h > @@ -280,4 +280,6 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); > int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb > cb, > void *data); > Add comment for this function, parameters, and return value like other interface. Regards, CK > +s32 cmdq_pkt_poll_addr(struct cmdq_pkt *pkt, u32 value, u32 addr, > u32 mask, u8 reg_gpr); > + > #endif /* __MTK_CMDQ_H__ */ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-21 2:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-20 7:43 [PATCH v1, 0/1] soc: mediatek: cmdq: add cmdq_pkt_poll_addr function Yongqiang Niu 2022-01-20 7:43 ` [PATCH v1, 1/1] " Yongqiang Niu 2022-01-21 2:08 ` CK Hu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).