Chinaunix首页 | 论坛 | 博客
  • 博客访问: 150214
  • 博文数量: 22
  • 博客积分: 1456
  • 博客等级: 上尉
  • 技术积分: 252
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-25 00:08
个人简介

ddd

文章存档

2011年(1)

2010年(21)

我的朋友

分类: 嵌入式

2010-05-29 18:30:09

移植U-Boot-2009.08到友善之臂mini2440(五)

 

 

5.1在文件中添加“CONFIG_S3C2440,使得原来s3c2410的代码可以编译进来

1/include/common.h文件的第496行:

#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X) || defined(CONFIG_S3C2440)

2/include/s3c24x0.h文件的第859599110148404行:

将“#ifdef CONFIG_S3C2410改为 #if defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

 

顺便在其中加入2440 NAND FLASH 寄存器定义(第160行附近)和CAMDIVN定义(第128行附近):

    120 /* CLOCK & POWER MANAGEMENT (see S3C2400 manual chapter 6) */

    121 /*                          (see S3C2410 manual chapter 7) */

    122 typedef struct {

    123         S3C24X0_REG32   LOCKTIME;

    124         S3C24X0_REG32   MPLLCON;

    125         S3C24X0_REG32   UPLLCON;

    126         S3C24X0_REG32   CLKCON;

    127         S3C24X0_REG32   CLKSLOW;

    128         S3C24X0_REG32   CLKDIVN;

    #if defined (CONFIG_S3C2440)

              S3C24X0_REG32 CAMDIVN;

     #endif

    132

    133 } /*__attribute__((__packed__))*/ S3C24X0_CLOCK_POWER;

 

#if defined(CONFIG_S3C2410)

/* NAND FLASH (see S3C2410 manual chapter 6) */

typedef struct {

        S3C24X0_REG32   NFCONF;

        S3C24X0_REG32   NFCMD;

        S3C24X0_REG32   NFADDR;

        S3C24X0_REG32   NFDATA;

        S3C24X0_REG32   NFSTAT;

        S3C24X0_REG32   NFECC;

} /*__attribute__((__packed__))*/ S3C2410_NAND;

#endif

 

#if defined (CONFIG_S3C2440)

/* NAND FLASH (see S3C2440 manual chapter 6) */

typedef struct {

        S3C24X0_REG32 NFCONF;

        S3C24X0_REG32 NFCONT;

        S3C24X0_REG32 NFCMD;

        S3C24X0_REG32 NFADDR;

        S3C24X0_REG32 NFDATA;

        S3C24X0_REG32   NFMECCD0;

        S3C24X0_REG32   NFMECCD1;

        S3C24X0_REG32   NFSECCD;

        S3C24X0_REG32   NFSTAT;

        S3C24X0_REG32   NFESTAT0;

        S3C24X0_REG32   NFESTAT1;

        S3C24X0_REG32   NFMECC0;

        S3C24X0_REG32   NFMECC1;

        S3C24X0_REG32   NFSECC;

        S3C24X0_REG32   NFSBLK;

        S3C24X0_REG32   NFEBLK;

} /*__attribute__((__packed__))*/ S3C2410_NAND;

#endif

 

    

3))/cpu/arm920t/s3c24x0/interrupts.c文件的第36

34 #if defined(CONFIG_S3C2400)

     35 #include 3c2400.h>

     36 #elif defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

     37 #include 3c2410.h>

 

4cpu/arm920t/s3c24x0/timer.c文件的3337添加|| defined (CONFIG_S3C2440)

180行添加||defined(CONFIG_MINI2440)

 

5/drivers/serial/serial_s3c24x0.c,原来的位置在/cpu/arm920t/s3c24x0/serial.c

24行添加|| defined (CONFIG_S3C2440)

 

6cpu/arm920t/s3c24x0/speed.c

头文件对S3C2440的支持:

在文件的的3337行添加、|| defined (CONFIG_S3C2440)

 

由于S3C2410S3C2440MPLLUPLL计算公式不一样,所以get_PLLCLK函数也需要修改

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

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

     s = r & 0x3;

#if defined(CONFIG_S3C2440)

   if (pllreg == MPLL)

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

    else if (pllreg == UPLL)

#endif

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

 

由于S3C2410S3C2440的设置方法也不一样,所以get_HCLK函数也需要修改

 

/* return HCLK frequency */
ulong get_HCLK(void)
{
   S3C24X0_CLOCK_POWER *
const clk_power = S3C24X0_GetBase_CLOCK_POWER();
#if defined(CONFIG_S3C2440)
    if (clk_power->CLKDIVN & 0x6)
                            {
               if ((clk_power->CLKDIVN & 0x6)==2) return(get_FCLK()/2);
 if ((clk_power->CLKDIVN & 0x6)==6) return((clk_power->CAMDIVN & 0x100) ? get_FCLK()/6 : get_FCLK()/3);
 if ((clk_power->CLKDIVN & 0x6)==4) return((clk_power->CAMDIVN & 0x200) ? get_FCLK()/8 : get_FCLK()/4);
             return(get_FCLK());
                            }
 
       else return(get_FCLK());
#else
    return((clk_power->CLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK());
#endif

}

 

7/cpu/arm920t/s3c24x0/usb_ohci.c文件的第43行: #elif defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

 

8drivers/rtc/s3c24x0_rtc.c文件的第35行: #elif defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

 

9/cpu/arm920t/s3c24x0/usb.c文件的第2731行: #elif defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

 

10)修改/drivers/i2c/s3c24x0_i2c.c文件,其原来的位置/cpu/arm920t/s3c24x0/i2c.c

32行: #elif defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

6382139147171行:

将“#ifdef CONFIG_S3C2410”改为 #if defined(CONFIG_S3C2410) || defined (CONFIG_S3C2440)

阅读(1779) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~