Chinaunix首页 | 论坛 | 博客
  • 博客访问: 89588
  • 博文数量: 19
  • 博客积分: 760
  • 博客等级: 军士长
  • 技术积分: 260
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 16:30
文章存档

2011年(1)

2009年(18)

我的朋友

分类: 嵌入式

2009-07-30 17:18:26

2.1        修改board/Embest/edukit2410/lowlevel_init.S文件

依照开发板的内存区的配置情况, 修改board/Embest/edukit2410/lowlevel_init.S文件,

......

#define B1_BWSCON          (DW32)

#define B2_BWSCON          (DW16)

#define B3_BWSCON          (DW16+UBLB)

#define B4_BWSCON          (DW16)

#define B5_BWSCON          (DW16)

#define B6_BWSCON          (DW32)

#define B7_BWSCON          (DW32)......

 

……

 

//#define B3_Tacs               0xc

 

//#define B3_Tcos               0x7

 

//#define B3_Tacc               0xf

 

//#define B3_Tcoh                     0x1

 

#define B3_Tacs                 0x0

 

#define B3_Tcos                 0x0

 

#define B3_Tacc                 0x7

 

#define B3_Tcoh                 0x0

 

#define B3_Tah                  0x0

 

#define B3_Tacp                 0x0

 

#define B3_PMC                 0x0

 

......

 

//#define B5_Tacs               0xc

 

//#define B5_Tcos               0x7

 

//#define B5_Tacc               0xf

 

//#define B5_Tcoh                     0x1

 

#define B5_Tacs                 0x0

 

#define B5_Tcos                 0x0

 

#define B5_Tacc                 0x7

 

#define B5_Tcoh                 0x0

 

#define B5_Tah                  0x0

 

#define B5_Tacp                 0x0

 

#define B5_PMC                 0x0

 

......

 

#define B6_MT                    0x3 /* SDRAM */

#define B6_Trcd                  0x1

#define B6_SCAN               0x1 /* 9bit */

 

#define B7_MT                    0x3 /* SDRAM */

#define B7_Trcd                  0x1 /* 3clk */

#define B7_SCAN               0x1 /* 9bit */

 

……

 

.word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)

.word 0x32

.word 0x30

.word 0x30

2.2        修改/board/Embest/edukit2410/edukit2410.c

 修改其对GPIOPLL的配置(请参阅开发板的硬件说明和芯片手册)

......

#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

 

#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 = 0x5fbfff;

gpio->GPBCON = 0x155559;

gpio->GPBUP = 0x7ff;

gpio->GPCCON = 0xaaaa55aa;

gpio->GPCUP = 0xffff;

gpio->GPDCON = 0xAAAAAAAA;

gpio->GPDUP = 0x0000FFFF;

gpio->GPECON = 0xa6aaaaaa;

gpio->GPEUP = 0xffff;

//gpio->GPEDATA = 0x2000;

gpio->GPFCON = 0x000055AA;

gpio->GPFUP = 0x000000FF;

#if defined(CONFIG_edukit2410_LED)

gpio->GPGCON = 0xff4af7b9;

gpio->GPGUP = 0xffff;

#else

gpio->GPGCON = 0xFF95FF3A;

gpio->GPGUP = 0x0000FFFF;

#endif

//gpio->GPGDATA = 0xffcf;

gpio->GPHCON = 0x2aaaaa;

gpio->GPHUP = 0x000007FF;

 

gpio->EXTINT0=0x22222222;

gpio->EXTINT1=0x22222222;

gpio->EXTINT2=0x22222222;

 

#if defined(CONFIG_S3C2410)

    /* arch number of SMDK2410-Board */

     gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;

#endif

 

/* adress of boot parameters */

gd->bd->bi_boot_params = 0x30000100;

 

icache_enable();

dcache_enable();

 

# if defined(CONFIG_edukit2410_LED)

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

#endif

 

return 0;

}

2.3        为了实现NAND Flash的读写,再次修改/include/configs/edukit2410.h

......

/*

 * High Level Configuration Options

 * (easy to change)

 */

#define CONFIG_ARM920T        1     /* This is an ARM920T Core      */

#define   CONFIG_S3C2410              1     /* in a SAMSUNG S3C2410 SoC     */

//#define CONFIG_SBC2410X           1     /* on a friendly-arm SBC-2410X Board  */

#define CONFIG_edukit2410            1

#define CONFIG_edukit2410_LED           1

......

/*

 * Command line configuration.

 */

#include

 

#define CONFIG_CMD_ASKENV

#define CONFIG_CMD_CACHE

#define CONFIG_CMD_DATE

#define CONFIG_CMD_DHCP

#define CONFIG_CMD_ELF

#define CONFIG_CMD_PING

#define CONFIG_CMD_NAND

#define CONFIG_CMD_REGINFO

 

#define CONFIG_CMD_JFFS2

/* JFFS2 Support    080218  */

 

#define CONFIG_CMD_USB

/* USB Support  080218  */

 

#define CONFIG_CMD_FAT

/* FAT support  080218  */

 

......

#define CFG_LONGHELP

/* undef to save memory */

#define CFG_PROMPT "[Edukit2410]#"

/*Monitor Command Prompt */

#define CFG_CBSIZE 256

/* Console I/O Buffer Size */

......

#define CFG_LOAD_ADDR 0x30800000

 /* default load address */

 

......

 

/* timeout values are in ticks */

#define CFG_FLASH_ERASE_TOUT    (5*CFG_HZ) /* Timeout for Flash Erase */

#define CFG_FLASH_WRITE_TOUT    (5*CFG_HZ) /* Timeout for Flash Write */

 

#define CFG_ENV_IS_IN_NAND 1

#define CFG_ENV_OFFSET 0X30000

#define CFG_NAND_LEGACY

//#define    CFG_ENV_IS_IN_FLASH    1

 

#define CFG_ENV_SIZE        0x10000    /* Total Size of Environment Sector */

 

/*----------------------------------------------------------------------

 * NAND flash settings

 */

#if defined(CONFIG_CMD_NAND)

#define CFG_NAND_BASE 0x4E000000

/* NandFlash控制器在SFR区起始寄存器地址 */

#define CFG_MAX_NAND_DEVICE 1

 /* 支持的最在Nand Flash数据 */

#define SECTORSIZE 512

/* 1页的大小 */

#define NAND_SECTOR_SIZE SECTORSIZE

#define NAND_BLOCK_MASK 511

/* 页掩码 */

#define ADDR_COLUMN 1

/* 一个字节的Column地址 */

#define ADDR_PAGE 3

/* 3字节的页块地址!!!!!*/

#define ADDR_COLUMN_PAGE 4

/* 总共4字节的页块地址!!!!! */

#define NAND_ChipID_UNKNOWN 0x00

/* 未知芯片的ID */

#define NAND_MAX_FLOORS 1

#define NAND_MAX_CHIPS 1

 

//#define NAND_WAIT_READY(nand)       NF_WaitRB()

//#define NAND_DISABLE_CE(nand) NF_SetCE(NFCE_HIGH)

//#define NAND_ENABLE_CE(nand)  NF_SetCE(NFCE_LOW)

//#define WRITE_NAND_COMMAND(d, adr)    NF_Cmd(d)

//#define WRITE_NAND_COMMANDW(d, adr) NF_CmdW(d)

//#define WRITE_NAND_ADDRESS(d, adr)      NF_Addr(d)

//#define WRITE_NAND(d, adr)         NF_Write(d)

//#define READ_NAND(adr)               NF_Read()

 

/* Nand Flash命令层底层接口函数 */

#define WRITE_NAND_ADDRESS(d, adr) {rNFADDR = d;}

#define WRITE_NAND(d, adr) {rNFDATA = d;}

#define READ_NAND(adr) (rNFDATA)

#define NAND_WAIT_READY(nand) {while(!(rNFSTAT&(1<<0)));}

#define WRITE_NAND_COMMAND(d, adr) {rNFCMD = d;}

#define WRITE_NAND_COMMANDW(d, adr)    NF_CmdW(d)

#define NAND_DISABLE_CE(nand) {rNFCONF |= (1<<11);}

#define NAND_ENABLE_CE(nand) {rNFCONF &= ~(1<<11);}

 

/* the following s are NOP's because S3C24X0 handles this in hardware */

 

#define NAND_CTL_CLRALE(nandptr)

#define NAND_CTL_SETALE(nandptr)

#define NAND_CTL_CLRCLE(nandptr)

#define NAND_CTL_SETCLE(nandptr)

/* 允许Nand Flash写校验 */

#define CONFIG_MTD_NAND_VERIFY_WRITE 1

......

#endif /* __CONFIG_H */

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