// SPDX-License-Identifier: GPL-2.0-only /* * Time related functions for Hexagon architecture * * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
*/
/* * For the clocksource we need: * pcycle frequency (600MHz) * For the loops_per_jiffy we need: * thread/cpu frequency (100MHz) * And for the timer, we need: * sleep clock rate
*/
/* * 8x50 HDD Specs 5-8. Simulator co-sim not fixed until * release 1.1, and then it's "adjustable" and probably not defaulted.
*/ #define RTOS_TIMER_INT 3 #define RTOS_TIMER_REGS_ADDR 0xAB000000UL
/* A lot of this stuff should move into a platform specific section. */ struct adsp_hw_timer_struct {
u32 match; /* Match value */
u32 count;
u32 enable; /* [1] - CLR_ON_MATCH_EN, [0] - EN */
u32 clear; /* one-shot register that clears the count */
};
/* Look for "TCX0" for related constants. */ static __iomem struct adsp_hw_timer_struct *rtos_timer;
/* Called from smp.c for each CPU's timer ipi call */ void ipi_timer(void)
{ int cpu = smp_processor_id(); struct clock_event_device *ce_dev = &per_cpu(clock_events, cpu);
/* * time_init_deferred - called by start_kernel to set up timer/clock source * * Install the IRQ handler for the clock, setup timers. * This is done late, as that way, we can use ioremap(). * * This runs just before the delay loop is calibrated, and * is used for delay calibration.
*/ staticvoid __init time_init_deferred(void)
{ struct resource *resource = NULL; struct clock_event_device *ce_dev = &hexagon_clockevent_dev; unsignedlong flag = IRQF_TIMER | IRQF_TRIGGER_RISING;
ce_dev->cpumask = cpu_all_mask;
resource = rtos_timer_device.resource;
/* ioremap here means this has to run later, after paging init */
rtos_timer = ioremap(resource->start, resource_size(resource));
if (!rtos_timer) {
release_mem_region(resource->start, resource_size(resource));
}
clocksource_register_khz(&hexagon_clocksource, pcycle_freq_mhz * 1000);
/* Note: the sim generic RTOS clock is apparently really 18750Hz */
/* * Last arg is some guaranteed seconds for which the conversion will * work without overflow.
*/
clockevents_calc_mult_shift(ce_dev, sleep_clk_freq, 4);
while ((__vmgettime() - start) < cycles)
cpu_relax();
}
EXPORT_SYMBOL(__delay);
/* * This could become parametric or perhaps even computed at run-time, * but for now we take the observed simulator jitter.
*/ staticlonglong fudgefactor = 350; /* Maybe lower if kernel optimized. */
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.