summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRussell King <rmk@flint.arm.linux.org.uk>2003-12-21 21:08:33 +0000
committerRussell King <rmk@flint.arm.linux.org.uk>2003-12-21 21:08:33 +0000
commit7266355c6a09ea5b95012520a4ea23896aa417ac (patch)
tree0aa675a77cf20b5a051a9d954b8c29308c3a6a9a /include
parent67e9bb60cdf60c3ead23020c96090e722895f47a (diff)
parentf5793133f9126b7b3a9b554a23e61b3e366e7287 (diff)
[ARM] Merge current 2.6 into experimental tree.
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-ebsa285/time.h5
-rw-r--r--include/asm-arm/arch-pxa/time.h8
-rw-r--r--include/asm-arm/arch-sa1100/time.h8
-rw-r--r--include/asm-arm/arch-shark/time.h2
-rw-r--r--include/asm-arm/div64.h44
5 files changed, 52 insertions, 15 deletions
diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
index a3b012a73887..f651eeb655be 100644
--- a/include/asm-arm/arch-ebsa285/time.h
+++ b/include/asm-arm/arch-ebsa285/time.h
@@ -243,6 +243,7 @@ void __init time_init(void)
if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ &&
CMOS_READ(RTC_REG_B) == reg_b) {
+ struct timespec tv;
/*
* We have a RTC. Check the battery
@@ -250,7 +251,9 @@ void __init time_init(void)
if ((reg_d & 0x80) == 0)
printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");
- xtime.tv_sec = get_isa_cmos_time();
+ tv.tv_nsec = 0;
+ tv.tv_sec = get_isa_cmos_time();
+ do_settimeofday(&tv);
set_rtc = set_isa_cmos_time;
} else
rtc_base = 0;
diff --git a/include/asm-arm/arch-pxa/time.h b/include/asm-arm/arch-pxa/time.h
index 91865bd8fce8..dc46484fe0c7 100644
--- a/include/asm-arm/arch-pxa/time.h
+++ b/include/asm-arm/arch-pxa/time.h
@@ -73,9 +73,15 @@ pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
void __init time_init(void)
{
+ struct timespec tv;
+
gettimeoffset = pxa_gettimeoffset;
set_rtc = pxa_set_rtc;
- xtime.tv_sec = pxa_get_rtc_time();
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = pxa_get_rtc_time();
+ do_settimeofday(&tv);
+
timer_irq.handler = pxa_timer_interrupt;
OSMR0 = 0; /* set initial match at 0 */
OSSR = 0xf; /* clear status on all timers */
diff --git a/include/asm-arm/arch-sa1100/time.h b/include/asm-arm/arch-sa1100/time.h
index a7c984968819..bd93a2feb9a3 100644
--- a/include/asm-arm/arch-sa1100/time.h
+++ b/include/asm-arm/arch-sa1100/time.h
@@ -92,9 +92,15 @@ sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
void __init time_init(void)
{
+ struct timespec tv;
+
gettimeoffset = sa1100_gettimeoffset;
set_rtc = sa1100_set_rtc;
- xtime.tv_sec = sa1100_get_rtc_time();
+
+ tv.tv.nsec = 0;
+ tv.tv_sec = sa1100_get_rtc_time();
+ do_settimeofday(&tv);
+
timer_irq.handler = sa1100_timer_interrupt;
OSMR0 = 0; /* set initial match at 0 */
OSSR = 0xf; /* clear status on all timers */
diff --git a/include/asm-arm/arch-shark/time.h b/include/asm-arm/arch-shark/time.h
index 86a9bdebae23..66e45254a628 100644
--- a/include/asm-arm/arch-shark/time.h
+++ b/include/asm-arm/arch-shark/time.h
@@ -34,8 +34,6 @@ void __init time_init(void)
outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
outb(HZ_TIME >> 8, 0x40);
- xtime.tv_sec = 0;
-
timer_irq.handler = timer_interrupt;
setup_irq(IRQ_TIMER, &timer_irq);
}
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h
index 3e3bdb7e7b79..4957da3df270 100644
--- a/include/asm-arm/div64.h
+++ b/include/asm-arm/div64.h
@@ -1,18 +1,42 @@
#ifndef __ASM_ARM_DIV64
#define __ASM_ARM_DIV64
-/* We're not 64-bit, but... */
+/*
+ * The semantics of do_div() are:
+ *
+ * uint32_t do_div(uint64_t *n, uint32_t base)
+ * {
+ * uint32_t remainder = *n % base;
+ * *n = *n / base;
+ * return remainder;
+ * }
+ *
+ * In other words, a 64-bit dividend with a 32-bit divisor producing
+ * a 64-bit result and a 32-bit remainder. To accomplish this optimally
+ * we call a special __do_div64 helper with completely non standard
+ * calling convention for arguments and results (beware).
+ */
+
+#ifdef __ARMEB__
+#define __xh "r0"
+#define __xl "r1"
+#else
+#define __xl "r0"
+#define __xh "r1"
+#endif
+
#define do_div(n,base) \
({ \
- register int __res asm("r2") = base; \
- register unsigned long long __n asm("r0") = n; \
- asm("bl do_div64" \
- : "=r" (__n), "=r" (__res) \
- : "0" (__n), "1" (__res) \
- : "r3", "ip", "lr", "cc"); \
- n = __n; \
- __res; \
+ register unsigned int __base asm("r4") = base; \
+ register unsigned long long __n asm("r0") = n; \
+ register unsigned long long __res asm("r2"); \
+ register unsigned int __rem asm(__xh); \
+ asm("bl __do_div64" \
+ : "=r" (__rem), "=r" (__res) \
+ : "r" (__n), "r" (__base) \
+ : "ip", "lr", "cc"); \
+ n = __res; \
+ __rem; \
})
#endif
-