blob: 821a09cbd6054f6d089d6f3062531b7325a7135d [file] [log] [blame]
Kuninori Morimoto5933f6d2018-12-28 00:32:24 -08001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Paul Mundt5ac54962009-05-08 16:44:00 +09003 * arch/sh/kernel/time.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
6 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
Paul Mundt42786002009-04-28 23:12:10 +09007 * Copyright (C) 2002 - 2009 Paul Mundt
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/profile.h>
Paul Mundt65e5d902006-12-06 11:24:48 +090013#include <linux/timex.h>
14#include <linux/sched.h>
Paul Mundt57be2b42007-05-09 17:33:24 +090015#include <linux/clockchips.h>
Magnus Dammeaab8912009-04-15 10:50:12 +000016#include <linux/platform_device.h>
Paul Mundt8c245942008-08-06 18:37:07 +090017#include <linux/smp.h>
Paul Mundt47c8a082009-04-27 17:34:39 +090018#include <linux/rtc.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080019#include <asm/clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/rtc.h>
Bartosz Golaszewski507fd012019-10-03 11:29:12 +020021#include <asm/platform_early.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080022
Paul Mundt82b24222009-07-29 22:43:58 +090023static void __init sh_late_time_init(void)
Magnus Damm8e0b8422009-04-28 08:19:50 +000024{
Paul Mundt1d29ebe2009-06-14 19:45:40 +090025 /*
26 * Make sure all compiled-in early timers register themselves.
Paul Mundt6fe32a42009-06-14 20:02:30 +090027 *
28 * Run probe() for two "earlytimer" devices, these will be the
29 * clockevents and clocksource devices respectively. In the event
30 * that only a clockevents device is available, we -ENODEV on the
31 * clocksource and the jiffies clocksource is used transparently
32 * instead. No error handling is necessary here.
Paul Mundt1d29ebe2009-06-14 19:45:40 +090033 */
Bartosz Golaszewski201e9102019-10-03 11:29:13 +020034 sh_early_platform_driver_register_all("earlytimer");
35 sh_early_platform_driver_probe("earlytimer", 2, 0);
Magnus Damm8e0b8422009-04-28 08:19:50 +000036}
Paul Mundt82b24222009-07-29 22:43:58 +090037
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090038void __init time_init(void)
39{
Arnd Bergmann19f48592018-04-20 17:46:39 +020040 timer_probe();
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090041
42 clk_init();
43
Paul Mundt82b24222009-07-29 22:43:58 +090044 late_time_init = sh_late_time_init;
Magnus Damm8e0b8422009-04-28 08:19:50 +000045}