]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/arm64/kernel/time.c
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234
[mirror_ubuntu-jammy-kernel.git] / arch / arm64 / kernel / time.c
CommitLineData
caab277b 1// SPDX-License-Identifier: GPL-2.0-only
985c0679
MZ
2/*
3 * Based on arch/arm/kernel/time.c
4 *
5 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
6 * Modifications for ARM (C) 1994-2001 Russell King
7 * Copyright (C) 2012 ARM Ltd.
985c0679
MZ
8 */
9
9358d755 10#include <linux/clockchips.h>
985c0679
MZ
11#include <linux/export.h>
12#include <linux/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/time.h>
15#include <linux/init.h>
16#include <linux/sched.h>
17#include <linux/smp.h>
18#include <linux/timex.h>
19#include <linux/errno.h>
20#include <linux/profile.h>
21#include <linux/syscore_ops.h>
22#include <linux/timer.h>
23#include <linux/irq.h>
1aee5d7a 24#include <linux/delay.h>
0583fe47 25#include <linux/clocksource.h>
bc3ee18a 26#include <linux/clk-provider.h>
b09ca1ec 27#include <linux/acpi.h>
985c0679 28
1aee5d7a 29#include <clocksource/arm_arch_timer.h>
985c0679
MZ
30
31#include <asm/thread_info.h>
32#include <asm/stacktrace.h>
33
985c0679
MZ
34unsigned long profile_pc(struct pt_regs *regs)
35{
36 struct stackframe frame;
37
38 if (!in_lock_functions(regs->pc))
39 return regs->pc;
40
41 frame.fp = regs->regs[29];
985c0679 42 frame.pc = regs->pc;
20380bb3 43#ifdef CONFIG_FUNCTION_GRAPH_TRACER
a448276c 44 frame.graph = 0;
20380bb3 45#endif
985c0679 46 do {
fe13f95b 47 int ret = unwind_frame(NULL, &frame);
985c0679
MZ
48 if (ret < 0)
49 return 0;
50 } while (in_lock_functions(frame.pc));
51
52 return frame.pc;
53}
54EXPORT_SYMBOL(profile_pc);
985c0679
MZ
55
56void __init time_init(void)
57{
1aee5d7a
MR
58 u32 arch_timer_rate;
59
bc3ee18a 60 of_clk_init(NULL);
ba5d08c0 61 timer_probe();
1aee5d7a 62
9358d755
LP
63 tick_setup_hrtimer_broadcast();
64
1aee5d7a 65 arch_timer_rate = arch_timer_get_rate();
0583fe47
RH
66 if (!arch_timer_rate)
67 panic("Unable to initialise architected timer.\n");
1aee5d7a 68
1aee5d7a
MR
69 /* Calibrate the delay loop directly */
70 lpj_fine = arch_timer_rate / HZ;
985c0679 71}