How to set CPU frequency on u-boot?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set CPU frequency on u-boot?

1,694 Views
LiLinfei
Contributor I

Hi,

How to set CPU frequency on u-boot?

Our machine must keep working at 800Mhz.But I see the frequency under U-boot is 396Mhz.

U-boot version : 2016.03

SOC:IMX6ULL 

Thanks!

Labels (1)
0 Kudos
3 Replies

1,665 Views
joanxie
NXP TechSupport
NXP TechSupport

you can find the cpu frequency settings in the dtsi file as below:

"https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/dts/imx6ull.dtsi?h=imx_v2019.04_4..."

0 Kudos

1,531 Views
avijitnsec
Contributor III

How to change the default frequency in the dts file? If I set it in the uboot, does it persist when kernel boots up? Or kernel overwrite the value? 

0 Kudos

325 Views
AlfTeleco
Contributor III

On the U-boot version U-Boot 2021.04-lf_v2021.04 write the CCM Arm Clock Root Register (CCM_CACRR) at the function get_mcu_main_clk() on the file /arch/arm/mach-imx/mx6/clock.c. The content of the function must be like this:

=====================================================================

u32 reg, freq;

reg = __raw_readl(&imx_ccm->cacrr);
reg &= ~MXC_CCM_CACRR_ARM_PODF_MASK;
__raw_writel(reg, &imx_ccm->cacrr);

reg = __raw_readl(&imx_ccm->cacrr);
reg &= MXC_CCM_CACRR_ARM_PODF_MASK;
reg >>= MXC_CCM_CACRR_ARM_PODF_OFFSET;
freq = decode_pll(PLL_SYS, MXC_HCLK);

return freq / (reg + 1);

=====================================================================

We are setting the register CCM_CACRR to have NO divider, like it is said in the datasheet:

AlfTeleco_0-1707405319109.png

Also boost the LDO_SOC voltage from 1.175 to 1.225 at the function /arch/arm/mach-imx/mx6/soc.c: board_postclk_init()

set_ldo_voltage(LDO_SOC, 1225); /* Set VDDSOC to 1.225V */

 

BR

0 Kudos