Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * arch/sh/kernel/cpu/clock.c - SuperH clock framework |
| 3 | * |
Paul Mundt | b1f6cfe | 2009-05-12 04:27:43 +0900 | [diff] [blame] | 4 | * Copyright (C) 2005 - 2009 Paul Mundt |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 5 | * |
| 6 | * This clock framework is derived from the OMAP version by: |
| 7 | * |
Paul Mundt | b1f6cfe | 2009-05-12 04:27:43 +0900 | [diff] [blame] | 8 | * Copyright (C) 2004 - 2008 Nokia Corporation |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 9 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> |
| 10 | * |
Paul Mundt | 1d11856 | 2006-12-01 13:15:14 +0900 | [diff] [blame] | 11 | * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com> |
| 12 | * |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 13 | * 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 Mundt | 51a5006 | 2010-03-08 21:45:19 +0900 | [diff] [blame] | 19 | #include <linux/clk.h> |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 20 | #include <asm/clock.h> |
Paul Mundt | 253b088 | 2009-05-13 17:38:11 +0900 | [diff] [blame] | 21 | #include <asm/machvec.h> |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 22 | |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 23 | int __init clk_init(void) |
| 24 | { |
Paul Mundt | 253b088 | 2009-05-13 17:38:11 +0900 | [diff] [blame] | 25 | int ret; |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 26 | |
Rich Felker | 15f0c8f | 2016-07-31 03:11:30 +0000 | [diff] [blame] | 27 | #ifndef CONFIG_COMMON_CLK |
Paul Mundt | 253b088 | 2009-05-13 17:38:11 +0900 | [diff] [blame] | 28 | ret = arch_clk_init(); |
| 29 | if (unlikely(ret)) { |
| 30 | pr_err("%s: CPU clock registration failed.\n", __func__); |
| 31 | return ret; |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 32 | } |
Rich Felker | 15f0c8f | 2016-07-31 03:11:30 +0000 | [diff] [blame] | 33 | #endif |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 34 | |
Paul Mundt | 253b088 | 2009-05-13 17:38:11 +0900 | [diff] [blame] | 35 | 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 pervushin | dfbbbe9 | 2007-05-15 08:42:22 +0900 | [diff] [blame] | 43 | |
Rich Felker | 15f0c8f | 2016-07-31 03:11:30 +0000 | [diff] [blame] | 44 | #ifndef CONFIG_COMMON_CLK |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 45 | /* Kick the child clocks.. */ |
Paul Mundt | b1f6cfe | 2009-05-12 04:27:43 +0900 | [diff] [blame] | 46 | recalculate_root_clocks(); |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 47 | |
Paul Mundt | 4ff29ff | 2009-05-12 05:14:53 +0900 | [diff] [blame] | 48 | /* Enable the necessary init clocks */ |
| 49 | clk_enable_init_clocks(); |
Rich Felker | 15f0c8f | 2016-07-31 03:11:30 +0000 | [diff] [blame] | 50 | #endif |
Paul Mundt | 4ff29ff | 2009-05-12 05:14:53 +0900 | [diff] [blame] | 51 | |
Paul Mundt | 36ddf31 | 2006-01-16 22:14:17 -0800 | [diff] [blame] | 52 | return ret; |
| 53 | } |
| 54 | |
Paul Mundt | cedcf33 | 2009-05-13 21:51:28 +0900 | [diff] [blame] | 55 | |