soc/mediatek/mt8189: Extract code to disable secure mode from DDP driver

Extract code for disabling secure mode from mtk_ddp_init and implement
it as mtk_display_disable_secure_mode(). This allows disabling display
secure mode without using DDP, for example, when FW display is not
needed.

Unlike previous SoCs, MT8189 is designed so that access to display
registers defaults to secure mode, due to specific product requirements.
However, Chromebook products do not use this setting and instead require
the register permissions to be set for normal mode access, consistent
with previous SoC behavior.

Also reordered function declarations to group similar types (e.g.,
display, DDP) together for better readability.

BUG=b:422507985
BRANCH=none
TEST=utility gbb --set --flash --flags=0x0, and check the DUT screen.

Signed-off-by: Xiandong Wang <xiandong.wang@mediatek.corp-partner.google.com>
Signed-off-by: Vince Liu <vince-wl.liu@mediatek.corp-partner.google.com>
Change-Id: Ic378ef62540c408ccd59e482abfe9f9c8ca5a13d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88272
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
Vince Liu 2025-06-06 16:42:46 +08:00 committed by Yidi Lin
commit 78a89d4d70
2 changed files with 24 additions and 15 deletions

View file

@ -26,8 +26,9 @@ struct panel_description {
uint32_t quirks;
};
int mtk_display_init(void);
struct panel_description *get_active_panel(void);
void mtk_display_disable_secure_mode(void);
int mtk_display_init(void);
void mtk_ddp_init(void);
void mtk_ddp_mode_set(const struct edid *edid, enum disp_path_sel path);

View file

@ -86,26 +86,18 @@ static void disp_clock_on(void)
__func__, read32(&mmsys_cfg->mmsys_cg_con0), read32(&mmsys_cfg->mmsys_cg_con1));
}
void mtk_ddp_init(void)
void mtk_display_disable_secure_mode(void)
{
int i;
disp_clock_on();
printk(BIOS_DEBUG, "%s: shadow: %#x %#x, secure before: [%#x %#x %#x] larb: %x\n",
printk(BIOS_DEBUG, "%s: shadow: %#x %#x, secure before: [%#x %#x %#x]\n",
__func__,
read32(&mmsys_cfg->disp_bypass_mux_shadow),
read32(&mmsys_cfg->disp_crossbar_con),
read32(&mmsys_cfg->mmsys_security_disable),
read32(&mmsys_cfg->mmsys_security_disable1),
read32(&mmsys_cfg->mmsys_security_disable2),
read32(&smi_larb0->port_l0_ovl_rdma[0]));
read32(&mmsys_cfg->mmsys_security_disable2));
/* Turn off M4U port */
for (i = 0; i < RDMA_PORT_NR; i++) {
write32(&smi_larb0->port_l0_ovl_rdma[i], 0);
write32(&smi_larb1->port_l0_ovl_rdma[i], 0);
}
/* disable shadow */
write32(&mmsys_cfg->disp_bypass_mux_shadow, 0x1);
write32(&mmsys_cfg->disp_crossbar_con, 0x00FF0000);
@ -113,14 +105,30 @@ void mtk_ddp_init(void)
write32(&mmsys_cfg->mmsys_security_disable, 0xFFFFFFFF);
write32(&mmsys_cfg->mmsys_security_disable1, 0xFFFFFFFF);
write32(&mmsys_cfg->mmsys_security_disable2, 0xFFFFFFFF);
printk(BIOS_DEBUG, "%s: shadow: %#x %#x, secure: [%#x %#x %#x] larb: %#x\n",
printk(BIOS_DEBUG, "%s: shadow: %#x %#x, secure: [%#x %#x %#x]n",
__func__,
read32(&mmsys_cfg->disp_bypass_mux_shadow),
read32(&mmsys_cfg->disp_crossbar_con),
read32(&mmsys_cfg->mmsys_security_disable),
read32(&mmsys_cfg->mmsys_security_disable1),
read32(&mmsys_cfg->mmsys_security_disable2),
read32(&smi_larb0->port_l0_ovl_rdma[0]));
read32(&mmsys_cfg->mmsys_security_disable2));
}
void mtk_ddp_init(void)
{
int i;
mtk_display_disable_secure_mode();
/* Turn off M4U port */
for (i = 0; i < RDMA_PORT_NR; i++) {
write32(&smi_larb0->port_l0_ovl_rdma[i], 0);
write32(&smi_larb1->port_l0_ovl_rdma[i], 0);
}
printk(BIOS_DEBUG, "%s: larb: %#x\n",
__func__, read32(&smi_larb0->port_l0_ovl_rdma[0]));
}
void mtk_ddp_mode_set(const struct edid *edid, enum disp_path_sel path)