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
__initramfs_start = .;
usr/built-in.o(.init.ramfs)
__initramfs_end = .;
. = ALIGN(64);
__per_cpu_start = .;
*(.data.percpu)
__per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL
__init_begin = _stext;
*(.init.data)
......
......@@ -17,7 +17,7 @@
*
* Inputs: r0 contains the address
* Outputs: r0 is the error code
* r1, r2 contains the zero-extended value
* r2, r3 contains the zero-extended value
* lr corrupted
*
* No other registers must be altered. (see include/asm-arm/uaccess.h
......@@ -32,39 +32,39 @@
.global __get_user_1
__get_user_1:
1: ldrbt r1, [r0]
1: ldrbt r2, [r0]
mov r0, #0
mov pc, lr
.global __get_user_2
__get_user_2:
2: ldrbt r1, [r0], #1
3: ldrbt r2, [r0]
2: ldrbt r2, [r0], #1
3: ldrbt r3, [r0]
#ifndef __ARMEB__
orr r1, r1, r2, lsl #8
orr r2, r2, r3, lsl #8
#else
orr r1, r2, r1, lsl #8
orr r2, r3, r2, lsl #8
#endif
mov r0, #0
mov pc, lr
.global __get_user_4
__get_user_4:
4: ldrt r1, [r0]
4: ldrt r2, [r0]
mov r0, #0
mov pc, lr
.global __get_user_8
__get_user_8:
5: ldrt r1, [r0], #4
6: ldrt r2, [r0]
5: ldrt r2, [r0], #4
6: ldrt r3, [r0]
mov r0, #0
mov pc, lr
__get_user_bad_8:
mov r2, #0
mov r3, #0
__get_user_bad:
mov r1, #0
mov r2, #0
mov r0, #-EFAULT
mov pc, lr
......
......@@ -16,7 +16,7 @@
* __put_user_X
*
* Inputs: r0 contains the address
* r1, r2 contains the value
* r2, r3 contains the value
* Outputs: r0 is the error code
* lr corrupted
*
......@@ -32,33 +32,33 @@
.global __put_user_1
__put_user_1:
1: strbt r1, [r0]
1: strbt r2, [r0]
mov r0, #0
mov pc, lr
.global __put_user_2
__put_user_2:
mov ip, r1, lsr #8
mov ip, r2, lsr #8
#ifndef __ARMEB__
2: strbt r1, [r0], #1
2: strbt r2, [r0], #1
3: strbt ip, [r0]
#else
2: strbt ip, [r0], #1
3: strbt r1, [r0]
3: strbt r2, [r0]
#endif
mov r0, #0
mov pc, lr
.global __put_user_4
__put_user_4:
4: strt r1, [r0]
4: strt r2, [r0]
mov r0, #0
mov pc, lr
.global __put_user_8
__put_user_8:
5: strt r1, [r0], #4
6: strt r2, [r0]
5: strt r2, [r0], #4
6: strt r3, [r0]
mov r0, #0
mov pc, lr
......
......@@ -37,7 +37,49 @@
#include "clock.h"
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
......@@ -50,31 +92,31 @@ static unsigned long timer_ticks_usec;
static unsigned long s3c2410_gettimeoffset (void)
{
unsigned long tdone;
unsigned long usec;
unsigned long irqpend;
unsigned long tval;
/* 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 */
irqpend = __raw_readl(S3C2410_SRCPND);
if (irqpend & SRCPND_TIMER4) {
/* re-read the timer, and try and fix up for the missed
* interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4));
tdone += 1<<16;
}
* interrupt. Note, the interrupt may go off before the
* timer has re-loaded from wrapping.
*/
/* currently, tcnt is in 12MHz units, but this may change
* for non-bast machines...
*/
tval = __raw_readl(S3C2410_TCNTO(4));
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)
/* configure the system for whichever machine is in use */
if (machine_is_bast() || machine_is_vr1000()) {
timer_ticks_usec = 12; /* timer is at 12MHz */
tcnt = (timer_ticks_usec * (1000*1000)) / HZ;
/* timer is at 12MHz, scaler is 1 */
timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
tcnt = 12000000 / HZ;
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
......@@ -129,13 +172,15 @@ static void s3c2410_timer_setup (void)
/* for the h1940 (and others), we use the pclk from the core
* to generate the timer values. since values around 50 to
* 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 */
timer_ticks_usec = s3c24xx_pclk / (1000*1000);
timer_ticks_usec /= 6;
timer_usec_ticks = timer_mask_usec_ticks(6, s3c24xx_pclk);
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
......@@ -146,8 +191,12 @@ static void s3c2410_timer_setup (void)
tcnt = (s3c24xx_pclk / 6) / HZ;
}
printk("setup_timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx\n",
tcon, tcnt, tcfg0, tcfg1);
/* timers reload after counting zero, so reduce the count by 1 */
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... */
if (tcnt > 0xffff) {
......
......@@ -108,35 +108,35 @@ extern int __get_user_4(void *);
extern int __get_user_8(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__ ( \
__asmeq("%0", "r0") __asmeq("%1", "r1") \
__asmeq("%0", "r0") __asmeq("%1", "r2") \
"bl __get_user_" #__s \
: "=&r" (__e), "=r" (__r1) \
: "=&r" (__e), "=r" (__r2) \
: "0" (__p) \
: __i, "cc")
#define get_user(x,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"); \
switch (sizeof(*(__p))) { \
case 1: \
__get_user_x(__r1, __p, __e, 1, "lr"); \
__get_user_x(__r2, __p, __e, 1, "lr"); \
break; \
case 2: \
__get_user_x(__r1, __p, __e, 2, "r2", "lr"); \
__get_user_x(__r2, __p, __e, 2, "r3", "lr"); \
break; \
case 4: \
__get_user_x(__r1, __p, __e, 4, "lr"); \
__get_user_x(__r2, __p, __e, 4, "lr"); \
break; \
case 8: \
__get_user_x(__r1, __p, __e, 8, "lr"); \
__get_user_x(__r2, __p, __e, 8, "lr"); \
break; \
default: __e = __get_user_bad(); break; \
} \
x = __r1; \
x = __r2; \
__e; \
})
......@@ -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_bad(void);
#define __put_user_x(__r1,__p,__e,__s) \
#define __put_user_x(__r2,__p,__e,__s) \
__asm__ __volatile__ ( \
__asmeq("%0", "r0") __asmeq("%2", "r1") \
__asmeq("%0", "r0") __asmeq("%2", "r2") \
"bl __put_user_" #__s \
: "=&r" (__e) \
: "0" (__p), "r" (__r1) \
: "0" (__p), "r" (__r2) \
: "ip", "lr", "cc")
#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);\
register int __e asm("r0"); \
switch (sizeof(*(__p))) { \
case 1: \
__put_user_x(__r1, __p, __e, 1); \
__put_user_x(__r2, __p, __e, 1); \
break; \
case 2: \
__put_user_x(__r1, __p, __e, 2); \
__put_user_x(__r2, __p, __e, 2); \
break; \
case 4: \
__put_user_x(__r1, __p, __e, 4); \
__put_user_x(__r2, __p, __e, 4); \
break; \
case 8: \
__put_user_x(__r1, __p, __e, 8); \
__put_user_x(__r2, __p, __e, 8); \
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