// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2006 Jim Cromie * * This is a clocksource driver for the Geode SCx200's 1 or 27 MHz * high-resolution timer. The Geode SC-1100 (at least) has a buggy * time stamp counter (TSC), which loses time unless 'idle=poll' is * given as a boot-arg. In its absence, the Generic Timekeeping code * will detect and de-rate the bad TSC, allowing this timer to take * over timekeeping duties. * * Based on work by John Stultz, and Ted Phelps (in a 2.6.12-rc6 patch)
*/
/* The base timer frequency, * 27 if selected */ #define HRT_FREQ 1000000
static u64 read_hrt(struct clocksource *cs)
{ /* Read the timer value */ return (u64) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
}
staticstruct clocksource cs_hrt = {
.name = "scx200_hrt",
.rating = 250,
.read = read_hrt,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, /* mult, shift are set based on mhz27 flag */
};
staticint __init init_hrt_clocksource(void)
{
u32 freq; /* Make sure scx200 has initialized the configuration block */ if (!scx200_cb_present()) return -ENODEV;
/* Reserve the timer's ISA io-region for ourselves */ if (!request_region(scx200_cb_base + SCx200_TIMER_OFFSET,
SCx200_TIMER_SIZE, "NatSemi SCx200 High-Resolution Timer")) {
pr_warn("unable to lock timer region\n"); return -ENODEV;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.