Skip to content

Commit 22ce09c

Browse files
Jason-JH LinAngeloGioacchino Del Regno
authored andcommitted
soc: mediatek: mtk-cmdq: Add mminfra_offset adjustment for DRAM addresses
Since GCE has been moved to MMINFRA in MT8196, all transactions from MMINFRA to DRAM will have their addresses adjusted by subtracting a mminfra_offset. Therefore, the CMDQ helper driver needs to get the mminfra_offset value of the SoC from cmdq_mbox_priv of cmdq_pkt and then add it to the DRAM address when generating instructions to ensure GCE accesses the correct DRAM address. CMDQ users can then call CMDQ helper APIs as usual. Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
1 parent 40dc5bb commit 22ce09c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ int cmdq_pkt_mem_move(struct cmdq_pkt *pkt, dma_addr_t src_addr, dma_addr_t dst_
372372
int ret;
373373

374374
/* read the value of src_addr into high_addr_reg_idx */
375+
src_addr += pkt->priv.mminfra_offset;
375376
ret = cmdq_pkt_assign(pkt, high_addr_reg_idx, CMDQ_ADDR_HIGH(src_addr));
376377
if (ret < 0)
377378
return ret;
@@ -380,6 +381,7 @@ int cmdq_pkt_mem_move(struct cmdq_pkt *pkt, dma_addr_t src_addr, dma_addr_t dst_
380381
return ret;
381382

382383
/* write the value of value_reg_idx into dst_addr */
384+
dst_addr += pkt->priv.mminfra_offset;
383385
ret = cmdq_pkt_assign(pkt, high_addr_reg_idx, CMDQ_ADDR_HIGH(dst_addr));
384386
if (ret < 0)
385387
return ret;
@@ -505,7 +507,7 @@ int cmdq_pkt_poll_addr(struct cmdq_pkt *pkt, dma_addr_t addr, u32 value, u32 mas
505507
inst.op = CMDQ_CODE_MASK;
506508
inst.dst_t = CMDQ_REG_TYPE;
507509
inst.sop = CMDQ_POLL_ADDR_GPR;
508-
inst.value = addr;
510+
inst.value = addr + pkt->priv.mminfra_offset;
509511
ret = cmdq_pkt_append_command(pkt, inst);
510512
if (ret < 0)
511513
return ret;
@@ -565,7 +567,7 @@ int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa)
565567
struct cmdq_instruction inst = {
566568
.op = CMDQ_CODE_JUMP,
567569
.offset = CMDQ_JUMP_ABSOLUTE,
568-
.value = addr >> shift_pa
570+
.value = (addr + pkt->priv.mminfra_offset) >> pkt->priv.shift_pa
569571
};
570572
return cmdq_pkt_append_command(pkt, inst);
571573
}

0 commit comments

Comments
 (0)