if (!*base)
panic("Unable to map regs for %pOFn", np);
/* * Reset the timer if the reset control is available, wiping * out the state the firmware may have left it
*/
rstc = of_reset_control_get(np, NULL); if (!IS_ERR(rstc)) {
reset_control_assert(rstc);
reset_control_deassert(rstc);
}
/* * Not all implementations use a peripheral clock, so don't panic * if it's not present
*/
pclk = of_clk_get_by_name(np, "pclk"); if (!IS_ERR(pclk)) if (clk_prepare_enable(pclk))
pr_warn("pclk for %pOFn is present, but could not be activated\n",
np);
if (!of_property_read_u32(np, "clock-freq", rate) ||
!of_property_read_u32(np, "clock-frequency", rate)) return 0;
timer_clk = of_clk_get_by_name(np, "timer"); if (IS_ERR(timer_clk)) {
ret = PTR_ERR(timer_clk); goto out_pclk_disable;
}
ret = clk_prepare_enable(timer_clk); if (ret) goto out_timer_clk_put;
*rate = clk_get_rate(timer_clk); if (!(*rate)) {
ret = -EINVAL; goto out_timer_clk_disable;
}
/* * Fallback to use the clocksource as sched_clock if no separate * timer is found. sched_io_base then points to the current_value * register of the clocksource timer.
*/
sched_io_base = iobase + 0x04;
sched_rate = rate;
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.