blob: fca9b1e78a63bcffa3969a11422b8c3c84264b0f [file] [log] [blame]
Paul Mundt36ddf312006-01-16 22:14:17 -08001/*
2 * arch/sh/kernel/cpu/clock.c - SuperH clock framework
3 *
Paul Mundtb1f6cfe2009-05-12 04:27:43 +09004 * Copyright (C) 2005 - 2009 Paul Mundt
Paul Mundt36ddf312006-01-16 22:14:17 -08005 *
6 * This clock framework is derived from the OMAP version by:
7 *
Paul Mundtb1f6cfe2009-05-12 04:27:43 +09008 * Copyright (C) 2004 - 2008 Nokia Corporation
Paul Mundt36ddf312006-01-16 22:14:17 -08009 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
10 *
Paul Mundt1d118562006-12-01 13:15:14 +090011 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
12 *
Paul Mundt36ddf312006-01-16 22:14:17 -080013 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#include <linux/kernel.h>
18#include <linux/init.h>
Paul Mundt51a50062010-03-08 21:45:19 +090019#include <linux/clk.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080020#include <asm/clock.h>
Paul Mundt253b0882009-05-13 17:38:11 +090021#include <asm/machvec.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080022
Paul Mundt36ddf312006-01-16 22:14:17 -080023int __init clk_init(void)
24{
Paul Mundt253b0882009-05-13 17:38:11 +090025 int ret;
Paul Mundt36ddf312006-01-16 22:14:17 -080026
Rich Felker15f0c8f2016-07-31 03:11:30 +000027#ifndef CONFIG_COMMON_CLK
Paul Mundt253b0882009-05-13 17:38:11 +090028 ret = arch_clk_init();
29 if (unlikely(ret)) {
30 pr_err("%s: CPU clock registration failed.\n", __func__);
31 return ret;
Paul Mundt36ddf312006-01-16 22:14:17 -080032 }
Rich Felker15f0c8f2016-07-31 03:11:30 +000033#endif
Paul Mundt36ddf312006-01-16 22:14:17 -080034
Paul Mundt253b0882009-05-13 17:38:11 +090035 if (sh_mv.mv_clk_init) {
36 ret = sh_mv.mv_clk_init();
37 if (unlikely(ret)) {
38 pr_err("%s: machvec clock initialization failed.\n",
39 __func__);
40 return ret;
41 }
42 }
dmitry pervushindfbbbe92007-05-15 08:42:22 +090043
Rich Felker15f0c8f2016-07-31 03:11:30 +000044#ifndef CONFIG_COMMON_CLK
Paul Mundt36ddf312006-01-16 22:14:17 -080045 /* Kick the child clocks.. */
Paul Mundtb1f6cfe2009-05-12 04:27:43 +090046 recalculate_root_clocks();
Paul Mundt36ddf312006-01-16 22:14:17 -080047
Paul Mundt4ff29ff2009-05-12 05:14:53 +090048 /* Enable the necessary init clocks */
49 clk_enable_init_clocks();
Rich Felker15f0c8f2016-07-31 03:11:30 +000050#endif
Paul Mundt4ff29ff2009-05-12 05:14:53 +090051
Paul Mundt36ddf312006-01-16 22:14:17 -080052 return ret;
53}
54
Paul Mundtcedcf332009-05-13 21:51:28 +090055