天天看点

u-boot-2009.11移植(适用于TQ2440和MINI2440)第三篇:修改初始化代码

注意:红色标记部分为修改的地方

代码运行到了第二阶段代码lib_arm/board.c 中的start_armboot 函数,开始了系统的全面初始化。

3.1 修改 lib_arm/board.c 文件

这个文件的修改主要是关闭为AT9200 写的代码,增加LED的点亮(如果需要,此文未加)

#include <onenand_uboot.h>

#include <mmc.h>

//#include <s3c2410.h>    //for led

…………

#if 0

void inline __coloured_LED_init (void) {}

void coloured_LED_init (void) __attribute__((weak,alias("__coloured_LED_init")));

void inline __red_LED_on (void) {}

void red_LED_on (void) __attribute__((weak,alias("__red_LED_on")));

…………….

void inline __blue_LED_off(void) {}

void blue_LED_off(void) __attribute__((weak,alias("__blue_LED_off")));

#endif

#define M_MDIV  0xC3

#define M_PDIV  0x4

#define M_SDIV  0x1

#elif FCLK_SPEED==1    

//#define M_MDIV    0x5c

//#define M_PDIV    0x4

//#define M_SDIV    0x0

#if defined(CONFIG_S3C2410)

#define M_MDIV  0xA1

#define M_PDIV  0x3

#define M_SDIV  0x1

#endif

#if defined(CONFIG_S3C2440)

#define M_MDIV 0x7f

#define M_PDIV 0x2

#define M_SDIV 0x1

#endif

#endif

#define USB_CLOCK 1

#if USB_CLOCK==0

#define U_M_MDIV    0xA1

#define U_M_PDIV    0x3

#define U_M_SDIV    0x1

#elif USB_CLOCK==1

#if defined(CONFIG_S3C2410)

#define U_M_MDIV    0x48

#define U_M_PDIV    0x3

#endif

#if defined(CONFIG_S3C2440)

#define U_M_MDIV 0x38

#define U_M_PDIV 0x2

#endif

#define U_M_SDIV    0x2

#endif

…………..

int board_init (void)

{

………

     gpio->GPACON= 0x007FFFFF;

     //gpio->GPBCON = 0x00044556;

     gpio->GPBCON = 0x00044555;//启动后禁止蜂鸣器响

     ………………

gpio->EXTINT0=0x22222222;

    gpio->EXTINT1=0x22222222;

    gpio->EXTINT2=0x22222222;

#if defined(CONFIG_S3C2410)

    gd->bd->bi_arch_number= MACH_TYPE_SMDK2410;

#endif

#if defined(CONFIG_S3C2440)

    gd->bd->bi_arch_number= MACH_TYPE_S3C2440 ;

#endif

    gd->bd->bi_boot_params= 0x30000100;

    icache_enable();

    dcache_enable();

    return 0;

}

int dram_init (void)

{

    gd->bd->bi_dram[0].start= PHYS_SDRAM_1;

    gd->bd->bi_dram[0].size= PHYS_SDRAM_1_SIZE;

    return 0;

}

#if 0

#if defined(CONFIG_CMD_NAND)

extern ulong nand_probe(ulong physadr);

……..

void nand_init(void)

{

    structs3c2410_nand * const nand = s3c2410_get_base_nand();

    NF_Init();

#ifdef DEBUG

    printf("NANDflash probing at 0x%.8lX\n", (ulong)nand);

#endif

    printf("%4lu MB\n", nand_probe((ulong)nand) >> 20);

}

#endif

#endif

#ifdef CONFIG_CMD_NET

int board_eth_init(bd_t *bis)

{

    int rc = 0;

#ifdef CONFIG_CS8900

    rc =cs8900_initialize(0, CONFIG_CS8900_BASE);

#endif

#ifdef CONFIG_DRIVER_DM9000

    rc= dm9000_initialize(bis);

#endif

    return rc;

}

#endif

到这里第二阶段的初始化的主线代码就修改完了,下面是各子系统的初始化和功能代码的修改

继续阅读