xref: /openbmc/linux/arch/sh/kernel/time.c (revision 201e9109)
15933f6d2SKuninori Morimoto // SPDX-License-Identifier: GPL-2.0
2b179b72fSPaul Mundt /*
35ac54964SPaul Mundt  *  arch/sh/kernel/time.c
4b179b72fSPaul Mundt  *
5b179b72fSPaul Mundt  *  Copyright (C) 1999  Tetsuya Okada & Niibe Yutaka
6b179b72fSPaul Mundt  *  Copyright (C) 2000  Philipp Rumpf <prumpf@tux.org>
7b179b72fSPaul Mundt  *  Copyright (C) 2002 - 2009  Paul Mundt
8b179b72fSPaul Mundt  *  Copyright (C) 2002  M. R. Brown  <mrbrown@linux-sh.org>
9b179b72fSPaul Mundt  */
10b179b72fSPaul Mundt #include <linux/kernel.h>
11b179b72fSPaul Mundt #include <linux/init.h>
12b179b72fSPaul Mundt #include <linux/profile.h>
13b179b72fSPaul Mundt #include <linux/timex.h>
14b179b72fSPaul Mundt #include <linux/sched.h>
15b179b72fSPaul Mundt #include <linux/clockchips.h>
16b179b72fSPaul Mundt #include <linux/platform_device.h>
17b179b72fSPaul Mundt #include <linux/smp.h>
18b179b72fSPaul Mundt #include <linux/rtc.h>
19b179b72fSPaul Mundt #include <asm/clock.h>
20b179b72fSPaul Mundt #include <asm/rtc.h>
21507fd01dSBartosz Golaszewski #include <asm/platform_early.h>
22b179b72fSPaul Mundt 
sh_late_time_init(void)2382b24221SPaul Mundt static void __init sh_late_time_init(void)
24b179b72fSPaul Mundt {
251d29ebebSPaul Mundt 	/*
261d29ebebSPaul Mundt 	 * Make sure all compiled-in early timers register themselves.
276fe32a46SPaul Mundt 	 *
286fe32a46SPaul Mundt 	 * Run probe() for two "earlytimer" devices, these will be the
296fe32a46SPaul Mundt 	 * clockevents and clocksource devices respectively. In the event
306fe32a46SPaul Mundt 	 * that only a clockevents device is available, we -ENODEV on the
316fe32a46SPaul Mundt 	 * clocksource and the jiffies clocksource is used transparently
326fe32a46SPaul Mundt 	 * instead. No error handling is necessary here.
331d29ebebSPaul Mundt 	 */
34201e9109SBartosz Golaszewski 	sh_early_platform_driver_register_all("earlytimer");
35201e9109SBartosz Golaszewski 	sh_early_platform_driver_probe("earlytimer", 2, 0);
36b179b72fSPaul Mundt }
3782b24221SPaul Mundt 
time_init(void)38b179b72fSPaul Mundt void __init time_init(void)
39b179b72fSPaul Mundt {
4019f48591SArnd Bergmann 	timer_probe();
41b179b72fSPaul Mundt 
42b179b72fSPaul Mundt 	clk_init();
43b179b72fSPaul Mundt 
4482b24221SPaul Mundt 	late_time_init = sh_late_time_init;
45b179b72fSPaul Mundt }
46