Skip to content

Commit 88a2ffc

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

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,27 @@ int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
294294
}
295295
EXPORT_SYMBOL(cmdq_pkt_write_s_value);
296296

297+
int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
298+
u16 addr_low, u32 value, u32 mask)
299+
{
300+
struct cmdq_instruction inst = {};
301+
int err;
302+
303+
inst.op = CMDQ_CODE_MASK;
304+
inst.mask = ~mask;
305+
err = cmdq_pkt_append_command(pkt, inst);
306+
if (err < 0)
307+
return err;
308+
309+
inst.op = CMDQ_CODE_WRITE_S_MASK;
310+
inst.sop = high_addr_reg_idx;
311+
inst.offset = addr_low;
312+
inst.value = value;
313+
314+
return cmdq_pkt_append_command(pkt, inst);
315+
}
316+
EXPORT_SYMBOL(cmdq_pkt_write_s_mask_value);
317+
297318
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event)
298319
{
299320
struct cmdq_instruction inst = { {0} };

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,21 @@ int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
164164
int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
165165
u16 addr_low, u32 value);
166166

167+
/**
168+
* cmdq_pkt_write_s_mask_value() - append write_s command with mask to the CMDQ
169+
* packet which write value to a physical
170+
* address
171+
* @pkt: the CMDQ packet
172+
* @high_addr_reg_idx: internal register ID which contains high address of pa
173+
* @addr_low: low address of pa
174+
* @value: the specified target value
175+
* @mask: the specified target mask
176+
*
177+
* Return: 0 for success; else the error code is returned
178+
*/
179+
int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
180+
u16 addr_low, u32 value, u32 mask);
181+
167182
/**
168183
* cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
169184
* @pkt: the CMDQ packet

0 commit comments

Comments
 (0)