From: Vivien Chappelier <vchappel@irisa.fr>
To: Ralf Baechle <ralf@oss.sgi.com>
Cc: linux-mips@linux-mips.org
Subject: [PATCH 2.5] udelay
Date: Mon, 13 Jan 2003 11:04:52 +0100 [thread overview]
Message-ID: <3E228F44.8070309@irisa.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 254 bytes --]
Hi,
The HZ constant has been changed in 2.5 and this breaks
udelay(). Here is a patch to fix this. Note that the first multiply in
udelay is still optimized out by the compiler if the delay is constant,
as in current implementation.
Vivien.
[-- Attachment #2: linux-mips-udelay.diff --]
[-- Type: text/plain, Size: 1125 bytes --]
--- include/asm-mips64/delay.h 2002-12-11 20:44:20.000000000 +0100
+++ include/asm-mips64/delay.h 2003-01-07 20:36:37.000000000 +0100
@@ -41,11 +41,11 @@
{
unsigned long lo;
-#if (HZ == 100)
- usecs *= 0x00068db8bac710cbUL; /* 2**64 / (1000000 / HZ) */
-#elif (HZ == 128)
- usecs *= 0x0008637bd05af6c6UL; /* 2**64 / (1000000 / HZ) */
-#endif
+/* HZ * 2**64 / 1000000 */
+#define __UDELAY_FIXED64_HZ_1000000 (0x8000000000000000UL / (500000 / HZ))
+
+ usecs *= __UDELAY_FIXED64_HZ_1000000;
+
__asm__("dmultu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
--- include/asm-mips/delay.h 2002-12-11 20:44:18.000000000 +0100
+++ include/asm-mips/delay.h 2003-01-08 19:25:17.000000000 +0100
@@ -40,11 +40,10 @@
{
unsigned long lo;
-#if (HZ == 100)
- usecs *= 0x00068db8; /* 2**32 / (1000000 / HZ) */
-#elif (HZ == 128)
- usecs *= 0x0008637b; /* 2**32 / (1000000 / HZ) */
-#endif
+/* HZ * 2**32 / 1000000 */
+#define __UDELAY_FIXED32_HZ_1000000 (0x80000000UL / (500000 / HZ))
+
+ usecs *= __UDELAY_FIXED32_HZ_1000000;
__asm__("multu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
next reply other threads:[~2003-01-13 10:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-13 10:04 Vivien Chappelier [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-01-11 18:55 [PATCH 2.5] udelay Vivien Chappelier
2002-12-21 18:11 Vivien Chappelier
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=3E228F44.8070309@irisa.fr \
--to=vchappel@irisa.fr \
--cc=linux-mips@linux-mips.org \
--cc=ralf@oss.sgi.com \
--cc=vivienc@nerim.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox