aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/acpi_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/acpi_pm.c')
-rw-r--r--drivers/clocksource/acpi_pm.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 4eee533f3f4a..71d2ac4e3f46 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -178,11 +178,13 @@ static int verify_pmtmr_rate(void)
178 178
179/* Number of monotonicity checks to perform during initialization */ 179/* Number of monotonicity checks to perform during initialization */
180#define ACPI_PM_MONOTONICITY_CHECKS 10 180#define ACPI_PM_MONOTONICITY_CHECKS 10
181/* Number of reads we try to get two different values */
182#define ACPI_PM_READ_CHECKS 10000
181 183
182static int __init init_acpi_pm_clocksource(void) 184static int __init init_acpi_pm_clocksource(void)
183{ 185{
184 cycle_t value1, value2; 186 cycle_t value1, value2;
185 unsigned int i, j, good = 0; 187 unsigned int i, j = 0;
186 188
187 if (!pmtmr_ioport) 189 if (!pmtmr_ioport)
188 return -ENODEV; 190 return -ENODEV;
@@ -192,29 +194,26 @@ static int __init init_acpi_pm_clocksource(void)
192 194
193 /* "verify" this timing source: */ 195 /* "verify" this timing source: */
194 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { 196 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
197 udelay(100 * j);
195 value1 = clocksource_acpi_pm.read(); 198 value1 = clocksource_acpi_pm.read();
196 for (i = 0; i < 10000; i++) { 199 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
197 value2 = clocksource_acpi_pm.read(); 200 value2 = clocksource_acpi_pm.read();
198 if (value2 == value1) 201 if (value2 == value1)
199 continue; 202 continue;
200 if (value2 > value1) 203 if (value2 > value1)
201 good++;
202 break; 204 break;
203 if ((value2 < value1) && ((value2) < 0xFFF)) 205 if ((value2 < value1) && ((value2) < 0xFFF))
204 good++;
205 break; 206 break;
206 printk(KERN_INFO "PM-Timer had inconsistent results:" 207 printk(KERN_INFO "PM-Timer had inconsistent results:"
207 " 0x%#llx, 0x%#llx - aborting.\n", 208 " 0x%#llx, 0x%#llx - aborting.\n",
208 value1, value2); 209 value1, value2);
209 return -EINVAL; 210 return -EINVAL;
210 } 211 }
211 udelay(300 * i); 212 if (i == ACPI_PM_READ_CHECKS) {
212 } 213 printk(KERN_INFO "PM-Timer failed consistency check "
213 214 " (0x%#llx) - aborting.\n", value1);
214 if (good != ACPI_PM_MONOTONICITY_CHECKS) { 215 return -ENODEV;
215 printk(KERN_INFO "PM-Timer failed consistency check " 216 }
216 " (0x%#llx) - aborting.\n", value1);
217 return -ENODEV;
218 } 217 }
219 218
220 if (verify_pmtmr_rate() != 0) 219 if (verify_pmtmr_rate() != 0)