删除
#define CONFIG_S3C2410 1 /* specifically a SAMSUNG S3C2410 SoC */
#define CONFIG_SMDK2410 1 /* on a SAMSUNG SMDK2410 Board */
添加
#define CONFIG_S3C2440 1 /* specifically a SAMSUNG S3C2440 SoC */
#define CONFIG_MICRO2440
#define CONFIG_SKIP_LOWLEVEL_INIT
【说明】
定义CONFIG_SKIP_LOWLEVEL_INIT是因为我们要在RAM中运行,所以要跳过底层的一些初始化代码
# if defined(CONFIG_S3C2410)
ldr r1, =0x3ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif
# if defined(CONFIG_S3C2440)
# define LOCKTIME 0x4C000000
# define MPLLCON 0x4C000004
# define UPLLCON 0x4C000008
# define CLKDIV_VAL 5
# define M_MDIV 0x7f /* XTal=12.0MHz MPLL=405MHz */
# define M_PDIV 2
# define M_SDIV 1
# define U_MDIV 0x38 /* XTal=12.0MHz UPLL=48MHz */
# define U_PDIV 2
# define U_SDIV 2
ldr r1, =0x7fff
ldr r0, =INTSUBMSK
str r1, [r0]
ldr r0,=LOCKTIME /* 设置U_LTIME和M_LTIME */
ldr r1,=0x0fff0fff
str r1,[r0]
ldr r0, =CLKDIVN /* Fclk:Hclk:Pclk = 1:4:8 */
ldr r1, =CLKDIV_VAL
str r1, [r0]
mrc p15, 0, r0, c1, c0, 0 /* 总线模式设为异步模式 */
orr r0, r0, #0xc0000000
mcr p15, 0, r0, c1, c0, 0
ldr r0,=UPLLCON /* 配置UPLL */
ldr r1,=((U_MDIV<<12) + (U_PDIV<<4) + U_SDIV)
str r1,[r0]
nop /* 为确保硬件完成操作,至少需7个时钟周期 */
nop
nop
nop
nop
nop
nop
ldr r0,=MPLLCON /* 配置MPLL */
ldr r1,=((M_MDIV<<12) + (M_PDIV<<4) + M_SDIV)
str r1,[r0]
#else
/* FCLK:HCLK:PCLK = 1:2:4 */
/* default FCLK is 120 MHz ! */
ldr r0, =CLKDIVN
mov r1, #3
str r1, [r0]
#endif /* CONFIG_S3C2440 */
#endif /* CONFIG_S3C24X0 */
#define FCLK_SPEED 2
#if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */
#define M_MDIV 0xC3
#define M_PDIV 0x4
#define M_SDIV 0x1
#elif FCLK_SPEED==1 /* Fout = 202.8MHz */
#define M_MDIV 0xA1
#define M_PDIV 0x3
#define M_SDIV 0x1
#elif FCLK_SPEED==2 /* Fout = 405MHz */
#define M_MDIV 0x7F
#define M_PDIV 0x2
#define M_SDIV 0x1
#endif
#define USB_CLOCK 2
#if USB_CLOCK==0
#define U_M_MDIV 0xA1
#define U_M_PDIV 0x3
#define U_M_SDIV 0x1
#elif USB_CLOCK==1
#define U_M_MDIV 0x48
#define U_M_PDIV 0x3
#define U_M_SDIV 0x2
#elif USB_CLOCK==2 /* Fout = 48MHz */
#define U_M_MDIV 0x38
#define U_M_PDIV 0x2
#define U_M_SDIV 0x2
#endif
int board_init (void)
{
......
gd->bd->bi_arch_number = MACH_TYPE_MINI2440;
......
}
int dram_init (void)
{
......
gd->ram_size = PHYS_SDRAM_1_SIZE;
return 0;
}
【说明】
我在发布资源时用的是MACH_TYPE_MICRO2440,之前的Linux内核中有MICRO2440的机器码,值为2680,但是最近的内核,比如Linux-2.6.39中并没有这个值,虽然我自己是在Micro2440开发板上移植,但机器码还是使用MACH_TYPE_MINI2440,其值为1999。所以下载了资源的网友一定要注意gd->bd->bi_arch_number 的值。
[408@WZC u-boot-2011.06]$ make
编译完成后将u-boot.bin下载到SDRAM的0x33f80000地址处,u-boot已经能在RAM中运行。