mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
[S390] Provide arch specific mdelay implementation.
Use an own implementation instead of the common code udelay loop. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
78d81f2f84
commit
0cd6a403e8
@ -14,10 +14,11 @@
|
|||||||
#ifndef _S390_DELAY_H
|
#ifndef _S390_DELAY_H
|
||||||
#define _S390_DELAY_H
|
#define _S390_DELAY_H
|
||||||
|
|
||||||
extern void __udelay(unsigned long usecs);
|
extern void __udelay(unsigned long long usecs);
|
||||||
extern void udelay_simple(unsigned long usecs);
|
extern void udelay_simple(unsigned long long usecs);
|
||||||
extern void __delay(unsigned long loops);
|
extern void __delay(unsigned long loops);
|
||||||
|
|
||||||
#define udelay(n) __udelay(n)
|
#define udelay(n) __udelay((unsigned long long) (n))
|
||||||
|
#define mdelay(n) __udelay((unsigned long long) (n) * 1000)
|
||||||
|
|
||||||
#endif /* defined(_S390_DELAY_H) */
|
#endif /* defined(_S390_DELAY_H) */
|
||||||
|
@ -25,13 +25,13 @@ void __delay(unsigned long loops)
|
|||||||
asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
|
asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __udelay_disabled(unsigned long usecs)
|
static void __udelay_disabled(unsigned long long usecs)
|
||||||
{
|
{
|
||||||
unsigned long mask, cr0, cr0_saved;
|
unsigned long mask, cr0, cr0_saved;
|
||||||
u64 clock_saved;
|
u64 clock_saved;
|
||||||
|
|
||||||
clock_saved = local_tick_disable();
|
clock_saved = local_tick_disable();
|
||||||
set_clock_comparator(get_clock() + ((u64) usecs << 12));
|
set_clock_comparator(get_clock() + (usecs << 12));
|
||||||
__ctl_store(cr0_saved, 0, 0);
|
__ctl_store(cr0_saved, 0, 0);
|
||||||
cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
|
cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
|
||||||
__ctl_load(cr0 , 0, 0);
|
__ctl_load(cr0 , 0, 0);
|
||||||
@ -46,14 +46,14 @@ static void __udelay_disabled(unsigned long usecs)
|
|||||||
set_clock_comparator(S390_lowcore.clock_comparator);
|
set_clock_comparator(S390_lowcore.clock_comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __udelay_enabled(unsigned long usecs)
|
static void __udelay_enabled(unsigned long long usecs)
|
||||||
{
|
{
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
u64 clock_saved;
|
u64 clock_saved;
|
||||||
u64 end;
|
u64 end;
|
||||||
|
|
||||||
mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
|
mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
|
||||||
end = get_clock() + ((u64) usecs << 12);
|
end = get_clock() + (usecs << 12);
|
||||||
do {
|
do {
|
||||||
clock_saved = 0;
|
clock_saved = 0;
|
||||||
if (end < S390_lowcore.clock_comparator) {
|
if (end < S390_lowcore.clock_comparator) {
|
||||||
@ -72,7 +72,7 @@ static void __udelay_enabled(unsigned long usecs)
|
|||||||
/*
|
/*
|
||||||
* Waits for 'usecs' microseconds using the TOD clock comparator.
|
* Waits for 'usecs' microseconds using the TOD clock comparator.
|
||||||
*/
|
*/
|
||||||
void __udelay(unsigned long usecs)
|
void __udelay(unsigned long long usecs)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
@ -106,11 +106,11 @@ EXPORT_SYMBOL(__udelay);
|
|||||||
* Simple udelay variant. To be used on startup and reboot
|
* Simple udelay variant. To be used on startup and reboot
|
||||||
* when the interrupt handler isn't working.
|
* when the interrupt handler isn't working.
|
||||||
*/
|
*/
|
||||||
void udelay_simple(unsigned long usecs)
|
void udelay_simple(unsigned long long usecs)
|
||||||
{
|
{
|
||||||
u64 end;
|
u64 end;
|
||||||
|
|
||||||
end = get_clock() + ((u64) usecs << 12);
|
end = get_clock() + (usecs << 12);
|
||||||
while (get_clock() < end)
|
while (get_clock() < end)
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user