Commit 5cfc8ee0 authored by John Stultz's avatar John Stultz Committed by Russell King

ARM: convert arm to arch_gettimeoffset()

Convert arm to use GENERIC_TIME via the arch_getoffset() infrastructure,
reducing the amount of arch specific code we need to maintain.

The arm architecture is the last arch that need to be converted.
Signed-off-by: default avatarJohn Stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
parent e4bf5bec
...@@ -42,6 +42,11 @@ config GENERIC_GPIO ...@@ -42,6 +42,11 @@ config GENERIC_GPIO
config GENERIC_TIME config GENERIC_TIME
bool bool
default y
config ARCH_USES_GETTIMEOFFSET
bool
default n
config GENERIC_CLOCKEVENTS config GENERIC_CLOCKEVENTS
bool bool
...@@ -231,6 +236,7 @@ config ARCH_AAEC2000 ...@@ -231,6 +236,7 @@ config ARCH_AAEC2000
select CPU_ARM920T select CPU_ARM920T
select ARM_AMBA select ARM_AMBA
select HAVE_CLK select HAVE_CLK
select ARCH_USES_GETTIMEOFFSET
help help
This enables support for systems based on the Agilent AAEC-2000 This enables support for systems based on the Agilent AAEC-2000
...@@ -271,6 +277,7 @@ config ARCH_AT91 ...@@ -271,6 +277,7 @@ config ARCH_AT91
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select HAVE_CLK select HAVE_CLK
select ARCH_USES_GETTIMEOFFSET
help help
This enables support for systems based on the Atmel AT91RM9200, This enables support for systems based on the Atmel AT91RM9200,
AT91SAM9 and AT91CAP9 processors. AT91SAM9 and AT91CAP9 processors.
...@@ -290,6 +297,7 @@ config ARCH_BCMRING ...@@ -290,6 +297,7 @@ config ARCH_BCMRING
config ARCH_CLPS711X config ARCH_CLPS711X
bool "Cirrus Logic CLPS711x/EP721x-based" bool "Cirrus Logic CLPS711x/EP721x-based"
select CPU_ARM720T select CPU_ARM720T
select ARCH_USES_GETTIMEOFFSET
help help
Support for Cirrus Logic 711x/721x based boards. Support for Cirrus Logic 711x/721x based boards.
...@@ -298,6 +306,7 @@ config ARCH_GEMINI ...@@ -298,6 +306,7 @@ config ARCH_GEMINI
select CPU_FA526 select CPU_FA526
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ARCH_USES_GETTIMEOFFSET
help help
Support for the Cortina Systems Gemini family SoCs Support for the Cortina Systems Gemini family SoCs
...@@ -306,6 +315,7 @@ config ARCH_EBSA110 ...@@ -306,6 +315,7 @@ config ARCH_EBSA110
select CPU_SA110 select CPU_SA110
select ISA select ISA
select NO_IOPORT select NO_IOPORT
select ARCH_USES_GETTIMEOFFSET
help help
This is an evaluation board for the StrongARM processor available This is an evaluation board for the StrongARM processor available
from Digital. It has limited hardware on-board, including an from Digital. It has limited hardware on-board, including an
...@@ -321,6 +331,7 @@ config ARCH_EP93XX ...@@ -321,6 +331,7 @@ config ARCH_EP93XX
select COMMON_CLKDEV select COMMON_CLKDEV
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_HOLES_MEMORYMODEL
select ARCH_USES_GETTIMEOFFSET
help help
This enables support for the Cirrus EP93xx series of CPUs. This enables support for the Cirrus EP93xx series of CPUs.
...@@ -328,6 +339,7 @@ config ARCH_FOOTBRIDGE ...@@ -328,6 +339,7 @@ config ARCH_FOOTBRIDGE
bool "FootBridge" bool "FootBridge"
select CPU_SA110 select CPU_SA110
select FOOTBRIDGE select FOOTBRIDGE
select ARCH_USES_GETTIMEOFFSET
help help
Support for systems based on the DC21285 companion chip Support for systems based on the DC21285 companion chip
("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
...@@ -366,6 +378,7 @@ config ARCH_H720X ...@@ -366,6 +378,7 @@ config ARCH_H720X
bool "Hynix HMS720x-based" bool "Hynix HMS720x-based"
select CPU_ARM720T select CPU_ARM720T
select ISA_DMA_API select ISA_DMA_API
select ARCH_USES_GETTIMEOFFSET
help help
This enables support for systems based on the Hynix HMS720x This enables support for systems based on the Hynix HMS720x
...@@ -408,6 +421,7 @@ config ARCH_IXP23XX ...@@ -408,6 +421,7 @@ config ARCH_IXP23XX
depends on MMU depends on MMU
select CPU_XSC3 select CPU_XSC3
select PCI select PCI
select ARCH_USES_GETTIMEOFFSET
help help
Support for Intel's IXP23xx (XScale) family of processors. Support for Intel's IXP23xx (XScale) family of processors.
...@@ -416,6 +430,7 @@ config ARCH_IXP2000 ...@@ -416,6 +430,7 @@ config ARCH_IXP2000
depends on MMU depends on MMU
select CPU_XSCALE select CPU_XSCALE
select PCI select PCI
select ARCH_USES_GETTIMEOFFSET
help help
Support for Intel's IXP2400/2800 (XScale) family of processors. Support for Intel's IXP2400/2800 (XScale) family of processors.
...@@ -434,6 +449,7 @@ config ARCH_L7200 ...@@ -434,6 +449,7 @@ config ARCH_L7200
bool "LinkUp-L7200" bool "LinkUp-L7200"
select CPU_ARM720T select CPU_ARM720T
select FIQ select FIQ
select ARCH_USES_GETTIMEOFFSET
help help
Say Y here if you intend to run this kernel on a LinkUp Systems Say Y here if you intend to run this kernel on a LinkUp Systems
L7200 Software Development Board which uses an ARM720T processor. L7200 Software Development Board which uses an ARM720T processor.
...@@ -523,6 +539,7 @@ config ARCH_KS8695 ...@@ -523,6 +539,7 @@ config ARCH_KS8695
select CPU_ARM922T select CPU_ARM922T
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ARCH_USES_GETTIMEOFFSET
help help
Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
System-on-Chip devices. System-on-Chip devices.
...@@ -569,6 +586,7 @@ config ARCH_PNX4008 ...@@ -569,6 +586,7 @@ config ARCH_PNX4008
bool "Philips Nexperia PNX4008 Mobile" bool "Philips Nexperia PNX4008 Mobile"
select CPU_ARM926T select CPU_ARM926T
select COMMON_CLKDEV select COMMON_CLKDEV
select ARCH_USES_GETTIMEOFFSET
help help
This enables support for Philips PNX4008 mobile platform. This enables support for Philips PNX4008 mobile platform.
...@@ -613,6 +631,7 @@ config ARCH_RPC ...@@ -613,6 +631,7 @@ config ARCH_RPC
select ISA_DMA_API select ISA_DMA_API
select NO_IOPORT select NO_IOPORT
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select ARCH_USES_GETTIMEOFFSET
help help
On the Acorn Risc-PC, Linux can support the internal IDE disk and On the Acorn Risc-PC, Linux can support the internal IDE disk and
CD-ROM interface, serial and parallel port, and the floppy drive. CD-ROM interface, serial and parallel port, and the floppy drive.
...@@ -639,6 +658,7 @@ config ARCH_S3C2410 ...@@ -639,6 +658,7 @@ config ARCH_S3C2410
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_HAS_CPUFREQ select ARCH_HAS_CPUFREQ
select HAVE_CLK select HAVE_CLK
select ARCH_USES_GETTIMEOFFSET
help help
Samsung S3C2410X CPU based systems, such as the Simtec Electronics Samsung S3C2410X CPU based systems, such as the Simtec Electronics
BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
...@@ -652,6 +672,7 @@ config ARCH_S3C64XX ...@@ -652,6 +672,7 @@ config ARCH_S3C64XX
select ARM_VIC select ARM_VIC
select HAVE_CLK select HAVE_CLK
select NO_IOPORT select NO_IOPORT
select ARCH_USES_GETTIMEOFFSET
select ARCH_HAS_CPUFREQ select ARCH_HAS_CPUFREQ
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select SAMSUNG_CLKSRC select SAMSUNG_CLKSRC
...@@ -708,6 +729,7 @@ config ARCH_SHARK ...@@ -708,6 +729,7 @@ config ARCH_SHARK
select ISA_DMA select ISA_DMA
select ZONE_DMA select ZONE_DMA
select PCI select PCI
select ARCH_USES_GETTIMEOFFSET
help help
Support for the StrongARM based Digital DNARD machine, also known Support for the StrongARM based Digital DNARD machine, also known
as "Shark" (<http://www.shark-linux.de/shark.html>). as "Shark" (<http://www.shark-linux.de/shark.html>).
...@@ -717,6 +739,7 @@ config ARCH_LH7A40X ...@@ -717,6 +739,7 @@ config ARCH_LH7A40X
select CPU_ARM922T select CPU_ARM922T
select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
select ARCH_USES_GETTIMEOFFSET
help help
Say Y here for systems based on one of the Sharp LH7A40X Say Y here for systems based on one of the Sharp LH7A40X
System on a Chip processors. These CPUs include an ARM922T System on a Chip processors. These CPUs include an ARM922T
......
...@@ -38,7 +38,7 @@ struct sys_timer { ...@@ -38,7 +38,7 @@ struct sys_timer {
void (*init)(void); void (*init)(void);
void (*suspend)(void); void (*suspend)(void);
void (*resume)(void); void (*resume)(void);
#ifndef CONFIG_GENERIC_TIME #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
unsigned long (*offset)(void); unsigned long (*offset)(void);
#endif #endif
}; };
......
...@@ -72,12 +72,15 @@ unsigned long profile_pc(struct pt_regs *regs) ...@@ -72,12 +72,15 @@ unsigned long profile_pc(struct pt_regs *regs)
EXPORT_SYMBOL(profile_pc); EXPORT_SYMBOL(profile_pc);
#endif #endif
#ifndef CONFIG_GENERIC_TIME #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
static unsigned long dummy_gettimeoffset(void) u32 arch_gettimeoffset(void)
{ {
if (system_timer->offset != NULL)
return system_timer->offset() * 1000;
return 0; return 0;
} }
#endif #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
#ifdef CONFIG_LEDS_TIMER #ifdef CONFIG_LEDS_TIMER
static inline void do_leds(void) static inline void do_leds(void)
...@@ -93,63 +96,6 @@ static inline void do_leds(void) ...@@ -93,63 +96,6 @@ static inline void do_leds(void)
#define do_leds() #define do_leds()
#endif #endif
#ifndef CONFIG_GENERIC_TIME
void do_gettimeofday(struct timeval *tv)
{
unsigned long flags;
unsigned long seq;
unsigned long usec, sec;
do {
seq = read_seqbegin_irqsave(&xtime_lock, flags);
usec = system_timer->offset();
sec = xtime.tv_sec;
usec += xtime.tv_nsec / 1000;
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
/* usec may have gone up a lot: be safe */
while (usec >= 1000000) {
usec -= 1000000;
sec++;
}
tv->tv_sec = sec;
tv->tv_usec = usec;
}
EXPORT_SYMBOL(do_gettimeofday);
int do_settimeofday(struct timespec *tv)
{
time_t wtm_sec, sec = tv->tv_sec;
long wtm_nsec, nsec = tv->tv_nsec;
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irq(&xtime_lock);
/*
* This is revolting. We need to set "xtime" correctly. However, the
* value in this location is the value at the most recent update of
* wall time. Discover what correction gettimeofday() would have
* done, and then undo it!
*/
nsec -= system_timer->offset() * NSEC_PER_USEC;
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
set_normalized_timespec(&xtime, sec, nsec);
set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
ntp_clear();
write_sequnlock_irq(&xtime_lock);
clock_was_set();
return 0;
}
EXPORT_SYMBOL(do_settimeofday);
#endif /* !CONFIG_GENERIC_TIME */
#ifndef CONFIG_GENERIC_CLOCKEVENTS #ifndef CONFIG_GENERIC_CLOCKEVENTS
/* /*
...@@ -214,10 +160,6 @@ device_initcall(timer_init_sysfs); ...@@ -214,10 +160,6 @@ device_initcall(timer_init_sysfs);
void __init time_init(void) void __init time_init(void)
{ {
#ifndef CONFIG_GENERIC_TIME
if (system_timer->offset == NULL)
system_timer->offset = dummy_gettimeoffset;
#endif
system_timer->init(); system_timer->init();
} }
...@@ -97,6 +97,7 @@ config ARCH_AT572D940HF ...@@ -97,6 +97,7 @@ config ARCH_AT572D940HF
config ARCH_AT91X40 config ARCH_AT91X40
bool "AT91x40" bool "AT91x40"
select ARCH_USES_GETTIMEOFFSET
endchoice endchoice
......
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