Commit 4236031c authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] FRV: Make calibrate_delay() optional

The attached patch makes calibrate_delay() optional. In this architecture, it's
a waste of time since we can predict exactly what it's going to come up with
just by looking at the CPU's hardware clock registers. Thus far, we haven't
seen a board with any clock not dependent on the CPU's clock.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2c71699c
...@@ -28,6 +28,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -28,6 +28,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
bool bool
default y default y
......
...@@ -57,6 +57,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -57,6 +57,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_BUST_SPINLOCK config GENERIC_BUST_SPINLOCK
bool bool
......
...@@ -45,6 +45,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -45,6 +45,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_BUST_SPINLOCK config GENERIC_BUST_SPINLOCK
bool bool
......
...@@ -20,6 +20,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -20,6 +20,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config CRIS config CRIS
bool bool
default y default y
......
...@@ -33,6 +33,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -33,6 +33,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default n default n
config GENERIC_CALIBRATE_DELAY
bool
default y
config ISA config ISA
bool bool
default y default y
......
...@@ -373,6 +373,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -373,6 +373,10 @@ config RWSEM_XCHGADD_ALGORITHM
depends on !M386 depends on !M386
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config X86_PPRO_FENCE config X86_PPRO_FENCE
bool bool
depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 depends on M686 || M586MMX || M586TSC || M586 || M486 || M386
......
...@@ -30,6 +30,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -30,6 +30,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config TIME_INTERPOLATION config TIME_INTERPOLATION
bool bool
default y default y
......
...@@ -21,6 +21,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -21,6 +21,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
mainmenu "Linux/68k Kernel Configuration" mainmenu "Linux/68k Kernel Configuration"
source "init/Kconfig" source "init/Kconfig"
......
...@@ -29,6 +29,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -29,6 +29,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default n default n
config GENERIC_CALIBRATE_DELAY
bool
default y
source "init/Kconfig" source "init/Kconfig"
menu "Processor type and features" menu "Processor type and features"
......
...@@ -852,6 +852,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -852,6 +852,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config HAVE_DEC_LOCK config HAVE_DEC_LOCK
bool bool
default y default y
......
...@@ -32,6 +32,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -32,6 +32,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
bool bool
......
...@@ -22,6 +22,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -22,6 +22,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config HAVE_DEC_LOCK config HAVE_DEC_LOCK
bool bool
default y default y
......
...@@ -20,6 +20,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -20,6 +20,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
bool bool
default y default y
......
...@@ -14,6 +14,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -14,6 +14,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config GENERIC_BUST_SPINLOCK config GENERIC_BUST_SPINLOCK
bool bool
......
...@@ -25,6 +25,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -25,6 +25,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
source "init/Kconfig" source "init/Kconfig"
menu "System type" menu "System type"
......
...@@ -25,6 +25,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -25,6 +25,10 @@ config RWSEM_GENERIC_SPINLOCK
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
config LOG_BUF_SHIFT config LOG_BUF_SHIFT
int int
default 14 default 14
......
...@@ -207,6 +207,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -207,6 +207,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config SUN_PM config SUN_PM
bool bool
default y default y
......
...@@ -186,6 +186,10 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -186,6 +186,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
choice choice
prompt "SPARC64 Huge TLB Page Size" prompt "SPARC64 Huge TLB Page Size"
depends on HUGETLB_PAGE depends on HUGETLB_PAGE
......
...@@ -31,6 +31,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -31,6 +31,10 @@ config RWSEM_GENERIC_SPINLOCK
bool bool
default y default y
config GENERIC_CALIBRATE_DELAY
bool
default y
menu "UML-specific options" menu "UML-specific options"
config MODE_TT config MODE_TT
......
...@@ -19,6 +19,9 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -19,6 +19,9 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
default n default n
config GENERIC_CALIBRATE_DELAY
bool
default y
# Turn off some random 386 crap that can affect device config # Turn off some random 386 crap that can affect device config
config ISA config ISA
......
...@@ -41,6 +41,10 @@ config RWSEM_GENERIC_SPINLOCK ...@@ -41,6 +41,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM config RWSEM_XCHGADD_ALGORITHM
bool bool
config GENERIC_CALIBRATE_DELAY
bool
default y
config X86_CMPXCHG config X86_CMPXCHG
bool bool
default y default y
......
...@@ -92,7 +92,6 @@ static __inline__ unsigned int num_booting_cpus(void) ...@@ -92,7 +92,6 @@ static __inline__ unsigned int num_booting_cpus(void)
} }
extern void smp_send_timer(void); extern void smp_send_timer(void);
extern void calibrate_delay(void);
extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); extern unsigned long send_IPI_mask_phys(cpumask_t, int, int);
#endif /* not __ASSEMBLY__ */ #endif /* not __ASSEMBLY__ */
......
...@@ -25,7 +25,6 @@ extern void ia32_syscall(void); ...@@ -25,7 +25,6 @@ extern void ia32_syscall(void);
extern void ia32_cstar_target(void); extern void ia32_cstar_target(void);
extern void ia32_sysenter_target(void); extern void ia32_sysenter_target(void);
extern void calibrate_delay(void);
extern void cpu_idle(void); extern void cpu_idle(void);
extern void config_acpi_tables(void); extern void config_acpi_tables(void);
extern void ia32_syscall(void); extern void ia32_syscall(void);
......
...@@ -38,6 +38,7 @@ extern unsigned long loops_per_jiffy; ...@@ -38,6 +38,7 @@ extern unsigned long loops_per_jiffy;
#define ndelay(x) udelay(((x)+999)/1000) #define ndelay(x) udelay(((x)+999)/1000)
#endif #endif
void calibrate_delay(void);
void msleep(unsigned int msecs); void msleep(unsigned int msecs);
unsigned long msleep_interruptible(unsigned int msecs); unsigned long msleep_interruptible(unsigned int msecs);
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# #
obj-y := main.o version.o mounts.o initramfs.o obj-y := main.o version.o mounts.o initramfs.o
obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
mounts-y := do_mounts.o mounts-y := do_mounts.o
mounts-$(CONFIG_DEVFS_FS) += do_mounts_devfs.o mounts-$(CONFIG_DEVFS_FS) += do_mounts_devfs.o
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
......
/* calibrate.c: default delay calibration
*
* Excised from init/main.c
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/init.h>
static unsigned long preset_lpj;
static int __init lpj_setup(char *str)
{
preset_lpj = simple_strtoul(str,NULL,0);
return 1;
}
__setup("lpj=", lpj_setup);
/*
* This is the number of bits of precision for the loops_per_jiffy. Each
* bit takes on average 1.5/HZ seconds. This (like the original) is a little
* better than 1%
*/
#define LPS_PREC 8
void __devinit calibrate_delay(void)
{
unsigned long ticks, loopbit;
int lps_precision = LPS_PREC;
if (preset_lpj) {
loops_per_jiffy = preset_lpj;
printk("Calibrating delay loop (skipped)... "
"%lu.%02lu BogoMIPS preset\n",
loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ)) % 100);
} else {
loops_per_jiffy = (1<<12);
printk(KERN_DEBUG "Calibrating delay loop... ");
while ((loops_per_jiffy <<= 1) != 0) {
/* wait for "start of" clock tick */
ticks = jiffies;
while (ticks == jiffies)
/* nothing */;
/* Go .. */
ticks = jiffies;
__delay(loops_per_jiffy);
ticks = jiffies - ticks;
if (ticks)
break;
}
/*
* Do a binary approximation to get loops_per_jiffy set to
* equal one clock (up to lps_precision bits)
*/
loops_per_jiffy >>= 1;
loopbit = loops_per_jiffy;
while (lps_precision-- && (loopbit >>= 1)) {
loops_per_jiffy |= loopbit;
ticks = jiffies;
while (ticks == jiffies)
/* nothing */;
ticks = jiffies;
__delay(loops_per_jiffy);
if (jiffies != ticks) /* longer than 1 tick */
loops_per_jiffy &= ~loopbit;
}
/* Round the value and print it */
printk("%lu.%02lu BogoMIPS (lpj=%lu)\n",
loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ)) % 100,
loops_per_jiffy);
}
}
...@@ -182,15 +182,6 @@ static int __init obsolete_checksetup(char *line) ...@@ -182,15 +182,6 @@ static int __init obsolete_checksetup(char *line)
return 0; return 0;
} }
static unsigned long preset_lpj;
static int __init lpj_setup(char *str)
{
preset_lpj = simple_strtoul(str,NULL,0);
return 1;
}
__setup("lpj=", lpj_setup);
/* /*
* This should be approx 2 Bo*oMips to start (note initial shift), and will * This should be approx 2 Bo*oMips to start (note initial shift), and will
* still work even if initially too large, it will just take slightly longer * still work even if initially too large, it will just take slightly longer
...@@ -199,67 +190,6 @@ unsigned long loops_per_jiffy = (1<<12); ...@@ -199,67 +190,6 @@ unsigned long loops_per_jiffy = (1<<12);
EXPORT_SYMBOL(loops_per_jiffy); EXPORT_SYMBOL(loops_per_jiffy);
/*
* This is the number of bits of precision for the loops_per_jiffy. Each
* bit takes on average 1.5/HZ seconds. This (like the original) is a little
* better than 1%
*/
#define LPS_PREC 8
void __devinit calibrate_delay(void)
{
unsigned long ticks, loopbit;
int lps_precision = LPS_PREC;
if (preset_lpj) {
loops_per_jiffy = preset_lpj;
printk("Calibrating delay loop (skipped)... "
"%lu.%02lu BogoMIPS preset\n",
loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ)) % 100);
} else {
loops_per_jiffy = (1<<12);
printk(KERN_DEBUG "Calibrating delay loop... ");
while ((loops_per_jiffy <<= 1) != 0) {
/* wait for "start of" clock tick */
ticks = jiffies;
while (ticks == jiffies)
/* nothing */;
/* Go .. */
ticks = jiffies;
__delay(loops_per_jiffy);
ticks = jiffies - ticks;
if (ticks)
break;
}
/*
* Do a binary approximation to get loops_per_jiffy set to
* equal one clock (up to lps_precision bits)
*/
loops_per_jiffy >>= 1;
loopbit = loops_per_jiffy;
while (lps_precision-- && (loopbit >>= 1)) {
loops_per_jiffy |= loopbit;
ticks = jiffies;
while (ticks == jiffies)
/* nothing */;
ticks = jiffies;
__delay(loops_per_jiffy);
if (jiffies != ticks) /* longer than 1 tick */
loops_per_jiffy &= ~loopbit;
}
/* Round the value and print it */
printk("%lu.%02lu BogoMIPS (lpj=%lu)\n",
loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ)) % 100,
loops_per_jiffy);
}
}
static int __init debug_kernel(char *str) static int __init debug_kernel(char *str)
{ {
if (*str) if (*str)
......
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