天天看點

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

到這裡第二階段的初始化的主線代碼就修改完了,下面是各子系統的初始化和功能代碼的修改

繼續閱讀