// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2020 Western Digital Corporation or its affiliates. * * Most of the M-mode (i.e. NoMMU) RISC-V systems usually have a * CLINT MMIO timer device.
*/
staticint clint_timer_dying_cpu(unsignedint cpu)
{
disable_percpu_irq(clint_timer_irq); /* * Don't disable IPI when CPU goes offline because * the masking/unmasking of virtual IPIs is done * via generic IPI-Mux
*/ return 0;
}
staticint __init clint_timer_init_dt(struct device_node *np)
{ int rc;
u32 i, nr_irqs; void __iomem *base; struct of_phandle_args oirq;
/* * Ensure that CLINT device interrupts are either RV_IRQ_TIMER or * RV_IRQ_SOFT. If it's anything else then we ignore the device.
*/
nr_irqs = of_irq_count(np); for (i = 0; i < nr_irqs; i++) { if (of_irq_parse_one(np, i, &oirq)) {
pr_err("%pOFP: failed to parse irq %d.\n", np, i); continue;
}
/* If CLINT ipi or timer irq not found then fail */ if (!clint_ipi_irq || !clint_timer_irq) {
pr_err("%pOFP: ipi/timer irq not found\n", np); return -ENODEV;
}
base = of_iomap(np, 0); if (!base) {
pr_err("%pOFP: could not map registers\n", np); return -ENODEV;
}
clint_ipi_base = base + CLINT_IPI_OFF;
clint_timer_cmp = base + CLINT_TIMER_CMP_OFF;
clint_timer_val = base + CLINT_TIMER_VAL_OFF;
clint_timer_freq = riscv_timebase;
#ifdef CONFIG_RISCV_M_MODE /* * Yes, that's an odd naming scheme. time_val is public, but hopefully * will die in favor of something cleaner.
*/
clint_time_val = clint_timer_val; #endif
pr_info("%pOFP: timer running at %ld Hz\n", np, clint_timer_freq);
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.