-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 30214 b: refs/heads/master c: 5d0cf41 h: refs/heads/master v: v3
- Loading branch information
john stultz
authored and
Linus Torvalds
committed
Jun 26, 2006
1 parent
85d6abc
commit 5a6593c
Showing
12 changed files
with
595 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 61743fe445213b87fb55a389c8d073785323ca3e | ||
refs/heads/master: 5d0cf410e94b1f1ff852c3f210d22cc6c5a27ffa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <linux/clocksource.h> | ||
#include <linux/errno.h> | ||
#include <linux/hpet.h> | ||
#include <linux/init.h> | ||
|
||
#include <asm/hpet.h> | ||
#include <asm/io.h> | ||
|
||
#define HPET_MASK 0xFFFFFFFF | ||
#define HPET_SHIFT 22 | ||
|
||
/* FSEC = 10^-15 NSEC = 10^-9 */ | ||
#define FSEC_PER_NSEC 1000000 | ||
|
||
static void *hpet_ptr; | ||
|
||
static cycle_t read_hpet(void) | ||
{ | ||
return (cycle_t)readl(hpet_ptr); | ||
} | ||
|
||
static struct clocksource clocksource_hpet = { | ||
.name = "hpet", | ||
.rating = 250, | ||
.read = read_hpet, | ||
.mask = (cycle_t)HPET_MASK, | ||
.mult = 0, /* set below */ | ||
.shift = HPET_SHIFT, | ||
.is_continuous = 1, | ||
}; | ||
|
||
static int __init init_hpet_clocksource(void) | ||
{ | ||
unsigned long hpet_period; | ||
void __iomem* hpet_base; | ||
u64 tmp; | ||
|
||
if (!hpet_address) | ||
return -ENODEV; | ||
|
||
/* calculate the hpet address: */ | ||
hpet_base = | ||
(void __iomem*)ioremap_nocache(hpet_address, HPET_MMAP_SIZE); | ||
hpet_ptr = hpet_base + HPET_COUNTER; | ||
|
||
/* calculate the frequency: */ | ||
hpet_period = readl(hpet_base + HPET_PERIOD); | ||
|
||
/* | ||
* hpet period is in femto seconds per cycle | ||
* so we need to convert this to ns/cyc units | ||
* aproximated by mult/2^shift | ||
* | ||
* fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift | ||
* fsec/cyc * 1ns/1000000fsec * 2^shift = mult | ||
* fsec/cyc * 2^shift * 1nsec/1000000fsec = mult | ||
* (fsec/cyc << shift)/1000000 = mult | ||
* (hpet_period << shift)/FSEC_PER_NSEC = mult | ||
*/ | ||
tmp = (u64)hpet_period << HPET_SHIFT; | ||
do_div(tmp, FSEC_PER_NSEC); | ||
clocksource_hpet.mult = (u32)tmp; | ||
|
||
return register_clocksource(&clocksource_hpet); | ||
} | ||
|
||
module_init(init_hpet_clocksource); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o | ||
obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o |
Oops, something went wrong.