Chinaunix首页 | 论坛 | 博客
  • 博客访问: 808268
  • 博文数量: 118
  • 博客积分: 2067
  • 博客等级: 大尉
  • 技术积分: 1751
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-17 14:27
文章存档

2016年(1)

2013年(1)

2012年(3)

2011年(26)

2010年(47)

2009年(40)

分类: LINUX

2009-07-25 18:09:12


环境:arm-linux-gcc4.3.2 redhat as5 友善之臂MICRO2440开发板 u-boot-2009.06
因为移植过程与下面列的差不多,所以就不细写了,移植好的放在下面,只是完成了启动。


文件:uboot_micro2440_200906.tar.bz2
大小:0KB
下载:下载

转载:移植U-Boot.1.3.1到S3C244和S3C2410
2
原文链接:http://blog.chinaunix.net/u1/34474/showart.php?id=487416
首先,U-Boot1.3.1还没有支持s3c2440,移植仍是用2410的文件稍作修改而成的。2440和2410的区别在我移植1.2.0的文章中已经写了,这里不再赘述。
对于1.3.1和1.2.0的差别,我初看了一下,(对于ARM920T内核)应该是增加了对ATMEL公司的AT91RM9200系列处理器的支持。至于S3C24X0系列的芯片,原理上并没有什么大的变化。

一、在U-Boot中建立自己的开发板类型,并测试编译。
我为开发板取名叫: tekkaman2440
0 在工作目录下解压U-Boot。
 [tekkamanninja@ARM9-Host working]$ tar -xjvf u-boot-1.3.1.tar.bz2  
 
1 进入U-Boot目录,修改Makefile(我在fedora 8 下,比较喜欢使用KWrite)
[tekkamanninja@ARM9-Host working]$ cd u-boot-1.3.1
[tekkamanninja@ARM9-Host u-boot-1.3.1]$ kwrite Makefile
#为tekkaman2440建立编译项
sbc2410x_config: unconfig
    @$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
tekkaman2440_config    :    unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t tekkaman2440 tekkaman s3c24x0

各项的意思如下:
arm: CPU的架构(ARCH)
arm920t: CPU的类型(CPU),其对应于cpu/arm920t子目录。
tekkaman2440: 开发板的型号(BOARD),对应于board/tekkaman/tekkaman2440目录。
tekkaman: 开发者/或经销商(vender)。
s3c24x0: 片上系统(SOC)。

同时在“ifndef CROSS_COMPILE ”之前加上自己交叉编译器的路径,比如我使用crosstool-0.43制作的基于2.6.24内核和gcc-4.1.1-glibc-2.3.2的ARM9TDMI交叉编译器,则:
CROSS_COMPILE=/home/tekkamanninja/working/gcc4.1.1/gcc-4.1.1-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-
 
2 在/board子目录中建立自己的开发板tekkaman2440目录
由于我在上一步板子的开发者/或经销商(vender)中填了 tekkaman ,所以开发板tekkaman2440目录一定要建在/board子目录中的tekkaman目录下 ,否则编译会出错。
[tekkamanninja@ARM9-Host u-boot-1.3.1]$ cd board
[tekkamanninja@ARM9-Host board]$ mkdir tekkaman tekkaman/tekkaman2440
[tekkamanninja@ARM9-Host board]$ cp -arf sbc2410x/* tekkaman/tekkaman2440/
[tekkamanninja@ARM9-Host board]$ cd tekkaman/tekkaman2440/
[tekkamanninja@ARM9-Host tekkaman2440]$ mv sbc2410x.c tekkaman2440.c
  
 还要记得修改自己的开发板tekkaman2440目录下的Makefile文件,不然编译时会出错:
[tekkamanninja@ARM9-Host tekkaman2440]$ kwrite Makefile
COBJS    := tekkaman2440.o flash.o
 
3 在include/configs/中建立配置头文件
[tekkamanninja@ARM9-Host tekkaman2440]$ cd ../../..
[tekkamanninja@ARM9-Host u-boot-1.3.1]$ cp include/configs/sbc2410x.h include/configs/tekkaman2440.h
 
4 测试编译能否成功
  1、配置
[tekkamanninja@ARM9-Host u-boot-1.3.1]$ make tekkaman2440_config
Configuring for tekkaman2440 board...
可能出现的问题:
     (1) 如果出现:
      $ make tekkaman2440_config
      Make1927: *** 遗漏分隔符 。 停止。
      请在U-boot的根目录下的Makefile的
        @$(MKCONFIG) $(@:_config=) arm arm920t tekkaman2440 tekkaman)
       前加上“Tab”键

2、测试编译
[tekkamanninja@ARM9-Host u-boot-1.3.1]$make
测试通过后进行下一步

二、修改U-Boot中的文件,以同时匹配2440和2410。
 1 修改/cpu/arm920t/start.S

#include <config.h>
#include <version.h>
#if    defined(CONFIG_AT91RM9200DK)
#include <status_led.h>    /*这是针对AT91RM9200DK开发板的。对于SCB2440V4也有4个LED指示灯,我用来指示程序用行的进度。*/
#endif
......
/*
 * the actual start code
 */


start_code:
    /*
     * set the cpu to SVC32 mode
     */

    mrs    r0,cpsr
    bic    r0,r0,#0x1f
    orr    r0,r0,#0xd3
    msr    cpsr,r0
#if    defined(CONFIG_AT91RM9200DK)
    bl coloured_LED_init
    bl red_LED_on
#endif

 (0)修改寄存器地址定义

#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)|| defined(CONFIG_S3C2440)
    /* turn off the watchdog */

#if defined(CONFIG_S3C2400)
#define pWTCON        0x15300000
#define INTMSK        0x14400008    /* Interupt-Controller base addresses */
#define CLKDIVN    0x14800014    /* clock divisor register */
#else
#define pWTCON        0x53000000
#define INTMSK        0x4A000008    /* Interupt-Controller base addresses */
#define INTSUBMSK    0x4A00001C
#define CLKDIVN    0x4C000014    /* clock divisor register */
#endif
#define CLK_CTL_BASE 0x4C000000 /* tekkaman */
#define MDIV_405 0x7f << 12 /* tekkaman */
#define PSDIV_405 0x21 /* tekkaman */
#define MDIV_200 0xa1 << 12 /* tekkaman */
#define PSDIV_200 0x31 /* tekkaman */

    
......

(1)修改中断禁止部分

#if defined(CONFIG_S3C2410)
    ldr r1, =0x7ff
/*根据2410芯片手册,INTSUBMSK有11位可用,
                       vivi也是0x7ff,U-Boot一直没改过来。*/

    ldr r0, =INTSUBMSK
    str r1, [r0]
#endif
#if defined(CONFIG_S3C2440)
    ldr r1, =0x7fff /*根据2440芯片手册,INTSUBMSK有15位可用*/
    ldr r0, =INTSUBMSK
    str r1, [r0]

#endif

(2)修改时钟设置(2440的主频为405MHz。)

# if defined(CONFIG_S3C2440)
    /* FCLK:HCLK:PCLK = 1:4:8 */
    ldr r0, =CLKDIVN
    mov r1, #5
    str r1, [r0]
    
    mrc p15, 0, r1, c1, c0, 0 /*read ctrl register tekkaman*/
    orr r1, r1, #0xc0000000 /*Asynchronous tekkaman*/
    mcr p15, 0, r1, c1, c0, 0 /*write ctrl register tekkaman*/

    /*now, CPU clock is 405.00 Mhz tekkaman*/
    mov r1, #CLK_CTL_BASE /* tekkaman*/
    mov r2, #MDIV_405 /* mpll_405mhz tekkaman*/
    add r2, r2, #PSDIV_405 /* mpll_405mhz tekkaman*/
    str r2, [r1, #0x04] /* MPLLCON tekkaman */

#else
    /* FCLK:HCLK:PCLK = 1:2:4 */
    /* default FCLK is 12 MHz ! 在这里U-Boot有一个错误:以为默认时钟为120MHz。其实如果没有添加以下设置FCLK的语句,芯片内部的PLL是无效的,即FCLK为 12MHz。S3C24x0的芯片手册说得很明白。我一开始没有注意到这一点,是 CalmArrow提醒了我并和我讨论过,他也做过实验证实了这点。在这里对CalmArrow表示感谢和敬意!*/
    ldr    r0, =CLKDIVN
    mov    r1, #3
    str    r1, [r0]

    mrc p15, 0, r1, c1, c0, 0 /*read ctrl register tekkaman*/
    orr r1, r1, #0xc0000000 /*Asynchronous tekkaman*/
    mcr p15, 0, r1, c1, c0, 0 /*write ctrl register tekkaman*/

    /*now, CPU clock is 202.8 Mhz tekkaman*/
    mov r1, #CLK_CTL_BASE /* tekkaman*/
    mov r2, #MDIV_200 /* mpll_200mhz tekkaman*/
    add r2, r2, #PSDIV_200 /* mpll_200mhz tekkaman*/
    str r2, [r1, #0x04]


# endif
#endif    /* CONFIG_S3C2400 || CONFIG_S3C2410|| CONFIG_S3C2440 */

 红色部分是我添加的,利用vivi的代码。 

   (3)将从Flash启动改成从NAND Flash启动。
在以下U-Boot的重定向语句段:

#ifdef    CONFIG_AT91RM9200

#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate:                /* relocate U-Boot to RAM     */
    adr    r0, _start        /* r0 <- current position of code */
    ldr    r1, _TEXT_BASE        /* test if we run from flash or RAM */
    cmp r0, r1 /* don't reloc during debug */
    beq stack_setup

    ldr    r2, _armboot_start
    ldr    r3, _bss_start
    sub    r2, r3, r2        /* r2 <- size of armboot */
    add    r2, r0, r2        /* r2 <- source end address*/

copy_loop:
    ldmia     {r3-r10}        /* copy from source address [r0] */
    stmia     {r3-r10}        /* copy to target address [r1] */
    cmp    r0, r2            /* until source end addreee [r2] */
    ble    copy_loop
#endif    /* CONFIG_SKIP_RELOCATE_UBOOT */
#endif

的后面添加上:

#ifdef CONFIG_S3C2440_NAND_BOOT
    @ reset NAND
    mov r1, #NAND_CTL_BASE
    ldr r2, =( (7<<12)|(7<<8)|(7<<4)|(0<<0) )
    str r2, [r1, #oNFCONF]
    ldr r2, [r1, #oNFCONF]

    ldr r2, =( (1<<4)|(0<<1)|(1<<0) ) @ Active low CE Control
    str r2, [r1, #oNFCONT]
    ldr r2, [r1, #oNFCONT]

    ldr r2, =(0x6) @ RnB Clear
    str r2, [r1, #oNFSTAT]
    ldr r2, [r1, #oNFSTAT]
    
    mov r2, #0xff @ RESET command
    strb r2, [r1, #oNFCMD]

  mov r3, #0 @ wait
nand1:
  add r3, r3, #0x1
  cmp r3, #0xa
  blt nand1

nand2:
  ldr r2, [r1, #oNFSTAT] @ wait ready
  tst r2, #0x4
  beq nand2


    ldr r2, [r1, #oNFCONT]
    orr r2, r2, #0x2 @ Flash Memory Chip Disable
    str r2, [r1, #oNFCONT]

@ get read to call C s (for nand_read())
  ldr sp, DW_STACK_START @ setup stack pointer
  mov fp, #0 @ no previous , so fp=0

@ copy U-Boot to RAM
  ldr r0, =TEXT_BASE
  mov r1, #0x0
  mov r2, #0x30000
  bl nand_read_ll
  tst r0, #0x0
  beq ok_nand_read

bad_nand_read:
loop2: b loop2 @ infinite loop


ok_nand_read:
@ verify
  mov r0, #0
  ldr r1, =TEXT_BASE
  mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes
go_next:
  ldr r3, [r0], #4
  ldr r4, [r1], #4
  teq r3, r4
  bne notmatch
  subs r2, r2, #4
  beq stack_setup
  bne go_next

notmatch:
loop3: b loop3 @ infinite loop

#endif @ CONFIG_S3C2440_NAND_BOOT

#ifdef CONFIG_S3C2410_NAND_BOOT
@ reset NAND
  mov r1, #NAND_CTL_BASE
  ldr r2, =0xf830 @ initial value
  str r2, [r1, #oNFCONF]
  ldr r2, [r1, #oNFCONF]
  bic r2, r2, #0x800 @ enable chip
  str r2, [r1, #oNFCONF]
  mov r2, #0xff @ RESET command
  strb r2, [r1, #oNFCMD]


  mov r3, #0 @ wait
nand1:
  add r3, r3, #0x1
  cmp r3, #0xa
  blt nand1

nand2:
  ldr r2, [r1, #oNFSTAT] @ wait ready
  tst r2, #0x1
  beq nand2

  ldr r2, [r1, #oNFCONF]
  orr r2, r2, #0x800 @ disable chip
  str r2, [r1, #oNFCONF]

@ get read to call C s (for nand_read())
  ldr sp, DW_STACK_START @ setup stack pointer
  mov fp, #0 @ no previous , so fp=0

@ copy U-Boot to RAM
  ldr r0, =TEXT_BASE
  mov r1, #0x0
  mov r2, #0x30000
  bl nand_read_ll
  tst r0, #0x0
  beq ok_nand_read

bad_nand_read:
loop2: b loop2 @ infinite loop


ok_nand_read:
@ verify
  mov r0, #0
  ldr r1, =TEXT_BASE
  mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes
go_next:
  ldr r3, [r0], #4
  ldr r4, [r1], #4
  teq r3, r4
  bne notmatch
  subs r2, r2, #4
  beq stack_setup
  bne go_next

notmatch:
loop3: b loop3 @ infinite loop

#endif @ CONFIG_S3C2410_NAND_BOOT



在“ldr    pc, _start_armboot”之前加入:

# if defined(CONFIG_tekkaman2440_LED)
    @ LED1 on u-boot stage 1 is
    mov r1, #GPIO_CTL_BASE
    add r1, r1, #oGPIO_B
    ldr r2,=0x155aa
    str r2, [r1, #oGPIO_CON]
    mov r2, #0xff
    str r2, [r1, #oGPIO_UP]
    mov r2, #0x1c0
    str r2, [r1, #oGPIO_DAT]
#endif

修改目的:如果看到只有LED1亮了,说明U-Boot的第一阶段已完成!(针对友善之臂SBC2440V4,不是这块开发板的,必须修改或不添加)

在 “  _start_armboot:    .word start_armboot  ” 后加入:

.align 2
DW_STACK_START: .word STACK_BASE+STACK_SIZE-4

2  在board/tekkaman/tekkaman2440加入NAND Flash读函数文件,拷贝vivi中的nand_read.c文件到此文件夹即可:

#include <config.h>

#define __REGb(x) (*(volatile unsigned char *)(x))
#define __REGi(x) (*(volatile unsigned int *)(x))
#define NF_BASE 0x4e000000


# if defined(CONFIG_S3C2440)

#define NFCONF __REGi(NF_BASE + 0x0)
#define NFCONT __REGi(NF_BASE + 0x4)
#define NFCMD __REGb(NF_BASE + 0x8)
#define NFADDR __REGb(NF_BASE + 0xC)
#define NFDATA __REGb(NF_BASE + 0x10)
#define NFSTAT __REGb(NF_BASE + 0x20)

//#define GPDAT __REGi(GPIO_CTL_BASE+oGPIO_F+oGPIO_DAT)


#define NAND_CHIP_ENABLE (NFCONT &= ~(1<<1))
#define NAND_CHIP_DISABLE (NFCONT |= (1<<1))
#define NAND_CLEAR_RB (NFSTAT |= (1<<2))
#define NAND_DETECT_RB { while(! (NFSTAT&(1<<2)) );}

#define BUSY 4
inline void wait_idle(void) {
    while(!(NFSTAT & BUSY));
    NFSTAT |= BUSY;
}

#define NAND_SECTOR_SIZE 512
#define NAND_BLOCK_MASK (NAND_SECTOR_SIZE - 1)

/* low level nand read */
int
nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
    int i, j;

    if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
        return -1; /* invalid alignment */
    }

    NAND_CHIP_ENABLE;

    for(i=start_addr; i < (start_addr + size);) {
        /* READ0 */
        NAND_CLEAR_RB;
        NFCMD = 0;

        /* Write Address */
        NFADDR = i & 0xff;
        NFADDR = (i >> 9) & 0xff;
        NFADDR = (i >> 17) & 0xff;
        NFADDR = (i >> 25) & 0xff;

        NAND_DETECT_RB;

        for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
            *buf = (NFDATA & 0xff);
            buf++;
        }
    }
    NAND_CHIP_DISABLE;
    return 0;
}
# endif

# if defined(CONFIG_S3C2410)

#define NFCONF __REGi(NF_BASE + 0x0)
#define NFCMD __REGb(NF_BASE + 0x4)
#define NFADDR __REGb(NF_BASE + 0x8)
#define NFDATA __REGb(NF_BASE + 0xc)
#define NFSTAT __REGb(NF_BASE + 0x10)
#define BUSY 1

inline void wait_idle(void) {
    int i;
    while(!(NFSTAT & BUSY))
      for(i=0; i<10; i++);
}
/* low level nand read */
int
nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
    int i, j;
    if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
        return -1; /* invalid alignment */
    }
    /* chip Enable */
    NFCONF &= ~0x800;
    for(i=0; i<10; i++);
    for(i=start_addr; i < (start_addr + size);) {
      /* READ0 */
      NFCMD = 0;
      /* Write Address */
      NFADDR = i & 0xff;
      NFADDR = (i >> 9) & 0xff;
      NFADDR = (i >> 17) & 0xff;
      NFADDR = (i >> 25) & 0xff;
      wait_idle();
      for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
 *buf = (NFDATA & 0xff);
 buf++;
      }
    }
    /* chip Disable */
    NFCONF |= 0x800; /* chip disable */
    return 0;
}
# endif

3 修改board/tekkaman/tekkaman2440/Makefile文件

......
OBJS := tekkaman2440.o nand_read.o flash.o
......

4 修改include/configs/tekkaman2440.h文件,添加如下内容:

......
/*
 * Nandflash Boot
 */

#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x8000
//#define UBOOT_RAM_BASE 0x33f80000

/* NAND Flash Controller */
#define NAND_CTL_BASE 0x4E000000
#define bINT_CTL(Nb) __REG(INT_CTL_BASE + (Nb))
/* Offset */
#define oNFCONF 0x00

# if defined(CONFIG_S3C2440)
#define CONFIG_S3C2440_NAND_BOOT 1
/* Offset */
#define oNFCONT 0x04
#define oNFCMD 0x08
#define oNFADDR 0x0c
#define oNFDATA 0x10
#define oNFSTAT 0x20
#define oNFECC 0x2c
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCONT (*(volatile unsigned int *)0x4e000004)
#define rNFCMD (*(volatile unsigned char *)0x4e000008)
#define rNFADDR (*(volatile unsigned char *)0x4e00000c)
#define rNFDATA (*(volatile unsigned char *)0x4e000010)
#define rNFSTAT (*(volatile unsigned int *)0x4e000020)
#define rNFECC (*(volatile unsigned int *)0x4e00002c)

# if defined(CONFIG_tekkaman2440_LED)
/* GPIO */
#define GPIO_CTL_BASE 0x56000000
#define oGPIO_B 0x10
#define oGPIO_CON 0x0 /* R/W, Configures the pins of the port */
#define oGPIO_DAT 0x4 /* R/W, Data register for port */
#define oGPIO_UP 0x8 /* R/W, Pull-up disable register */


#endif

# if defined(CONFIG_S3C2410)
#define CONFIG_S3C2410_NAND_BOOT 1
/* Offset */
#define oNFCONF 0x00
#define oNFCMD 0x04
#define oNFADDR 0x08
#define oNFDATA 0x0c
#define oNFSTAT 0x10
#define oNFECC 0x14
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCMD (*(volatile unsigned char *)0x4e000004)
#define rNFADDR (*(volatile unsigned char *)0x4e000008)
#define rNFDATA (*(volatile unsigned char *)0x4e00000c)
#define rNFSTAT (*(volatile unsigned int *)0x4e000010)
#define rNFECC (*(volatile unsigned int *)0x4e000014)
#define rNFECC0 (*(volatile unsigned char *)0x4e000014)
#define rNFECC1 (*(volatile unsigned char *)0x4e000015)
#define rNFECC2 (*(volatile unsigned char *)0x4e000016)
#endif

/*JFFS2 Support  */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_DEV  "nand0"
#define CONFIG_JFFS2_PART_SIZE  0x4c0000
#define CONFIG_JFFS2_PART_OFFSET 0x40000
/*JFFS2 Support  */

/* USB Support 080218 */
#define CONFIG_USB_OHCI
#define CONFIG_USB_STORAGE
#define CONFIG_USB_KEYBOARD
#define CONFIG_DOS_PARTITION
#define CFG_DEVICE_DEREGISTER
#define CONFIG_SUPPORT_VFAT
#define LITTLEENDIAN
/* USB Support 080218 */


#endif /* __CONFIG_H */

5 修改board/tekkaman/tekkaman2440/lowlevel_init.S文件
    依照开发板的内存区的配置情况, 修改board/tekkaman/tekkaman2440/lowlevel_init.S文件,我利用友善之臂提供的vivi源码里的信息做了如下更改:

......
#define B1_BWSCON        (DW16)

#if defined(CONFIG_DRIVER_NE2000)
#define B2_BWSCON         (DW16 + UBLB)
#else
#define B2_BWSCON        (DW16)
#endif

#define B3_BWSCON        (DW16 + WAIT + UBLB)
#define B4_BWSCON        (DW16)
#define B5_BWSCON        (DW16)
#define B6_BWSCON        (DW32)
#define B7_BWSCON        (DW32)
......
#if defined(CONFIG_DRIVER_NE2000)
#define B2_Tacs             0x3    /* 4clk tekkaman*/
#define B2_Tcos             0x3    /* 4clk tekkaman*/
#define B2_Tacc             0x7    /* 14clk */
#define B2_Tcoh             0x3    /* 4clk tekkaman*/
#define B2_Tah             0x3    /* 4clk tekkaman*/
#define B2_Tacp             0x3    /* 6clk tekkaman*/
#define B2_PMC             0x0    /* normal */
#else
#define B2_Tacs            0x0
#define B2_Tcos            0x0
#define B2_Tacc            0x7
#define B2_Tcoh            0x0
#define B2_Tah            0x0
#define B2_Tacp            0x0
#define B2_PMC            0x0
#endif
……

/* REFRESH parameter */
#define REFEN            0x1    /* Refresh enable */
#define TREFMD            0x0    /* CBR(CAS before RAS)/Auto refresh */
#define Trc            0x3    /* 7clk */
#define Tchr            0x2    /* 3clk */

# if defined(CONFIG_S3C2440)
#define Trp            0x2    /* 4clk */
#define REFCNT            1012
#else

#define Trp            0x0    /* 2clk */
#define REFCNT            0x0459
#endif

6 修改/board/tekkaman/tekkaman2440/tekkaman2440.c
 修改其对GPIO和PLL的配置(请参阅开发板的硬件说明和芯片手册):

......
#define FCLK_SPEED 1

#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        

#if defined(CONFIG_S3C2410)
/* Fout = 202.8MHz */
#define M_MDIV    0xA1
#define M_PDIV    0x3
#define M_SDIV    0x1
#endif

#if defined(CONFIG_S3C2440)
/* Fout = 405MHz */
#define M_MDIV 0x7f        
#define M_PDIV 0x2
#define M_SDIV 0x1
#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
......
/* set up the I/O ports */
gpio->GPACON = 0x007FFFFF;
# if defined(CONFIG_tekkaman2440_LED)
    gpio->GPBCON = 0x00055556;
#else

    gpio->GPBCON = 0x00044556;
#endif
......

#if defined(CONFIG_S3C2410)
    /* arch number of SMDK2410-Board */
    gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
#endif

#if defined(CONFIG_S3C2440)
    /* arch number of S3C2440 -Board */
    gd->bd->bi_arch_number = MACH_TYPE_S3C2440 ;
#endif

/* adress of boot parameters */
gd->bd->bi_boot_params = 0x30000100;
icache_enable();
dcache_enable();
# if defined(CONFIG_tekkaman2440_LED)
    gpio->GPBDAT = 0x180;
//tekkamanninja

    
//int board_init (void)设置完成后,LED1和LED2会亮起!

#endif
return 0;
}


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