Skip to content

Commit 63f40a7

Browse files
Yongqiang NiuJassiBrar
authored andcommitted
mailbox: mtk-cmdq: add gce software ddr enable private data
if gce work control by software, we need set software enable for MT8186 Soc there is a handshake flow between gce and ddr hardware, if not set ddr enable flag of gce, ddr will fall into idle mode, then gce instructions will not process done. we need set this flag of gce to tell ddr when gce is idle or busy controlled by software flow. 0x48[2:0] means control by software 0x48[18:16] means ddr enable 0x48[2:0] is pre-condition of 0x48[18:16]. if we want set 0x48[18:16] ddr enable, 0x48[2:0] must be set at same time. and only these bits is useful, other bits is useless bits Signed-off-by: Yongqiang Niu <[email protected]> Reviewed-by: CK Hu <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 23ba2e7 commit 63f40a7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/mailbox/mtk-cmdq-mailbox.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#define GCE_GCTL_VALUE 0x48
4141
#define GCE_CTRL_BY_SW GENMASK(2, 0)
42+
#define GCE_DDR_EN GENMASK(18, 16)
4243

4344
#define CMDQ_THR_ACTIVE_SLOT_CYCLES 0x3200
4445
#define CMDQ_THR_ENABLED 0x1
@@ -81,13 +82,15 @@ struct cmdq {
8182
bool suspended;
8283
u8 shift_pa;
8384
bool control_by_sw;
85+
bool sw_ddr_en;
8486
u32 gce_num;
8587
};
8688

8789
struct gce_plat {
8890
u32 thread_nr;
8991
u8 shift;
9092
bool control_by_sw;
93+
bool sw_ddr_en;
9194
u32 gce_num;
9295
};
9396

@@ -127,10 +130,16 @@ static void cmdq_thread_resume(struct cmdq_thread *thread)
127130
static void cmdq_init(struct cmdq *cmdq)
128131
{
129132
int i;
133+
u32 gctl_regval = 0;
130134

131135
WARN_ON(clk_bulk_enable(cmdq->gce_num, cmdq->clocks));
132136
if (cmdq->control_by_sw)
133-
writel(GCE_CTRL_BY_SW, cmdq->base + GCE_GCTL_VALUE);
137+
gctl_regval = GCE_CTRL_BY_SW;
138+
if (cmdq->sw_ddr_en)
139+
gctl_regval |= GCE_DDR_EN;
140+
141+
if (gctl_regval)
142+
writel(gctl_regval, cmdq->base + GCE_GCTL_VALUE);
134143

135144
writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
136145
for (i = 0; i <= CMDQ_MAX_EVENT; i++)
@@ -545,6 +554,7 @@ static int cmdq_probe(struct platform_device *pdev)
545554
cmdq->thread_nr = plat_data->thread_nr;
546555
cmdq->shift_pa = plat_data->shift;
547556
cmdq->control_by_sw = plat_data->control_by_sw;
557+
cmdq->sw_ddr_en = plat_data->sw_ddr_en;
548558
cmdq->gce_num = plat_data->gce_num;
549559
cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
550560
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,

0 commit comments

Comments
 (0)