blob: fe74b9179fec72f2d38a9f66bb9ea87ceab6ebf9 [file] [log] [blame]
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4210.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * EXYNOS4210 - Clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/kernel.h>
15#include <linux/err.h>
16#include <linux/clk.h>
17#include <linux/io.h>
18
19#include <plat/cpu-freq.h>
20#include <plat/clock.h>
21#include <plat/cpu.h>
22#include <plat/pll.h>
23#include <plat/s5p-clock.h>
24#include <plat/clock-clksrc.h>
25#include <plat/exynos4.h>
26
27#include <mach/hardware.h>
28#include <mach/map.h>
29#include <mach/regs-clock.h>
30#include <mach/exynos4-clock.h>
31
32static struct clksrc_clk *sysclks[] = {
33 /* nothing here yet */
34};
35
36static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
37{
38 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable);
39}
40
41static struct clksrc_clk clksrcs[] = {
42 {
43 .clk = {
44 .name = "sclk_sata",
45 .id = -1,
46 .enable = exynos4_clksrc_mask_fsys_ctrl,
47 .ctrlbit = (1 << 24),
48 },
49 .sources = &clkset_mout_corebus,
50 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 },
51 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 },
52 }, {
53 .clk = {
54 .name = "sclk_fimd",
55 .devname = "exynos4-fb.1",
56 .enable = exynos4_clksrc_mask_lcd1_ctrl,
57 .ctrlbit = (1 << 0),
58 },
59 .sources = &clkset_group,
60 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 },
61 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 },
62 },
63};
64
65static struct clk init_clocks_off[] = {
66 {
67 .name = "sataphy",
68 .id = -1,
69 .parent = &clk_aclk_133.clk,
70 .enable = exynos4_clk_ip_fsys_ctrl,
71 .ctrlbit = (1 << 3),
72 }, {
73 .name = "sata",
74 .id = -1,
75 .parent = &clk_aclk_133.clk,
76 .enable = exynos4_clk_ip_fsys_ctrl,
77 .ctrlbit = (1 << 10),
78 }, {
79 .name = "fimd",
80 .devname = "exynos4-fb.1",
81 .enable = exynos4_clk_ip_lcd1_ctrl,
82 .ctrlbit = (1 << 0),
83 },
84};
85
86void __init exynos4210_register_clocks(void)
87{
88 int ptr;
89
90 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_CPU;
91 clk_mout_mpll.reg_src.shift = 8;
92 clk_mout_mpll.reg_src.size = 1;
93
94 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
95 s3c_register_clksrc(sysclks[ptr], 1);
96
97 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
98
99 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
100 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
101}