Skip to content

Commit 1af43fc

Browse files
Dennis YC Hsiehmbgg
authored andcommitted
soc: mediatek: cmdq: add write_s value function
add write_s function in cmdq helper functions which writes a constant value to address with large dma access support. Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> Link: https://lore.kernel.org/r/1594136714-11650-6-git-send-email-dennis-yc.hsieh@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
1 parent d3b04aa commit 1af43fc

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/soc/mediatek/mtk-cmdq-helper.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,20 @@ int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
280280
}
281281
EXPORT_SYMBOL(cmdq_pkt_write_s_mask);
282282

283+
int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
284+
u16 addr_low, u32 value)
285+
{
286+
struct cmdq_instruction inst = {};
287+
288+
inst.op = CMDQ_CODE_WRITE_S;
289+
inst.sop = high_addr_reg_idx;
290+
inst.offset = addr_low;
291+
inst.value = value;
292+
293+
return cmdq_pkt_append_command(pkt, inst);
294+
}
295+
EXPORT_SYMBOL(cmdq_pkt_write_s_value);
296+
283297
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event)
284298
{
285299
struct cmdq_instruction inst = { {0} };

include/linux/soc/mediatek/mtk-cmdq.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
151151
int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
152152
u16 addr_low, u16 src_reg_idx, u32 mask);
153153

154+
/**
155+
* cmdq_pkt_write_s_value() - append write_s command to the CMDQ packet which
156+
* write value to a physical address
157+
* @pkt: the CMDQ packet
158+
* @high_addr_reg_idx: internal register ID which contains high address of pa
159+
* @addr_low: low address of pa
160+
* @value: the specified target value
161+
*
162+
* Return: 0 for success; else the error code is returned
163+
*/
164+
int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
165+
u16 addr_low, u32 value);
166+
154167
/**
155168
* cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
156169
* @pkt: the CMDQ packet

0 commit comments

Comments
 (0)