微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > U-boot1.1.6移植到TQ2440开发板(上)

U-boot1.1.6移植到TQ2440开发板(上)

时间:11-25 来源:互联网 点击:

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

s3c2440nand->

s3c2440nand->

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

*p = (addr >>

*p = (addr >>

*p = (addr >>

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

*p = (col >>

*p = (page >>

*p = (page >>

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

s3c2440nand->

s3c2440nand->

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

if(pDID >

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

*p = (i >>

*p = (i >>

*p = (i >>

volatileunsignedchar*p = (volatileunsignedchar*)&s3c2440nand->

*p = (page >>

*p = (page >>

0MHZ ((0x5c<12)|(0x01<4)|(0x03))

#defineS3C2440_UPLL_48MHZ ((0x38<12)|(0x02<4)|(0x02)) //HJ 100MHz

#defineS3C2440_CLKdiv 0x05 //HJ 100MHz

#defineS3C2440_CLKdiv136 0x07 //HJ 133MHz

#defineS3C2440_CLKdiv188 0x04

#defineS3C2440_CAMdivN188 ((0<8)|(1<9))

#defineS3C2440_MPLL_399MHz ((0x6e<12)|(0x03<4)|(0x01))

#defineS3C2440_UPLL_48MHZ_Fin16MHz ((60<12)|(4<4)|(2))

voidclock_init(void)

{

S3C24X0_CLOCK_POWER*clk_power = (S3C24X0_CLOCK_POWER*)0x4C000000;

#ifCONFIG_133MHZ_SDRAM

clk_power->CLKdivN = S3C2440_CLKdiv136; //HJ 1:3:6

#else

clk_power->CLKdivN= S3C2440_CLKdiv; //HJ 1:4:8

#endif

__asm__( "mrc p15, 0, r1, c1, c0, 0n"

"orr r1, r1, #0xc0000000n"

"mcr p15, 0, r1, c1, c0, 0n"

:::"r1"

);

clk_power->LOCKTIME= 0xFFFFFF;

clk_power->UPLLCON= S3C2440_UPLL_48MHZ; //fin=12.000MHz

// clk_power->UPLLCON = S3C2440_UPLL_48MHZ_Fin16MHz; //fin=16.934MHz

delay (4000);

clk_power->MPLLCON= S3C2440_MPLL_400MHZ; //fin=12.000MHz

// clk_power->MPLLCON = S3C2440_MPLL_405MHZ; //HJ 405MHz

// clk_power->MPLLCON = S3C2440_MPLL_440MHZ; //HJ 440MHz

// clk_power->MPLLCON = S3C2440_MPLL_480MHZ; //HJ 480MHz

// clk_power->MPLLCON = S3C2440_MPLL_399MHz; //fin=16.934MHz

delay (8000);

}

修改cpu/arm920t/s3c24x0/speed.c中get_HCLK等函数,首先在前面添加DECLARE_GLOBAL_DATA_PTR;使其能使用gd_t全局数据结构的指针

FLCK、HCLK和PCLK的关系

S3C2440有三个时钟FLCK、HCLK和PCLK

FCLK is used by ARM920T,内核时钟,主频。

HCLK is used for AHB bus, which is used by the ARM920T, the memory controller, the interrupt controller, the LCD controller, the DMA and USB host block. 也就是总线时钟,包括USB时钟。

PCLK is used for APB bus, which is used by the peripherals such as WDT, IIS, I2C, PWM timer, MMC interface,ADC, UART, GPIO, RTC and SPI.即IO接口时钟,例如串口的时钟设置就是从PCLK来的;

具体代码:

staticulongget_PLLCLK(intpllreg)

{

S3C24X0_CLOCK_POWER* constclk_power = S3C24X0_GetBase_CLOCK_POWER();

ulongr, m, p, s;

if(pllreg == MPLL)

r = clk_power->MPLLCON;

elseif(pllreg == UPLL)

r = clk_power->UPLLCON;

else

hang();

m = ((r & 0xFF000) >> 12) + 8;

p = ((r & 0x003F0) >> 4) + 2;

s = r & 0x3;

if(gd->bd->bi_arch_number== MACH_TYPE_SMDK2410)

return((CONFIG_SYS_CLK_FREQ * m) / (p < s));

else

return((CONFIG_SYS_CLK_FREQ * m *2) / (p < s));

}

ulongget_FCLK(void)

{

return(get_PLLCLK(MPLL));

}

#defineS3C2440_CLKdivN_PdivN (1<0)

#defineS3C2440_CLKdivN_HdivN_MASK (3<1)

#defineS3C2440_CLKdivN_HdivN_1 (0<1)

#defineS3C2440_CLKdivN_HdivN_2 (1<1)

#defineS3C2440_CLKdivN_HdivN_4_8 (2<1)

#defineS3C2440_CLKdivN_HdivN_3_6 (3<1)

#defineS3C2440_CLKdivN_UCLK (1<3)

#defineS3C2440_CAMdivN_CAMCLK_MASK (0xf<0)

#defineS3C2440_CAMdivN_CAMCLK_SEL (1<4)

#defineS3C2440_CAMdivN_HCLK3_HALF (1<8)

#defineS3C2440_CAMdivN_HCLK4_HALF (1<9)

#defineS3C2440_CAMdivN_DVSEN (1<12)

ulongget_HCLK(void)

{

S3C24X0_CLOCK_POWER* constclk_power = S3C24X0_GetBase_CLOCK_POWER();

unsignedlongclkdiv;

unsignedlongcamdiv;

inthdiv = 1;

clkdiv = clk_power->CLKdivN;

camdiv = clk_power->CAMdivN;

if(gd->bd->bi_arch_number== MACH_TYPE_SMDK2410)

return((clk_power->CLKdivN& 0x2) ? get_FCLK()/2 : get_FCLK());

else

{

switch(clkdiv & S3C2440_CLKdivN_HdivN_MASK) {

caseS3C2440_CLKdivN_HdivN_1:

hdiv = 1;

break;

caseS3C2440_CLKdivN_HdivN_2:

hdiv = 2;

break;

caseS3C2440_CLKdivN_HdivN_4_8:

hdiv = (camdiv & S3C2440_CAMdivN_HCLK4_HALF) ? 8 : 4;

break;

caseS3C2440_CLKdivN_HdivN_3_6:

hdiv = (camdiv & S3C2440_CAMdivN_HCLK3_HALF) ? 6 : 3;

break;

}

returnget_FCLK() / hdiv;

}

}

ulongget_PCLK(void)

{

S3C24X0_CLOCK_POWER* constclk_power = S3C24X0_GetBase_CLOCK_POWER();

unsignedlongclkdiv;

unsignedlongcamdiv;

inthdiv = 1;

clkdiv = clk_power->CLKdivN;

camdiv = clk_power->CAMdivN;

if(gd->bd->bi_arch_number== MACH_TYPE_SMDK2410)

return((clk_power->CLKdivN& 0x1) ? get_HCLK()/2 : get_HCLK());

else

{

switch(clkdiv & S3C2440_CLKdivN_HdivN_MASK) {

caseS3C2440_CLKdivN_HdivN_1:

hdiv = 1;

break;

caseS3C2440_CLKdivN_HdivN_2:

hdiv = 2;

break;

caseS3C244

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top