Skip to contentSkip to conversation

bug fix for the delay function of ARM s3c44b0

PATCH New Chaofu Chen 2 participants 2 messages Nov 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug fix for the delay function of ARM s3c44b0

The original implementation of delay function of ARM s3c44b0 doesnt' cooperate with U-Boot kernel well, which will cause fake-time-out. What is important is to keep timestamp in unit of millisecond.

cpu/s3c44b0/interrupts.c +5 -6
diff -purN old/cpu/s3c44b0/interrupts.c new/cpu/s3c44b0/interrupts.c
@@ -147,7 +147,7 @@ static ulong lastdec;
 int interrupt_init (void)
 {
 	TCFG0 = 0x000000E9;
-	TCFG1 = 0x00000004;
+	TCFG1 = 0x00000040;
 	TCON = 0x00000900;
 	TCNTB1 = TIMER_LOAD_VAL;
 	TCMPB1 = 0;
@@ -185,7 +185,7 @@ void udelay (unsigned long usec)
 
 	tmo = usec / 1000;
 	tmo *= CFG_HZ;
-	tmo /= 8;
+	tmo /= 1000;
 
 	tmo += get_timer (0);
 
@@ -213,7 +213,7 @@ ulong get_timer_masked (void)
 	}
 	lastdec = now;
 
-	return timestamp;
+	return (timestamp >> 3);
 }
 
 void udelay_masked (unsigned long usec)
@@ -225,10 +225,9 @@ void udelay_masked (unsigned long usec)
 	if (usec >= 1000) {
 		tmo = usec / 1000;
 		tmo *= CFG_HZ;
-		tmo /= 8;
+		tmo /= 1000;
 	} else {
-		tmo = usec * CFG_HZ;
-		tmo /= (1000*8);
+		tmo = 1;
 	}
 
 	endtime = get_timer(0) + tmo;
#1 lore raw

PATCH 1/1 bug fix for the delay function of ARM s3c44b0

Quoted 2 lines · Chaofu Chen

The original implementation of delay function of ARM s3c44b0 doesnt' cooperate with U-Boot kernel well, which will cause fake-time-out. What is important is to keep timestamp in unit of millisecond.

SOB please

Quoted 13 lines

diff -purN old/cpu/s3c44b0/interrupts.c new/cpu/s3c44b0/interrupts.c

cpu/s3c44b0/interrupts.c +1 -1
@@ -147,7 +147,7 @@ static ulong lastdec;
 int interrupt_init (void)
 {
 	TCFG0 = 0x000000E9;
-	TCFG1 = 0x00000004;
+	TCFG1 = 0x00000040;
 	TCON = 0x00000900;
 	TCNTB1 = TIMER_LOAD_VAL;
 	TCMPB1 = 0;

cpu/s3c44b0/interrupts.c void udelay (unsigned long usec) · line 187

Quoted 3 lines
cpu/s3c44b0/interrupts.c +0 -0
@@ -185,7 +185,7 @@ void udelay (unsigned long usec)
 
 	tmo = usec / 1000;
 	tmo *= CFG_HZ;

now it's CFG_HZ

please rebase you code against the current tree

Best Regards,
J.