修改文件:common/borad_f.c;
添加如下内容:
#include <asm/arch/crm_regs.h>
/* 参考: 正点原子Linux驱动开发 */
void system_clock_init(void)
{
struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
printf("system_clock_init\n");
// return;
/******************* PLL 输出时钟设置************************/
if ((imx_ccm->ccsr & (0x01 << 2)) == 0) //CPU 使用的是 ARM PLL
{
/*将CPU时钟切换到XTAL (OSC) 时钟*/
imx_ccm->ccsr &= ~(0x01 << 8); //控制CCSR: step_sel ,选择 osc_clk 作为时钟源
imx_ccm->ccsr |= (0x01 << 2); //设置GLITCHLESS MUX 选择 step_clk 作为时钟源
}
/*设置PLL1输出时钟为792MHz,它将作为CPU时钟*/
imx_ccm->analog_pll_sys = (1 << 13) | (0x42 << 0);
/*将CPU 时钟重新切换到 ARM PLL*/
imx_ccm->ccsr &= ~(0x01 << 2);
/*设置时钟分频系数为0,即不分频*/
imx_ccm->cacrr &= ~(0x07 << 0); //清零分频寄存器
}
之后修改这个文件中的: void board_init_f(ulong boot_flags),添加对system_clock_init的调用:
void board_init_f(ulong boot_flags)
{
system_clock_init();
#ifdef CONFIG_SYS_GENERIC_GLOBAL_DATA
......
}
修改之后系统的开机启动速度没有明显变化,有点出乎意料。