All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaofu Chen <chaofu.chen@yahoo.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] bug fix for the delay function of ARM s3c44b0
Date: Thu, 13 Nov 2008 05:11:24 -0800 (PST)	[thread overview]
Message-ID: <88421.34726.qm@web45012.mail.sp1.yahoo.com> (raw)

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. 

diff -purN old/cpu/s3c44b0/interrupts.c new/cpu/s3c44b0/interrupts.c
--- old/cpu/s3c44b0/interrupts.c	2005-12-17 00:39:27.000000000 +0800
+++ new/cpu/s3c44b0/interrupts.c	2008-11-13 20:36:46.000000000 +0800
@@ -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;



      

             reply	other threads:[~2008-11-13 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 13:11 Chaofu Chen [this message]
2008-11-13 15:42 ` [U-Boot] [PATCH] bug fix for the delay function of ARM s3c44b0 Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88421.34726.qm@web45012.mail.sp1.yahoo.com \
    --to=chaofu.chen@yahoo.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.