分类:
2011-08-09 11:41:02
1.2.2 添加Nand Flash 读取函数
在board/ mini2440加入NAND Flash读取函数(start.S中需要的nand_read_ll函数)文件nand_read.c ,内容如下:
另外还要修改board/ /mini2440/Makefile文件,将nand_read.c编译进u-boot:
OBJS := mini2440.o nand_read.o flash.o
1.2.3 修改board/mini2440/lowlevel_init.S文件
(1)修改BWSCON,mini2440 BANK0接NOR Flash,BANK4接DM9000,BANK6接RAM,对于mini2440,只要修改B4_BWSCON即可:
#define B3_BWSCON (DW16 + WAIT + UBLB)
//#define B4_BWSCON (DW16)
#define B4_BWSCON (DW16 + WAIT + UBLB)
#define B5_BWSCON (DW16)
……
#define B4_Tacs 0x0 /* 0clk */
#define B4_Tcos 0x3 /* 4clk */
#define B4_Tacc 0x7 /* 14clk */
#define B4_Tcoh 0x1 /* 1clk */
#define B4_Tah 0x3 /* 4clk */
#define B4_Tacp 0x6 /* 6clk */
#define B4_PMC 0x0 /* normal */
#define B5_Tacs 0x0 /* 0clk */
(2)然后修改 REFRESH 的刷新周期:
#define B7_SCAN 0x1 /* 9bit */
/* REFRESH parameter */
#define REFEN 0x1 /* Refresh enable */
#define TREFMD 0x0 /* CBR(CAS before RAS)/Auto refresh */
#define Trc 0x3 /* 7clk */
#define Tchr 0x2 /* 3clk */
//#define REFCNT 1113 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */
# if defined(CONFIG_S3C2440)
#define Trp 0x2 /* 4clk */
#define REFCNT 1012
#else
#define Trp 0x0 /* 2clk */
#define REFCNT 0x4f4 /* period=7.8125us, HCLK=100Mhz, (2048+1-7.8125*100) */
#endif
_TEXT_BASE:
.word TEXT_BASE
1.2.4 修改GPIO和PLL的配置
在/board/ mini2440/mini2440.c 中对GPIO和PLL的配置进行修改(参阅开发板的硬件说明和芯片手册):
#elif FCLK_SPEED==1 /* Fout = 202.8MHz */
/*#define M_MDIV 0xA1
#define M_PDIV 0x3
#define M_SDIV 0x1*/
#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
/*------------------------*/
#endif
……
#elif USB_CLOCK==1
/*#define U_M_MDIV 0x48
#define U_M_PDIV 0x3*/
#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
为连接LED和蜂鸣器的GPIO修改配置寄存器:
/* set up the I/O ports */
gpio->GPACON = 0x007FFFFF;
/*gpio->GPBCON = 0x00044555;*/
#if defined(CONFIG_mini2440_LED)
gpio->GPBCON = 0x00055555;
#else
gpio->GPBCON = 0x00044555;
#endif
gpio->GPBUP = 0x000007FF;
为引导linux 内核,修改开发板的类型代码:
gpio->GPHUP = 0x000007FF;
/* arch number of SMDK2410-Board */
//gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
#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_mini2440 ;
#endif
/* adress of boot parameters */
为使int board_init (void)设置完成后,LED1和LED2同时亮起,在int board_init (void)的最后添加:
icache_enable();
dcache_enable();
# if defined(CONFIG_mini2440_LED)
gpio->GPBDAT = 0x180;
//int board_init (void)设置完成后,LED1和LED2会亮起!
#endif
return 0;