xref: /kernel/linux/linux-5.10/arch/sh/kernel/time.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  arch/sh/kernel/time.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 1999  Tetsuya Okada & Niibe Yutaka
68c2ecf20Sopenharmony_ci *  Copyright (C) 2000  Philipp Rumpf <prumpf@tux.org>
78c2ecf20Sopenharmony_ci *  Copyright (C) 2002 - 2009  Paul Mundt
88c2ecf20Sopenharmony_ci *  Copyright (C) 2002  M. R. Brown  <mrbrown@linux-sh.org>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#include <linux/kernel.h>
118c2ecf20Sopenharmony_ci#include <linux/init.h>
128c2ecf20Sopenharmony_ci#include <linux/profile.h>
138c2ecf20Sopenharmony_ci#include <linux/timex.h>
148c2ecf20Sopenharmony_ci#include <linux/sched.h>
158c2ecf20Sopenharmony_ci#include <linux/clockchips.h>
168c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
178c2ecf20Sopenharmony_ci#include <linux/smp.h>
188c2ecf20Sopenharmony_ci#include <linux/rtc.h>
198c2ecf20Sopenharmony_ci#include <asm/clock.h>
208c2ecf20Sopenharmony_ci#include <asm/rtc.h>
218c2ecf20Sopenharmony_ci#include <asm/platform_early.h>
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic void __init sh_late_time_init(void)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	/*
268c2ecf20Sopenharmony_ci	 * Make sure all compiled-in early timers register themselves.
278c2ecf20Sopenharmony_ci	 *
288c2ecf20Sopenharmony_ci	 * Run probe() for two "earlytimer" devices, these will be the
298c2ecf20Sopenharmony_ci	 * clockevents and clocksource devices respectively. In the event
308c2ecf20Sopenharmony_ci	 * that only a clockevents device is available, we -ENODEV on the
318c2ecf20Sopenharmony_ci	 * clocksource and the jiffies clocksource is used transparently
328c2ecf20Sopenharmony_ci	 * instead. No error handling is necessary here.
338c2ecf20Sopenharmony_ci	 */
348c2ecf20Sopenharmony_ci	sh_early_platform_driver_register_all("earlytimer");
358c2ecf20Sopenharmony_ci	sh_early_platform_driver_probe("earlytimer", 2, 0);
368c2ecf20Sopenharmony_ci}
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_civoid __init time_init(void)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	timer_probe();
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	clk_init();
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	late_time_init = sh_late_time_init;
458c2ecf20Sopenharmony_ci}
46