Commit fc4bc01e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents cfc894b6 5a07f86f
...@@ -56,6 +56,10 @@ SECTIONS ...@@ -56,6 +56,10 @@ SECTIONS
__initramfs_start = .; __initramfs_start = .;
usr/built-in.o(.init.ramfs) usr/built-in.o(.init.ramfs)
__initramfs_end = .; __initramfs_end = .;
. = ALIGN(64);
__per_cpu_start = .;
*(.data.percpu)
__per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL #ifndef CONFIG_XIP_KERNEL
__init_begin = _stext; __init_begin = _stext;
*(.init.data) *(.init.data)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* Inputs: r0 contains the address * Inputs: r0 contains the address
* Outputs: r0 is the error code * Outputs: r0 is the error code
* r1, r2 contains the zero-extended value * r2, r3 contains the zero-extended value
* lr corrupted * lr corrupted
* *
* No other registers must be altered. (see include/asm-arm/uaccess.h * No other registers must be altered. (see include/asm-arm/uaccess.h
...@@ -32,39 +32,39 @@ ...@@ -32,39 +32,39 @@
.global __get_user_1 .global __get_user_1
__get_user_1: __get_user_1:
1: ldrbt r1, [r0] 1: ldrbt r2, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __get_user_2 .global __get_user_2
__get_user_2: __get_user_2:
2: ldrbt r1, [r0], #1 2: ldrbt r2, [r0], #1
3: ldrbt r2, [r0] 3: ldrbt r3, [r0]
#ifndef __ARMEB__ #ifndef __ARMEB__
orr r1, r1, r2, lsl #8 orr r2, r2, r3, lsl #8
#else #else
orr r1, r2, r1, lsl #8 orr r2, r3, r2, lsl #8
#endif #endif
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __get_user_4 .global __get_user_4
__get_user_4: __get_user_4:
4: ldrt r1, [r0] 4: ldrt r2, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __get_user_8 .global __get_user_8
__get_user_8: __get_user_8:
5: ldrt r1, [r0], #4 5: ldrt r2, [r0], #4
6: ldrt r2, [r0] 6: ldrt r3, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
__get_user_bad_8: __get_user_bad_8:
mov r2, #0 mov r3, #0
__get_user_bad: __get_user_bad:
mov r1, #0 mov r2, #0
mov r0, #-EFAULT mov r0, #-EFAULT
mov pc, lr mov pc, lr
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* __put_user_X * __put_user_X
* *
* Inputs: r0 contains the address * Inputs: r0 contains the address
* r1, r2 contains the value * r2, r3 contains the value
* Outputs: r0 is the error code * Outputs: r0 is the error code
* lr corrupted * lr corrupted
* *
...@@ -32,33 +32,33 @@ ...@@ -32,33 +32,33 @@
.global __put_user_1 .global __put_user_1
__put_user_1: __put_user_1:
1: strbt r1, [r0] 1: strbt r2, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __put_user_2 .global __put_user_2
__put_user_2: __put_user_2:
mov ip, r1, lsr #8 mov ip, r2, lsr #8
#ifndef __ARMEB__ #ifndef __ARMEB__
2: strbt r1, [r0], #1 2: strbt r2, [r0], #1
3: strbt ip, [r0] 3: strbt ip, [r0]
#else #else
2: strbt ip, [r0], #1 2: strbt ip, [r0], #1
3: strbt r1, [r0] 3: strbt r2, [r0]
#endif #endif
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __put_user_4 .global __put_user_4
__put_user_4: __put_user_4:
4: strt r1, [r0] 4: strt r2, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
.global __put_user_8 .global __put_user_8
__put_user_8: __put_user_8:
5: strt r1, [r0], #4 5: strt r2, [r0], #4
6: strt r2, [r0] 6: strt r3, [r0]
mov r0, #0 mov r0, #0
mov pc, lr mov pc, lr
......
...@@ -37,7 +37,49 @@ ...@@ -37,7 +37,49 @@
#include "clock.h" #include "clock.h"
static unsigned long timer_startval; static unsigned long timer_startval;
static unsigned long timer_ticks_usec; static unsigned long timer_usec_ticks;
#define TIMER_USEC_SHIFT 16
/* we use the shifted arithmetic to work out the ratio of timer ticks
* to usecs, as often the peripheral clock is not a nice even multiple
* of 1MHz.
*
* shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
* for the current HZ value of 200 without producing overflows.
*
* Original patch by Dimitry Andric, updated by Ben Dooks
*/
/* timer_mask_usec_ticks
*
* given a clock and divisor, make the value to pass into timer_ticks_to_usec
* to scale the ticks into usecs
*/
static inline unsigned long
timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
{
unsigned long den = pclk / 1000;
return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
}
/* timer_ticks_to_usec
*
* convert timer ticks to usec.
*/
static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
{
unsigned long res;
res = ticks * timer_usec_ticks;
res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */
return res >> TIMER_USEC_SHIFT;
}
/*** /***
* Returns microsecond since last clock interrupt. Note that interrupts * Returns microsecond since last clock interrupt. Note that interrupts
...@@ -50,31 +92,31 @@ static unsigned long timer_ticks_usec; ...@@ -50,31 +92,31 @@ static unsigned long timer_ticks_usec;
static unsigned long s3c2410_gettimeoffset (void) static unsigned long s3c2410_gettimeoffset (void)
{ {
unsigned long tdone; unsigned long tdone;
unsigned long usec;
unsigned long irqpend; unsigned long irqpend;
unsigned long tval;
/* work out how many ticks have gone since last timer interrupt */ /* work out how many ticks have gone since last timer interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4)); tval = __raw_readl(S3C2410_TCNTO(4));
tdone = timer_startval - tval;
/* check to see if there is an interrupt pending */ /* check to see if there is an interrupt pending */
irqpend = __raw_readl(S3C2410_SRCPND); irqpend = __raw_readl(S3C2410_SRCPND);
if (irqpend & SRCPND_TIMER4) { if (irqpend & SRCPND_TIMER4) {
/* re-read the timer, and try and fix up for the missed /* re-read the timer, and try and fix up for the missed
* interrupt */ * interrupt. Note, the interrupt may go off before the
* timer has re-loaded from wrapping.
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4)); */
tdone += 1<<16;
}
/* currently, tcnt is in 12MHz units, but this may change tval = __raw_readl(S3C2410_TCNTO(4));
* for non-bast machines... tdone = timer_startval - tval;
*/
usec = tdone / timer_ticks_usec; if (tval != 0)
tdone += timer_startval;
}
return usec; return timer_ticks_to_usec(tdone);
} }
...@@ -120,8 +162,9 @@ static void s3c2410_timer_setup (void) ...@@ -120,8 +162,9 @@ static void s3c2410_timer_setup (void)
/* configure the system for whichever machine is in use */ /* configure the system for whichever machine is in use */
if (machine_is_bast() || machine_is_vr1000()) { if (machine_is_bast() || machine_is_vr1000()) {
timer_ticks_usec = 12; /* timer is at 12MHz */ /* timer is at 12MHz, scaler is 1 */
tcnt = (timer_ticks_usec * (1000*1000)) / HZ; timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
tcnt = 12000000 / HZ;
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
...@@ -129,13 +172,15 @@ static void s3c2410_timer_setup (void) ...@@ -129,13 +172,15 @@ static void s3c2410_timer_setup (void)
/* for the h1940 (and others), we use the pclk from the core /* for the h1940 (and others), we use the pclk from the core
* to generate the timer values. since values around 50 to * to generate the timer values. since values around 50 to
* 70MHz are not values we can directly generate the timer * 70MHz are not values we can directly generate the timer
* value from, we need to pre-scaleand divide before using it. * value from, we need to pre-scale and divide before using it.
*
* for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
* (8.45 ticks per usec)
*/ */
/* this is used as default if no other timer can be found */ /* this is used as default if no other timer can be found */
timer_ticks_usec = s3c24xx_pclk / (1000*1000); timer_usec_ticks = timer_mask_usec_ticks(6, s3c24xx_pclk);
timer_ticks_usec /= 6;
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_DIV2; tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
...@@ -146,8 +191,12 @@ static void s3c2410_timer_setup (void) ...@@ -146,8 +191,12 @@ static void s3c2410_timer_setup (void)
tcnt = (s3c24xx_pclk / 6) / HZ; tcnt = (s3c24xx_pclk / 6) / HZ;
} }
printk("setup_timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx\n", /* timers reload after counting zero, so reduce the count by 1 */
tcon, tcnt, tcfg0, tcfg1);
tcnt--;
printk("timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
/* check to see if timer is within 16bit range... */ /* check to see if timer is within 16bit range... */
if (tcnt > 0xffff) { if (tcnt > 0xffff) {
......
...@@ -108,35 +108,35 @@ extern int __get_user_4(void *); ...@@ -108,35 +108,35 @@ extern int __get_user_4(void *);
extern int __get_user_8(void *); extern int __get_user_8(void *);
extern int __get_user_bad(void); extern int __get_user_bad(void);
#define __get_user_x(__r1,__p,__e,__s,__i...) \ #define __get_user_x(__r2,__p,__e,__s,__i...) \
__asm__ __volatile__ ( \ __asm__ __volatile__ ( \
__asmeq("%0", "r0") __asmeq("%1", "r1") \ __asmeq("%0", "r0") __asmeq("%1", "r2") \
"bl __get_user_" #__s \ "bl __get_user_" #__s \
: "=&r" (__e), "=r" (__r1) \ : "=&r" (__e), "=r" (__r2) \
: "0" (__p) \ : "0" (__p) \
: __i, "cc") : __i, "cc")
#define get_user(x,p) \ #define get_user(x,p) \
({ \ ({ \
const register typeof(*(p)) __user *__p asm("r0") = (p);\ const register typeof(*(p)) __user *__p asm("r0") = (p);\
register typeof(*(p)) __r1 asm("r1"); \ register typeof(*(p)) __r2 asm("r2"); \
register int __e asm("r0"); \ register int __e asm("r0"); \
switch (sizeof(*(__p))) { \ switch (sizeof(*(__p))) { \
case 1: \ case 1: \
__get_user_x(__r1, __p, __e, 1, "lr"); \ __get_user_x(__r2, __p, __e, 1, "lr"); \
break; \ break; \
case 2: \ case 2: \
__get_user_x(__r1, __p, __e, 2, "r2", "lr"); \ __get_user_x(__r2, __p, __e, 2, "r3", "lr"); \
break; \ break; \
case 4: \ case 4: \
__get_user_x(__r1, __p, __e, 4, "lr"); \ __get_user_x(__r2, __p, __e, 4, "lr"); \
break; \ break; \
case 8: \ case 8: \
__get_user_x(__r1, __p, __e, 8, "lr"); \ __get_user_x(__r2, __p, __e, 8, "lr"); \
break; \ break; \
default: __e = __get_user_bad(); break; \ default: __e = __get_user_bad(); break; \
} \ } \
x = __r1; \ x = __r2; \
__e; \ __e; \
}) })
...@@ -227,31 +227,31 @@ extern int __put_user_4(void *, unsigned int); ...@@ -227,31 +227,31 @@ extern int __put_user_4(void *, unsigned int);
extern int __put_user_8(void *, unsigned long long); extern int __put_user_8(void *, unsigned long long);
extern int __put_user_bad(void); extern int __put_user_bad(void);
#define __put_user_x(__r1,__p,__e,__s) \ #define __put_user_x(__r2,__p,__e,__s) \
__asm__ __volatile__ ( \ __asm__ __volatile__ ( \
__asmeq("%0", "r0") __asmeq("%2", "r1") \ __asmeq("%0", "r0") __asmeq("%2", "r2") \
"bl __put_user_" #__s \ "bl __put_user_" #__s \
: "=&r" (__e) \ : "=&r" (__e) \
: "0" (__p), "r" (__r1) \ : "0" (__p), "r" (__r2) \
: "ip", "lr", "cc") : "ip", "lr", "cc")
#define put_user(x,p) \ #define put_user(x,p) \
({ \ ({ \
const register typeof(*(p)) __r1 asm("r1") = (x); \ const register typeof(*(p)) __r2 asm("r2") = (x); \
const register typeof(*(p)) __user *__p asm("r0") = (p);\ const register typeof(*(p)) __user *__p asm("r0") = (p);\
register int __e asm("r0"); \ register int __e asm("r0"); \
switch (sizeof(*(__p))) { \ switch (sizeof(*(__p))) { \
case 1: \ case 1: \
__put_user_x(__r1, __p, __e, 1); \ __put_user_x(__r2, __p, __e, 1); \
break; \ break; \
case 2: \ case 2: \
__put_user_x(__r1, __p, __e, 2); \ __put_user_x(__r2, __p, __e, 2); \
break; \ break; \
case 4: \ case 4: \
__put_user_x(__r1, __p, __e, 4); \ __put_user_x(__r2, __p, __e, 4); \
break; \ break; \
case 8: \ case 8: \
__put_user_x(__r1, __p, __e, 8); \ __put_user_x(__r2, __p, __e, 8); \
break; \ break; \
default: __e = __put_user_bad(); break; \ default: __e = __put_user_bad(); break; \
} \ } \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment