aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-03-23 20:22:36 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-03-24 04:08:58 -0400
commit5cfc8ee0bb5134e1204e1ec5843e164f24315021 (patch)
tree56a5ef91318f0bba164f944ad3f06bc200bd94dd
parente4bf5becccf4685754c4d8e4485bb2ff7d28147f (diff)
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: John Stultz <johnstul@us.ibm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--arch/arm/Kconfig23
-rw-r--r--arch/arm/include/asm/mach/time.h2
-rw-r--r--arch/arm/kernel/time.c70
-rw-r--r--arch/arm/mach-at91/Kconfig1
4 files changed, 31 insertions, 65 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bcaa8c83e522..bf856f492eb5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -42,6 +42,11 @@ config GENERIC_GPIO
42 42
43config GENERIC_TIME 43config GENERIC_TIME
44 bool 44 bool
45 default y
46
47config ARCH_USES_GETTIMEOFFSET
48 bool
49 default n
45 50
46config GENERIC_CLOCKEVENTS 51config GENERIC_CLOCKEVENTS
47 bool 52 bool
@@ -231,6 +236,7 @@ config ARCH_AAEC2000
231 select CPU_ARM920T 236 select CPU_ARM920T
232 select ARM_AMBA 237 select ARM_AMBA
233 select HAVE_CLK 238 select HAVE_CLK
239 select ARCH_USES_GETTIMEOFFSET
234 help 240 help
235 This enables support for systems based on the Agilent AAEC-2000 241 This enables support for systems based on the Agilent AAEC-2000
236 242
@@ -271,6 +277,7 @@ config ARCH_AT91
271 select GENERIC_GPIO 277 select GENERIC_GPIO
272 select ARCH_REQUIRE_GPIOLIB 278 select ARCH_REQUIRE_GPIOLIB
273 select HAVE_CLK 279 select HAVE_CLK
280 select ARCH_USES_GETTIMEOFFSET
274 help 281 help
275 This enables support for systems based on the Atmel AT91RM9200, 282 This enables support for systems based on the Atmel AT91RM9200,
276 AT91SAM9 and AT91CAP9 processors. 283 AT91SAM9 and AT91CAP9 processors.
@@ -290,6 +297,7 @@ config ARCH_BCMRING
290config ARCH_CLPS711X 297config ARCH_CLPS711X
291 bool "Cirrus Logic CLPS711x/EP721x-based" 298 bool "Cirrus Logic CLPS711x/EP721x-based"
292 select CPU_ARM720T 299 select CPU_ARM720T
300 select ARCH_USES_GETTIMEOFFSET
293 help 301 help
294 Support for Cirrus Logic 711x/721x based boards. 302 Support for Cirrus Logic 711x/721x based boards.
295 303
@@ -298,6 +306,7 @@ config ARCH_GEMINI
298 select CPU_FA526 306 select CPU_FA526
299 select GENERIC_GPIO 307 select GENERIC_GPIO
300 select ARCH_REQUIRE_GPIOLIB 308 select ARCH_REQUIRE_GPIOLIB
309 select ARCH_USES_GETTIMEOFFSET
301 help 310 help
302 Support for the Cortina Systems Gemini family SoCs 311 Support for the Cortina Systems Gemini family SoCs
303 312
@@ -306,6 +315,7 @@ config ARCH_EBSA110
306 select CPU_SA110 315 select CPU_SA110
307 select ISA 316 select ISA
308 select NO_IOPORT 317 select NO_IOPORT
318 select ARCH_USES_GETTIMEOFFSET
309 help 319 help
310 This is an evaluation board for the StrongARM processor available 320 This is an evaluation board for the StrongARM processor available
311 from Digital. It has limited hardware on-board, including an 321 from Digital. It has limited hardware on-board, including an
@@ -321,6 +331,7 @@ config ARCH_EP93XX
321 select COMMON_CLKDEV 331 select COMMON_CLKDEV
322 select ARCH_REQUIRE_GPIOLIB 332 select ARCH_REQUIRE_GPIOLIB
323 select ARCH_HAS_HOLES_MEMORYMODEL 333 select ARCH_HAS_HOLES_MEMORYMODEL
334 select ARCH_USES_GETTIMEOFFSET
324 help 335 help
325 This enables support for the Cirrus EP93xx series of CPUs. 336 This enables support for the Cirrus EP93xx series of CPUs.
326 337
@@ -328,6 +339,7 @@ config ARCH_FOOTBRIDGE
328 bool "FootBridge" 339 bool "FootBridge"
329 select CPU_SA110 340 select CPU_SA110
330 select FOOTBRIDGE 341 select FOOTBRIDGE
342 select ARCH_USES_GETTIMEOFFSET
331 help 343 help
332 Support for systems based on the DC21285 companion chip 344 Support for systems based on the DC21285 companion chip
333 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 345 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
@@ -366,6 +378,7 @@ config ARCH_H720X
366 bool "Hynix HMS720x-based" 378 bool "Hynix HMS720x-based"
367 select CPU_ARM720T 379 select CPU_ARM720T
368 select ISA_DMA_API 380 select ISA_DMA_API
381 select ARCH_USES_GETTIMEOFFSET
369 help 382 help
370 This enables support for systems based on the Hynix HMS720x 383 This enables support for systems based on the Hynix HMS720x
371 384
@@ -408,6 +421,7 @@ config ARCH_IXP23XX
408 depends on MMU 421 depends on MMU
409 select CPU_XSC3 422 select CPU_XSC3
410 select PCI 423 select PCI
424 select ARCH_USES_GETTIMEOFFSET
411 help 425 help
412 Support for Intel's IXP23xx (XScale) family of processors. 426 Support for Intel's IXP23xx (XScale) family of processors.
413 427
@@ -416,6 +430,7 @@ config ARCH_IXP2000
416 depends on MMU 430 depends on MMU
417 select CPU_XSCALE 431 select CPU_XSCALE
418 select PCI 432 select PCI
433 select ARCH_USES_GETTIMEOFFSET
419 help 434 help
420 Support for Intel's IXP2400/2800 (XScale) family of processors. 435 Support for Intel's IXP2400/2800 (XScale) family of processors.
421 436
@@ -434,6 +449,7 @@ config ARCH_L7200
434 bool "LinkUp-L7200" 449 bool "LinkUp-L7200"
435 select CPU_ARM720T 450 select CPU_ARM720T
436 select FIQ 451 select FIQ
452 select ARCH_USES_GETTIMEOFFSET
437 help 453 help
438 Say Y here if you intend to run this kernel on a LinkUp Systems 454 Say Y here if you intend to run this kernel on a LinkUp Systems
439 L7200 Software Development Board which uses an ARM720T processor. 455 L7200 Software Development Board which uses an ARM720T processor.
@@ -523,6 +539,7 @@ config ARCH_KS8695
523 select CPU_ARM922T 539 select CPU_ARM922T
524 select GENERIC_GPIO 540 select GENERIC_GPIO
525 select ARCH_REQUIRE_GPIOLIB 541 select ARCH_REQUIRE_GPIOLIB
542 select ARCH_USES_GETTIMEOFFSET
526 help 543 help
527 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based 544 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
528 System-on-Chip devices. 545 System-on-Chip devices.
@@ -569,6 +586,7 @@ config ARCH_PNX4008
569 bool "Philips Nexperia PNX4008 Mobile" 586 bool "Philips Nexperia PNX4008 Mobile"
570 select CPU_ARM926T 587 select CPU_ARM926T
571 select COMMON_CLKDEV 588 select COMMON_CLKDEV
589 select ARCH_USES_GETTIMEOFFSET
572 help 590 help
573 This enables support for Philips PNX4008 mobile platform. 591 This enables support for Philips PNX4008 mobile platform.
574 592
@@ -613,6 +631,7 @@ config ARCH_RPC
613 select ISA_DMA_API 631 select ISA_DMA_API
614 select NO_IOPORT 632 select NO_IOPORT
615 select ARCH_SPARSEMEM_ENABLE 633 select ARCH_SPARSEMEM_ENABLE
634 select ARCH_USES_GETTIMEOFFSET
616 help 635 help
617 On the Acorn Risc-PC, Linux can support the internal IDE disk and 636 On the Acorn Risc-PC, Linux can support the internal IDE disk and
618 CD-ROM interface, serial and parallel port, and the floppy drive. 637 CD-ROM interface, serial and parallel port, and the floppy drive.
@@ -639,6 +658,7 @@ config ARCH_S3C2410
639 select GENERIC_GPIO 658 select GENERIC_GPIO
640 select ARCH_HAS_CPUFREQ 659 select ARCH_HAS_CPUFREQ
641 select HAVE_CLK 660 select HAVE_CLK
661 select ARCH_USES_GETTIMEOFFSET
642 help 662 help
643 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 663 Samsung S3C2410X CPU based systems, such as the Simtec Electronics
644 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 664 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
@@ -652,6 +672,7 @@ config ARCH_S3C64XX
652 select ARM_VIC 672 select ARM_VIC
653 select HAVE_CLK 673 select HAVE_CLK
654 select NO_IOPORT 674 select NO_IOPORT
675 select ARCH_USES_GETTIMEOFFSET
655 select ARCH_HAS_CPUFREQ 676 select ARCH_HAS_CPUFREQ
656 select ARCH_REQUIRE_GPIOLIB 677 select ARCH_REQUIRE_GPIOLIB
657 select SAMSUNG_CLKSRC 678 select SAMSUNG_CLKSRC
@@ -708,6 +729,7 @@ config ARCH_SHARK
708 select ISA_DMA 729 select ISA_DMA
709 select ZONE_DMA 730 select ZONE_DMA
710 select PCI 731 select PCI
732 select ARCH_USES_GETTIMEOFFSET
711 help 733 help
712 Support for the StrongARM based Digital DNARD machine, also known 734 Support for the StrongARM based Digital DNARD machine, also known
713 as "Shark" (<http://www.shark-linux.de/shark.html>). 735 as "Shark" (<http://www.shark-linux.de/shark.html>).
@@ -717,6 +739,7 @@ config ARCH_LH7A40X
717 select CPU_ARM922T 739 select CPU_ARM922T
718 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM 740 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
719 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 741 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
742 select ARCH_USES_GETTIMEOFFSET
720 help 743 help
721 Say Y here for systems based on one of the Sharp LH7A40X 744 Say Y here for systems based on one of the Sharp LH7A40X
722 System on a Chip processors. These CPUs include an ARM922T 745 System on a Chip processors. These CPUs include an ARM922T
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index 8bffc3ff3acf..35d408f6dccf 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -38,7 +38,7 @@ struct sys_timer {
38 void (*init)(void); 38 void (*init)(void);
39 void (*suspend)(void); 39 void (*suspend)(void);
40 void (*resume)(void); 40 void (*resume)(void);
41#ifndef CONFIG_GENERIC_TIME 41#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
42 unsigned long (*offset)(void); 42 unsigned long (*offset)(void);
43#endif 43#endif
44}; 44};
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 28753805d2d1..38c261f9951c 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -72,12 +72,15 @@ unsigned long profile_pc(struct pt_regs *regs)
72EXPORT_SYMBOL(profile_pc); 72EXPORT_SYMBOL(profile_pc);
73#endif 73#endif
74 74
75#ifndef CONFIG_GENERIC_TIME 75#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
76static unsigned long dummy_gettimeoffset(void) 76u32 arch_gettimeoffset(void)
77{ 77{
78 if (system_timer->offset != NULL)
79 return system_timer->offset() * 1000;
80
78 return 0; 81 return 0;
79} 82}
80#endif 83#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
81 84
82#ifdef CONFIG_LEDS_TIMER 85#ifdef CONFIG_LEDS_TIMER
83static inline void do_leds(void) 86static inline void do_leds(void)
@@ -93,63 +96,6 @@ static inline void do_leds(void)
93#define do_leds() 96#define do_leds()
94#endif 97#endif
95 98
96#ifndef CONFIG_GENERIC_TIME
97void do_gettimeofday(struct timeval *tv)
98{
99 unsigned long flags;
100 unsigned long seq;
101 unsigned long usec, sec;
102
103 do {
104 seq = read_seqbegin_irqsave(&xtime_lock, flags);
105 usec = system_timer->offset();
106 sec = xtime.tv_sec;
107 usec += xtime.tv_nsec / 1000;
108 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
109
110 /* usec may have gone up a lot: be safe */
111 while (usec >= 1000000) {
112 usec -= 1000000;
113 sec++;
114 }
115
116 tv->tv_sec = sec;
117 tv->tv_usec = usec;
118}
119
120EXPORT_SYMBOL(do_gettimeofday);
121
122int do_settimeofday(struct timespec *tv)
123{
124 time_t wtm_sec, sec = tv->tv_sec;
125 long wtm_nsec, nsec = tv->tv_nsec;
126
127 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
128 return -EINVAL;
129
130 write_seqlock_irq(&xtime_lock);
131 /*
132 * This is revolting. We need to set "xtime" correctly. However, the
133 * value in this location is the value at the most recent update of
134 * wall time. Discover what correction gettimeofday() would have
135 * done, and then undo it!
136 */
137 nsec -= system_timer->offset() * NSEC_PER_USEC;
138
139 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
140 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
141
142 set_normalized_timespec(&xtime, sec, nsec);
143 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
144
145 ntp_clear();
146 write_sequnlock_irq(&xtime_lock);
147 clock_was_set();
148 return 0;
149}
150
151EXPORT_SYMBOL(do_settimeofday);
152#endif /* !CONFIG_GENERIC_TIME */
153 99
154#ifndef CONFIG_GENERIC_CLOCKEVENTS 100#ifndef CONFIG_GENERIC_CLOCKEVENTS
155/* 101/*
@@ -214,10 +160,6 @@ device_initcall(timer_init_sysfs);
214 160
215void __init time_init(void) 161void __init time_init(void)
216{ 162{
217#ifndef CONFIG_GENERIC_TIME
218 if (system_timer->offset == NULL)
219 system_timer->offset = dummy_gettimeoffset;
220#endif
221 system_timer->init(); 163 system_timer->init();
222} 164}
223 165
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 2db43a5ddd9b..8a5e8e9fe448 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -97,6 +97,7 @@ config ARCH_AT572D940HF
97 97
98config ARCH_AT91X40 98config ARCH_AT91X40
99 bool "AT91x40" 99 bool "AT91x40"
100 select ARCH_USES_GETTIMEOFFSET
100 101
101endchoice 102endchoice
102 103