aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/acpi_pm.c24
-rw-r--r--drivers/clocksource/clksrc-dbx500-prcmu.c5
-rw-r--r--drivers/clocksource/cs5535-clockevt.c3
-rw-r--r--drivers/clocksource/cyclone.c2
-rw-r--r--drivers/clocksource/scx200_hrt.c24
5 files changed, 27 insertions, 31 deletions
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 6b5cf02c35c8..82e882028fcf 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/async.h>
26#include <asm/io.h> 27#include <asm/io.h>
27 28
28/* 29/*
@@ -179,17 +180,15 @@ static int verify_pmtmr_rate(void)
179/* Number of reads we try to get two different values */ 180/* Number of reads we try to get two different values */
180#define ACPI_PM_READ_CHECKS 10000 181#define ACPI_PM_READ_CHECKS 10000
181 182
182static int __init init_acpi_pm_clocksource(void) 183static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie)
183{ 184{
184 cycle_t value1, value2; 185 cycle_t value1, value2;
185 unsigned int i, j = 0; 186 unsigned int i, j = 0;
186 187
187 if (!pmtmr_ioport)
188 return -ENODEV;
189 188
190 /* "verify" this timing source: */ 189 /* "verify" this timing source: */
191 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { 190 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
192 udelay(100 * j); 191 usleep_range(100 * j, 100 * j + 100);
193 value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); 192 value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
194 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { 193 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
195 value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); 194 value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
@@ -203,25 +202,34 @@ static int __init init_acpi_pm_clocksource(void)
203 " 0x%#llx, 0x%#llx - aborting.\n", 202 " 0x%#llx, 0x%#llx - aborting.\n",
204 value1, value2); 203 value1, value2);
205 pmtmr_ioport = 0; 204 pmtmr_ioport = 0;
206 return -EINVAL; 205 return;
207 } 206 }
208 if (i == ACPI_PM_READ_CHECKS) { 207 if (i == ACPI_PM_READ_CHECKS) {
209 printk(KERN_INFO "PM-Timer failed consistency check " 208 printk(KERN_INFO "PM-Timer failed consistency check "
210 " (0x%#llx) - aborting.\n", value1); 209 " (0x%#llx) - aborting.\n", value1);
211 pmtmr_ioport = 0; 210 pmtmr_ioport = 0;
212 return -ENODEV; 211 return;
213 } 212 }
214 } 213 }
215 214
216 if (verify_pmtmr_rate() != 0){ 215 if (verify_pmtmr_rate() != 0){
217 pmtmr_ioport = 0; 216 pmtmr_ioport = 0;
218 return -ENODEV; 217 return;
219 } 218 }
220 219
221 return clocksource_register_hz(&clocksource_acpi_pm, 220 clocksource_register_hz(&clocksource_acpi_pm,
222 PMTMR_TICKS_PER_SEC); 221 PMTMR_TICKS_PER_SEC);
223} 222}
224 223
224static int __init init_acpi_pm_clocksource(void)
225{
226 if (!pmtmr_ioport)
227 return -ENODEV;
228
229 async_schedule(acpi_pm_clocksource_async, NULL);
230 return 0;
231}
232
225/* We use fs_initcall because we want the PCI fixups to have run 233/* We use fs_initcall because we want the PCI fixups to have run
226 * but we still need to load before device_initcall 234 * but we still need to load before device_initcall
227 */ 235 */
diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c
index fb6b6d28b60e..c26c369eb9e6 100644
--- a/drivers/clocksource/clksrc-dbx500-prcmu.c
+++ b/drivers/clocksource/clksrc-dbx500-prcmu.c
@@ -52,7 +52,6 @@ static struct clocksource clocksource_dbx500_prcmu = {
52 .name = "dbx500-prcmu-timer", 52 .name = "dbx500-prcmu-timer",
53 .rating = 300, 53 .rating = 300,
54 .read = clksrc_dbx500_prcmu_read, 54 .read = clksrc_dbx500_prcmu_read,
55 .shift = 10,
56 .mask = CLOCKSOURCE_MASK(32), 55 .mask = CLOCKSOURCE_MASK(32),
57 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 56 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
58}; 57};
@@ -90,7 +89,5 @@ void __init clksrc_dbx500_prcmu_init(void __iomem *base)
90 setup_sched_clock(dbx500_prcmu_sched_clock_read, 89 setup_sched_clock(dbx500_prcmu_sched_clock_read,
91 32, RATE_32K); 90 32, RATE_32K);
92#endif 91#endif
93 clocksource_calc_mult_shift(&clocksource_dbx500_prcmu, 92 clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K);
94 RATE_32K, SCHED_CLOCK_MIN_WRAP);
95 clocksource_register(&clocksource_dbx500_prcmu);
96} 93}
diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c
index b7dab32ce63c..540795cd0760 100644
--- a/drivers/clocksource/cs5535-clockevt.c
+++ b/drivers/clocksource/cs5535-clockevt.c
@@ -100,7 +100,6 @@ static struct clock_event_device cs5535_clockevent = {
100 .set_mode = mfgpt_set_mode, 100 .set_mode = mfgpt_set_mode,
101 .set_next_event = mfgpt_next_event, 101 .set_next_event = mfgpt_next_event,
102 .rating = 250, 102 .rating = 250,
103 .cpumask = cpu_all_mask,
104 .shift = 32 103 .shift = 32
105}; 104};
106 105
@@ -133,7 +132,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
133 132
134static struct irqaction mfgptirq = { 133static struct irqaction mfgptirq = {
135 .handler = mfgpt_tick, 134 .handler = mfgpt_tick,
136 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER, 135 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER | IRQF_SHARED,
137 .name = DRV_NAME, 136 .name = DRV_NAME,
138}; 137};
139 138
diff --git a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c
index 72f811f73e9c..9e0998f22885 100644
--- a/drivers/clocksource/cyclone.c
+++ b/drivers/clocksource/cyclone.c
@@ -55,11 +55,11 @@ static int __init init_cyclone_clocksource(void)
55 } 55 }
56 /* even on 64bit systems, this is only 32bits: */ 56 /* even on 64bit systems, this is only 32bits: */
57 base = readl(reg); 57 base = readl(reg);
58 iounmap(reg);
58 if (!base) { 59 if (!base) {
59 printk(KERN_ERR "Summit chipset: Could not find valid CBAR value.\n"); 60 printk(KERN_ERR "Summit chipset: Could not find valid CBAR value.\n");
60 return -ENODEV; 61 return -ENODEV;
61 } 62 }
62 iounmap(reg);
63 63
64 /* setup PMCC: */ 64 /* setup PMCC: */
65 offset = base + CYCLONE_PMCC_OFFSET; 65 offset = base + CYCLONE_PMCC_OFFSET;
diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_hrt.c
index 27f4d9637b62..64f9e8294434 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;
@@ -71,7 +69,7 @@ static int __init init_hrt_clocksource(void)
71 if (!request_region(scx200_cb_base + SCx200_TIMER_OFFSET, 69 if (!request_region(scx200_cb_base + SCx200_TIMER_OFFSET,
72 SCx200_TIMER_SIZE, 70 SCx200_TIMER_SIZE,
73 "NatSemi SCx200 High-Resolution Timer")) { 71 "NatSemi SCx200 High-Resolution Timer")) {
74 printk(KERN_WARNING NAME ": unable to lock timer region\n"); 72 pr_warn("unable to lock timer region\n");
75 return -ENODEV; 73 return -ENODEV;
76 } 74 }
77 75
@@ -79,19 +77,13 @@ 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 { 84 pr_info("enabling scx200 high-res timer (%s MHz +%d ppm)\n", mhz27 ? "27":"1", ppm);
87 cs_hrt.shift = HRT_SHIFT_1;
88 cs_hrt.mult = clocksource_hz2mult(HRT_FREQ + ppm,
89 cs_hrt.shift);
90 }
91 printk(KERN_INFO "enabling scx200 high-res timer (%s MHz +%d ppm)\n",
92 mhz27 ? "27":"1", ppm);
93 85
94 return clocksource_register(&cs_hrt); 86 return clocksource_register_hz(&cs_hrt, freq);
95} 87}
96 88
97module_init(init_hrt_clocksource); 89module_init(init_hrt_clocksource);