/* * The Otto platform provides multiple 28 bit timers/counters with the following * operating logic. If enabled the timer counts up. Per timer one can set a * maximum counter value as an end marker. If end marker is reached the timer * fires an interrupt. If the timer "overflows" by reaching the end marker or * by adding 1 to 0x0fffffff the counter is reset to 0. When this happens and * the timer is in operating mode COUNTER it stops. In mode TIMER it will * continue to count up.
*/ #define RTTM_CTRL_COUNTER 0 #define RTTM_CTRL_TIMER BIT(24)
/* * Timers are derived from the LXB clock frequency. Usually this is a fixed * multiple of the 25 MHz oscillator. The 930X SOC is an exception from that. * Its LXB clock has only dividers and uses the switch PLL of 2.45 GHz as its * base. The only meaningful frequencies we can achieve from that are 175.000 * MHz and 153.125 MHz. The greatest common divisor of all explained possible * speeds is 3125000. Pin the timers to this 3.125 MHz reference frequency.
*/ #define RTTM_TICKS_PER_SEC 3125000
staticvoid rttm_bounce_timer(void __iomem *base, u32 mode)
{ /* * When a running timer has less than ~5us left, a stop/start sequence * might fail. While the details are unknown the most evident effect is * that the subsequent interrupt will not be fired. * * As a workaround issue an intermediate restart with a very slow * frequency of ~3kHz keeping the target counter (>=8). So the follow * up restart will always be issued outside the critical window.
*/
/* Use the first n timers as per CPU clock event generators */
for_each_possible_cpu(cpu) {
to = per_cpu_ptr(&rttm_to, cpu);
to->of_irq.index = to->of_base.index = cpu; if (timer_of_init(np, to)) {
pr_err("setup of timer %d failed\n", cpu); goto rollback;
}
rttm_setup_timer(to->of_base.base);
}
/* Activate the n'th + 1 timer as a stable CPU clocksource. */
to = &rttm_cs.to;
to->of_base.index = clkidx;
timer_of_init(np, to); if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) {
rttm_enable_clocksource(&rttm_cs.cs);
clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC);
sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC);
} else
pr_err(" setup of timer %d as clocksource failed", clkidx);
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.