天天看點

移植U-Boot-2008.10到友善之臂mini2440(七 完)

1.2.14 搜尋以下檔案,把支援S3C2410的宏定義改成同時支援S3C2410和S3C2440

(1) 檔案 u-boot-2008.10/cpu/arm920t/s3c24x0/i2c.c :

 #include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

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

#include <s3c2410.h>

 ......

        S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

//#ifdef CONFIG_S3C2410

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

        return (gpio->GPEDAT & 0x8000) >> 15;

 ......

        S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

//#ifdef CONFIG_S3C2410

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

        gpio->GPEDAT = (gpio->GPEDAT & ~0x4000) | (x&1) << 14;

 #endif

 ......

        if ((status & I2CSTAT_BSY) || GetI2CSDA () == 0) {

//#ifdef CONFIG_S3C2410

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

               ulong old_gpecon = gpio->GPECON;

 #endif

 ......

//#ifdef CONFIG_S3C2410

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

 ......

//#ifdef CONFIG_S3C2410

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

               gpio->GPECON = old_gpecon;

 #endif

(2)檔案u-boot-2008.10/cpu/arm920t/s3c24x0/serial.c :

  #include <common.h>

//#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)

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

 #if defined(CONFIG_S3C2400) || defined(CONFIG_TRAB)

 #include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

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

#include <s3c2410.h>

 #endif

(3) 以下三個檔案的修改相同:

u-boot-2008.10/cpu/arm920t/s3c24x0/usb.c u-boot-2008.10/cpu/arm920t/s3c24x0/usb_ohci.c u-boot-2008.10/drivers/rtc/s3c24x0_rtc.c

修改頭檔案的引用:

 #if defined(CONFIG_S3C2400)

 # include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

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

# include <s3c2410.h>

 #endif

(4)檔案u-boot-2008.10/include/common.h :

ulong  get_OPB_freq (void);

 ulong  get_PCI_freq (void);

 #endif

//#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \

        //defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)

 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \

        defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400) || defined(CONFIG_S3C2440)

void    s3c2410_irq(void);

 #define ARM920_IRQ_CALLBACK s3c2410_irq

 ulong  get_FCLK (void);

(5) 檔案u-boot-2008.10/include/s3c24x0.h :

        S3C24X0_REG32  PRIORITY;

        S3C24X0_REG32  INTPND;

        S3C24X0_REG32  INTOFFSET;

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  SUBSRCPND;

        S3C24X0_REG32  INTSUBMSK;

 #endif

……

 typedef struct {

        S3C24X0_REG32  DISRC;

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  DISRCC;

 #endif

        S3C24X0_REG32  DIDST;

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  DIDSTC;

 #endif

        S3C24X0_REG32  DCON;

……

 #ifdef CONFIG_S3C2400

        S3C24X0_REG32  res[1];

 #endif

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  res[7];

 #endif

 } S3C24X0_DMA;

……

        S3C24X0_REG32  CLKCON;

        S3C24X0_REG32  CLKSLOW;

        S3C24X0_REG32  CLKDIVN;

#if defined (CONFIG_S3C2440)

        S3C24X0_REG32 CAMDIVN;

#endif

 } S3C24X0_CLOCK_POWER;

 ……

        S3C24X0_REG32  res[8];

        S3C24X0_REG32  DITHMODE;

        S3C24X0_REG32  TPAL;

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  LCDINTPND;

        S3C24X0_REG32  LCDSRCPND;

        S3C24X0_REG32  LCDINTMSK;

……

        S3C24X0_REG32  MISCCR;

        S3C24X0_REG32  EXTINT;

 #endif

//#ifdef CONFIG_S3C2410

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

        S3C24X0_REG32  GPACON;

        S3C24X0_REG32  GPADAT;

        S3C24X0_REG32  res1[2];

    移植成功後,U-BOOT在嵌入式系統中運作良好。同時支援 Nand Flash 和 Nor Flash 啟動(仍需改進)。

附:U-Boot各個版本的下載下傳位址 ftp://ftp.denx.de/pub/u-boot/

參考博文:

http://blog.csdn.net/hugerat/archive/2009/01/21/3847025.aspx

http://expowinzax.blog.163.com/blog/static/12408013200922222038567/

http://blog.chinaunix.net/u1/34474/showart.php?id=1808274

    非常感謝以上文章的幫助!