看下面的相关链接介绍UBOOT2011.06-RC2,如果有兴趣的朋友看到我上2篇的移植愚见后,如果你也亲自去实践过的话,我想你肯定会发现,当你输入NAND READ 或是NAND WRITE命令的时候,#命令符号后会不断地打印 一串信号:
raise: Signal # 8 caught
raise: Signal # 8 caught而且是循环打印,无法停止,但是NAND ERASE命令是可行的 没有这种信号输出,起初我开始怀疑是不是NAND驱动有问题,导致NAND的读写函数功能没有实现完全,但是事实上这种可能很小,因为既然SMDK6400已经实现了,我想OK6410应该不会出现这个问题啊,况且1GB的NAND芯片已经被识别了,带着这种疑问,我想了好久,还是想不通,核查代码一遍又一遍,搞的我还去翻了一遍单板上的NAND芯片英文资料还有SOC_S3C6410的DATASHEET,哎,看的头都大了,但是一切都是都那么的美好,看不出个问题,没办法,还是去GOOLE一下吧,带着渺茫的希望,翻了好几页,终于让我在国外的一个网站论坛上看到了希望,原来 对于S3C6410来说,较新版的UBOOT版本都有一个BUG,那就是再u-boot-2011.06-rc2/arch/arm/cpu/arm1176/s3c64xx/timer.c这个文件上,其实这个问题早几个月以前就有人提出来了,因为我看他们的聊天记录视乎是1月份左右的,本人英语虽很稀烂,但是看这些还是不成问题的了,可能会有人问,既然问题出了,为啥子DENX TEAM不加进新版本的UBOOT呢?其实我也很疑惑,但是正如DENX TEAM的UBOOT软件工程师WOLF GANG所气愤的,他不希望因为某一个芯片而去把UBOOT里面的代码的可读性以及可理解性破坏掉,改了timer.c里面的几个变量名的确可以让S3C6410 WORK WELL,但是这样,代码的可读性将会变得很差,因此,他的建议是需要的人直接去修改TIMER.C的代码,即使是以后更新的版本,也不会因为S3C6410这个芯片而去改动,其实,他说的很对,毕竟代码如果可读性降低了,那维护起来也很不方便,更让人很难理解啊,在这点上我还是很认同的,呵呵。好了,废话,说了一大堆,在这,贴出这个 PATCH吧:
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index 9768319..c1280f2 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -43,7 +43,7 @@
#include <asm/arch/s3c6400.h>
#include <div64.h>
-static ulong timer_load_val;
+DECLARE_GLOBAL_DATA_PTR;
#define PRESCALER 167
@@ -60,12 +60,6 @@ static inline ulong read_timer(void)
return timers->TCNTO4;
}
-/* Internal tick units */
-/* Last decremneter snapshot */
-static unsigned long lastdec;
-/* Monotonic incrementing timer */
-static unsigned long long timestamp;
-
int timer_init(void)
{
s3c64xx_timers *const timers = s3c64xx_get_base_timers();
@@ -83,20 +77,18 @@ int timer_init(void)
* the prescaler automatically for other PCLK frequencies.
*/
timers->TCFG0 = PRESCALER << 8;
- if (timer_load_val == 0) {
- timer_load_val = get_PCLK() / PRESCALER * (100 / 4); /* 100s */
- timers->TCFG1 = (timers->TCFG1 & ~0xf0000) | 0x20000;
- }
+ gd->timer_rate_hz = get_PCLK() / PRESCALER * (100 / 4); /* 100s */
+ timers->TCFG1 = (timers->TCFG1 & ~0xf0000) | 0x20000;
/* load value for 10 ms timeout */
- lastdec = timers->TCNTB4 = timer_load_val;
+ gd->lastinc = timers->TCNTB4 = gd->timer_rate_hz;
/* auto load, manual update of Timer 4 */
timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO |
TCON_4_UPDATE;
/* auto load, start Timer 4 */
timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO | COUNT_4_ON;
- timestamp = 0;
+ gd->timer_reset_value = 0;
return 0;
}
@@ -113,16 +105,16 @@ unsigned long long get_ticks(void)
{
ulong now = read_timer();
- if (lastdec >= now) {
+ if (gd->lastinc >= now) {
/* normal mode */
- timestamp += lastdec - now;
+ gd->timer_reset_value += gd->lastinc - now;
} else {
/* we have an overflow ... */
- timestamp += lastdec + timer_load_val - now;
+ gd->timer_reset_value += gd->lastinc + gd->timer_rate_hz - now;
}
- lastdec = now;
+ gd->lastinc = now;
- return timestamp;
+ return gd->timer_reset_value;
}
/*
@@ -132,14 +124,14 @@ unsigned long long get_ticks(void)
ulong get_tbclk(void)
{
/* We overrun in 100s */
- return (ulong)(timer_load_val / 100);
+ return (ulong)(gd->timer_rate_hz / 100);
}
void reset_timer_masked(void)
{
/* reset time */
- lastdec = read_timer();
- timestamp = 0;
+ gd->lastinc = read_timer();
+ gd->timer_reset_value = 0;
}
void reset_timer(void)
@@ -150,7 +142,7 @@ void reset_timer(void)
ulong get_timer_masked(void)
{
unsigned long long res = get_ticks();
- do_div (res, (timer_load_val / (100 * CONFIG_SYS_HZ)));
+ do_div(res, (gd->timer_rate_hz / (100 * CONFIG_SYS_HZ)));
return res;
}
@@ -161,7 +153,7 @@ ulong get_timer(ulong base)
void set_timer(ulong t)
{
- timestamp = t * (timer_load_val / (100 * CONFIG_SYS_HZ));
+ gd->timer_reset_value = t * (gd->timer_rate_hz / (100 * CONFIG_SYS_HZ));
}
void __udelay(unsigned long usec)
@@ -170,7 +162,7 @@ void __udelay(unsigned long usec)
ulong tmo;
tmo = (usec + 9) / 10;
- tmp = get_ticks() + tmo; /* get current timestamp */
+ tmp = get_ticks() + tmo; /* get current timer_reset_value */
while (get_ticks() < tmp)/* loop till event */
/*NOP*/;