分类: LINUX
2009-04-25 23:13:12
一.U-BOOT板本为U-BOOT-
二.新建开发板的目录
1.在board目录下将smdk2410复制为ckz24x0目录
2.将board/ckz24x0/smdk2410.c改名为ckz24x0.c
3.将include/configs/smdk2410.h复制为ckz24x0.h
4.修改顶层Makefile,添加:
Ckz24x0_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t ckz24x0 NULL s
5.修改board/ckz24x0/Makefile:
COBJS := smdk2410.o flash.o
改为:
COBJS := ckz24x0.o flash.o
二.修改SDRAM的配置
1.根据HCLK设置SDRAM的刷新参数,主要是REFCNT寄存器,修改board/ckz24x0/lowlevel_init.S
#define REFCNT 1113
改为
#define REFCNT 0x
三.修改board_init函数
1.修改board/ckz24x0/ckz24x0.c中的board_init函数,修改为:
#define S
#define S
#define S
#define S
#define S
#define S
int board_init (void)
{
S
S
/* set up the I/O ports */
gpio->GPACON = 0x007FFFFF;
gpio->GPBCON = 0x00044555;
gpio->GPBUP = 0x000007FF;
gpio->GPCCON = 0xAAAAAAAA;
gpio->GPCUP = 0x0000FFFF;
gpio->GPDCON = 0xAAAAAAAA;
gpio->GPDUP = 0x0000FFFF;
gpio->GPECON = 0xAAAAAAAA;
gpio->GPEUP = 0x0000FFFF;
gpio->GPFCON = 0x000055AA;
gpio->GPFUP = 0x000000FF;
gpio->GPGCON = 0xFF95FFBA;
gpio->GPGUP = 0x0000FFFF;
gpio->GPHCON = 0x002AFAAA;
gpio->GPHUP = 0x000007FF;
if ((gpio->GSTATUS1 == 0x32410000) || (gpio->GSTATUS1 == 0x32410002) ) {
} else {
/* FCLK:HCLK:PCLK = 1:4:8 */
clk_power->CLKDIVN = S
__asm__( "mrc p15,0,r1,c1,c0,0\n"
"orr r1,r1,#0xc0000000\n"
"mcr p15,0,r1,c1,c0,0\n"
:::"r1"
);
/* to reduce PLL lock time, adjust the LOCKTIME register */
clk_power->LOCKTIME = 0xFFFFFF;
/* configure MPLL */
clk_power->MPLLCON = S
/* some delay between MPLL and UPLL */
delay (4000);
/* configure UPLL */
clk_power->UPLLCON = S
/* some delay between MPLL and UPLL */
delay (8000);
/* arch number of SMDK2410-Board */
gd->bd->bi_arch_number = MACH_TYPE_SMDK2440;
}
/* adress of boot parameters */
gd->bd->bi_boot_params = 0x30000100;
icache_enable();
dcache_enable();
return 0;
}
四.在/include/s
typedef struct {
S
S
S
S
S
S
S
} S
五.修改cpu/arm920t/s
DECLARE_GLOBAL_DATA_PTR;
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
1. 修改get_PLLCLK()
DECLARE_GLOBAL_DATA_PTR;
static ulong get_PLLCLK(int pllreg)
{
S
ulong r, m, p, s;
if (pllreg == MPLL)
r = clk_power->MPLLCON;
else if (pllreg == UPLL)
r = clk_power->UPLLCON;
else
hang();
m = ((r & 0xFF000) >> 12) + 8;
p = ((r & 0x
s = r & 0x3;
if(gd->bd->bi_arch_number == MACH_TYPE_SMDK2410) {
return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
} else {
return ((CONFIG_SYS_CLK_FREQ*m*2) / (p<
}
}
2. 修改get_HCLK()
/* return HCLK frequency */
ulong get_HCLK(void)
{
S
unsigned long clkdiv;
unsigned long camdiv;
int hdiv = 1;
if (gd->bd->bi_arch_number == MACH_TYPE_SMDK2410)
return((clk_power->CLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK());
else {
clkdiv = clk_power->CLKDIVN;
camdiv = clk_power->CAMDIVN;
switch(clkdiv & S
case S
hdiv = 1;
break;
case S
hdiv = 2;
break;
case S
hdiv = (camdiv & S
break;
case S
hdiv = (camdiv & S
break;
}
return get_FCLK() / hdiv;
}
}
3. 修改get_PCLK()
/* return PCLK frequency */
ulong get_PCLK(void)
{
S
unsigned long clkdiv;
unsigned long camdiv;
int hdiv = 1;
if (gd->bd->bi_arch_number == MACH_TYPE_SMDK2410)
return((clk_power->CLKDIVN & 0x1) ? get_HCLK()/2 : get_HCLK());
else {
clkdiv = clk_power->CLKDIVN;
camdiv = clk_power->CAMDIVN;
switch(clkdiv & S
case S
hdiv = 1;
break;
case S
hdiv = 2;
break;
case S
hdiv = (camdiv & S
break;
case S
hdiv = (camdiv & S
break;
}
return get_FCLK() / hdiv / ((clkdiv & S
}
}
六.选择 NOR FLASH 型号
1.修改include/configs/ckz24x0.h 把型号改成开发板中的NOR flash型号 AM29LV800
#if 0
#define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */
#endif
#define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */
重新编译
七.配置include/configs/ckz24x0.h中定义CS8900的各个默认地址,如IP,MAC等
#define CONFIG_ETHADDR 08:00:3e:26:
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.6.239
#define CONFIG_SERVERIP 192.168.6.15
八.添加include/configs/ckz24x0.h
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_CMD_LINE_TAG 1
#define CONFIG_BOOTDELAY 3
#define CONFIG_BOOTARGS "noinitrd console=ttSAC0 root=/dev/mtdblock1 rootfstype=jffs2"
#define CONFIG_BOOTCOMMAND "nboot 0x32000000 0 0; bootm 0x32000000"
九.添加PING命令
修改include/configs/ckz24x0.h:
#define CONFIG_COMMANDS \
(CONFIG_CMD_DFL | \
CFG_CMD_CACHE | \
CFG_CMD_PING | \
CFG_CMD_REGINFO | \
CFG_CMD_DATE | \
CFG_CMD_ELF)
十.修改提示符
修改include/configs/ckz24x0.h:
#define CFG_PROMPT "ckz24x0> " /* Monitor Command Prompt */
十一.支持NAND FLASH
1. 修改配置文件include/configs/ckz24x0.h的宏定义
#define CONFIG_COMMANDS \
(CONFIG_CMD_DFL | \
CFG_CMD_CACHE | \
CFG_CMD_PING | \
CFG_CMD_NAND | \
/*CFG_CMD_EEPROM |*/ \
/*CFG_CMD_I
/*CFG_CMD_USB |*/ \
CFG_CMD_REGINFO | \
CFG_CMD_DATE | \
CFG_CMD_ELF)
2. 在include/configs/ckz24x0.h中添加三个跟NAND 有关的宏定义
#define CFG_NAND_BASE 0
#define CFG_MAX_NAND_DEVICE 1
#define NAND_MAX_CHIPS 1
3. 在include/s
/* NAND FLASH (see S
typedef struct {
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
} /*__attribute__((__packed__))*/ S
4. 在include/s
static inline S
{
return (S
}
5.新建cpu/arm920t/s
#include
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include3c2410.h>
#include
DECLARE_GLOBAL_DATA_PTR;
#define S
#define S
static void s
{
S
if(chip == -1) {
s
} else {
s
}
}
static void s
{
S
struct nand_chip *chip = mtd->priv;
switch (cmd) {
case NAND_CTL_SETNCE:
case NAND_CTL_CLRNCE:
printf("%s: called for NCE\n", __FUNCTION__);
break;
case NAND_CTL_SETCLE:
chip->IO_ADDR_W = (void *) &s
break;
case NAND_CTL_SETALE:
chip->IO_ADDR_W = (void *) &s
break;
default:
chip->IO_ADDR_W = (void *) &s
break;
}
}
static int s
{
S
return (s
}
static void s
{
S
#define TACLS 0
#define TWRPH0 4
#define TWRPH1 2
s
s
}
void board_nand_init(struct nand_chip *chip)
{
S
s
chip->IO_ADDR_R = (void *)&s
chip->IO_ADDR_W = (void *)&s
chip->hwcontrol = s
chip->dev_ready = s
chip->select_chip = s
chip->options = 0;
chip->eccmode = NAND_ECC_SOFT;
}
#endif
6.修改cpu/arm920t/s
COBJS = i
usb_ohci.o nand_flash.o
十二.修改完,已经可以编译U-BOOT
Make ckz24x0_config
Make all
生成u-boot.bin,用HJTAG下载到板上运行
八.测试网络
1.把开发板连上网络
2.配置开发板的IP地址:
SMDK2410 # setenv ipaddr 192.168.6.239
SMDK2410 # setenv ethaddr 08:00:3e:26:
SMDK2410 # setenv serverip 192.168.6.15
SMDK2410 # saveenv
3.打开电脑的tftp-server
tftp 0x30000000 u-boot.bin
4. 烧写U-BOOT
SMDK2410 # protect off all
SMDK2410 # erase all
SMDK2410 # tftp 0x30000000 u-boot.bin
SMDK2410 # cp.b 0x30000000 0x0 0x1ffff
SMDK2410 # protect on all