aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/scx200_hrt.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2012-01-09 19:15:03 -0500
committerJohn Stultz <john.stultz@linaro.org>2012-02-01 21:37:40 -0500
commit12d6d41276def096cb3f7dc36f438db9ed6a0a8d (patch)
treec5e9a63bc8baf8a2bdc6ae2e6e6134e2a6be7fba /drivers/clocksource/scx200_hrt.c
parentc7f798e3722610d486e951f04bbc00b6ba124d62 (diff)
clocksource: scx200_hrt: Convert scx200 to use clocksource_register_hz
Converts the scx200 clocksource to using clocksource_register_hz. CC: Jim Cromie <jim.cromie@gmail.com> Tested-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/clocksource/scx200_hrt.c')
-rw-r--r--drivers/clocksource/scx200_hrt.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_hrt.c
index e4e4a04ab23f..60db8b1492f1 100644
--- a/drivers/clocksource/scx200_hrt.c
+++ b/drivers/clocksource/scx200_hrt.c
@@ -49,9 +49,6 @@ static cycle_t read_hrt(struct clocksource *cs)
49 return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET); 49 return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
50} 50}
51 51
52#define HRT_SHIFT_1 22
53#define HRT_SHIFT_27 26
54
55static struct clocksource cs_hrt = { 52static struct clocksource cs_hrt = {
56 .name = "scx200_hrt", 53 .name = "scx200_hrt",
57 .rating = 250, 54 .rating = 250,
@@ -63,6 +60,7 @@ static struct clocksource cs_hrt = {
63 60
64static int __init init_hrt_clocksource(void) 61static int __init init_hrt_clocksource(void)
65{ 62{
63 u32 freq;
66 /* Make sure scx200 has initialized the configuration block */ 64 /* Make sure scx200 has initialized the configuration block */
67 if (!scx200_cb_present()) 65 if (!scx200_cb_present())
68 return -ENODEV; 66 return -ENODEV;
@@ -79,19 +77,15 @@ static int __init init_hrt_clocksource(void)
79 outb(HR_TMEN | (mhz27 ? HR_TMCLKSEL : 0), 77 outb(HR_TMEN | (mhz27 ? HR_TMCLKSEL : 0),
80 scx200_cb_base + SCx200_TMCNFG_OFFSET); 78 scx200_cb_base + SCx200_TMCNFG_OFFSET);
81 79
82 if (mhz27) { 80 freq = (HRT_FREQ + ppm);
83 cs_hrt.shift = HRT_SHIFT_27; 81 if (mhz27)
84 cs_hrt.mult = clocksource_hz2mult((HRT_FREQ + ppm) * 27, 82 freq *= 27;
85 cs_hrt.shift); 83
86 } else {
87 cs_hrt.shift = HRT_SHIFT_1;
88 cs_hrt.mult = clocksource_hz2mult(HRT_FREQ + ppm,
89 cs_hrt.shift);
90 }
91 pr_info("enabling scx200 high-res timer (%s MHz +%d ppm)\n", 84 pr_info("enabling scx200 high-res timer (%s MHz +%d ppm)\n",
85 printk(KERN_INFO "enabling scx200 high-res timer (%s MHz +%d ppm)\n",
92 mhz27 ? "27":"1", ppm); 86 mhz27 ? "27":"1", ppm);
93 87
94 return clocksource_register(&cs_hrt); 88 return clocksource_register_hz(&cs_hrt, freq);
95} 89}
96 90
97module_init(init_hrt_clocksource); 91module_init(init_hrt_clocksource);