Skip to content

Commit 84fd420

Browse files
Yongqiang NiuJassiBrar
authored andcommitted
mailbox: cmdq: add mt8192 support
add mt8192 support Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
1 parent 5f48ed2 commit 84fd420

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/mailbox/mtk-cmdq-mailbox.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define CMDQ_THR_WAIT_TOKEN 0x30
3737
#define CMDQ_THR_PRIORITY 0x40
3838

39+
#define GCE_GCTL_VALUE 0x48
40+
3941
#define CMDQ_THR_ACTIVE_SLOT_CYCLES 0x3200
4042
#define CMDQ_THR_ENABLED 0x1
4143
#define CMDQ_THR_DISABLED 0x0
@@ -76,11 +78,13 @@ struct cmdq {
7678
struct clk *clock;
7779
bool suspended;
7880
u8 shift_pa;
81+
bool control_by_sw;
7982
};
8083

8184
struct gce_plat {
8285
u32 thread_nr;
8386
u8 shift;
87+
bool control_by_sw;
8488
};
8589

8690
u8 cmdq_get_shift_pa(struct mbox_chan *chan)
@@ -121,6 +125,8 @@ static void cmdq_init(struct cmdq *cmdq)
121125
int i;
122126

123127
WARN_ON(clk_enable(cmdq->clock) < 0);
128+
if (cmdq->control_by_sw)
129+
writel(0x7, cmdq->base + GCE_GCTL_VALUE);
124130
writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
125131
for (i = 0; i <= CMDQ_MAX_EVENT; i++)
126132
writel(i, cmdq->base + CMDQ_SYNC_TOKEN_UPDATE);
@@ -540,6 +546,7 @@ static int cmdq_probe(struct platform_device *pdev)
540546

541547
cmdq->thread_nr = plat_data->thread_nr;
542548
cmdq->shift_pa = plat_data->shift;
549+
cmdq->control_by_sw = plat_data->control_by_sw;
543550
cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
544551
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
545552
"mtk_cmdq", cmdq);
@@ -605,11 +612,14 @@ static const struct dev_pm_ops cmdq_pm_ops = {
605612
static const struct gce_plat gce_plat_v2 = {.thread_nr = 16};
606613
static const struct gce_plat gce_plat_v3 = {.thread_nr = 24};
607614
static const struct gce_plat gce_plat_v4 = {.thread_nr = 24, .shift = 3};
615+
static const struct gce_plat gce_plat_v5 = {.thread_nr = 24, .shift = 3,
616+
.control_by_sw = true};
608617

609618
static const struct of_device_id cmdq_of_ids[] = {
610619
{.compatible = "mediatek,mt8173-gce", .data = (void *)&gce_plat_v2},
611620
{.compatible = "mediatek,mt8183-gce", .data = (void *)&gce_plat_v3},
612621
{.compatible = "mediatek,mt6779-gce", .data = (void *)&gce_plat_v4},
622+
{.compatible = "mediatek,mt8192-gce", .data = (void *)&gce_plat_v5},
613623
{}
614624
};
615625

0 commit comments

Comments
 (0)