jason-ch chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/73375 )
Change subject: soc/mediatek/mt8188: Add mtcmos init support ......................................................................
soc/mediatek/mt8188: Add mtcmos init support
Bus protection is a HW mechanism to avoid bus hang and incomplete bus transaction. In power domain (mtcmos) turn-off flow, bus protect control bit must be assert first to ensure current transaction is complete and block further transaction. In turn-on stage, bus protect control bit must be release after the power is stable so that bus transaction can continue.
BUG=b:264204465 TEST=build pass
Change-Id: I14aa63c4934073a14552cef64f40657d0197bbe1 Signed-off-by: garmin chang garmin.chang@mediatek.corp-partner.google.com Signed-off-by: jason-ch chen jason-ch.chen@mediatek.corp-partner.google.com --- M src/soc/mediatek/mt8188/mtcmos.c 1 file changed, 92 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/73375/1
diff --git a/src/soc/mediatek/mt8188/mtcmos.c b/src/soc/mediatek/mt8188/mtcmos.c old mode 100644 new mode 100755 index 3143b01..4a2f70a --- a/src/soc/mediatek/mt8188/mtcmos.c +++ b/src/soc/mediatek/mt8188/mtcmos.c @@ -5,7 +5,78 @@ #include <soc/mtcmos.h> #include <soc/spm.h>
+enum { + VPPSYS0_PROT_STEP_6_MASK = 0x00100000, + VPPSYS0_PROT_STEP_5_MASK = 0x00276C16, + VPPSYS0_PROT_STEP_4_MASK = 0x00800000, + VPPSYS0_PROT_STEP_3_MASK = 0x00800200, + VPPSYS0_PROT_STEP_2_MASK = 0x80302846, + VPPSYS0_PROT_STEP_1_MASK = 0x00000400, + VDOSYS0_PROT_STEP_4_MASK = 0x00000060, + VDOSYS0_PROT_STEP_3_MASK = 0x00800000, + VDOSYS0_PROT_STEP_2_MASK = 0x00000020, + VDOSYS0_PROT_STEP_1_MASK = 0x00100000, + VPPSYS1_PROT_STEP_3_MASK = 0x00040000, + VPPSYS1_PROT_STEP_2_MASK = 0x00800000, + VPPSYS1_PROT_STEP_1_MASK = 0x00000020, + VDOSYS1_PROT_STEP_3_MASK = 0x00000400, + VDOSYS1_PROT_STEP_2_MASK = 0x00400000, + VDOSYS1_PROT_STEP_1_MASK = 0x40000000, + ADSP_PROT_STEP_1_MASK = 0x00100000, + ADSP_PROT_STEP_2_MASK = 0x00001000, + AUDIO_PROT_STEP_1_MASK = 0x00000F00, + AUDIO_PROT_STEP_2_MASK = 0x00600000, +}; + void mtcmos_set_scpd_ext_buck_iso(const struct power_domain_data *pd) { clrbits32(&mtk_spm->ext_buck_iso, pd->ext_buck_iso_bits); } + +void mtcmos_protect_display_bus(void) +{ + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_sub_infra_vdnr_clr, + VPPSYS0_PROT_STEP_6_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr_2, + VPPSYS0_PROT_STEP_5_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr, + VPPSYS0_PROT_STEP_4_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr_2, + VPPSYS0_PROT_STEP_3_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VPPSYS0_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr, + VPPSYS0_PROT_STEP_1_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_sub_infra_vdnr_clr, + VDOSYS0_PROT_STEP_4_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VDOSYS0_PROT_STEP_3_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr, + VDOSYS0_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VDOSYS0_PROT_STEP_1_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr_2, + VPPSYS1_PROT_STEP_3_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VPPSYS1_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VPPSYS1_PROT_STEP_1_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr_2, + VDOSYS1_PROT_STEP_3_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VDOSYS1_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_mm_clr, + VDOSYS1_PROT_STEP_1_MASK); +} + +void mtcmos_protect_audio_bus(void) +{ + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr_2, + ADSP_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr_2, + ADSP_PROT_STEP_1_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr_2, + AUDIO_PROT_STEP_2_MASK); + write32(&mt8188_infracfg_ao->infra_topaxi_protecten_clr_2, + AUDIO_PROT_STEP_1_MASK); +}