先解決上面的錯誤,修改arch/arm/cpu/arm1176/s3c64xx/timer.c
static ulong timer_load_val;修改為 DECLARE_GLOBAL_DATA_PTR;
刪除下面的兩個定義:
/* Internal tick units */
/* Last decremneter snapshot */
static unsigned long lastdec;
/* Monotonic incrementing timer */
static unsigned long long timestamp;
接著把:
timers->TCFG0 =PRESCALER << 8;
if (timer_load_val == 0) {
timer_load_val =get_PCLK() / PRESCALER * (100 / 4); /* 100s */
timers->TCFG1 =(timers->TCFG1 & ~0xf0000) | 0x20000;
}
修改為:
timers->TCFG0 =PRESCALER << 8;
gd->timer_rate_hz =get_PCLK() / PRESCALER * (100 / 4); /* 100s */
timers->TCFG1 = (timers->TCFG1& ~0xf0000) | 0x20000;
將lastdec = timers->TCNTB4 = timer_load_val;修改為:
gd->lastinc = timers->TCNTB4 = gd->timer_rate_hz;
將timestamp = 0;修改為gd->timer_reset_value = 0;
將unsigned long long get_ticks(void)
{
ulong now = read_timer();
if (lastdec >= now) {
/* normal mode */
timestamp +=lastdec - now;
} else {
/* we have anoverflow ... */
timestamp +=lastdec + timer_load_val - now;
}
lastdec = now;
return timestamp;
}
修改為:
unsigned long long get_ticks(void)
{
ulong now = read_timer();
if (gd->lastinc >=now) {
/* normal mode */
gd->timer_reset_value += gd->lastinc - now;
} else {
/* we have anoverflow ... */
gd->timer_reset_value += gd->lastinc + gd->timer_rate_hz - now;
}
gd->lastinc = now;
returngd->timer_reset_value;
}
將ulong get_tbclk(void)
{
/* We overrun in 100s */
return(ulong)(timer_load_val / 100);
}
ulong get_timer_masked(void)
{
unsigned long long res =get_ticks();
do_div (res,(timer_load_val / (100 * CONFIG_SYS_HZ)));
return res;
}
修改為:
ulong get_tbclk(void)
{
/* We overrun in 100s */
return(ulong)(gd->timer_rate_hz / 100);
}
ulong get_timer_masked(void)
{
unsigned long long res =get_ticks();
//do_div (res,(timer_load_val / (100 * CONFIG_SYS_HZ)));
return res;
}
修改nand_spl/board/samsung/ok6410/ok6410_nand_spl.c將
void board_init_f(unsigned long bootflag)
{
relocate_code(CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
CONFIG_SYS_TEXT_BASE);
}
改為:
void board_init_f(unsigned long bootflag)
{
relocate_code(8*1024,NULL,
CONFIG_SYS_TEXT_BASE);
}
修改bl1的配置大小:nand_spl/board/samsung/ok6410/config.mk
# PAD_TO used to generate a 4kByte binary needed for the combined image
# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 4096
PAD_TO := $(shell expr$$[$(CONFIG_SYS_TEXT_BASE) + 4096])
修改為
# PAD_TO used to generate a 8kByte binary needed for the combined image
# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 8192
PAD_TO := $(shell expr$(CONFIG_SYS_TEXT_BASE) + 8192)
重新編譯燒寫:
Nandflash的初始化過程如下:
board_init_rànand_initànand_init_chipàboard_nand_initànand_scanà
nand_scan_identànand_scan_tailànand_register
在drivers/mtd/nand/nand_ids.c文件中定義了連個數組:nand_flash_ids[]和nand_manuf_ids[]。
添加ok6410 nandflash型號:
/* 16 Gigabit */
{NAND 2GiB 1,8V8-bit, 0xA5, 0, 2048, 0,LP_OPTIONS},
{NAND 2GiB 3,3V8-bit, 0xD5, 0, 2048, 0,LP_OPTIONS},
{NAND 2GiB 3,3V8-bit, 0x38, 4096, 2048,4096*128, LP_OPTIONS},
{NAND 2GiB 1,8V16-bit, 0xB5, 0, 2048, 0,LP_OPTIONS16},
{NAND 2GiB 3,3V16-bit, 0xC5, 0, 2048, 0,LP_OPTIONS16},
每個字段的含義如下:注意 IDcode需要自己測。
Name. ID code, pagesize, chipsize in MegaByte, eraseblock size, options
重新編譯燒寫:
這裡nandflash是使用的4位ecc校驗,有興趣的可以自己實現8位ecc校驗,6410是支持8位ecc的。