Message ID | 20231023043751.17114-5-jason-jh.lin@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add CMDQ secure driver for SVP | expand |
Il 23/10/23 06:37, Jason-JH.Lin ha scritto: > Add cmdq_pkt_write_s_reg_value to support write a value to a register. > > It appends write_s command to the command buffer in a CMDQ packet, > ask GCE to excute a write instruction to write a value to a register > with low 16 bits physical address offset. > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> Please fix the commit title: soc: mediatek: cmdq: xxxx Regards, Angelo
Hi Angelo, Thanks for the reviews. On Mon, 2023-10-23 at 11:50 +0200, AngeloGioacchino Del Regno wrote: > Il 23/10/23 06:37, Jason-JH.Lin ha scritto: > > Add cmdq_pkt_write_s_reg_value to support write a value to a > > register. > > > > It appends write_s command to the command buffer in a CMDQ packet, > > ask GCE to excute a write instruction to write a value to a > > register > > with low 16 bits physical address offset. > > > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > > Please fix the commit title: > > soc: mediatek: cmdq: xxxx > OK, I'll fix that. Thanks! Regards, Jason-JH.Lin > Regards, > Angelo >
diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 5194d66dfc0a..4be2a18a4a02 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -287,6 +287,19 @@ int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, } EXPORT_SYMBOL(cmdq_pkt_write_s_value); +int cmdq_pkt_write_s_reg_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u32 value) +{ + struct cmdq_instruction inst = {}; + + inst.op = CMDQ_CODE_WRITE_S; + inst.dst_t = CMDQ_REG_TYPE; + inst.reg_dst = high_addr_reg_idx; + inst.value = value; + + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_write_s_reg_value); + int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u16 addr_low, u32 value, u32 mask) { diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index ea4fadfb5443..4262594a0d18 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -207,6 +207,17 @@ int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u16 addr_low, u32 value, u32 mask); +/** + * cmdq_pkt_write_s_reg_value() - append write_s command to the CMDQ packet which + * write value to a register with low address pa + * @pkt: the CMDQ packet + * @reg_idx: internal register ID which contains high address of pa + * @value: the specified target value + * + * Return: 0 for success; else the error code is returned + */ +int cmdq_pkt_write_s_reg_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u32 value); + /** * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet * @pkt: the CMDQ packet
Add cmdq_pkt_write_s_reg_value to support write a value to a register. It appends write_s command to the command buffer in a CMDQ packet, ask GCE to excute a write instruction to write a value to a register with low 16 bits physical address offset. Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> --- drivers/soc/mediatek/mtk-cmdq-helper.c | 13 +++++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 11 +++++++++++ 2 files changed, 24 insertions(+)