diff options
Diffstat (limited to 'arch/x86/kernel/hpet_32.c')
-rw-r--r-- | arch/x86/kernel/hpet_32.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/x86/kernel/hpet_32.c b/arch/x86/kernel/hpet_32.c index 533d4932bc79..748abf0286d2 100644 --- a/arch/x86/kernel/hpet_32.c +++ b/arch/x86/kernel/hpet_32.c | |||
@@ -8,10 +8,9 @@ | |||
8 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
9 | 9 | ||
10 | #include <asm/hpet.h> | 10 | #include <asm/hpet.h> |
11 | #include <asm/i8253.h> | ||
11 | #include <asm/io.h> | 12 | #include <asm/io.h> |
12 | 13 | ||
13 | extern struct clock_event_device *global_clock_event; | ||
14 | |||
15 | #define HPET_MASK CLOCKSOURCE_MASK(32) | 14 | #define HPET_MASK CLOCKSOURCE_MASK(32) |
16 | #define HPET_SHIFT 22 | 15 | #define HPET_SHIFT 22 |
17 | 16 | ||
@@ -22,7 +21,7 @@ extern struct clock_event_device *global_clock_event; | |||
22 | * HPET address is set in acpi/boot.c, when an ACPI entry exists | 21 | * HPET address is set in acpi/boot.c, when an ACPI entry exists |
23 | */ | 22 | */ |
24 | unsigned long hpet_address; | 23 | unsigned long hpet_address; |
25 | static void __iomem * hpet_virt_address; | 24 | static void __iomem *hpet_virt_address; |
26 | 25 | ||
27 | static inline unsigned long hpet_readl(unsigned long a) | 26 | static inline unsigned long hpet_readl(unsigned long a) |
28 | { | 27 | { |
@@ -34,6 +33,17 @@ static inline void hpet_writel(unsigned long d, unsigned long a) | |||
34 | writel(d, hpet_virt_address + a); | 33 | writel(d, hpet_virt_address + a); |
35 | } | 34 | } |
36 | 35 | ||
36 | static inline void hpet_set_mapping(void) | ||
37 | { | ||
38 | hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE); | ||
39 | } | ||
40 | |||
41 | static inline void hpet_clear_mapping(void) | ||
42 | { | ||
43 | iounmap(hpet_virt_address); | ||
44 | hpet_virt_address = NULL; | ||
45 | } | ||
46 | |||
37 | /* | 47 | /* |
38 | * HPET command line enable / disable | 48 | * HPET command line enable / disable |
39 | */ | 49 | */ |
@@ -83,7 +93,7 @@ static void hpet_reserve_platform_timers(unsigned long id) | |||
83 | 93 | ||
84 | memset(&hd, 0, sizeof (hd)); | 94 | memset(&hd, 0, sizeof (hd)); |
85 | hd.hd_phys_address = hpet_address; | 95 | hd.hd_phys_address = hpet_address; |
86 | hd.hd_address = hpet_virt_address; | 96 | hd.hd_address = hpet; |
87 | hd.hd_nirqs = nrtimers; | 97 | hd.hd_nirqs = nrtimers; |
88 | hd.hd_flags = HPET_DATA_PLATFORM; | 98 | hd.hd_flags = HPET_DATA_PLATFORM; |
89 | hpet_reserve_timer(&hd, 0); | 99 | hpet_reserve_timer(&hd, 0); |
@@ -238,7 +248,7 @@ int __init hpet_enable(void) | |||
238 | if (!is_hpet_capable()) | 248 | if (!is_hpet_capable()) |
239 | return 0; | 249 | return 0; |
240 | 250 | ||
241 | hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE); | 251 | hpet_set_mapping(); |
242 | 252 | ||
243 | /* | 253 | /* |
244 | * Read the period and check for a sane value: | 254 | * Read the period and check for a sane value: |
@@ -334,13 +344,11 @@ int __init hpet_enable(void) | |||
334 | return 0; | 344 | return 0; |
335 | 345 | ||
336 | out_nohpet: | 346 | out_nohpet: |
337 | iounmap(hpet_virt_address); | 347 | hpet_clear_mapping(); |
338 | hpet_virt_address = NULL; | ||
339 | boot_hpet_disable = 1; | 348 | boot_hpet_disable = 1; |
340 | return 0; | 349 | return 0; |
341 | } | 350 | } |
342 | 351 | ||
343 | |||
344 | #ifdef CONFIG_HPET_EMULATE_RTC | 352 | #ifdef CONFIG_HPET_EMULATE_RTC |
345 | 353 | ||
346 | /* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET | 354 | /* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET |