Hello Weiyi Lu,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/46411
to review the following change.
Change subject: HACK: soc/mediatek: Add function to raise the CCI frequency ......................................................................
HACK: soc/mediatek: Add function to raise the CCI frequency
Implement mt_pll_raise_cci_freq() in MT8192 to raise the frequency. usage: mt_pll_raise_cci_freq(1400UL * MHz); note: Obviously, little/big/cci raise_freq() could be merged.
Signed-off-by: Weiyi Lu weiyi.lu@mediatek.com Change-Id: I084cd7888b1dcfdeaef308b8bb3677d034497a30 --- M src/soc/mediatek/common/include/soc/pll_common.h M src/soc/mediatek/mt8192/pll.c 2 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/46411/1
diff --git a/src/soc/mediatek/common/include/soc/pll_common.h b/src/soc/mediatek/common/include/soc/pll_common.h index 54b12e8..59a70ff 100644 --- a/src/soc/mediatek/common/include/soc/pll_common.h +++ b/src/soc/mediatek/common/include/soc/pll_common.h @@ -60,6 +60,7 @@ void mt_pll_init(void); void mt_pll_raise_little_cpu_freq(u32 freq); void mt_pll_raise_ca76_freq(u32 freq); +void mt_pll_raise_cci_freq(u32 freq);
enum fmeter_type { FMETER_ABIST = 0, diff --git a/src/soc/mediatek/mt8192/pll.c b/src/soc/mediatek/mt8192/pll.c index cd65d25..9b13398 100644 --- a/src/soc/mediatek/mt8192/pll.c +++ b/src/soc/mediatek/mt8192/pll.c @@ -573,3 +573,30 @@ /* disable [4] intermediate clock armpll_divider_pll1_ck */ clrbits32(&mtk_topckgen->clk_misc_cfg_0, 1 << 4); } + +void mt_pll_raise_cci_freq(u32 freq) +{ + /* enable [4] intermediate clock armpll_divider_pll1_ck */ + setbits32(&mtk_topckgen->clk_misc_cfg_0, 1 << 4); + + /* switch cci clock source to intermediate clock */ + clrsetbits32(&mt8192_mcucfg->bus_plldiv_cfg, MCU_MUX_MASK, + MCU_MUX_SRC_DIV_PLL1); + + /* disable ccipll frequency output */ + clrbits32(plls[APMIXED_CCIPLL].reg, PLL_EN); + + /* raise ccipll frequency */ + pll_set_rate(&plls[APMIXED_CCIPLL], freq); + + /* enable ccipll frequency output */ + setbits32(plls[APMIXED_CCIPLL].reg, PLL_EN); + udelay(PLL_EN_DELAY); + + /* switch cci clock source back to ccipll */ + clrsetbits32(&mt8192_mcucfg->bus_plldiv_cfg, MCU_MUX_MASK, + MCU_MUX_SRC_PLL); + + /* disable [4] intermediate clock armpll_divider_pll1_ck */ + clrbits32(&mtk_topckgen->clk_misc_cfg_0, 1 << 4); +}