aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-03-15 17:07:57 -0400
committerArnd Bergmann <arnd@arndb.de>2012-03-15 17:07:57 -0400
commite7051e9dab77ddeaddbe12364939ae239d92ca73 (patch)
treeb1855cb663f64a374277df1a909cbac1ecf15fbf /arch/arm/mach-exynos
parent38abdcd0d0689aaca94e740ac67a952c7918caef (diff)
parent5da30bb6d902a36265e74f7141a904b19ec25bd4 (diff)
Merge branch 'samsung/exynos5' into next/soc2
Diffstat (limited to 'arch/arm/mach-exynos')
-rw-r--r--arch/arm/mach-exynos/Kconfig32
-rw-r--r--arch/arm/mach-exynos/Makefile8
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c1576
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.h30
-rw-r--r--arch/arm/mach-exynos/clock-exynos4210.c48
-rw-r--r--arch/arm/mach-exynos/clock-exynos4212.c32
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c1247
-rw-r--r--arch/arm/mach-exynos/clock.c1564
-rw-r--r--arch/arm/mach-exynos/common.c449
-rw-r--r--arch/arm/mach-exynos/common.h40
-rw-r--r--arch/arm/mach-exynos/dev-ahci.c4
-rw-r--r--arch/arm/mach-exynos/dev-audio.c4
-rw-r--r--arch/arm/mach-exynos/dev-uart.c78
-rw-r--r--arch/arm/mach-exynos/dma.c125
-rw-r--r--arch/arm/mach-exynos/include/mach/debug-macro.S9
-rw-r--r--arch/arm/mach-exynos/include/mach/exynos4-clock.h43
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h595
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h44
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h478
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-gpio.h20
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-pmu.h1
-rw-r--r--arch/arm/mach-exynos/include/mach/uncompress.h17
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c8
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c78
-rw-r--r--arch/arm/mach-exynos/mach-origen.c2
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c2
-rw-r--r--arch/arm/mach-exynos/mct.c23
-rw-r--r--arch/arm/mach-exynos/platsmp.c9
-rw-r--r--arch/arm/mach-exynos/pm.c40
-rw-r--r--arch/arm/mach-exynos/setup-i2c0.c9
30 files changed, 4429 insertions, 2186 deletions
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 5d602f68a0e8..42f072db1145 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -11,18 +11,19 @@ if ARCH_EXYNOS
11 11
12menu "SAMSUNG EXYNOS SoCs Support" 12menu "SAMSUNG EXYNOS SoCs Support"
13 13
14choice
15 prompt "EXYNOS System Type"
16 default ARCH_EXYNOS4
17
18config ARCH_EXYNOS4 14config ARCH_EXYNOS4
19 bool "SAMSUNG EXYNOS4" 15 bool "SAMSUNG EXYNOS4"
16 default y
20 select HAVE_SMP 17 select HAVE_SMP
21 select MIGHT_HAVE_CACHE_L2X0 18 select MIGHT_HAVE_CACHE_L2X0
22 help 19 help
23 Samsung EXYNOS4 SoCs based systems 20 Samsung EXYNOS4 SoCs based systems
24 21
25endchoice 22config ARCH_EXYNOS5
23 bool "SAMSUNG EXYNOS5"
24 select HAVE_SMP
25 help
26 Samsung EXYNOS5 (Cortex-A15) SoC based systems
26 27
27comment "EXYNOS SoCs" 28comment "EXYNOS SoCs"
28 29
@@ -41,6 +42,7 @@ config SOC_EXYNOS4212
41 bool "SAMSUNG EXYNOS4212" 42 bool "SAMSUNG EXYNOS4212"
42 default y 43 default y
43 depends on ARCH_EXYNOS4 44 depends on ARCH_EXYNOS4
45 select SAMSUNG_DMADEV
44 select S5P_PM if PM 46 select S5P_PM if PM
45 select S5P_SLEEP if PM 47 select S5P_SLEEP if PM
46 help 48 help
@@ -50,9 +52,17 @@ config SOC_EXYNOS4412
50 bool "SAMSUNG EXYNOS4412" 52 bool "SAMSUNG EXYNOS4412"
51 default y 53 default y
52 depends on ARCH_EXYNOS4 54 depends on ARCH_EXYNOS4
55 select SAMSUNG_DMADEV
53 help 56 help
54 Enable EXYNOS4412 SoC support 57 Enable EXYNOS4412 SoC support
55 58
59config SOC_EXYNOS5250
60 bool "SAMSUNG EXYNOS5250"
61 default y
62 depends on ARCH_EXYNOS5
63 help
64 Enable EXYNOS5250 SoC support
65
56config EXYNOS4_MCT 66config EXYNOS4_MCT
57 bool 67 bool
58 default y 68 default y
@@ -333,6 +343,7 @@ config MACH_SMDK4212
333 select SAMSUNG_DEV_BACKLIGHT 343 select SAMSUNG_DEV_BACKLIGHT
334 select SAMSUNG_DEV_KEYPAD 344 select SAMSUNG_DEV_KEYPAD
335 select SAMSUNG_DEV_PWM 345 select SAMSUNG_DEV_PWM
346 select EXYNOS4_DEV_DMA
336 select EXYNOS4_SETUP_I2C1 347 select EXYNOS4_SETUP_I2C1
337 select EXYNOS4_SETUP_I2C3 348 select EXYNOS4_SETUP_I2C3
338 select EXYNOS4_SETUP_I2C7 349 select EXYNOS4_SETUP_I2C7
@@ -351,7 +362,7 @@ config MACH_SMDK4412
351 Machine support for Samsung SMDK4412 362 Machine support for Samsung SMDK4412
352endif 363endif
353 364
354comment "Flattened Device Tree based board for Exynos4 based SoC" 365comment "Flattened Device Tree based board for EXYNOS SoCs"
355 366
356config MACH_EXYNOS4_DT 367config MACH_EXYNOS4_DT
357 bool "Samsung Exynos4 Machine using device tree" 368 bool "Samsung Exynos4 Machine using device tree"
@@ -365,6 +376,15 @@ config MACH_EXYNOS4_DT
365 Note: This is under development and not all peripherals can be supported 376 Note: This is under development and not all peripherals can be supported
366 with this machine file. 377 with this machine file.
367 378
379config MACH_EXYNOS5_DT
380 bool "SAMSUNG EXYNOS5 Machine using device tree"
381 select SOC_EXYNOS5250
382 select USE_OF
383 select ARM_AMBA
384 help
385 Machine support for Samsung Exynos4 machine with device tree enabled.
386 Select this if a fdt blob is available for the EXYNOS4 SoC based board.
387
368if ARCH_EXYNOS4 388if ARCH_EXYNOS4
369 389
370comment "Configuration for HSMMC 8-bit bus width" 390comment "Configuration for HSMMC 8-bit bus width"
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 5fc202cdfdb6..29967efd262a 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -12,7 +12,9 @@ obj- :=
12 12
13# Core 13# Core
14 14
15obj-$(CONFIG_ARCH_EXYNOS4) += common.o clock.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
17obj-$(CONFIG_ARCH_EXYNOS5) += clock-exynos5.o
16obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 18obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
17obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 19obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
18 20
@@ -40,9 +42,11 @@ obj-$(CONFIG_MACH_SMDK4212) += mach-smdk4x12.o
40obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o 42obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o
41 43
42obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o 44obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o
45obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o
43 46
44# device support 47# device support
45 48
49obj-y += dev-uart.o
46obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o 50obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o
47obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o 51obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
48obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o 52obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o
@@ -51,7 +55,7 @@ obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
51obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o 55obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o
52obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o 56obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
53 57
54obj-$(CONFIG_ARCH_EXYNOS4) += setup-i2c0.o 58obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o
55obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o 59obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
56obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o 60obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
57obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o 61obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
new file mode 100644
index 000000000000..6504d8b1f8e5
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -0,0 +1,1576 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27#include <mach/sysmmu.h>
28
29#include "common.h"
30#include "clock-exynos4.h"
31
32#ifdef CONFIG_PM_SLEEP
33static struct sleep_save exynos4_clock_save[] = {
34 SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS),
35 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS),
36 SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS),
37 SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS),
38 SAVE_ITEM(EXYNOS4_CLKSRC_TOP0),
39 SAVE_ITEM(EXYNOS4_CLKSRC_TOP1),
40 SAVE_ITEM(EXYNOS4_CLKSRC_CAM),
41 SAVE_ITEM(EXYNOS4_CLKSRC_TV),
42 SAVE_ITEM(EXYNOS4_CLKSRC_MFC),
43 SAVE_ITEM(EXYNOS4_CLKSRC_G3D),
44 SAVE_ITEM(EXYNOS4_CLKSRC_LCD0),
45 SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO),
46 SAVE_ITEM(EXYNOS4_CLKSRC_FSYS),
47 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0),
48 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1),
49 SAVE_ITEM(EXYNOS4_CLKDIV_CAM),
50 SAVE_ITEM(EXYNOS4_CLKDIV_TV),
51 SAVE_ITEM(EXYNOS4_CLKDIV_MFC),
52 SAVE_ITEM(EXYNOS4_CLKDIV_G3D),
53 SAVE_ITEM(EXYNOS4_CLKDIV_LCD0),
54 SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO),
55 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0),
56 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1),
57 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2),
58 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3),
59 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0),
60 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1),
61 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2),
62 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3),
63 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4),
64 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5),
65 SAVE_ITEM(EXYNOS4_CLKDIV_TOP),
66 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP),
67 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM),
68 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV),
69 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0),
70 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO),
71 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS),
72 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0),
73 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1),
74 SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO),
75 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM),
76 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM),
77 SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV),
78 SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC),
79 SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D),
80 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0),
81 SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS),
82 SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS),
83 SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL),
84 SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK),
85 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC),
86 SAVE_ITEM(EXYNOS4_CLKSRC_DMC),
87 SAVE_ITEM(EXYNOS4_CLKDIV_DMC0),
88 SAVE_ITEM(EXYNOS4_CLKDIV_DMC1),
89 SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC),
90 SAVE_ITEM(EXYNOS4_CLKSRC_CPU),
91 SAVE_ITEM(EXYNOS4_CLKDIV_CPU),
92 SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4),
93 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU),
94 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU),
95};
96#endif
97
98static struct clk exynos4_clk_sclk_hdmi27m = {
99 .name = "sclk_hdmi27m",
100 .rate = 27000000,
101};
102
103static struct clk exynos4_clk_sclk_hdmiphy = {
104 .name = "sclk_hdmiphy",
105};
106
107static struct clk exynos4_clk_sclk_usbphy0 = {
108 .name = "sclk_usbphy0",
109 .rate = 27000000,
110};
111
112static struct clk exynos4_clk_sclk_usbphy1 = {
113 .name = "sclk_usbphy1",
114};
115
116static struct clk dummy_apb_pclk = {
117 .name = "apb_pclk",
118 .id = -1,
119};
120
121static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
122{
123 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable);
124}
125
126static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
127{
128 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable);
129}
130
131static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
132{
133 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable);
134}
135
136int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
137{
138 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable);
139}
140
141static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
142{
143 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable);
144}
145
146static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
147{
148 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable);
149}
150
151static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
152{
153 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable);
154}
155
156static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
157{
158 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable);
159}
160
161static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
162{
163 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable);
164}
165
166static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
167{
168 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable);
169}
170
171static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
172{
173 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable);
174}
175
176static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
177{
178 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable);
179}
180
181int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
182{
183 return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable);
184}
185
186int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
187{
188 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable);
189}
190
191static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
192{
193 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable);
194}
195
196static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
197{
198 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable);
199}
200
201static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
202{
203 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
204}
205
206static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
207{
208 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
209}
210
211/* Core list of CMU_CPU side */
212
213static struct clksrc_clk exynos4_clk_mout_apll = {
214 .clk = {
215 .name = "mout_apll",
216 },
217 .sources = &clk_src_apll,
218 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 },
219};
220
221static struct clksrc_clk exynos4_clk_sclk_apll = {
222 .clk = {
223 .name = "sclk_apll",
224 .parent = &exynos4_clk_mout_apll.clk,
225 },
226 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 },
227};
228
229static struct clksrc_clk exynos4_clk_mout_epll = {
230 .clk = {
231 .name = "mout_epll",
232 },
233 .sources = &clk_src_epll,
234 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 },
235};
236
237struct clksrc_clk exynos4_clk_mout_mpll = {
238 .clk = {
239 .name = "mout_mpll",
240 },
241 .sources = &clk_src_mpll,
242
243 /* reg_src will be added in each SoCs' clock */
244};
245
246static struct clk *exynos4_clkset_moutcore_list[] = {
247 [0] = &exynos4_clk_mout_apll.clk,
248 [1] = &exynos4_clk_mout_mpll.clk,
249};
250
251static struct clksrc_sources exynos4_clkset_moutcore = {
252 .sources = exynos4_clkset_moutcore_list,
253 .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list),
254};
255
256static struct clksrc_clk exynos4_clk_moutcore = {
257 .clk = {
258 .name = "moutcore",
259 },
260 .sources = &exynos4_clkset_moutcore,
261 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 },
262};
263
264static struct clksrc_clk exynos4_clk_coreclk = {
265 .clk = {
266 .name = "core_clk",
267 .parent = &exynos4_clk_moutcore.clk,
268 },
269 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 },
270};
271
272static struct clksrc_clk exynos4_clk_armclk = {
273 .clk = {
274 .name = "armclk",
275 .parent = &exynos4_clk_coreclk.clk,
276 },
277};
278
279static struct clksrc_clk exynos4_clk_aclk_corem0 = {
280 .clk = {
281 .name = "aclk_corem0",
282 .parent = &exynos4_clk_coreclk.clk,
283 },
284 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
285};
286
287static struct clksrc_clk exynos4_clk_aclk_cores = {
288 .clk = {
289 .name = "aclk_cores",
290 .parent = &exynos4_clk_coreclk.clk,
291 },
292 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
293};
294
295static struct clksrc_clk exynos4_clk_aclk_corem1 = {
296 .clk = {
297 .name = "aclk_corem1",
298 .parent = &exynos4_clk_coreclk.clk,
299 },
300 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 },
301};
302
303static struct clksrc_clk exynos4_clk_periphclk = {
304 .clk = {
305 .name = "periphclk",
306 .parent = &exynos4_clk_coreclk.clk,
307 },
308 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 },
309};
310
311/* Core list of CMU_CORE side */
312
313static struct clk *exynos4_clkset_corebus_list[] = {
314 [0] = &exynos4_clk_mout_mpll.clk,
315 [1] = &exynos4_clk_sclk_apll.clk,
316};
317
318struct clksrc_sources exynos4_clkset_mout_corebus = {
319 .sources = exynos4_clkset_corebus_list,
320 .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list),
321};
322
323static struct clksrc_clk exynos4_clk_mout_corebus = {
324 .clk = {
325 .name = "mout_corebus",
326 },
327 .sources = &exynos4_clkset_mout_corebus,
328 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 },
329};
330
331static struct clksrc_clk exynos4_clk_sclk_dmc = {
332 .clk = {
333 .name = "sclk_dmc",
334 .parent = &exynos4_clk_mout_corebus.clk,
335 },
336 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 },
337};
338
339static struct clksrc_clk exynos4_clk_aclk_cored = {
340 .clk = {
341 .name = "aclk_cored",
342 .parent = &exynos4_clk_sclk_dmc.clk,
343 },
344 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 },
345};
346
347static struct clksrc_clk exynos4_clk_aclk_corep = {
348 .clk = {
349 .name = "aclk_corep",
350 .parent = &exynos4_clk_aclk_cored.clk,
351 },
352 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 },
353};
354
355static struct clksrc_clk exynos4_clk_aclk_acp = {
356 .clk = {
357 .name = "aclk_acp",
358 .parent = &exynos4_clk_mout_corebus.clk,
359 },
360 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 },
361};
362
363static struct clksrc_clk exynos4_clk_pclk_acp = {
364 .clk = {
365 .name = "pclk_acp",
366 .parent = &exynos4_clk_aclk_acp.clk,
367 },
368 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 },
369};
370
371/* Core list of CMU_TOP side */
372
373struct clk *exynos4_clkset_aclk_top_list[] = {
374 [0] = &exynos4_clk_mout_mpll.clk,
375 [1] = &exynos4_clk_sclk_apll.clk,
376};
377
378static struct clksrc_sources exynos4_clkset_aclk = {
379 .sources = exynos4_clkset_aclk_top_list,
380 .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list),
381};
382
383static struct clksrc_clk exynos4_clk_aclk_200 = {
384 .clk = {
385 .name = "aclk_200",
386 },
387 .sources = &exynos4_clkset_aclk,
388 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 },
389 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 },
390};
391
392static struct clksrc_clk exynos4_clk_aclk_100 = {
393 .clk = {
394 .name = "aclk_100",
395 },
396 .sources = &exynos4_clkset_aclk,
397 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 },
398 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 },
399};
400
401static struct clksrc_clk exynos4_clk_aclk_160 = {
402 .clk = {
403 .name = "aclk_160",
404 },
405 .sources = &exynos4_clkset_aclk,
406 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 },
407 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 },
408};
409
410struct clksrc_clk exynos4_clk_aclk_133 = {
411 .clk = {
412 .name = "aclk_133",
413 },
414 .sources = &exynos4_clkset_aclk,
415 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 },
416 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 },
417};
418
419static struct clk *exynos4_clkset_vpllsrc_list[] = {
420 [0] = &clk_fin_vpll,
421 [1] = &exynos4_clk_sclk_hdmi27m,
422};
423
424static struct clksrc_sources exynos4_clkset_vpllsrc = {
425 .sources = exynos4_clkset_vpllsrc_list,
426 .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
427};
428
429static struct clksrc_clk exynos4_clk_vpllsrc = {
430 .clk = {
431 .name = "vpll_src",
432 .enable = exynos4_clksrc_mask_top_ctrl,
433 .ctrlbit = (1 << 0),
434 },
435 .sources = &exynos4_clkset_vpllsrc,
436 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 },
437};
438
439static struct clk *exynos4_clkset_sclk_vpll_list[] = {
440 [0] = &exynos4_clk_vpllsrc.clk,
441 [1] = &clk_fout_vpll,
442};
443
444static struct clksrc_sources exynos4_clkset_sclk_vpll = {
445 .sources = exynos4_clkset_sclk_vpll_list,
446 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
447};
448
449static struct clksrc_clk exynos4_clk_sclk_vpll = {
450 .clk = {
451 .name = "sclk_vpll",
452 },
453 .sources = &exynos4_clkset_sclk_vpll,
454 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 },
455};
456
457static struct clk exynos4_init_clocks_off[] = {
458 {
459 .name = "timers",
460 .parent = &exynos4_clk_aclk_100.clk,
461 .enable = exynos4_clk_ip_peril_ctrl,
462 .ctrlbit = (1<<24),
463 }, {
464 .name = "csis",
465 .devname = "s5p-mipi-csis.0",
466 .enable = exynos4_clk_ip_cam_ctrl,
467 .ctrlbit = (1 << 4),
468 }, {
469 .name = "csis",
470 .devname = "s5p-mipi-csis.1",
471 .enable = exynos4_clk_ip_cam_ctrl,
472 .ctrlbit = (1 << 5),
473 }, {
474 .name = "fimc",
475 .devname = "exynos4-fimc.0",
476 .enable = exynos4_clk_ip_cam_ctrl,
477 .ctrlbit = (1 << 0),
478 }, {
479 .name = "fimc",
480 .devname = "exynos4-fimc.1",
481 .enable = exynos4_clk_ip_cam_ctrl,
482 .ctrlbit = (1 << 1),
483 }, {
484 .name = "fimc",
485 .devname = "exynos4-fimc.2",
486 .enable = exynos4_clk_ip_cam_ctrl,
487 .ctrlbit = (1 << 2),
488 }, {
489 .name = "fimc",
490 .devname = "exynos4-fimc.3",
491 .enable = exynos4_clk_ip_cam_ctrl,
492 .ctrlbit = (1 << 3),
493 }, {
494 .name = "hsmmc",
495 .devname = "s3c-sdhci.0",
496 .parent = &exynos4_clk_aclk_133.clk,
497 .enable = exynos4_clk_ip_fsys_ctrl,
498 .ctrlbit = (1 << 5),
499 }, {
500 .name = "hsmmc",
501 .devname = "s3c-sdhci.1",
502 .parent = &exynos4_clk_aclk_133.clk,
503 .enable = exynos4_clk_ip_fsys_ctrl,
504 .ctrlbit = (1 << 6),
505 }, {
506 .name = "hsmmc",
507 .devname = "s3c-sdhci.2",
508 .parent = &exynos4_clk_aclk_133.clk,
509 .enable = exynos4_clk_ip_fsys_ctrl,
510 .ctrlbit = (1 << 7),
511 }, {
512 .name = "hsmmc",
513 .devname = "s3c-sdhci.3",
514 .parent = &exynos4_clk_aclk_133.clk,
515 .enable = exynos4_clk_ip_fsys_ctrl,
516 .ctrlbit = (1 << 8),
517 }, {
518 .name = "dwmmc",
519 .parent = &exynos4_clk_aclk_133.clk,
520 .enable = exynos4_clk_ip_fsys_ctrl,
521 .ctrlbit = (1 << 9),
522 }, {
523 .name = "dac",
524 .devname = "s5p-sdo",
525 .enable = exynos4_clk_ip_tv_ctrl,
526 .ctrlbit = (1 << 2),
527 }, {
528 .name = "mixer",
529 .devname = "s5p-mixer",
530 .enable = exynos4_clk_ip_tv_ctrl,
531 .ctrlbit = (1 << 1),
532 }, {
533 .name = "vp",
534 .devname = "s5p-mixer",
535 .enable = exynos4_clk_ip_tv_ctrl,
536 .ctrlbit = (1 << 0),
537 }, {
538 .name = "hdmi",
539 .devname = "exynos4-hdmi",
540 .enable = exynos4_clk_ip_tv_ctrl,
541 .ctrlbit = (1 << 3),
542 }, {
543 .name = "hdmiphy",
544 .devname = "exynos4-hdmi",
545 .enable = exynos4_clk_hdmiphy_ctrl,
546 .ctrlbit = (1 << 0),
547 }, {
548 .name = "dacphy",
549 .devname = "s5p-sdo",
550 .enable = exynos4_clk_dac_ctrl,
551 .ctrlbit = (1 << 0),
552 }, {
553 .name = "adc",
554 .enable = exynos4_clk_ip_peril_ctrl,
555 .ctrlbit = (1 << 15),
556 }, {
557 .name = "keypad",
558 .enable = exynos4_clk_ip_perir_ctrl,
559 .ctrlbit = (1 << 16),
560 }, {
561 .name = "rtc",
562 .enable = exynos4_clk_ip_perir_ctrl,
563 .ctrlbit = (1 << 15),
564 }, {
565 .name = "watchdog",
566 .parent = &exynos4_clk_aclk_100.clk,
567 .enable = exynos4_clk_ip_perir_ctrl,
568 .ctrlbit = (1 << 14),
569 }, {
570 .name = "usbhost",
571 .enable = exynos4_clk_ip_fsys_ctrl ,
572 .ctrlbit = (1 << 12),
573 }, {
574 .name = "otg",
575 .enable = exynos4_clk_ip_fsys_ctrl,
576 .ctrlbit = (1 << 13),
577 }, {
578 .name = "spi",
579 .devname = "s3c64xx-spi.0",
580 .enable = exynos4_clk_ip_peril_ctrl,
581 .ctrlbit = (1 << 16),
582 }, {
583 .name = "spi",
584 .devname = "s3c64xx-spi.1",
585 .enable = exynos4_clk_ip_peril_ctrl,
586 .ctrlbit = (1 << 17),
587 }, {
588 .name = "spi",
589 .devname = "s3c64xx-spi.2",
590 .enable = exynos4_clk_ip_peril_ctrl,
591 .ctrlbit = (1 << 18),
592 }, {
593 .name = "iis",
594 .devname = "samsung-i2s.0",
595 .enable = exynos4_clk_ip_peril_ctrl,
596 .ctrlbit = (1 << 19),
597 }, {
598 .name = "iis",
599 .devname = "samsung-i2s.1",
600 .enable = exynos4_clk_ip_peril_ctrl,
601 .ctrlbit = (1 << 20),
602 }, {
603 .name = "iis",
604 .devname = "samsung-i2s.2",
605 .enable = exynos4_clk_ip_peril_ctrl,
606 .ctrlbit = (1 << 21),
607 }, {
608 .name = "ac97",
609 .devname = "samsung-ac97",
610 .enable = exynos4_clk_ip_peril_ctrl,
611 .ctrlbit = (1 << 27),
612 }, {
613 .name = "fimg2d",
614 .enable = exynos4_clk_ip_image_ctrl,
615 .ctrlbit = (1 << 0),
616 }, {
617 .name = "mfc",
618 .devname = "s5p-mfc",
619 .enable = exynos4_clk_ip_mfc_ctrl,
620 .ctrlbit = (1 << 0),
621 }, {
622 .name = "i2c",
623 .devname = "s3c2440-i2c.0",
624 .parent = &exynos4_clk_aclk_100.clk,
625 .enable = exynos4_clk_ip_peril_ctrl,
626 .ctrlbit = (1 << 6),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-i2c.1",
630 .parent = &exynos4_clk_aclk_100.clk,
631 .enable = exynos4_clk_ip_peril_ctrl,
632 .ctrlbit = (1 << 7),
633 }, {
634 .name = "i2c",
635 .devname = "s3c2440-i2c.2",
636 .parent = &exynos4_clk_aclk_100.clk,
637 .enable = exynos4_clk_ip_peril_ctrl,
638 .ctrlbit = (1 << 8),
639 }, {
640 .name = "i2c",
641 .devname = "s3c2440-i2c.3",
642 .parent = &exynos4_clk_aclk_100.clk,
643 .enable = exynos4_clk_ip_peril_ctrl,
644 .ctrlbit = (1 << 9),
645 }, {
646 .name = "i2c",
647 .devname = "s3c2440-i2c.4",
648 .parent = &exynos4_clk_aclk_100.clk,
649 .enable = exynos4_clk_ip_peril_ctrl,
650 .ctrlbit = (1 << 10),
651 }, {
652 .name = "i2c",
653 .devname = "s3c2440-i2c.5",
654 .parent = &exynos4_clk_aclk_100.clk,
655 .enable = exynos4_clk_ip_peril_ctrl,
656 .ctrlbit = (1 << 11),
657 }, {
658 .name = "i2c",
659 .devname = "s3c2440-i2c.6",
660 .parent = &exynos4_clk_aclk_100.clk,
661 .enable = exynos4_clk_ip_peril_ctrl,
662 .ctrlbit = (1 << 12),
663 }, {
664 .name = "i2c",
665 .devname = "s3c2440-i2c.7",
666 .parent = &exynos4_clk_aclk_100.clk,
667 .enable = exynos4_clk_ip_peril_ctrl,
668 .ctrlbit = (1 << 13),
669 }, {
670 .name = "i2c",
671 .devname = "s3c2440-hdmiphy-i2c",
672 .parent = &exynos4_clk_aclk_100.clk,
673 .enable = exynos4_clk_ip_peril_ctrl,
674 .ctrlbit = (1 << 14),
675 }, {
676 .name = "SYSMMU_MDMA",
677 .enable = exynos4_clk_ip_image_ctrl,
678 .ctrlbit = (1 << 5),
679 }, {
680 .name = "SYSMMU_FIMC0",
681 .enable = exynos4_clk_ip_cam_ctrl,
682 .ctrlbit = (1 << 7),
683 }, {
684 .name = "SYSMMU_FIMC1",
685 .enable = exynos4_clk_ip_cam_ctrl,
686 .ctrlbit = (1 << 8),
687 }, {
688 .name = "SYSMMU_FIMC2",
689 .enable = exynos4_clk_ip_cam_ctrl,
690 .ctrlbit = (1 << 9),
691 }, {
692 .name = "SYSMMU_FIMC3",
693 .enable = exynos4_clk_ip_cam_ctrl,
694 .ctrlbit = (1 << 10),
695 }, {
696 .name = "SYSMMU_JPEG",
697 .enable = exynos4_clk_ip_cam_ctrl,
698 .ctrlbit = (1 << 11),
699 }, {
700 .name = "SYSMMU_FIMD0",
701 .enable = exynos4_clk_ip_lcd0_ctrl,
702 .ctrlbit = (1 << 4),
703 }, {
704 .name = "SYSMMU_FIMD1",
705 .enable = exynos4_clk_ip_lcd1_ctrl,
706 .ctrlbit = (1 << 4),
707 }, {
708 .name = "SYSMMU_PCIe",
709 .enable = exynos4_clk_ip_fsys_ctrl,
710 .ctrlbit = (1 << 18),
711 }, {
712 .name = "SYSMMU_G2D",
713 .enable = exynos4_clk_ip_image_ctrl,
714 .ctrlbit = (1 << 3),
715 }, {
716 .name = "SYSMMU_ROTATOR",
717 .enable = exynos4_clk_ip_image_ctrl,
718 .ctrlbit = (1 << 4),
719 }, {
720 .name = "SYSMMU_TV",
721 .enable = exynos4_clk_ip_tv_ctrl,
722 .ctrlbit = (1 << 4),
723 }, {
724 .name = "SYSMMU_MFC_L",
725 .enable = exynos4_clk_ip_mfc_ctrl,
726 .ctrlbit = (1 << 1),
727 }, {
728 .name = "SYSMMU_MFC_R",
729 .enable = exynos4_clk_ip_mfc_ctrl,
730 .ctrlbit = (1 << 2),
731 }
732};
733
734static struct clk exynos4_init_clocks_on[] = {
735 {
736 .name = "uart",
737 .devname = "s5pv210-uart.0",
738 .enable = exynos4_clk_ip_peril_ctrl,
739 .ctrlbit = (1 << 0),
740 }, {
741 .name = "uart",
742 .devname = "s5pv210-uart.1",
743 .enable = exynos4_clk_ip_peril_ctrl,
744 .ctrlbit = (1 << 1),
745 }, {
746 .name = "uart",
747 .devname = "s5pv210-uart.2",
748 .enable = exynos4_clk_ip_peril_ctrl,
749 .ctrlbit = (1 << 2),
750 }, {
751 .name = "uart",
752 .devname = "s5pv210-uart.3",
753 .enable = exynos4_clk_ip_peril_ctrl,
754 .ctrlbit = (1 << 3),
755 }, {
756 .name = "uart",
757 .devname = "s5pv210-uart.4",
758 .enable = exynos4_clk_ip_peril_ctrl,
759 .ctrlbit = (1 << 4),
760 }, {
761 .name = "uart",
762 .devname = "s5pv210-uart.5",
763 .enable = exynos4_clk_ip_peril_ctrl,
764 .ctrlbit = (1 << 5),
765 }
766};
767
768static struct clk exynos4_clk_pdma0 = {
769 .name = "dma",
770 .devname = "dma-pl330.0",
771 .enable = exynos4_clk_ip_fsys_ctrl,
772 .ctrlbit = (1 << 0),
773};
774
775static struct clk exynos4_clk_pdma1 = {
776 .name = "dma",
777 .devname = "dma-pl330.1",
778 .enable = exynos4_clk_ip_fsys_ctrl,
779 .ctrlbit = (1 << 1),
780};
781
782static struct clk exynos4_clk_mdma1 = {
783 .name = "dma",
784 .devname = "dma-pl330.2",
785 .enable = exynos4_clk_ip_image_ctrl,
786 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
787};
788
789static struct clk exynos4_clk_fimd0 = {
790 .name = "fimd",
791 .devname = "exynos4-fb.0",
792 .enable = exynos4_clk_ip_lcd0_ctrl,
793 .ctrlbit = (1 << 0),
794};
795
796struct clk *exynos4_clkset_group_list[] = {
797 [0] = &clk_ext_xtal_mux,
798 [1] = &clk_xusbxti,
799 [2] = &exynos4_clk_sclk_hdmi27m,
800 [3] = &exynos4_clk_sclk_usbphy0,
801 [4] = &exynos4_clk_sclk_usbphy1,
802 [5] = &exynos4_clk_sclk_hdmiphy,
803 [6] = &exynos4_clk_mout_mpll.clk,
804 [7] = &exynos4_clk_mout_epll.clk,
805 [8] = &exynos4_clk_sclk_vpll.clk,
806};
807
808struct clksrc_sources exynos4_clkset_group = {
809 .sources = exynos4_clkset_group_list,
810 .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list),
811};
812
813static struct clk *exynos4_clkset_mout_g2d0_list[] = {
814 [0] = &exynos4_clk_mout_mpll.clk,
815 [1] = &exynos4_clk_sclk_apll.clk,
816};
817
818static struct clksrc_sources exynos4_clkset_mout_g2d0 = {
819 .sources = exynos4_clkset_mout_g2d0_list,
820 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
821};
822
823static struct clksrc_clk exynos4_clk_mout_g2d0 = {
824 .clk = {
825 .name = "mout_g2d0",
826 },
827 .sources = &exynos4_clkset_mout_g2d0,
828 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 },
829};
830
831static struct clk *exynos4_clkset_mout_g2d1_list[] = {
832 [0] = &exynos4_clk_mout_epll.clk,
833 [1] = &exynos4_clk_sclk_vpll.clk,
834};
835
836static struct clksrc_sources exynos4_clkset_mout_g2d1 = {
837 .sources = exynos4_clkset_mout_g2d1_list,
838 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
839};
840
841static struct clksrc_clk exynos4_clk_mout_g2d1 = {
842 .clk = {
843 .name = "mout_g2d1",
844 },
845 .sources = &exynos4_clkset_mout_g2d1,
846 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 },
847};
848
849static struct clk *exynos4_clkset_mout_g2d_list[] = {
850 [0] = &exynos4_clk_mout_g2d0.clk,
851 [1] = &exynos4_clk_mout_g2d1.clk,
852};
853
854static struct clksrc_sources exynos4_clkset_mout_g2d = {
855 .sources = exynos4_clkset_mout_g2d_list,
856 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d_list),
857};
858
859static struct clk *exynos4_clkset_mout_mfc0_list[] = {
860 [0] = &exynos4_clk_mout_mpll.clk,
861 [1] = &exynos4_clk_sclk_apll.clk,
862};
863
864static struct clksrc_sources exynos4_clkset_mout_mfc0 = {
865 .sources = exynos4_clkset_mout_mfc0_list,
866 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
867};
868
869static struct clksrc_clk exynos4_clk_mout_mfc0 = {
870 .clk = {
871 .name = "mout_mfc0",
872 },
873 .sources = &exynos4_clkset_mout_mfc0,
874 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 },
875};
876
877static struct clk *exynos4_clkset_mout_mfc1_list[] = {
878 [0] = &exynos4_clk_mout_epll.clk,
879 [1] = &exynos4_clk_sclk_vpll.clk,
880};
881
882static struct clksrc_sources exynos4_clkset_mout_mfc1 = {
883 .sources = exynos4_clkset_mout_mfc1_list,
884 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
885};
886
887static struct clksrc_clk exynos4_clk_mout_mfc1 = {
888 .clk = {
889 .name = "mout_mfc1",
890 },
891 .sources = &exynos4_clkset_mout_mfc1,
892 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 },
893};
894
895static struct clk *exynos4_clkset_mout_mfc_list[] = {
896 [0] = &exynos4_clk_mout_mfc0.clk,
897 [1] = &exynos4_clk_mout_mfc1.clk,
898};
899
900static struct clksrc_sources exynos4_clkset_mout_mfc = {
901 .sources = exynos4_clkset_mout_mfc_list,
902 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
903};
904
905static struct clk *exynos4_clkset_sclk_dac_list[] = {
906 [0] = &exynos4_clk_sclk_vpll.clk,
907 [1] = &exynos4_clk_sclk_hdmiphy,
908};
909
910static struct clksrc_sources exynos4_clkset_sclk_dac = {
911 .sources = exynos4_clkset_sclk_dac_list,
912 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
913};
914
915static struct clksrc_clk exynos4_clk_sclk_dac = {
916 .clk = {
917 .name = "sclk_dac",
918 .enable = exynos4_clksrc_mask_tv_ctrl,
919 .ctrlbit = (1 << 8),
920 },
921 .sources = &exynos4_clkset_sclk_dac,
922 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 },
923};
924
925static struct clksrc_clk exynos4_clk_sclk_pixel = {
926 .clk = {
927 .name = "sclk_pixel",
928 .parent = &exynos4_clk_sclk_vpll.clk,
929 },
930 .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 },
931};
932
933static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
934 [0] = &exynos4_clk_sclk_pixel.clk,
935 [1] = &exynos4_clk_sclk_hdmiphy,
936};
937
938static struct clksrc_sources exynos4_clkset_sclk_hdmi = {
939 .sources = exynos4_clkset_sclk_hdmi_list,
940 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
941};
942
943static struct clksrc_clk exynos4_clk_sclk_hdmi = {
944 .clk = {
945 .name = "sclk_hdmi",
946 .enable = exynos4_clksrc_mask_tv_ctrl,
947 .ctrlbit = (1 << 0),
948 },
949 .sources = &exynos4_clkset_sclk_hdmi,
950 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 },
951};
952
953static struct clk *exynos4_clkset_sclk_mixer_list[] = {
954 [0] = &exynos4_clk_sclk_dac.clk,
955 [1] = &exynos4_clk_sclk_hdmi.clk,
956};
957
958static struct clksrc_sources exynos4_clkset_sclk_mixer = {
959 .sources = exynos4_clkset_sclk_mixer_list,
960 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
961};
962
963static struct clksrc_clk exynos4_clk_sclk_mixer = {
964 .clk = {
965 .name = "sclk_mixer",
966 .enable = exynos4_clksrc_mask_tv_ctrl,
967 .ctrlbit = (1 << 4),
968 },
969 .sources = &exynos4_clkset_sclk_mixer,
970 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 },
971};
972
973static struct clksrc_clk *exynos4_sclk_tv[] = {
974 &exynos4_clk_sclk_dac,
975 &exynos4_clk_sclk_pixel,
976 &exynos4_clk_sclk_hdmi,
977 &exynos4_clk_sclk_mixer,
978};
979
980static struct clksrc_clk exynos4_clk_dout_mmc0 = {
981 .clk = {
982 .name = "dout_mmc0",
983 },
984 .sources = &exynos4_clkset_group,
985 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 },
986 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 },
987};
988
989static struct clksrc_clk exynos4_clk_dout_mmc1 = {
990 .clk = {
991 .name = "dout_mmc1",
992 },
993 .sources = &exynos4_clkset_group,
994 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 },
995 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 },
996};
997
998static struct clksrc_clk exynos4_clk_dout_mmc2 = {
999 .clk = {
1000 .name = "dout_mmc2",
1001 },
1002 .sources = &exynos4_clkset_group,
1003 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 },
1004 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 },
1005};
1006
1007static struct clksrc_clk exynos4_clk_dout_mmc3 = {
1008 .clk = {
1009 .name = "dout_mmc3",
1010 },
1011 .sources = &exynos4_clkset_group,
1012 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 },
1013 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1014};
1015
1016static struct clksrc_clk exynos4_clk_dout_mmc4 = {
1017 .clk = {
1018 .name = "dout_mmc4",
1019 },
1020 .sources = &exynos4_clkset_group,
1021 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 },
1022 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1023};
1024
1025static struct clksrc_clk exynos4_clksrcs[] = {
1026 {
1027 .clk = {
1028 .name = "sclk_pwm",
1029 .enable = exynos4_clksrc_mask_peril0_ctrl,
1030 .ctrlbit = (1 << 24),
1031 },
1032 .sources = &exynos4_clkset_group,
1033 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1034 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1035 }, {
1036 .clk = {
1037 .name = "sclk_csis",
1038 .devname = "s5p-mipi-csis.0",
1039 .enable = exynos4_clksrc_mask_cam_ctrl,
1040 .ctrlbit = (1 << 24),
1041 },
1042 .sources = &exynos4_clkset_group,
1043 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 },
1044 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 },
1045 }, {
1046 .clk = {
1047 .name = "sclk_csis",
1048 .devname = "s5p-mipi-csis.1",
1049 .enable = exynos4_clksrc_mask_cam_ctrl,
1050 .ctrlbit = (1 << 28),
1051 },
1052 .sources = &exynos4_clkset_group,
1053 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 },
1054 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 },
1055 }, {
1056 .clk = {
1057 .name = "sclk_cam0",
1058 .enable = exynos4_clksrc_mask_cam_ctrl,
1059 .ctrlbit = (1 << 16),
1060 },
1061 .sources = &exynos4_clkset_group,
1062 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 },
1063 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 },
1064 }, {
1065 .clk = {
1066 .name = "sclk_cam1",
1067 .enable = exynos4_clksrc_mask_cam_ctrl,
1068 .ctrlbit = (1 << 20),
1069 },
1070 .sources = &exynos4_clkset_group,
1071 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 },
1072 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 },
1073 }, {
1074 .clk = {
1075 .name = "sclk_fimc",
1076 .devname = "exynos4-fimc.0",
1077 .enable = exynos4_clksrc_mask_cam_ctrl,
1078 .ctrlbit = (1 << 0),
1079 },
1080 .sources = &exynos4_clkset_group,
1081 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 },
1082 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 },
1083 }, {
1084 .clk = {
1085 .name = "sclk_fimc",
1086 .devname = "exynos4-fimc.1",
1087 .enable = exynos4_clksrc_mask_cam_ctrl,
1088 .ctrlbit = (1 << 4),
1089 },
1090 .sources = &exynos4_clkset_group,
1091 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 },
1092 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 },
1093 }, {
1094 .clk = {
1095 .name = "sclk_fimc",
1096 .devname = "exynos4-fimc.2",
1097 .enable = exynos4_clksrc_mask_cam_ctrl,
1098 .ctrlbit = (1 << 8),
1099 },
1100 .sources = &exynos4_clkset_group,
1101 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 },
1102 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 },
1103 }, {
1104 .clk = {
1105 .name = "sclk_fimc",
1106 .devname = "exynos4-fimc.3",
1107 .enable = exynos4_clksrc_mask_cam_ctrl,
1108 .ctrlbit = (1 << 12),
1109 },
1110 .sources = &exynos4_clkset_group,
1111 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 },
1112 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 },
1113 }, {
1114 .clk = {
1115 .name = "sclk_fimd",
1116 .devname = "exynos4-fb.0",
1117 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1118 .ctrlbit = (1 << 0),
1119 },
1120 .sources = &exynos4_clkset_group,
1121 .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 },
1122 .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 },
1123 }, {
1124 .clk = {
1125 .name = "sclk_fimg2d",
1126 },
1127 .sources = &exynos4_clkset_mout_g2d,
1128 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1129 .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1130 }, {
1131 .clk = {
1132 .name = "sclk_mfc",
1133 .devname = "s5p-mfc",
1134 },
1135 .sources = &exynos4_clkset_mout_mfc,
1136 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 },
1137 .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 },
1138 }, {
1139 .clk = {
1140 .name = "sclk_dwmmc",
1141 .parent = &exynos4_clk_dout_mmc4.clk,
1142 .enable = exynos4_clksrc_mask_fsys_ctrl,
1143 .ctrlbit = (1 << 16),
1144 },
1145 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1146 }
1147};
1148
1149static struct clksrc_clk exynos4_clk_sclk_uart0 = {
1150 .clk = {
1151 .name = "uclk1",
1152 .devname = "exynos4210-uart.0",
1153 .enable = exynos4_clksrc_mask_peril0_ctrl,
1154 .ctrlbit = (1 << 0),
1155 },
1156 .sources = &exynos4_clkset_group,
1157 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1158 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1159};
1160
1161static struct clksrc_clk exynos4_clk_sclk_uart1 = {
1162 .clk = {
1163 .name = "uclk1",
1164 .devname = "exynos4210-uart.1",
1165 .enable = exynos4_clksrc_mask_peril0_ctrl,
1166 .ctrlbit = (1 << 4),
1167 },
1168 .sources = &exynos4_clkset_group,
1169 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1170 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1171};
1172
1173static struct clksrc_clk exynos4_clk_sclk_uart2 = {
1174 .clk = {
1175 .name = "uclk1",
1176 .devname = "exynos4210-uart.2",
1177 .enable = exynos4_clksrc_mask_peril0_ctrl,
1178 .ctrlbit = (1 << 8),
1179 },
1180 .sources = &exynos4_clkset_group,
1181 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1182 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1183};
1184
1185static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1186 .clk = {
1187 .name = "uclk1",
1188 .devname = "exynos4210-uart.3",
1189 .enable = exynos4_clksrc_mask_peril0_ctrl,
1190 .ctrlbit = (1 << 12),
1191 },
1192 .sources = &exynos4_clkset_group,
1193 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1194 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1195};
1196
1197static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1198 .clk = {
1199 .name = "sclk_mmc",
1200 .devname = "s3c-sdhci.0",
1201 .parent = &exynos4_clk_dout_mmc0.clk,
1202 .enable = exynos4_clksrc_mask_fsys_ctrl,
1203 .ctrlbit = (1 << 0),
1204 },
1205 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1206};
1207
1208static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1209 .clk = {
1210 .name = "sclk_mmc",
1211 .devname = "s3c-sdhci.1",
1212 .parent = &exynos4_clk_dout_mmc1.clk,
1213 .enable = exynos4_clksrc_mask_fsys_ctrl,
1214 .ctrlbit = (1 << 4),
1215 },
1216 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1217};
1218
1219static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1220 .clk = {
1221 .name = "sclk_mmc",
1222 .devname = "s3c-sdhci.2",
1223 .parent = &exynos4_clk_dout_mmc2.clk,
1224 .enable = exynos4_clksrc_mask_fsys_ctrl,
1225 .ctrlbit = (1 << 8),
1226 },
1227 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1228};
1229
1230static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1231 .clk = {
1232 .name = "sclk_mmc",
1233 .devname = "s3c-sdhci.3",
1234 .parent = &exynos4_clk_dout_mmc3.clk,
1235 .enable = exynos4_clksrc_mask_fsys_ctrl,
1236 .ctrlbit = (1 << 12),
1237 },
1238 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1239};
1240
1241static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1242 .clk = {
1243 .name = "sclk_spi",
1244 .devname = "s3c64xx-spi.0",
1245 .enable = exynos4_clksrc_mask_peril1_ctrl,
1246 .ctrlbit = (1 << 16),
1247 },
1248 .sources = &exynos4_clkset_group,
1249 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1250 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1251};
1252
1253static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1254 .clk = {
1255 .name = "sclk_spi",
1256 .devname = "s3c64xx-spi.1",
1257 .enable = exynos4_clksrc_mask_peril1_ctrl,
1258 .ctrlbit = (1 << 20),
1259 },
1260 .sources = &exynos4_clkset_group,
1261 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1262 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1263};
1264
1265static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1266 .clk = {
1267 .name = "sclk_spi",
1268 .devname = "s3c64xx-spi.2",
1269 .enable = exynos4_clksrc_mask_peril1_ctrl,
1270 .ctrlbit = (1 << 24),
1271 },
1272 .sources = &exynos4_clkset_group,
1273 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1274 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1275};
1276
1277/* Clock initialization code */
1278static struct clksrc_clk *exynos4_sysclks[] = {
1279 &exynos4_clk_mout_apll,
1280 &exynos4_clk_sclk_apll,
1281 &exynos4_clk_mout_epll,
1282 &exynos4_clk_mout_mpll,
1283 &exynos4_clk_moutcore,
1284 &exynos4_clk_coreclk,
1285 &exynos4_clk_armclk,
1286 &exynos4_clk_aclk_corem0,
1287 &exynos4_clk_aclk_cores,
1288 &exynos4_clk_aclk_corem1,
1289 &exynos4_clk_periphclk,
1290 &exynos4_clk_mout_corebus,
1291 &exynos4_clk_sclk_dmc,
1292 &exynos4_clk_aclk_cored,
1293 &exynos4_clk_aclk_corep,
1294 &exynos4_clk_aclk_acp,
1295 &exynos4_clk_pclk_acp,
1296 &exynos4_clk_vpllsrc,
1297 &exynos4_clk_sclk_vpll,
1298 &exynos4_clk_aclk_200,
1299 &exynos4_clk_aclk_100,
1300 &exynos4_clk_aclk_160,
1301 &exynos4_clk_aclk_133,
1302 &exynos4_clk_dout_mmc0,
1303 &exynos4_clk_dout_mmc1,
1304 &exynos4_clk_dout_mmc2,
1305 &exynos4_clk_dout_mmc3,
1306 &exynos4_clk_dout_mmc4,
1307 &exynos4_clk_mout_mfc0,
1308 &exynos4_clk_mout_mfc1,
1309};
1310
1311static struct clk *exynos4_clk_cdev[] = {
1312 &exynos4_clk_pdma0,
1313 &exynos4_clk_pdma1,
1314 &exynos4_clk_mdma1,
1315 &exynos4_clk_fimd0,
1316};
1317
1318static struct clksrc_clk *exynos4_clksrc_cdev[] = {
1319 &exynos4_clk_sclk_uart0,
1320 &exynos4_clk_sclk_uart1,
1321 &exynos4_clk_sclk_uart2,
1322 &exynos4_clk_sclk_uart3,
1323 &exynos4_clk_sclk_mmc0,
1324 &exynos4_clk_sclk_mmc1,
1325 &exynos4_clk_sclk_mmc2,
1326 &exynos4_clk_sclk_mmc3,
1327 &exynos4_clk_sclk_spi0,
1328 &exynos4_clk_sclk_spi1,
1329 &exynos4_clk_sclk_spi2,
1330
1331};
1332
1333static struct clk_lookup exynos4_clk_lookup[] = {
1334 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk),
1335 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
1336 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
1337 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
1338 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
1339 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1340 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1341 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1342 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0),
1343 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1344 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1345 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
1346 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
1347 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
1348 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
1349};
1350
1351static int xtal_rate;
1352
1353static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1354{
1355 if (soc_is_exynos4210())
1356 return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0),
1357 pll_4508);
1358 else if (soc_is_exynos4212() || soc_is_exynos4412())
1359 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0));
1360 else
1361 return 0;
1362}
1363
1364static struct clk_ops exynos4_fout_apll_ops = {
1365 .get_rate = exynos4_fout_apll_get_rate,
1366};
1367
1368static u32 exynos4_vpll_div[][8] = {
1369 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1370 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1371};
1372
1373static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1374{
1375 return clk->rate;
1376}
1377
1378static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1379{
1380 unsigned int vpll_con0, vpll_con1 = 0;
1381 unsigned int i;
1382
1383 /* Return if nothing changed */
1384 if (clk->rate == rate)
1385 return 0;
1386
1387 vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0);
1388 vpll_con0 &= ~(0x1 << 27 | \
1389 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1390 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1391 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1392
1393 vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1);
1394 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1395 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1396 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1397
1398 for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) {
1399 if (exynos4_vpll_div[i][0] == rate) {
1400 vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1401 vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1402 vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1403 vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1404 vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1405 vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1406 vpll_con0 |= exynos4_vpll_div[i][7] << 27;
1407 break;
1408 }
1409 }
1410
1411 if (i == ARRAY_SIZE(exynos4_vpll_div)) {
1412 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1413 __func__);
1414 return -EINVAL;
1415 }
1416
1417 __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0);
1418 __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1);
1419
1420 /* Wait for VPLL lock */
1421 while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1422 continue;
1423
1424 clk->rate = rate;
1425 return 0;
1426}
1427
1428static struct clk_ops exynos4_vpll_ops = {
1429 .get_rate = exynos4_vpll_get_rate,
1430 .set_rate = exynos4_vpll_set_rate,
1431};
1432
1433void __init_or_cpufreq exynos4_setup_clocks(void)
1434{
1435 struct clk *xtal_clk;
1436 unsigned long apll = 0;
1437 unsigned long mpll = 0;
1438 unsigned long epll = 0;
1439 unsigned long vpll = 0;
1440 unsigned long vpllsrc;
1441 unsigned long xtal;
1442 unsigned long armclk;
1443 unsigned long sclk_dmc;
1444 unsigned long aclk_200;
1445 unsigned long aclk_100;
1446 unsigned long aclk_160;
1447 unsigned long aclk_133;
1448 unsigned int ptr;
1449
1450 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1451
1452 xtal_clk = clk_get(NULL, "xtal");
1453 BUG_ON(IS_ERR(xtal_clk));
1454
1455 xtal = clk_get_rate(xtal_clk);
1456
1457 xtal_rate = xtal;
1458
1459 clk_put(xtal_clk);
1460
1461 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1462
1463 if (soc_is_exynos4210()) {
1464 apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0),
1465 pll_4508);
1466 mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0),
1467 pll_4508);
1468 epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1469 __raw_readl(EXYNOS4_EPLL_CON1), pll_4600);
1470
1471 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1472 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1473 __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c);
1474 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1475 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0));
1476 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0));
1477 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1478 __raw_readl(EXYNOS4_EPLL_CON1));
1479
1480 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1481 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1482 __raw_readl(EXYNOS4_VPLL_CON1));
1483 } else {
1484 /* nothing */
1485 }
1486
1487 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1488 clk_fout_mpll.rate = mpll;
1489 clk_fout_epll.rate = epll;
1490 clk_fout_vpll.ops = &exynos4_vpll_ops;
1491 clk_fout_vpll.rate = vpll;
1492
1493 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1494 apll, mpll, epll, vpll);
1495
1496 armclk = clk_get_rate(&exynos4_clk_armclk.clk);
1497 sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk);
1498
1499 aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk);
1500 aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk);
1501 aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk);
1502 aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk);
1503
1504 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1505 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1506 armclk, sclk_dmc, aclk_200,
1507 aclk_100, aclk_160, aclk_133);
1508
1509 clk_f.rate = armclk;
1510 clk_h.rate = sclk_dmc;
1511 clk_p.rate = aclk_100;
1512
1513 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++)
1514 s3c_set_clksrc(&exynos4_clksrcs[ptr], true);
1515}
1516
1517static struct clk *exynos4_clks[] __initdata = {
1518 &exynos4_clk_sclk_hdmi27m,
1519 &exynos4_clk_sclk_hdmiphy,
1520 &exynos4_clk_sclk_usbphy0,
1521 &exynos4_clk_sclk_usbphy1,
1522};
1523
1524#ifdef CONFIG_PM_SLEEP
1525static int exynos4_clock_suspend(void)
1526{
1527 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1528 return 0;
1529}
1530
1531static void exynos4_clock_resume(void)
1532{
1533 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1534}
1535
1536#else
1537#define exynos4_clock_suspend NULL
1538#define exynos4_clock_resume NULL
1539#endif
1540
1541static struct syscore_ops exynos4_clock_syscore_ops = {
1542 .suspend = exynos4_clock_suspend,
1543 .resume = exynos4_clock_resume,
1544};
1545
1546void __init exynos4_register_clocks(void)
1547{
1548 int ptr;
1549
1550 s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks));
1551
1552 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++)
1553 s3c_register_clksrc(exynos4_sysclks[ptr], 1);
1554
1555 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++)
1556 s3c_register_clksrc(exynos4_sclk_tv[ptr], 1);
1557
1558 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
1559 s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1);
1560
1561 s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs));
1562 s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on));
1563
1564 s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev));
1565 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++)
1566 s3c_disable_clocks(exynos4_clk_cdev[ptr], 1);
1567
1568 s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1569 s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1570 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1571
1572 register_syscore_ops(&exynos4_clock_syscore_ops);
1573 s3c24xx_register_clock(&dummy_apb_pclk);
1574
1575 s3c_pwmclk_init();
1576}
diff --git a/arch/arm/mach-exynos/clock-exynos4.h b/arch/arm/mach-exynos/clock-exynos4.h
new file mode 100644
index 000000000000..cb71c29c14d1
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for exynos4 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_CLOCK_H
13#define __ASM_ARCH_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk exynos4_clk_aclk_133;
18extern struct clksrc_clk exynos4_clk_mout_mpll;
19
20extern struct clksrc_sources exynos4_clkset_mout_corebus;
21extern struct clksrc_sources exynos4_clkset_group;
22
23extern struct clk *exynos4_clkset_aclk_top_list[];
24extern struct clk *exynos4_clkset_group_list[];
25
26extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
27extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
28extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
29
30#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c
index 13312ccb2d93..3b131e4b6ef5 100644
--- a/arch/arm/mach-exynos/clock-exynos4210.c
+++ b/arch/arm/mach-exynos/clock-exynos4210.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4210.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4210 - Clock support 5 * EXYNOS4210 - Clock support
@@ -28,20 +26,20 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4210_clock_save[] = { 34static struct sleep_save exynos4210_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKSRC_LCD1), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKDIV_IMAGE), 37 SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1),
40 SAVE_ITEM(S5P_CLKDIV_LCD1), 38 SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1),
41 SAVE_ITEM(S5P_CLKSRC_MASK_LCD1), 39 SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1),
42 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4210), 40 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE),
43 SAVE_ITEM(S5P_CLKGATE_IP_LCD1), 41 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1),
44 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4210), 42 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR),
45}; 43};
46#endif 44#endif
47 45
@@ -51,7 +49,7 @@ static struct clksrc_clk *sysclks[] = {
51 49
52static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) 50static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
53{ 51{
54 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); 52 return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable);
55} 53}
56 54
57static struct clksrc_clk clksrcs[] = { 55static struct clksrc_clk clksrcs[] = {
@@ -62,9 +60,9 @@ static struct clksrc_clk clksrcs[] = {
62 .enable = exynos4_clksrc_mask_fsys_ctrl, 60 .enable = exynos4_clksrc_mask_fsys_ctrl,
63 .ctrlbit = (1 << 24), 61 .ctrlbit = (1 << 24),
64 }, 62 },
65 .sources = &clkset_mout_corebus, 63 .sources = &exynos4_clkset_mout_corebus,
66 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, 64 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 },
67 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, 65 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 },
68 }, { 66 }, {
69 .clk = { 67 .clk = {
70 .name = "sclk_fimd", 68 .name = "sclk_fimd",
@@ -72,9 +70,9 @@ static struct clksrc_clk clksrcs[] = {
72 .enable = exynos4_clksrc_mask_lcd1_ctrl, 70 .enable = exynos4_clksrc_mask_lcd1_ctrl,
73 .ctrlbit = (1 << 0), 71 .ctrlbit = (1 << 0),
74 }, 72 },
75 .sources = &clkset_group, 73 .sources = &exynos4_clkset_group,
76 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, 74 .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 },
77 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, 75 .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 },
78 }, 76 },
79}; 77};
80 78
@@ -82,13 +80,13 @@ static struct clk init_clocks_off[] = {
82 { 80 {
83 .name = "sataphy", 81 .name = "sataphy",
84 .id = -1, 82 .id = -1,
85 .parent = &clk_aclk_133.clk, 83 .parent = &exynos4_clk_aclk_133.clk,
86 .enable = exynos4_clk_ip_fsys_ctrl, 84 .enable = exynos4_clk_ip_fsys_ctrl,
87 .ctrlbit = (1 << 3), 85 .ctrlbit = (1 << 3),
88 }, { 86 }, {
89 .name = "sata", 87 .name = "sata",
90 .id = -1, 88 .id = -1,
91 .parent = &clk_aclk_133.clk, 89 .parent = &exynos4_clk_aclk_133.clk,
92 .enable = exynos4_clk_ip_fsys_ctrl, 90 .enable = exynos4_clk_ip_fsys_ctrl,
93 .ctrlbit = (1 << 10), 91 .ctrlbit = (1 << 10),
94 }, { 92 }, {
@@ -117,7 +115,7 @@ static void exynos4210_clock_resume(void)
117#define exynos4210_clock_resume NULL 115#define exynos4210_clock_resume NULL
118#endif 116#endif
119 117
120struct syscore_ops exynos4210_clock_syscore_ops = { 118static struct syscore_ops exynos4210_clock_syscore_ops = {
121 .suspend = exynos4210_clock_suspend, 119 .suspend = exynos4210_clock_suspend,
122 .resume = exynos4210_clock_resume, 120 .resume = exynos4210_clock_resume,
123}; 121};
@@ -126,9 +124,9 @@ void __init exynos4210_register_clocks(void)
126{ 124{
127 int ptr; 125 int ptr;
128 126
129 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_CPU; 127 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU;
130 clk_mout_mpll.reg_src.shift = 8; 128 exynos4_clk_mout_mpll.reg_src.shift = 8;
131 clk_mout_mpll.reg_src.size = 1; 129 exynos4_clk_mout_mpll.reg_src.size = 1;
132 130
133 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 131 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
134 s3c_register_clksrc(sysclks[ptr], 1); 132 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c
index 48af28566fa1..3ecc01e06f74 100644
--- a/arch/arm/mach-exynos/clock-exynos4212.c
+++ b/arch/arm/mach-exynos/clock-exynos4212.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4212.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4212 - Clock support 5 * EXYNOS4212 - Clock support
@@ -28,22 +26,22 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4212_clock_save[] = { 34static struct sleep_save exynos4212_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKDIV_IMAGE), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4212), 37 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE),
40 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4212), 38 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR),
41}; 39};
42#endif 40#endif
43 41
44static struct clk *clk_src_mpll_user_list[] = { 42static struct clk *clk_src_mpll_user_list[] = {
45 [0] = &clk_fin_mpll, 43 [0] = &clk_fin_mpll,
46 [1] = &clk_mout_mpll.clk, 44 [1] = &exynos4_clk_mout_mpll.clk,
47}; 45};
48 46
49static struct clksrc_sources clk_src_mpll_user = { 47static struct clksrc_sources clk_src_mpll_user = {
@@ -56,7 +54,7 @@ static struct clksrc_clk clk_mout_mpll_user = {
56 .name = "mout_mpll_user", 54 .name = "mout_mpll_user",
57 }, 55 },
58 .sources = &clk_src_mpll_user, 56 .sources = &clk_src_mpll_user,
59 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 24, .size = 1 }, 57 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 },
60}; 58};
61 59
62static struct clksrc_clk *sysclks[] = { 60static struct clksrc_clk *sysclks[] = {
@@ -89,7 +87,7 @@ static void exynos4212_clock_resume(void)
89#define exynos4212_clock_resume NULL 87#define exynos4212_clock_resume NULL
90#endif 88#endif
91 89
92struct syscore_ops exynos4212_clock_syscore_ops = { 90static struct syscore_ops exynos4212_clock_syscore_ops = {
93 .suspend = exynos4212_clock_suspend, 91 .suspend = exynos4212_clock_suspend,
94 .resume = exynos4212_clock_resume, 92 .resume = exynos4212_clock_resume,
95}; 93};
@@ -99,15 +97,15 @@ void __init exynos4212_register_clocks(void)
99 int ptr; 97 int ptr;
100 98
101 /* usbphy1 is removed */ 99 /* usbphy1 is removed */
102 clkset_group_list[4] = NULL; 100 exynos4_clkset_group_list[4] = NULL;
103 101
104 /* mout_mpll_user is used */ 102 /* mout_mpll_user is used */
105 clkset_group_list[6] = &clk_mout_mpll_user.clk; 103 exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk;
106 clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; 104 exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk;
107 105
108 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_DMC; 106 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC;
109 clk_mout_mpll.reg_src.shift = 12; 107 exynos4_clk_mout_mpll.reg_src.shift = 12;
110 clk_mout_mpll.reg_src.size = 1; 108 exynos4_clk_mout_mpll.reg_src.size = 1;
111 109
112 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 110 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
113 s3c_register_clksrc(sysclks[ptr], 1); 111 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
new file mode 100644
index 000000000000..d013982d0f8e
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -0,0 +1,1247 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Clock support for EXYNOS5 SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27#include <mach/sysmmu.h>
28
29#include "common.h"
30
31#ifdef CONFIG_PM_SLEEP
32static struct sleep_save exynos5_clock_save[] = {
33 /* will be implemented */
34};
35#endif
36
37static struct clk exynos5_clk_sclk_dptxphy = {
38 .name = "sclk_dptx",
39};
40
41static struct clk exynos5_clk_sclk_hdmi24m = {
42 .name = "sclk_hdmi24m",
43 .rate = 24000000,
44};
45
46static struct clk exynos5_clk_sclk_hdmi27m = {
47 .name = "sclk_hdmi27m",
48 .rate = 27000000,
49};
50
51static struct clk exynos5_clk_sclk_hdmiphy = {
52 .name = "sclk_hdmiphy",
53};
54
55static struct clk exynos5_clk_sclk_usbphy = {
56 .name = "sclk_usbphy",
57 .rate = 48000000,
58};
59
60static int exynos5_clksrc_mask_top_ctrl(struct clk *clk, int enable)
61{
62 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP, clk, enable);
63}
64
65static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk *clk, int enable)
66{
67 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0, clk, enable);
68}
69
70static int exynos5_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
71{
72 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS, clk, enable);
73}
74
75static int exynos5_clksrc_mask_gscl_ctrl(struct clk *clk, int enable)
76{
77 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL, clk, enable);
78}
79
80static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable)
81{
82 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable);
83}
84
85static int exynos5_clk_ip_core_ctrl(struct clk *clk, int enable)
86{
87 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE, clk, enable);
88}
89
90static int exynos5_clk_ip_disp1_ctrl(struct clk *clk, int enable)
91{
92 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1, clk, enable);
93}
94
95static int exynos5_clk_ip_fsys_ctrl(struct clk *clk, int enable)
96{
97 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS, clk, enable);
98}
99
100static int exynos5_clk_block_ctrl(struct clk *clk, int enable)
101{
102 return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK, clk, enable);
103}
104
105static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable)
106{
107 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable);
108}
109
110static int exynos5_clk_ip_gps_ctrl(struct clk *clk, int enable)
111{
112 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GPS, clk, enable);
113}
114
115static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable)
116{
117 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable);
118}
119
120static int exynos5_clk_ip_peric_ctrl(struct clk *clk, int enable)
121{
122 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC, clk, enable);
123}
124
125static int exynos5_clk_ip_peris_ctrl(struct clk *clk, int enable)
126{
127 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS, clk, enable);
128}
129
130/* Core list of CMU_CPU side */
131
132static struct clksrc_clk exynos5_clk_mout_apll = {
133 .clk = {
134 .name = "mout_apll",
135 },
136 .sources = &clk_src_apll,
137 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 0, .size = 1 },
138};
139
140static struct clksrc_clk exynos5_clk_sclk_apll = {
141 .clk = {
142 .name = "sclk_apll",
143 .parent = &exynos5_clk_mout_apll.clk,
144 },
145 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 24, .size = 3 },
146};
147
148static struct clksrc_clk exynos5_clk_mout_bpll = {
149 .clk = {
150 .name = "mout_bpll",
151 },
152 .sources = &clk_src_bpll,
153 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 0, .size = 1 },
154};
155
156static struct clk *exynos5_clk_src_bpll_user_list[] = {
157 [0] = &clk_fin_mpll,
158 [1] = &exynos5_clk_mout_bpll.clk,
159};
160
161static struct clksrc_sources exynos5_clk_src_bpll_user = {
162 .sources = exynos5_clk_src_bpll_user_list,
163 .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_user_list),
164};
165
166static struct clksrc_clk exynos5_clk_mout_bpll_user = {
167 .clk = {
168 .name = "mout_bpll_user",
169 },
170 .sources = &exynos5_clk_src_bpll_user,
171 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 24, .size = 1 },
172};
173
174static struct clksrc_clk exynos5_clk_mout_cpll = {
175 .clk = {
176 .name = "mout_cpll",
177 },
178 .sources = &clk_src_cpll,
179 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 8, .size = 1 },
180};
181
182static struct clksrc_clk exynos5_clk_mout_epll = {
183 .clk = {
184 .name = "mout_epll",
185 },
186 .sources = &clk_src_epll,
187 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 12, .size = 1 },
188};
189
190struct clksrc_clk exynos5_clk_mout_mpll = {
191 .clk = {
192 .name = "mout_mpll",
193 },
194 .sources = &clk_src_mpll,
195 .reg_src = { .reg = EXYNOS5_CLKSRC_CORE1, .shift = 8, .size = 1 },
196};
197
198static struct clk *exynos_clkset_vpllsrc_list[] = {
199 [0] = &clk_fin_vpll,
200 [1] = &exynos5_clk_sclk_hdmi27m,
201};
202
203static struct clksrc_sources exynos5_clkset_vpllsrc = {
204 .sources = exynos_clkset_vpllsrc_list,
205 .nr_sources = ARRAY_SIZE(exynos_clkset_vpllsrc_list),
206};
207
208static struct clksrc_clk exynos5_clk_vpllsrc = {
209 .clk = {
210 .name = "vpll_src",
211 .enable = exynos5_clksrc_mask_top_ctrl,
212 .ctrlbit = (1 << 0),
213 },
214 .sources = &exynos5_clkset_vpllsrc,
215 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 0, .size = 1 },
216};
217
218static struct clk *exynos5_clkset_sclk_vpll_list[] = {
219 [0] = &exynos5_clk_vpllsrc.clk,
220 [1] = &clk_fout_vpll,
221};
222
223static struct clksrc_sources exynos5_clkset_sclk_vpll = {
224 .sources = exynos5_clkset_sclk_vpll_list,
225 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_vpll_list),
226};
227
228static struct clksrc_clk exynos5_clk_sclk_vpll = {
229 .clk = {
230 .name = "sclk_vpll",
231 },
232 .sources = &exynos5_clkset_sclk_vpll,
233 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 16, .size = 1 },
234};
235
236static struct clksrc_clk exynos5_clk_sclk_pixel = {
237 .clk = {
238 .name = "sclk_pixel",
239 .parent = &exynos5_clk_sclk_vpll.clk,
240 },
241 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 28, .size = 4 },
242};
243
244static struct clk *exynos5_clkset_sclk_hdmi_list[] = {
245 [0] = &exynos5_clk_sclk_pixel.clk,
246 [1] = &exynos5_clk_sclk_hdmiphy,
247};
248
249static struct clksrc_sources exynos5_clkset_sclk_hdmi = {
250 .sources = exynos5_clkset_sclk_hdmi_list,
251 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list),
252};
253
254static struct clksrc_clk exynos5_clk_sclk_hdmi = {
255 .clk = {
256 .name = "sclk_hdmi",
257 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
258 .ctrlbit = (1 << 20),
259 },
260 .sources = &exynos5_clkset_sclk_hdmi,
261 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 20, .size = 1 },
262};
263
264static struct clksrc_clk *exynos5_sclk_tv[] = {
265 &exynos5_clk_sclk_pixel,
266 &exynos5_clk_sclk_hdmi,
267};
268
269static struct clk *exynos5_clk_src_mpll_user_list[] = {
270 [0] = &clk_fin_mpll,
271 [1] = &exynos5_clk_mout_mpll.clk,
272};
273
274static struct clksrc_sources exynos5_clk_src_mpll_user = {
275 .sources = exynos5_clk_src_mpll_user_list,
276 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_user_list),
277};
278
279static struct clksrc_clk exynos5_clk_mout_mpll_user = {
280 .clk = {
281 .name = "mout_mpll_user",
282 },
283 .sources = &exynos5_clk_src_mpll_user,
284 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 20, .size = 1 },
285};
286
287static struct clk *exynos5_clkset_mout_cpu_list[] = {
288 [0] = &exynos5_clk_mout_apll.clk,
289 [1] = &exynos5_clk_mout_mpll.clk,
290};
291
292static struct clksrc_sources exynos5_clkset_mout_cpu = {
293 .sources = exynos5_clkset_mout_cpu_list,
294 .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_cpu_list),
295};
296
297static struct clksrc_clk exynos5_clk_mout_cpu = {
298 .clk = {
299 .name = "mout_cpu",
300 },
301 .sources = &exynos5_clkset_mout_cpu,
302 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 16, .size = 1 },
303};
304
305static struct clksrc_clk exynos5_clk_dout_armclk = {
306 .clk = {
307 .name = "dout_armclk",
308 .parent = &exynos5_clk_mout_cpu.clk,
309 },
310 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 0, .size = 3 },
311};
312
313static struct clksrc_clk exynos5_clk_dout_arm2clk = {
314 .clk = {
315 .name = "dout_arm2clk",
316 .parent = &exynos5_clk_dout_armclk.clk,
317 },
318 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 28, .size = 3 },
319};
320
321static struct clk exynos5_clk_armclk = {
322 .name = "armclk",
323 .parent = &exynos5_clk_dout_arm2clk.clk,
324};
325
326/* Core list of CMU_CDREX side */
327
328static struct clk *exynos5_clkset_cdrex_list[] = {
329 [0] = &exynos5_clk_mout_mpll.clk,
330 [1] = &exynos5_clk_mout_bpll.clk,
331};
332
333static struct clksrc_sources exynos5_clkset_cdrex = {
334 .sources = exynos5_clkset_cdrex_list,
335 .nr_sources = ARRAY_SIZE(exynos5_clkset_cdrex_list),
336};
337
338static struct clksrc_clk exynos5_clk_cdrex = {
339 .clk = {
340 .name = "clk_cdrex",
341 },
342 .sources = &exynos5_clkset_cdrex,
343 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 4, .size = 1 },
344 .reg_div = { .reg = EXYNOS5_CLKDIV_CDREX, .shift = 16, .size = 3 },
345};
346
347static struct clksrc_clk exynos5_clk_aclk_acp = {
348 .clk = {
349 .name = "aclk_acp",
350 .parent = &exynos5_clk_mout_mpll.clk,
351 },
352 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 0, .size = 3 },
353};
354
355static struct clksrc_clk exynos5_clk_pclk_acp = {
356 .clk = {
357 .name = "pclk_acp",
358 .parent = &exynos5_clk_aclk_acp.clk,
359 },
360 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 4, .size = 3 },
361};
362
363/* Core list of CMU_TOP side */
364
365struct clk *exynos5_clkset_aclk_top_list[] = {
366 [0] = &exynos5_clk_mout_mpll_user.clk,
367 [1] = &exynos5_clk_mout_bpll_user.clk,
368};
369
370struct clksrc_sources exynos5_clkset_aclk = {
371 .sources = exynos5_clkset_aclk_top_list,
372 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list),
373};
374
375static struct clksrc_clk exynos5_clk_aclk_400 = {
376 .clk = {
377 .name = "aclk_400",
378 },
379 .sources = &exynos5_clkset_aclk,
380 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
381 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
382};
383
384struct clk *exynos5_clkset_aclk_333_166_list[] = {
385 [0] = &exynos5_clk_mout_cpll.clk,
386 [1] = &exynos5_clk_mout_mpll_user.clk,
387};
388
389struct clksrc_sources exynos5_clkset_aclk_333_166 = {
390 .sources = exynos5_clkset_aclk_333_166_list,
391 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list),
392};
393
394static struct clksrc_clk exynos5_clk_aclk_333 = {
395 .clk = {
396 .name = "aclk_333",
397 },
398 .sources = &exynos5_clkset_aclk_333_166,
399 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 16, .size = 1 },
400 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 20, .size = 3 },
401};
402
403static struct clksrc_clk exynos5_clk_aclk_166 = {
404 .clk = {
405 .name = "aclk_166",
406 },
407 .sources = &exynos5_clkset_aclk_333_166,
408 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 8, .size = 1 },
409 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 8, .size = 3 },
410};
411
412static struct clksrc_clk exynos5_clk_aclk_266 = {
413 .clk = {
414 .name = "aclk_266",
415 .parent = &exynos5_clk_mout_mpll_user.clk,
416 },
417 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 16, .size = 3 },
418};
419
420static struct clksrc_clk exynos5_clk_aclk_200 = {
421 .clk = {
422 .name = "aclk_200",
423 },
424 .sources = &exynos5_clkset_aclk,
425 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 12, .size = 1 },
426 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 12, .size = 3 },
427};
428
429static struct clksrc_clk exynos5_clk_aclk_66_pre = {
430 .clk = {
431 .name = "aclk_66_pre",
432 .parent = &exynos5_clk_mout_mpll_user.clk,
433 },
434 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP1, .shift = 24, .size = 3 },
435};
436
437static struct clksrc_clk exynos5_clk_aclk_66 = {
438 .clk = {
439 .name = "aclk_66",
440 .parent = &exynos5_clk_aclk_66_pre.clk,
441 },
442 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 },
443};
444
445static struct clk exynos5_init_clocks_off[] = {
446 {
447 .name = "timers",
448 .parent = &exynos5_clk_aclk_66.clk,
449 .enable = exynos5_clk_ip_peric_ctrl,
450 .ctrlbit = (1 << 24),
451 }, {
452 .name = "rtc",
453 .parent = &exynos5_clk_aclk_66.clk,
454 .enable = exynos5_clk_ip_peris_ctrl,
455 .ctrlbit = (1 << 20),
456 }, {
457 .name = "hsmmc",
458 .devname = "s3c-sdhci.0",
459 .parent = &exynos5_clk_aclk_200.clk,
460 .enable = exynos5_clk_ip_fsys_ctrl,
461 .ctrlbit = (1 << 12),
462 }, {
463 .name = "hsmmc",
464 .devname = "s3c-sdhci.1",
465 .parent = &exynos5_clk_aclk_200.clk,
466 .enable = exynos5_clk_ip_fsys_ctrl,
467 .ctrlbit = (1 << 13),
468 }, {
469 .name = "hsmmc",
470 .devname = "s3c-sdhci.2",
471 .parent = &exynos5_clk_aclk_200.clk,
472 .enable = exynos5_clk_ip_fsys_ctrl,
473 .ctrlbit = (1 << 14),
474 }, {
475 .name = "hsmmc",
476 .devname = "s3c-sdhci.3",
477 .parent = &exynos5_clk_aclk_200.clk,
478 .enable = exynos5_clk_ip_fsys_ctrl,
479 .ctrlbit = (1 << 15),
480 }, {
481 .name = "dwmci",
482 .parent = &exynos5_clk_aclk_200.clk,
483 .enable = exynos5_clk_ip_fsys_ctrl,
484 .ctrlbit = (1 << 16),
485 }, {
486 .name = "sata",
487 .devname = "ahci",
488 .enable = exynos5_clk_ip_fsys_ctrl,
489 .ctrlbit = (1 << 6),
490 }, {
491 .name = "sata_phy",
492 .enable = exynos5_clk_ip_fsys_ctrl,
493 .ctrlbit = (1 << 24),
494 }, {
495 .name = "sata_phy_i2c",
496 .enable = exynos5_clk_ip_fsys_ctrl,
497 .ctrlbit = (1 << 25),
498 }, {
499 .name = "mfc",
500 .devname = "s5p-mfc",
501 .enable = exynos5_clk_ip_mfc_ctrl,
502 .ctrlbit = (1 << 0),
503 }, {
504 .name = "hdmi",
505 .devname = "exynos4-hdmi",
506 .enable = exynos5_clk_ip_disp1_ctrl,
507 .ctrlbit = (1 << 6),
508 }, {
509 .name = "mixer",
510 .devname = "s5p-mixer",
511 .enable = exynos5_clk_ip_disp1_ctrl,
512 .ctrlbit = (1 << 5),
513 }, {
514 .name = "jpeg",
515 .enable = exynos5_clk_ip_gen_ctrl,
516 .ctrlbit = (1 << 2),
517 }, {
518 .name = "dsim0",
519 .enable = exynos5_clk_ip_disp1_ctrl,
520 .ctrlbit = (1 << 3),
521 }, {
522 .name = "iis",
523 .devname = "samsung-i2s.1",
524 .enable = exynos5_clk_ip_peric_ctrl,
525 .ctrlbit = (1 << 20),
526 }, {
527 .name = "iis",
528 .devname = "samsung-i2s.2",
529 .enable = exynos5_clk_ip_peric_ctrl,
530 .ctrlbit = (1 << 21),
531 }, {
532 .name = "pcm",
533 .devname = "samsung-pcm.1",
534 .enable = exynos5_clk_ip_peric_ctrl,
535 .ctrlbit = (1 << 22),
536 }, {
537 .name = "pcm",
538 .devname = "samsung-pcm.2",
539 .enable = exynos5_clk_ip_peric_ctrl,
540 .ctrlbit = (1 << 23),
541 }, {
542 .name = "spdif",
543 .devname = "samsung-spdif",
544 .enable = exynos5_clk_ip_peric_ctrl,
545 .ctrlbit = (1 << 26),
546 }, {
547 .name = "ac97",
548 .devname = "samsung-ac97",
549 .enable = exynos5_clk_ip_peric_ctrl,
550 .ctrlbit = (1 << 27),
551 }, {
552 .name = "usbhost",
553 .enable = exynos5_clk_ip_fsys_ctrl ,
554 .ctrlbit = (1 << 18),
555 }, {
556 .name = "usbotg",
557 .enable = exynos5_clk_ip_fsys_ctrl,
558 .ctrlbit = (1 << 7),
559 }, {
560 .name = "gps",
561 .enable = exynos5_clk_ip_gps_ctrl,
562 .ctrlbit = ((1 << 3) | (1 << 2) | (1 << 0)),
563 }, {
564 .name = "nfcon",
565 .enable = exynos5_clk_ip_fsys_ctrl,
566 .ctrlbit = (1 << 22),
567 }, {
568 .name = "iop",
569 .enable = exynos5_clk_ip_fsys_ctrl,
570 .ctrlbit = ((1 << 30) | (1 << 26) | (1 << 23)),
571 }, {
572 .name = "core_iop",
573 .enable = exynos5_clk_ip_core_ctrl,
574 .ctrlbit = ((1 << 21) | (1 << 3)),
575 }, {
576 .name = "mcu_iop",
577 .enable = exynos5_clk_ip_fsys_ctrl,
578 .ctrlbit = (1 << 0),
579 }, {
580 .name = "i2c",
581 .devname = "s3c2440-i2c.0",
582 .parent = &exynos5_clk_aclk_66.clk,
583 .enable = exynos5_clk_ip_peric_ctrl,
584 .ctrlbit = (1 << 6),
585 }, {
586 .name = "i2c",
587 .devname = "s3c2440-i2c.1",
588 .parent = &exynos5_clk_aclk_66.clk,
589 .enable = exynos5_clk_ip_peric_ctrl,
590 .ctrlbit = (1 << 7),
591 }, {
592 .name = "i2c",
593 .devname = "s3c2440-i2c.2",
594 .parent = &exynos5_clk_aclk_66.clk,
595 .enable = exynos5_clk_ip_peric_ctrl,
596 .ctrlbit = (1 << 8),
597 }, {
598 .name = "i2c",
599 .devname = "s3c2440-i2c.3",
600 .parent = &exynos5_clk_aclk_66.clk,
601 .enable = exynos5_clk_ip_peric_ctrl,
602 .ctrlbit = (1 << 9),
603 }, {
604 .name = "i2c",
605 .devname = "s3c2440-i2c.4",
606 .parent = &exynos5_clk_aclk_66.clk,
607 .enable = exynos5_clk_ip_peric_ctrl,
608 .ctrlbit = (1 << 10),
609 }, {
610 .name = "i2c",
611 .devname = "s3c2440-i2c.5",
612 .parent = &exynos5_clk_aclk_66.clk,
613 .enable = exynos5_clk_ip_peric_ctrl,
614 .ctrlbit = (1 << 11),
615 }, {
616 .name = "i2c",
617 .devname = "s3c2440-i2c.6",
618 .parent = &exynos5_clk_aclk_66.clk,
619 .enable = exynos5_clk_ip_peric_ctrl,
620 .ctrlbit = (1 << 12),
621 }, {
622 .name = "i2c",
623 .devname = "s3c2440-i2c.7",
624 .parent = &exynos5_clk_aclk_66.clk,
625 .enable = exynos5_clk_ip_peric_ctrl,
626 .ctrlbit = (1 << 13),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-hdmiphy-i2c",
630 .parent = &exynos5_clk_aclk_66.clk,
631 .enable = exynos5_clk_ip_peric_ctrl,
632 .ctrlbit = (1 << 14),
633 }
634};
635
636static struct clk exynos5_init_clocks_on[] = {
637 {
638 .name = "uart",
639 .devname = "s5pv210-uart.0",
640 .enable = exynos5_clk_ip_peric_ctrl,
641 .ctrlbit = (1 << 0),
642 }, {
643 .name = "uart",
644 .devname = "s5pv210-uart.1",
645 .enable = exynos5_clk_ip_peric_ctrl,
646 .ctrlbit = (1 << 1),
647 }, {
648 .name = "uart",
649 .devname = "s5pv210-uart.2",
650 .enable = exynos5_clk_ip_peric_ctrl,
651 .ctrlbit = (1 << 2),
652 }, {
653 .name = "uart",
654 .devname = "s5pv210-uart.3",
655 .enable = exynos5_clk_ip_peric_ctrl,
656 .ctrlbit = (1 << 3),
657 }, {
658 .name = "uart",
659 .devname = "s5pv210-uart.4",
660 .enable = exynos5_clk_ip_peric_ctrl,
661 .ctrlbit = (1 << 4),
662 }, {
663 .name = "uart",
664 .devname = "s5pv210-uart.5",
665 .enable = exynos5_clk_ip_peric_ctrl,
666 .ctrlbit = (1 << 5),
667 }
668};
669
670static struct clk exynos5_clk_pdma0 = {
671 .name = "dma",
672 .devname = "dma-pl330.0",
673 .enable = exynos5_clk_ip_fsys_ctrl,
674 .ctrlbit = (1 << 1),
675};
676
677static struct clk exynos5_clk_pdma1 = {
678 .name = "dma",
679 .devname = "dma-pl330.1",
680 .enable = exynos5_clk_ip_fsys_ctrl,
681 .ctrlbit = (1 << 1),
682};
683
684static struct clk exynos5_clk_mdma1 = {
685 .name = "dma",
686 .devname = "dma-pl330.2",
687 .enable = exynos5_clk_ip_gen_ctrl,
688 .ctrlbit = (1 << 4),
689};
690
691struct clk *exynos5_clkset_group_list[] = {
692 [0] = &clk_ext_xtal_mux,
693 [1] = NULL,
694 [2] = &exynos5_clk_sclk_hdmi24m,
695 [3] = &exynos5_clk_sclk_dptxphy,
696 [4] = &exynos5_clk_sclk_usbphy,
697 [5] = &exynos5_clk_sclk_hdmiphy,
698 [6] = &exynos5_clk_mout_mpll_user.clk,
699 [7] = &exynos5_clk_mout_epll.clk,
700 [8] = &exynos5_clk_sclk_vpll.clk,
701 [9] = &exynos5_clk_mout_cpll.clk,
702};
703
704struct clksrc_sources exynos5_clkset_group = {
705 .sources = exynos5_clkset_group_list,
706 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
707};
708
709/* Possible clock sources for aclk_266_gscl_sub Mux */
710static struct clk *clk_src_gscl_266_list[] = {
711 [0] = &clk_ext_xtal_mux,
712 [1] = &exynos5_clk_aclk_266.clk,
713};
714
715static struct clksrc_sources clk_src_gscl_266 = {
716 .sources = clk_src_gscl_266_list,
717 .nr_sources = ARRAY_SIZE(clk_src_gscl_266_list),
718};
719
720static struct clksrc_clk exynos5_clk_dout_mmc0 = {
721 .clk = {
722 .name = "dout_mmc0",
723 },
724 .sources = &exynos5_clkset_group,
725 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 0, .size = 4 },
726 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 0, .size = 4 },
727};
728
729static struct clksrc_clk exynos5_clk_dout_mmc1 = {
730 .clk = {
731 .name = "dout_mmc1",
732 },
733 .sources = &exynos5_clkset_group,
734 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 4, .size = 4 },
735 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 16, .size = 4 },
736};
737
738static struct clksrc_clk exynos5_clk_dout_mmc2 = {
739 .clk = {
740 .name = "dout_mmc2",
741 },
742 .sources = &exynos5_clkset_group,
743 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 8, .size = 4 },
744 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 0, .size = 4 },
745};
746
747static struct clksrc_clk exynos5_clk_dout_mmc3 = {
748 .clk = {
749 .name = "dout_mmc3",
750 },
751 .sources = &exynos5_clkset_group,
752 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 12, .size = 4 },
753 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 16, .size = 4 },
754};
755
756static struct clksrc_clk exynos5_clk_dout_mmc4 = {
757 .clk = {
758 .name = "dout_mmc4",
759 },
760 .sources = &exynos5_clkset_group,
761 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 16, .size = 4 },
762 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 0, .size = 4 },
763};
764
765static struct clksrc_clk exynos5_clk_sclk_uart0 = {
766 .clk = {
767 .name = "uclk1",
768 .devname = "exynos4210-uart.0",
769 .enable = exynos5_clksrc_mask_peric0_ctrl,
770 .ctrlbit = (1 << 0),
771 },
772 .sources = &exynos5_clkset_group,
773 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 0, .size = 4 },
774 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 0, .size = 4 },
775};
776
777static struct clksrc_clk exynos5_clk_sclk_uart1 = {
778 .clk = {
779 .name = "uclk1",
780 .devname = "exynos4210-uart.1",
781 .enable = exynos5_clksrc_mask_peric0_ctrl,
782 .ctrlbit = (1 << 4),
783 },
784 .sources = &exynos5_clkset_group,
785 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 4, .size = 4 },
786 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 4, .size = 4 },
787};
788
789static struct clksrc_clk exynos5_clk_sclk_uart2 = {
790 .clk = {
791 .name = "uclk1",
792 .devname = "exynos4210-uart.2",
793 .enable = exynos5_clksrc_mask_peric0_ctrl,
794 .ctrlbit = (1 << 8),
795 },
796 .sources = &exynos5_clkset_group,
797 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 8, .size = 4 },
798 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 8, .size = 4 },
799};
800
801static struct clksrc_clk exynos5_clk_sclk_uart3 = {
802 .clk = {
803 .name = "uclk1",
804 .devname = "exynos4210-uart.3",
805 .enable = exynos5_clksrc_mask_peric0_ctrl,
806 .ctrlbit = (1 << 12),
807 },
808 .sources = &exynos5_clkset_group,
809 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 12, .size = 4 },
810 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 12, .size = 4 },
811};
812
813static struct clksrc_clk exynos5_clk_sclk_mmc0 = {
814 .clk = {
815 .name = "sclk_mmc",
816 .devname = "s3c-sdhci.0",
817 .parent = &exynos5_clk_dout_mmc0.clk,
818 .enable = exynos5_clksrc_mask_fsys_ctrl,
819 .ctrlbit = (1 << 0),
820 },
821 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 8, .size = 8 },
822};
823
824static struct clksrc_clk exynos5_clk_sclk_mmc1 = {
825 .clk = {
826 .name = "sclk_mmc",
827 .devname = "s3c-sdhci.1",
828 .parent = &exynos5_clk_dout_mmc1.clk,
829 .enable = exynos5_clksrc_mask_fsys_ctrl,
830 .ctrlbit = (1 << 4),
831 },
832 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 24, .size = 8 },
833};
834
835static struct clksrc_clk exynos5_clk_sclk_mmc2 = {
836 .clk = {
837 .name = "sclk_mmc",
838 .devname = "s3c-sdhci.2",
839 .parent = &exynos5_clk_dout_mmc2.clk,
840 .enable = exynos5_clksrc_mask_fsys_ctrl,
841 .ctrlbit = (1 << 8),
842 },
843 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 8, .size = 8 },
844};
845
846static struct clksrc_clk exynos5_clk_sclk_mmc3 = {
847 .clk = {
848 .name = "sclk_mmc",
849 .devname = "s3c-sdhci.3",
850 .parent = &exynos5_clk_dout_mmc3.clk,
851 .enable = exynos5_clksrc_mask_fsys_ctrl,
852 .ctrlbit = (1 << 12),
853 },
854 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 },
855};
856
857static struct clksrc_clk exynos5_clksrcs[] = {
858 {
859 .clk = {
860 .name = "sclk_dwmci",
861 .parent = &exynos5_clk_dout_mmc4.clk,
862 .enable = exynos5_clksrc_mask_fsys_ctrl,
863 .ctrlbit = (1 << 16),
864 },
865 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 8, .size = 8 },
866 }, {
867 .clk = {
868 .name = "sclk_fimd",
869 .devname = "s3cfb.1",
870 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
871 .ctrlbit = (1 << 0),
872 },
873 .sources = &exynos5_clkset_group,
874 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 },
875 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 },
876 }, {
877 .clk = {
878 .name = "aclk_266_gscl",
879 },
880 .sources = &clk_src_gscl_266,
881 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 8, .size = 1 },
882 }, {
883 .clk = {
884 .name = "sclk_g3d",
885 .devname = "mali-t604.0",
886 .enable = exynos5_clk_block_ctrl,
887 .ctrlbit = (1 << 1),
888 },
889 .sources = &exynos5_clkset_aclk,
890 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
891 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
892 }, {
893 .clk = {
894 .name = "sclk_gscl_wrap",
895 .devname = "s5p-mipi-csis.0",
896 .enable = exynos5_clksrc_mask_gscl_ctrl,
897 .ctrlbit = (1 << 24),
898 },
899 .sources = &exynos5_clkset_group,
900 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 24, .size = 4 },
901 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 24, .size = 4 },
902 }, {
903 .clk = {
904 .name = "sclk_gscl_wrap",
905 .devname = "s5p-mipi-csis.1",
906 .enable = exynos5_clksrc_mask_gscl_ctrl,
907 .ctrlbit = (1 << 28),
908 },
909 .sources = &exynos5_clkset_group,
910 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 28, .size = 4 },
911 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 28, .size = 4 },
912 }, {
913 .clk = {
914 .name = "sclk_cam0",
915 .enable = exynos5_clksrc_mask_gscl_ctrl,
916 .ctrlbit = (1 << 16),
917 },
918 .sources = &exynos5_clkset_group,
919 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 16, .size = 4 },
920 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 16, .size = 4 },
921 }, {
922 .clk = {
923 .name = "sclk_cam1",
924 .enable = exynos5_clksrc_mask_gscl_ctrl,
925 .ctrlbit = (1 << 20),
926 },
927 .sources = &exynos5_clkset_group,
928 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 20, .size = 4 },
929 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 20, .size = 4 },
930 }, {
931 .clk = {
932 .name = "sclk_jpeg",
933 .parent = &exynos5_clk_mout_cpll.clk,
934 },
935 .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
936 },
937};
938
939/* Clock initialization code */
940static struct clksrc_clk *exynos5_sysclks[] = {
941 &exynos5_clk_mout_apll,
942 &exynos5_clk_sclk_apll,
943 &exynos5_clk_mout_bpll,
944 &exynos5_clk_mout_bpll_user,
945 &exynos5_clk_mout_cpll,
946 &exynos5_clk_mout_epll,
947 &exynos5_clk_mout_mpll,
948 &exynos5_clk_mout_mpll_user,
949 &exynos5_clk_vpllsrc,
950 &exynos5_clk_sclk_vpll,
951 &exynos5_clk_mout_cpu,
952 &exynos5_clk_dout_armclk,
953 &exynos5_clk_dout_arm2clk,
954 &exynos5_clk_cdrex,
955 &exynos5_clk_aclk_400,
956 &exynos5_clk_aclk_333,
957 &exynos5_clk_aclk_266,
958 &exynos5_clk_aclk_200,
959 &exynos5_clk_aclk_166,
960 &exynos5_clk_aclk_66_pre,
961 &exynos5_clk_aclk_66,
962 &exynos5_clk_dout_mmc0,
963 &exynos5_clk_dout_mmc1,
964 &exynos5_clk_dout_mmc2,
965 &exynos5_clk_dout_mmc3,
966 &exynos5_clk_dout_mmc4,
967 &exynos5_clk_aclk_acp,
968 &exynos5_clk_pclk_acp,
969};
970
971static struct clk *exynos5_clk_cdev[] = {
972 &exynos5_clk_pdma0,
973 &exynos5_clk_pdma1,
974 &exynos5_clk_mdma1,
975};
976
977static struct clksrc_clk *exynos5_clksrc_cdev[] = {
978 &exynos5_clk_sclk_uart0,
979 &exynos5_clk_sclk_uart1,
980 &exynos5_clk_sclk_uart2,
981 &exynos5_clk_sclk_uart3,
982 &exynos5_clk_sclk_mmc0,
983 &exynos5_clk_sclk_mmc1,
984 &exynos5_clk_sclk_mmc2,
985 &exynos5_clk_sclk_mmc3,
986};
987
988static struct clk_lookup exynos5_clk_lookup[] = {
989 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0.clk),
990 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk),
991 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk),
992 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk),
993 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk),
994 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk),
995 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk),
996 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk),
997 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0),
998 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1),
999 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1),
1000};
1001
1002static unsigned long exynos5_epll_get_rate(struct clk *clk)
1003{
1004 return clk->rate;
1005}
1006
1007static struct clk *exynos5_clks[] __initdata = {
1008 &exynos5_clk_sclk_hdmi27m,
1009 &exynos5_clk_sclk_hdmiphy,
1010 &clk_fout_bpll,
1011 &clk_fout_cpll,
1012 &exynos5_clk_armclk,
1013};
1014
1015static u32 epll_div[][6] = {
1016 { 192000000, 0, 48, 3, 1, 0 },
1017 { 180000000, 0, 45, 3, 1, 0 },
1018 { 73728000, 1, 73, 3, 3, 47710 },
1019 { 67737600, 1, 90, 4, 3, 20762 },
1020 { 49152000, 0, 49, 3, 3, 9961 },
1021 { 45158400, 0, 45, 3, 3, 10381 },
1022 { 180633600, 0, 45, 3, 1, 10381 },
1023};
1024
1025static int exynos5_epll_set_rate(struct clk *clk, unsigned long rate)
1026{
1027 unsigned int epll_con, epll_con_k;
1028 unsigned int i;
1029 unsigned int tmp;
1030 unsigned int epll_rate;
1031 unsigned int locktime;
1032 unsigned int lockcnt;
1033
1034 /* Return if nothing changed */
1035 if (clk->rate == rate)
1036 return 0;
1037
1038 if (clk->parent)
1039 epll_rate = clk_get_rate(clk->parent);
1040 else
1041 epll_rate = clk_ext_xtal_mux.rate;
1042
1043 if (epll_rate != 24000000) {
1044 pr_err("Invalid Clock : recommended clock is 24MHz.\n");
1045 return -EINVAL;
1046 }
1047
1048 epll_con = __raw_readl(EXYNOS5_EPLL_CON0);
1049 epll_con &= ~(0x1 << 27 | \
1050 PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1051 PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1052 PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1053
1054 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
1055 if (epll_div[i][0] == rate) {
1056 epll_con_k = epll_div[i][5] << 0;
1057 epll_con |= epll_div[i][1] << 27;
1058 epll_con |= epll_div[i][2] << PLL46XX_MDIV_SHIFT;
1059 epll_con |= epll_div[i][3] << PLL46XX_PDIV_SHIFT;
1060 epll_con |= epll_div[i][4] << PLL46XX_SDIV_SHIFT;
1061 break;
1062 }
1063 }
1064
1065 if (i == ARRAY_SIZE(epll_div)) {
1066 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
1067 __func__);
1068 return -EINVAL;
1069 }
1070
1071 epll_rate /= 1000000;
1072
1073 /* 3000 max_cycls : specification data */
1074 locktime = 3000 / epll_rate * epll_div[i][3];
1075 lockcnt = locktime * 10000 / (10000 / epll_rate);
1076
1077 __raw_writel(lockcnt, EXYNOS5_EPLL_LOCK);
1078
1079 __raw_writel(epll_con, EXYNOS5_EPLL_CON0);
1080 __raw_writel(epll_con_k, EXYNOS5_EPLL_CON1);
1081
1082 do {
1083 tmp = __raw_readl(EXYNOS5_EPLL_CON0);
1084 } while (!(tmp & 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT));
1085
1086 clk->rate = rate;
1087
1088 return 0;
1089}
1090
1091static struct clk_ops exynos5_epll_ops = {
1092 .get_rate = exynos5_epll_get_rate,
1093 .set_rate = exynos5_epll_set_rate,
1094};
1095
1096static int xtal_rate;
1097
1098static unsigned long exynos5_fout_apll_get_rate(struct clk *clk)
1099{
1100 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS5_APLL_CON0));
1101}
1102
1103static struct clk_ops exynos5_fout_apll_ops = {
1104 .get_rate = exynos5_fout_apll_get_rate,
1105};
1106
1107#ifdef CONFIG_PM
1108static int exynos5_clock_suspend(void)
1109{
1110 s3c_pm_do_save(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1111
1112 return 0;
1113}
1114
1115static void exynos5_clock_resume(void)
1116{
1117 s3c_pm_do_restore_core(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1118}
1119#else
1120#define exynos5_clock_suspend NULL
1121#define exynos5_clock_resume NULL
1122#endif
1123
1124struct syscore_ops exynos5_clock_syscore_ops = {
1125 .suspend = exynos5_clock_suspend,
1126 .resume = exynos5_clock_resume,
1127};
1128
1129void __init_or_cpufreq exynos5_setup_clocks(void)
1130{
1131 struct clk *xtal_clk;
1132 unsigned long apll;
1133 unsigned long bpll;
1134 unsigned long cpll;
1135 unsigned long mpll;
1136 unsigned long epll;
1137 unsigned long vpll;
1138 unsigned long vpllsrc;
1139 unsigned long xtal;
1140 unsigned long armclk;
1141 unsigned long mout_cdrex;
1142 unsigned long aclk_400;
1143 unsigned long aclk_333;
1144 unsigned long aclk_266;
1145 unsigned long aclk_200;
1146 unsigned long aclk_166;
1147 unsigned long aclk_66;
1148 unsigned int ptr;
1149
1150 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1151
1152 xtal_clk = clk_get(NULL, "xtal");
1153 BUG_ON(IS_ERR(xtal_clk));
1154
1155 xtal = clk_get_rate(xtal_clk);
1156
1157 xtal_rate = xtal;
1158
1159 clk_put(xtal_clk);
1160
1161 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1162
1163 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_APLL_CON0));
1164 bpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_BPLL_CON0));
1165 cpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_CPLL_CON0));
1166 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_MPLL_CON0));
1167 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS5_EPLL_CON0),
1168 __raw_readl(EXYNOS5_EPLL_CON1));
1169
1170 vpllsrc = clk_get_rate(&exynos5_clk_vpllsrc.clk);
1171 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS5_VPLL_CON0),
1172 __raw_readl(EXYNOS5_VPLL_CON1));
1173
1174 clk_fout_apll.ops = &exynos5_fout_apll_ops;
1175 clk_fout_bpll.rate = bpll;
1176 clk_fout_cpll.rate = cpll;
1177 clk_fout_mpll.rate = mpll;
1178 clk_fout_epll.rate = epll;
1179 clk_fout_vpll.rate = vpll;
1180
1181 printk(KERN_INFO "EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n"
1182 "M=%ld, E=%ld V=%ld",
1183 apll, bpll, cpll, mpll, epll, vpll);
1184
1185 armclk = clk_get_rate(&exynos5_clk_armclk);
1186 mout_cdrex = clk_get_rate(&exynos5_clk_cdrex.clk);
1187
1188 aclk_400 = clk_get_rate(&exynos5_clk_aclk_400.clk);
1189 aclk_333 = clk_get_rate(&exynos5_clk_aclk_333.clk);
1190 aclk_266 = clk_get_rate(&exynos5_clk_aclk_266.clk);
1191 aclk_200 = clk_get_rate(&exynos5_clk_aclk_200.clk);
1192 aclk_166 = clk_get_rate(&exynos5_clk_aclk_166.clk);
1193 aclk_66 = clk_get_rate(&exynos5_clk_aclk_66.clk);
1194
1195 printk(KERN_INFO "EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n"
1196 "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n"
1197 "ACLK166=%ld, ACLK66=%ld\n",
1198 armclk, mout_cdrex, aclk_400,
1199 aclk_333, aclk_266, aclk_200,
1200 aclk_166, aclk_66);
1201
1202
1203 clk_fout_epll.ops = &exynos5_epll_ops;
1204
1205 if (clk_set_parent(&exynos5_clk_mout_epll.clk, &clk_fout_epll))
1206 printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
1207 clk_fout_epll.name, exynos5_clk_mout_epll.clk.name);
1208
1209 clk_set_rate(&exynos5_clk_sclk_apll.clk, 100000000);
1210 clk_set_rate(&exynos5_clk_aclk_266.clk, 300000000);
1211
1212 clk_set_rate(&exynos5_clk_aclk_acp.clk, 267000000);
1213 clk_set_rate(&exynos5_clk_pclk_acp.clk, 134000000);
1214
1215 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrcs); ptr++)
1216 s3c_set_clksrc(&exynos5_clksrcs[ptr], true);
1217}
1218
1219void __init exynos5_register_clocks(void)
1220{
1221 int ptr;
1222
1223 s3c24xx_register_clocks(exynos5_clks, ARRAY_SIZE(exynos5_clks));
1224
1225 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sysclks); ptr++)
1226 s3c_register_clksrc(exynos5_sysclks[ptr], 1);
1227
1228 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sclk_tv); ptr++)
1229 s3c_register_clksrc(exynos5_sclk_tv[ptr], 1);
1230
1231 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrc_cdev); ptr++)
1232 s3c_register_clksrc(exynos5_clksrc_cdev[ptr], 1);
1233
1234 s3c_register_clksrc(exynos5_clksrcs, ARRAY_SIZE(exynos5_clksrcs));
1235 s3c_register_clocks(exynos5_init_clocks_on, ARRAY_SIZE(exynos5_init_clocks_on));
1236
1237 s3c24xx_register_clocks(exynos5_clk_cdev, ARRAY_SIZE(exynos5_clk_cdev));
1238 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clk_cdev); ptr++)
1239 s3c_disable_clocks(exynos5_clk_cdev[ptr], 1);
1240
1241 s3c_register_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1242 s3c_disable_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1243 clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup));
1244
1245 register_syscore_ops(&exynos5_clock_syscore_ops);
1246 s3c_pwmclk_init();
1247}
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
deleted file mode 100644
index 187287aa57ab..000000000000
--- a/arch/arm/mach-exynos/clock.c
+++ /dev/null
@@ -1,1564 +0,0 @@
1/* linux/arch/arm/mach-exynos4/clock.c
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/syscore_ops.h>
17
18#include <plat/cpu-freq.h>
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/pll.h>
22#include <plat/s5p-clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/pm.h>
25
26#include <mach/map.h>
27#include <mach/regs-clock.h>
28#include <mach/sysmmu.h>
29#include <mach/exynos4-clock.h>
30
31#include "common.h"
32
33#ifdef CONFIG_PM_SLEEP
34static struct sleep_save exynos4_clock_save[] = {
35 SAVE_ITEM(S5P_CLKDIV_LEFTBUS),
36 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS),
37 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS),
38 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS),
39 SAVE_ITEM(S5P_CLKSRC_TOP0),
40 SAVE_ITEM(S5P_CLKSRC_TOP1),
41 SAVE_ITEM(S5P_CLKSRC_CAM),
42 SAVE_ITEM(S5P_CLKSRC_TV),
43 SAVE_ITEM(S5P_CLKSRC_MFC),
44 SAVE_ITEM(S5P_CLKSRC_G3D),
45 SAVE_ITEM(S5P_CLKSRC_LCD0),
46 SAVE_ITEM(S5P_CLKSRC_MAUDIO),
47 SAVE_ITEM(S5P_CLKSRC_FSYS),
48 SAVE_ITEM(S5P_CLKSRC_PERIL0),
49 SAVE_ITEM(S5P_CLKSRC_PERIL1),
50 SAVE_ITEM(S5P_CLKDIV_CAM),
51 SAVE_ITEM(S5P_CLKDIV_TV),
52 SAVE_ITEM(S5P_CLKDIV_MFC),
53 SAVE_ITEM(S5P_CLKDIV_G3D),
54 SAVE_ITEM(S5P_CLKDIV_LCD0),
55 SAVE_ITEM(S5P_CLKDIV_MAUDIO),
56 SAVE_ITEM(S5P_CLKDIV_FSYS0),
57 SAVE_ITEM(S5P_CLKDIV_FSYS1),
58 SAVE_ITEM(S5P_CLKDIV_FSYS2),
59 SAVE_ITEM(S5P_CLKDIV_FSYS3),
60 SAVE_ITEM(S5P_CLKDIV_PERIL0),
61 SAVE_ITEM(S5P_CLKDIV_PERIL1),
62 SAVE_ITEM(S5P_CLKDIV_PERIL2),
63 SAVE_ITEM(S5P_CLKDIV_PERIL3),
64 SAVE_ITEM(S5P_CLKDIV_PERIL4),
65 SAVE_ITEM(S5P_CLKDIV_PERIL5),
66 SAVE_ITEM(S5P_CLKDIV_TOP),
67 SAVE_ITEM(S5P_CLKSRC_MASK_TOP),
68 SAVE_ITEM(S5P_CLKSRC_MASK_CAM),
69 SAVE_ITEM(S5P_CLKSRC_MASK_TV),
70 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0),
71 SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO),
72 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS),
73 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0),
74 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1),
75 SAVE_ITEM(S5P_CLKDIV2_RATIO),
76 SAVE_ITEM(S5P_CLKGATE_SCLKCAM),
77 SAVE_ITEM(S5P_CLKGATE_IP_CAM),
78 SAVE_ITEM(S5P_CLKGATE_IP_TV),
79 SAVE_ITEM(S5P_CLKGATE_IP_MFC),
80 SAVE_ITEM(S5P_CLKGATE_IP_G3D),
81 SAVE_ITEM(S5P_CLKGATE_IP_LCD0),
82 SAVE_ITEM(S5P_CLKGATE_IP_FSYS),
83 SAVE_ITEM(S5P_CLKGATE_IP_GPS),
84 SAVE_ITEM(S5P_CLKGATE_IP_PERIL),
85 SAVE_ITEM(S5P_CLKGATE_BLOCK),
86 SAVE_ITEM(S5P_CLKSRC_MASK_DMC),
87 SAVE_ITEM(S5P_CLKSRC_DMC),
88 SAVE_ITEM(S5P_CLKDIV_DMC0),
89 SAVE_ITEM(S5P_CLKDIV_DMC1),
90 SAVE_ITEM(S5P_CLKGATE_IP_DMC),
91 SAVE_ITEM(S5P_CLKSRC_CPU),
92 SAVE_ITEM(S5P_CLKDIV_CPU),
93 SAVE_ITEM(S5P_CLKDIV_CPU + 0x4),
94 SAVE_ITEM(S5P_CLKGATE_SCLKCPU),
95 SAVE_ITEM(S5P_CLKGATE_IP_CPU),
96};
97#endif
98
99struct clk clk_sclk_hdmi27m = {
100 .name = "sclk_hdmi27m",
101 .rate = 27000000,
102};
103
104struct clk clk_sclk_hdmiphy = {
105 .name = "sclk_hdmiphy",
106};
107
108struct clk clk_sclk_usbphy0 = {
109 .name = "sclk_usbphy0",
110 .rate = 27000000,
111};
112
113struct clk clk_sclk_usbphy1 = {
114 .name = "sclk_usbphy1",
115};
116
117static struct clk dummy_apb_pclk = {
118 .name = "apb_pclk",
119 .id = -1,
120};
121
122static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
123{
124 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
125}
126
127static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
128{
129 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
130}
131
132static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
133{
134 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
135}
136
137int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
138{
139 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
140}
141
142static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
143{
144 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
145}
146
147static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
148{
149 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
150}
151
152static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
153{
154 return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
155}
156
157static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
158{
159 return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
160}
161
162static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
163{
164 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
165}
166
167static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
168{
169 return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
170}
171
172static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
173{
174 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
175}
176
177static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
178{
179 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
180}
181
182int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
183{
184 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
185}
186
187int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
188{
189 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
190}
191
192static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
193{
194 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
195}
196
197static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
198{
199 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
200}
201
202static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
203{
204 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
205}
206
207static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
208{
209 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
210}
211
212/* Core list of CMU_CPU side */
213
214static struct clksrc_clk clk_mout_apll = {
215 .clk = {
216 .name = "mout_apll",
217 },
218 .sources = &clk_src_apll,
219 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
220};
221
222struct clksrc_clk clk_sclk_apll = {
223 .clk = {
224 .name = "sclk_apll",
225 .parent = &clk_mout_apll.clk,
226 },
227 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
228};
229
230struct clksrc_clk clk_mout_epll = {
231 .clk = {
232 .name = "mout_epll",
233 },
234 .sources = &clk_src_epll,
235 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
236};
237
238struct clksrc_clk clk_mout_mpll = {
239 .clk = {
240 .name = "mout_mpll",
241 },
242 .sources = &clk_src_mpll,
243
244 /* reg_src will be added in each SoCs' clock */
245};
246
247static struct clk *clkset_moutcore_list[] = {
248 [0] = &clk_mout_apll.clk,
249 [1] = &clk_mout_mpll.clk,
250};
251
252static struct clksrc_sources clkset_moutcore = {
253 .sources = clkset_moutcore_list,
254 .nr_sources = ARRAY_SIZE(clkset_moutcore_list),
255};
256
257static struct clksrc_clk clk_moutcore = {
258 .clk = {
259 .name = "moutcore",
260 },
261 .sources = &clkset_moutcore,
262 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
263};
264
265static struct clksrc_clk clk_coreclk = {
266 .clk = {
267 .name = "core_clk",
268 .parent = &clk_moutcore.clk,
269 },
270 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
271};
272
273static struct clksrc_clk clk_armclk = {
274 .clk = {
275 .name = "armclk",
276 .parent = &clk_coreclk.clk,
277 },
278};
279
280static struct clksrc_clk clk_aclk_corem0 = {
281 .clk = {
282 .name = "aclk_corem0",
283 .parent = &clk_coreclk.clk,
284 },
285 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
286};
287
288static struct clksrc_clk clk_aclk_cores = {
289 .clk = {
290 .name = "aclk_cores",
291 .parent = &clk_coreclk.clk,
292 },
293 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
294};
295
296static struct clksrc_clk clk_aclk_corem1 = {
297 .clk = {
298 .name = "aclk_corem1",
299 .parent = &clk_coreclk.clk,
300 },
301 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
302};
303
304static struct clksrc_clk clk_periphclk = {
305 .clk = {
306 .name = "periphclk",
307 .parent = &clk_coreclk.clk,
308 },
309 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
310};
311
312/* Core list of CMU_CORE side */
313
314struct clk *clkset_corebus_list[] = {
315 [0] = &clk_mout_mpll.clk,
316 [1] = &clk_sclk_apll.clk,
317};
318
319struct clksrc_sources clkset_mout_corebus = {
320 .sources = clkset_corebus_list,
321 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
322};
323
324static struct clksrc_clk clk_mout_corebus = {
325 .clk = {
326 .name = "mout_corebus",
327 },
328 .sources = &clkset_mout_corebus,
329 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
330};
331
332static struct clksrc_clk clk_sclk_dmc = {
333 .clk = {
334 .name = "sclk_dmc",
335 .parent = &clk_mout_corebus.clk,
336 },
337 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
338};
339
340static struct clksrc_clk clk_aclk_cored = {
341 .clk = {
342 .name = "aclk_cored",
343 .parent = &clk_sclk_dmc.clk,
344 },
345 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
346};
347
348static struct clksrc_clk clk_aclk_corep = {
349 .clk = {
350 .name = "aclk_corep",
351 .parent = &clk_aclk_cored.clk,
352 },
353 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
354};
355
356static struct clksrc_clk clk_aclk_acp = {
357 .clk = {
358 .name = "aclk_acp",
359 .parent = &clk_mout_corebus.clk,
360 },
361 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
362};
363
364static struct clksrc_clk clk_pclk_acp = {
365 .clk = {
366 .name = "pclk_acp",
367 .parent = &clk_aclk_acp.clk,
368 },
369 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
370};
371
372/* Core list of CMU_TOP side */
373
374struct clk *clkset_aclk_top_list[] = {
375 [0] = &clk_mout_mpll.clk,
376 [1] = &clk_sclk_apll.clk,
377};
378
379struct clksrc_sources clkset_aclk = {
380 .sources = clkset_aclk_top_list,
381 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
382};
383
384static struct clksrc_clk clk_aclk_200 = {
385 .clk = {
386 .name = "aclk_200",
387 },
388 .sources = &clkset_aclk,
389 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
390 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
391};
392
393static struct clksrc_clk clk_aclk_100 = {
394 .clk = {
395 .name = "aclk_100",
396 },
397 .sources = &clkset_aclk,
398 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
399 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
400};
401
402static struct clksrc_clk clk_aclk_160 = {
403 .clk = {
404 .name = "aclk_160",
405 },
406 .sources = &clkset_aclk,
407 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
408 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
409};
410
411struct clksrc_clk clk_aclk_133 = {
412 .clk = {
413 .name = "aclk_133",
414 },
415 .sources = &clkset_aclk,
416 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
417 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
418};
419
420static struct clk *clkset_vpllsrc_list[] = {
421 [0] = &clk_fin_vpll,
422 [1] = &clk_sclk_hdmi27m,
423};
424
425static struct clksrc_sources clkset_vpllsrc = {
426 .sources = clkset_vpllsrc_list,
427 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
428};
429
430static struct clksrc_clk clk_vpllsrc = {
431 .clk = {
432 .name = "vpll_src",
433 .enable = exynos4_clksrc_mask_top_ctrl,
434 .ctrlbit = (1 << 0),
435 },
436 .sources = &clkset_vpllsrc,
437 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
438};
439
440static struct clk *clkset_sclk_vpll_list[] = {
441 [0] = &clk_vpllsrc.clk,
442 [1] = &clk_fout_vpll,
443};
444
445static struct clksrc_sources clkset_sclk_vpll = {
446 .sources = clkset_sclk_vpll_list,
447 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
448};
449
450struct clksrc_clk clk_sclk_vpll = {
451 .clk = {
452 .name = "sclk_vpll",
453 },
454 .sources = &clkset_sclk_vpll,
455 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
456};
457
458static struct clk init_clocks_off[] = {
459 {
460 .name = "timers",
461 .parent = &clk_aclk_100.clk,
462 .enable = exynos4_clk_ip_peril_ctrl,
463 .ctrlbit = (1<<24),
464 }, {
465 .name = "csis",
466 .devname = "s5p-mipi-csis.0",
467 .enable = exynos4_clk_ip_cam_ctrl,
468 .ctrlbit = (1 << 4),
469 }, {
470 .name = "csis",
471 .devname = "s5p-mipi-csis.1",
472 .enable = exynos4_clk_ip_cam_ctrl,
473 .ctrlbit = (1 << 5),
474 }, {
475 .name = "fimc",
476 .devname = "exynos4-fimc.0",
477 .enable = exynos4_clk_ip_cam_ctrl,
478 .ctrlbit = (1 << 0),
479 }, {
480 .name = "fimc",
481 .devname = "exynos4-fimc.1",
482 .enable = exynos4_clk_ip_cam_ctrl,
483 .ctrlbit = (1 << 1),
484 }, {
485 .name = "fimc",
486 .devname = "exynos4-fimc.2",
487 .enable = exynos4_clk_ip_cam_ctrl,
488 .ctrlbit = (1 << 2),
489 }, {
490 .name = "fimc",
491 .devname = "exynos4-fimc.3",
492 .enable = exynos4_clk_ip_cam_ctrl,
493 .ctrlbit = (1 << 3),
494 }, {
495 .name = "fimd",
496 .devname = "exynos4-fb.0",
497 .enable = exynos4_clk_ip_lcd0_ctrl,
498 .ctrlbit = (1 << 0),
499 }, {
500 .name = "hsmmc",
501 .devname = "s3c-sdhci.0",
502 .parent = &clk_aclk_133.clk,
503 .enable = exynos4_clk_ip_fsys_ctrl,
504 .ctrlbit = (1 << 5),
505 }, {
506 .name = "hsmmc",
507 .devname = "s3c-sdhci.1",
508 .parent = &clk_aclk_133.clk,
509 .enable = exynos4_clk_ip_fsys_ctrl,
510 .ctrlbit = (1 << 6),
511 }, {
512 .name = "hsmmc",
513 .devname = "s3c-sdhci.2",
514 .parent = &clk_aclk_133.clk,
515 .enable = exynos4_clk_ip_fsys_ctrl,
516 .ctrlbit = (1 << 7),
517 }, {
518 .name = "hsmmc",
519 .devname = "s3c-sdhci.3",
520 .parent = &clk_aclk_133.clk,
521 .enable = exynos4_clk_ip_fsys_ctrl,
522 .ctrlbit = (1 << 8),
523 }, {
524 .name = "dwmmc",
525 .parent = &clk_aclk_133.clk,
526 .enable = exynos4_clk_ip_fsys_ctrl,
527 .ctrlbit = (1 << 9),
528 }, {
529 .name = "dac",
530 .devname = "s5p-sdo",
531 .enable = exynos4_clk_ip_tv_ctrl,
532 .ctrlbit = (1 << 2),
533 }, {
534 .name = "mixer",
535 .devname = "s5p-mixer",
536 .enable = exynos4_clk_ip_tv_ctrl,
537 .ctrlbit = (1 << 1),
538 }, {
539 .name = "vp",
540 .devname = "s5p-mixer",
541 .enable = exynos4_clk_ip_tv_ctrl,
542 .ctrlbit = (1 << 0),
543 }, {
544 .name = "hdmi",
545 .devname = "exynos4-hdmi",
546 .enable = exynos4_clk_ip_tv_ctrl,
547 .ctrlbit = (1 << 3),
548 }, {
549 .name = "hdmiphy",
550 .devname = "exynos4-hdmi",
551 .enable = exynos4_clk_hdmiphy_ctrl,
552 .ctrlbit = (1 << 0),
553 }, {
554 .name = "dacphy",
555 .devname = "s5p-sdo",
556 .enable = exynos4_clk_dac_ctrl,
557 .ctrlbit = (1 << 0),
558 }, {
559 .name = "adc",
560 .enable = exynos4_clk_ip_peril_ctrl,
561 .ctrlbit = (1 << 15),
562 }, {
563 .name = "keypad",
564 .enable = exynos4_clk_ip_perir_ctrl,
565 .ctrlbit = (1 << 16),
566 }, {
567 .name = "rtc",
568 .enable = exynos4_clk_ip_perir_ctrl,
569 .ctrlbit = (1 << 15),
570 }, {
571 .name = "watchdog",
572 .parent = &clk_aclk_100.clk,
573 .enable = exynos4_clk_ip_perir_ctrl,
574 .ctrlbit = (1 << 14),
575 }, {
576 .name = "usbhost",
577 .enable = exynos4_clk_ip_fsys_ctrl ,
578 .ctrlbit = (1 << 12),
579 }, {
580 .name = "otg",
581 .enable = exynos4_clk_ip_fsys_ctrl,
582 .ctrlbit = (1 << 13),
583 }, {
584 .name = "spi",
585 .devname = "s3c64xx-spi.0",
586 .enable = exynos4_clk_ip_peril_ctrl,
587 .ctrlbit = (1 << 16),
588 }, {
589 .name = "spi",
590 .devname = "s3c64xx-spi.1",
591 .enable = exynos4_clk_ip_peril_ctrl,
592 .ctrlbit = (1 << 17),
593 }, {
594 .name = "spi",
595 .devname = "s3c64xx-spi.2",
596 .enable = exynos4_clk_ip_peril_ctrl,
597 .ctrlbit = (1 << 18),
598 }, {
599 .name = "iis",
600 .devname = "samsung-i2s.0",
601 .enable = exynos4_clk_ip_peril_ctrl,
602 .ctrlbit = (1 << 19),
603 }, {
604 .name = "iis",
605 .devname = "samsung-i2s.1",
606 .enable = exynos4_clk_ip_peril_ctrl,
607 .ctrlbit = (1 << 20),
608 }, {
609 .name = "iis",
610 .devname = "samsung-i2s.2",
611 .enable = exynos4_clk_ip_peril_ctrl,
612 .ctrlbit = (1 << 21),
613 }, {
614 .name = "ac97",
615 .devname = "samsung-ac97",
616 .enable = exynos4_clk_ip_peril_ctrl,
617 .ctrlbit = (1 << 27),
618 }, {
619 .name = "fimg2d",
620 .enable = exynos4_clk_ip_image_ctrl,
621 .ctrlbit = (1 << 0),
622 }, {
623 .name = "mfc",
624 .devname = "s5p-mfc",
625 .enable = exynos4_clk_ip_mfc_ctrl,
626 .ctrlbit = (1 << 0),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-i2c.0",
630 .parent = &clk_aclk_100.clk,
631 .enable = exynos4_clk_ip_peril_ctrl,
632 .ctrlbit = (1 << 6),
633 }, {
634 .name = "i2c",
635 .devname = "s3c2440-i2c.1",
636 .parent = &clk_aclk_100.clk,
637 .enable = exynos4_clk_ip_peril_ctrl,
638 .ctrlbit = (1 << 7),
639 }, {
640 .name = "i2c",
641 .devname = "s3c2440-i2c.2",
642 .parent = &clk_aclk_100.clk,
643 .enable = exynos4_clk_ip_peril_ctrl,
644 .ctrlbit = (1 << 8),
645 }, {
646 .name = "i2c",
647 .devname = "s3c2440-i2c.3",
648 .parent = &clk_aclk_100.clk,
649 .enable = exynos4_clk_ip_peril_ctrl,
650 .ctrlbit = (1 << 9),
651 }, {
652 .name = "i2c",
653 .devname = "s3c2440-i2c.4",
654 .parent = &clk_aclk_100.clk,
655 .enable = exynos4_clk_ip_peril_ctrl,
656 .ctrlbit = (1 << 10),
657 }, {
658 .name = "i2c",
659 .devname = "s3c2440-i2c.5",
660 .parent = &clk_aclk_100.clk,
661 .enable = exynos4_clk_ip_peril_ctrl,
662 .ctrlbit = (1 << 11),
663 }, {
664 .name = "i2c",
665 .devname = "s3c2440-i2c.6",
666 .parent = &clk_aclk_100.clk,
667 .enable = exynos4_clk_ip_peril_ctrl,
668 .ctrlbit = (1 << 12),
669 }, {
670 .name = "i2c",
671 .devname = "s3c2440-i2c.7",
672 .parent = &clk_aclk_100.clk,
673 .enable = exynos4_clk_ip_peril_ctrl,
674 .ctrlbit = (1 << 13),
675 }, {
676 .name = "i2c",
677 .devname = "s3c2440-hdmiphy-i2c",
678 .parent = &clk_aclk_100.clk,
679 .enable = exynos4_clk_ip_peril_ctrl,
680 .ctrlbit = (1 << 14),
681 }, {
682 .name = "SYSMMU_MDMA",
683 .enable = exynos4_clk_ip_image_ctrl,
684 .ctrlbit = (1 << 5),
685 }, {
686 .name = "SYSMMU_FIMC0",
687 .enable = exynos4_clk_ip_cam_ctrl,
688 .ctrlbit = (1 << 7),
689 }, {
690 .name = "SYSMMU_FIMC1",
691 .enable = exynos4_clk_ip_cam_ctrl,
692 .ctrlbit = (1 << 8),
693 }, {
694 .name = "SYSMMU_FIMC2",
695 .enable = exynos4_clk_ip_cam_ctrl,
696 .ctrlbit = (1 << 9),
697 }, {
698 .name = "SYSMMU_FIMC3",
699 .enable = exynos4_clk_ip_cam_ctrl,
700 .ctrlbit = (1 << 10),
701 }, {
702 .name = "SYSMMU_JPEG",
703 .enable = exynos4_clk_ip_cam_ctrl,
704 .ctrlbit = (1 << 11),
705 }, {
706 .name = "SYSMMU_FIMD0",
707 .enable = exynos4_clk_ip_lcd0_ctrl,
708 .ctrlbit = (1 << 4),
709 }, {
710 .name = "SYSMMU_FIMD1",
711 .enable = exynos4_clk_ip_lcd1_ctrl,
712 .ctrlbit = (1 << 4),
713 }, {
714 .name = "SYSMMU_PCIe",
715 .enable = exynos4_clk_ip_fsys_ctrl,
716 .ctrlbit = (1 << 18),
717 }, {
718 .name = "SYSMMU_G2D",
719 .enable = exynos4_clk_ip_image_ctrl,
720 .ctrlbit = (1 << 3),
721 }, {
722 .name = "SYSMMU_ROTATOR",
723 .enable = exynos4_clk_ip_image_ctrl,
724 .ctrlbit = (1 << 4),
725 }, {
726 .name = "SYSMMU_TV",
727 .enable = exynos4_clk_ip_tv_ctrl,
728 .ctrlbit = (1 << 4),
729 }, {
730 .name = "SYSMMU_MFC_L",
731 .enable = exynos4_clk_ip_mfc_ctrl,
732 .ctrlbit = (1 << 1),
733 }, {
734 .name = "SYSMMU_MFC_R",
735 .enable = exynos4_clk_ip_mfc_ctrl,
736 .ctrlbit = (1 << 2),
737 }
738};
739
740static struct clk init_clocks[] = {
741 {
742 .name = "uart",
743 .devname = "s5pv210-uart.0",
744 .enable = exynos4_clk_ip_peril_ctrl,
745 .ctrlbit = (1 << 0),
746 }, {
747 .name = "uart",
748 .devname = "s5pv210-uart.1",
749 .enable = exynos4_clk_ip_peril_ctrl,
750 .ctrlbit = (1 << 1),
751 }, {
752 .name = "uart",
753 .devname = "s5pv210-uart.2",
754 .enable = exynos4_clk_ip_peril_ctrl,
755 .ctrlbit = (1 << 2),
756 }, {
757 .name = "uart",
758 .devname = "s5pv210-uart.3",
759 .enable = exynos4_clk_ip_peril_ctrl,
760 .ctrlbit = (1 << 3),
761 }, {
762 .name = "uart",
763 .devname = "s5pv210-uart.4",
764 .enable = exynos4_clk_ip_peril_ctrl,
765 .ctrlbit = (1 << 4),
766 }, {
767 .name = "uart",
768 .devname = "s5pv210-uart.5",
769 .enable = exynos4_clk_ip_peril_ctrl,
770 .ctrlbit = (1 << 5),
771 }
772};
773
774static struct clk clk_pdma0 = {
775 .name = "dma",
776 .devname = "dma-pl330.0",
777 .enable = exynos4_clk_ip_fsys_ctrl,
778 .ctrlbit = (1 << 0),
779};
780
781static struct clk clk_pdma1 = {
782 .name = "dma",
783 .devname = "dma-pl330.1",
784 .enable = exynos4_clk_ip_fsys_ctrl,
785 .ctrlbit = (1 << 1),
786};
787
788struct clk *clkset_group_list[] = {
789 [0] = &clk_ext_xtal_mux,
790 [1] = &clk_xusbxti,
791 [2] = &clk_sclk_hdmi27m,
792 [3] = &clk_sclk_usbphy0,
793 [4] = &clk_sclk_usbphy1,
794 [5] = &clk_sclk_hdmiphy,
795 [6] = &clk_mout_mpll.clk,
796 [7] = &clk_mout_epll.clk,
797 [8] = &clk_sclk_vpll.clk,
798};
799
800struct clksrc_sources clkset_group = {
801 .sources = clkset_group_list,
802 .nr_sources = ARRAY_SIZE(clkset_group_list),
803};
804
805static struct clk *clkset_mout_g2d0_list[] = {
806 [0] = &clk_mout_mpll.clk,
807 [1] = &clk_sclk_apll.clk,
808};
809
810static struct clksrc_sources clkset_mout_g2d0 = {
811 .sources = clkset_mout_g2d0_list,
812 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
813};
814
815static struct clksrc_clk clk_mout_g2d0 = {
816 .clk = {
817 .name = "mout_g2d0",
818 },
819 .sources = &clkset_mout_g2d0,
820 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
821};
822
823static struct clk *clkset_mout_g2d1_list[] = {
824 [0] = &clk_mout_epll.clk,
825 [1] = &clk_sclk_vpll.clk,
826};
827
828static struct clksrc_sources clkset_mout_g2d1 = {
829 .sources = clkset_mout_g2d1_list,
830 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
831};
832
833static struct clksrc_clk clk_mout_g2d1 = {
834 .clk = {
835 .name = "mout_g2d1",
836 },
837 .sources = &clkset_mout_g2d1,
838 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
839};
840
841static struct clk *clkset_mout_g2d_list[] = {
842 [0] = &clk_mout_g2d0.clk,
843 [1] = &clk_mout_g2d1.clk,
844};
845
846static struct clksrc_sources clkset_mout_g2d = {
847 .sources = clkset_mout_g2d_list,
848 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
849};
850
851static struct clk *clkset_mout_mfc0_list[] = {
852 [0] = &clk_mout_mpll.clk,
853 [1] = &clk_sclk_apll.clk,
854};
855
856static struct clksrc_sources clkset_mout_mfc0 = {
857 .sources = clkset_mout_mfc0_list,
858 .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list),
859};
860
861static struct clksrc_clk clk_mout_mfc0 = {
862 .clk = {
863 .name = "mout_mfc0",
864 },
865 .sources = &clkset_mout_mfc0,
866 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 },
867};
868
869static struct clk *clkset_mout_mfc1_list[] = {
870 [0] = &clk_mout_epll.clk,
871 [1] = &clk_sclk_vpll.clk,
872};
873
874static struct clksrc_sources clkset_mout_mfc1 = {
875 .sources = clkset_mout_mfc1_list,
876 .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list),
877};
878
879static struct clksrc_clk clk_mout_mfc1 = {
880 .clk = {
881 .name = "mout_mfc1",
882 },
883 .sources = &clkset_mout_mfc1,
884 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 },
885};
886
887static struct clk *clkset_mout_mfc_list[] = {
888 [0] = &clk_mout_mfc0.clk,
889 [1] = &clk_mout_mfc1.clk,
890};
891
892static struct clksrc_sources clkset_mout_mfc = {
893 .sources = clkset_mout_mfc_list,
894 .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
895};
896
897static struct clk *clkset_sclk_dac_list[] = {
898 [0] = &clk_sclk_vpll.clk,
899 [1] = &clk_sclk_hdmiphy,
900};
901
902static struct clksrc_sources clkset_sclk_dac = {
903 .sources = clkset_sclk_dac_list,
904 .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
905};
906
907static struct clksrc_clk clk_sclk_dac = {
908 .clk = {
909 .name = "sclk_dac",
910 .enable = exynos4_clksrc_mask_tv_ctrl,
911 .ctrlbit = (1 << 8),
912 },
913 .sources = &clkset_sclk_dac,
914 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
915};
916
917static struct clksrc_clk clk_sclk_pixel = {
918 .clk = {
919 .name = "sclk_pixel",
920 .parent = &clk_sclk_vpll.clk,
921 },
922 .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 },
923};
924
925static struct clk *clkset_sclk_hdmi_list[] = {
926 [0] = &clk_sclk_pixel.clk,
927 [1] = &clk_sclk_hdmiphy,
928};
929
930static struct clksrc_sources clkset_sclk_hdmi = {
931 .sources = clkset_sclk_hdmi_list,
932 .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
933};
934
935static struct clksrc_clk clk_sclk_hdmi = {
936 .clk = {
937 .name = "sclk_hdmi",
938 .enable = exynos4_clksrc_mask_tv_ctrl,
939 .ctrlbit = (1 << 0),
940 },
941 .sources = &clkset_sclk_hdmi,
942 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 0, .size = 1 },
943};
944
945static struct clk *clkset_sclk_mixer_list[] = {
946 [0] = &clk_sclk_dac.clk,
947 [1] = &clk_sclk_hdmi.clk,
948};
949
950static struct clksrc_sources clkset_sclk_mixer = {
951 .sources = clkset_sclk_mixer_list,
952 .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
953};
954
955static struct clksrc_clk clk_sclk_mixer = {
956 .clk = {
957 .name = "sclk_mixer",
958 .enable = exynos4_clksrc_mask_tv_ctrl,
959 .ctrlbit = (1 << 4),
960 },
961 .sources = &clkset_sclk_mixer,
962 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 4, .size = 1 },
963};
964
965static struct clksrc_clk *sclk_tv[] = {
966 &clk_sclk_dac,
967 &clk_sclk_pixel,
968 &clk_sclk_hdmi,
969 &clk_sclk_mixer,
970};
971
972static struct clksrc_clk clk_dout_mmc0 = {
973 .clk = {
974 .name = "dout_mmc0",
975 },
976 .sources = &clkset_group,
977 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
978 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
979};
980
981static struct clksrc_clk clk_dout_mmc1 = {
982 .clk = {
983 .name = "dout_mmc1",
984 },
985 .sources = &clkset_group,
986 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
987 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
988};
989
990static struct clksrc_clk clk_dout_mmc2 = {
991 .clk = {
992 .name = "dout_mmc2",
993 },
994 .sources = &clkset_group,
995 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
996 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
997};
998
999static struct clksrc_clk clk_dout_mmc3 = {
1000 .clk = {
1001 .name = "dout_mmc3",
1002 },
1003 .sources = &clkset_group,
1004 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
1005 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1006};
1007
1008static struct clksrc_clk clk_dout_mmc4 = {
1009 .clk = {
1010 .name = "dout_mmc4",
1011 },
1012 .sources = &clkset_group,
1013 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
1014 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1015};
1016
1017static struct clksrc_clk clksrcs[] = {
1018 {
1019 .clk = {
1020 .name = "sclk_pwm",
1021 .enable = exynos4_clksrc_mask_peril0_ctrl,
1022 .ctrlbit = (1 << 24),
1023 },
1024 .sources = &clkset_group,
1025 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1026 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1027 }, {
1028 .clk = {
1029 .name = "sclk_csis",
1030 .devname = "s5p-mipi-csis.0",
1031 .enable = exynos4_clksrc_mask_cam_ctrl,
1032 .ctrlbit = (1 << 24),
1033 },
1034 .sources = &clkset_group,
1035 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
1036 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
1037 }, {
1038 .clk = {
1039 .name = "sclk_csis",
1040 .devname = "s5p-mipi-csis.1",
1041 .enable = exynos4_clksrc_mask_cam_ctrl,
1042 .ctrlbit = (1 << 28),
1043 },
1044 .sources = &clkset_group,
1045 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
1046 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
1047 }, {
1048 .clk = {
1049 .name = "sclk_cam0",
1050 .enable = exynos4_clksrc_mask_cam_ctrl,
1051 .ctrlbit = (1 << 16),
1052 },
1053 .sources = &clkset_group,
1054 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
1055 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
1056 }, {
1057 .clk = {
1058 .name = "sclk_cam1",
1059 .enable = exynos4_clksrc_mask_cam_ctrl,
1060 .ctrlbit = (1 << 20),
1061 },
1062 .sources = &clkset_group,
1063 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
1064 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
1065 }, {
1066 .clk = {
1067 .name = "sclk_fimc",
1068 .devname = "exynos4-fimc.0",
1069 .enable = exynos4_clksrc_mask_cam_ctrl,
1070 .ctrlbit = (1 << 0),
1071 },
1072 .sources = &clkset_group,
1073 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
1074 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
1075 }, {
1076 .clk = {
1077 .name = "sclk_fimc",
1078 .devname = "exynos4-fimc.1",
1079 .enable = exynos4_clksrc_mask_cam_ctrl,
1080 .ctrlbit = (1 << 4),
1081 },
1082 .sources = &clkset_group,
1083 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
1084 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
1085 }, {
1086 .clk = {
1087 .name = "sclk_fimc",
1088 .devname = "exynos4-fimc.2",
1089 .enable = exynos4_clksrc_mask_cam_ctrl,
1090 .ctrlbit = (1 << 8),
1091 },
1092 .sources = &clkset_group,
1093 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
1094 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
1095 }, {
1096 .clk = {
1097 .name = "sclk_fimc",
1098 .devname = "exynos4-fimc.3",
1099 .enable = exynos4_clksrc_mask_cam_ctrl,
1100 .ctrlbit = (1 << 12),
1101 },
1102 .sources = &clkset_group,
1103 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
1104 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
1105 }, {
1106 .clk = {
1107 .name = "sclk_fimd",
1108 .devname = "exynos4-fb.0",
1109 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1110 .ctrlbit = (1 << 0),
1111 },
1112 .sources = &clkset_group,
1113 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
1114 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
1115 }, {
1116 .clk = {
1117 .name = "sclk_fimg2d",
1118 },
1119 .sources = &clkset_mout_g2d,
1120 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1121 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1122 }, {
1123 .clk = {
1124 .name = "sclk_mfc",
1125 .devname = "s5p-mfc",
1126 },
1127 .sources = &clkset_mout_mfc,
1128 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
1129 .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
1130 }, {
1131 .clk = {
1132 .name = "sclk_dwmmc",
1133 .parent = &clk_dout_mmc4.clk,
1134 .enable = exynos4_clksrc_mask_fsys_ctrl,
1135 .ctrlbit = (1 << 16),
1136 },
1137 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1138 }
1139};
1140
1141static struct clksrc_clk clk_sclk_uart0 = {
1142 .clk = {
1143 .name = "uclk1",
1144 .devname = "exynos4210-uart.0",
1145 .enable = exynos4_clksrc_mask_peril0_ctrl,
1146 .ctrlbit = (1 << 0),
1147 },
1148 .sources = &clkset_group,
1149 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1150 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1151};
1152
1153static struct clksrc_clk clk_sclk_uart1 = {
1154 .clk = {
1155 .name = "uclk1",
1156 .devname = "exynos4210-uart.1",
1157 .enable = exynos4_clksrc_mask_peril0_ctrl,
1158 .ctrlbit = (1 << 4),
1159 },
1160 .sources = &clkset_group,
1161 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1162 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1163};
1164
1165static struct clksrc_clk clk_sclk_uart2 = {
1166 .clk = {
1167 .name = "uclk1",
1168 .devname = "exynos4210-uart.2",
1169 .enable = exynos4_clksrc_mask_peril0_ctrl,
1170 .ctrlbit = (1 << 8),
1171 },
1172 .sources = &clkset_group,
1173 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1174 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1175};
1176
1177static struct clksrc_clk clk_sclk_uart3 = {
1178 .clk = {
1179 .name = "uclk1",
1180 .devname = "exynos4210-uart.3",
1181 .enable = exynos4_clksrc_mask_peril0_ctrl,
1182 .ctrlbit = (1 << 12),
1183 },
1184 .sources = &clkset_group,
1185 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1186 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1187};
1188
1189static struct clksrc_clk clk_sclk_mmc0 = {
1190 .clk = {
1191 .name = "sclk_mmc",
1192 .devname = "s3c-sdhci.0",
1193 .parent = &clk_dout_mmc0.clk,
1194 .enable = exynos4_clksrc_mask_fsys_ctrl,
1195 .ctrlbit = (1 << 0),
1196 },
1197 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1198};
1199
1200static struct clksrc_clk clk_sclk_mmc1 = {
1201 .clk = {
1202 .name = "sclk_mmc",
1203 .devname = "s3c-sdhci.1",
1204 .parent = &clk_dout_mmc1.clk,
1205 .enable = exynos4_clksrc_mask_fsys_ctrl,
1206 .ctrlbit = (1 << 4),
1207 },
1208 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1209};
1210
1211static struct clksrc_clk clk_sclk_mmc2 = {
1212 .clk = {
1213 .name = "sclk_mmc",
1214 .devname = "s3c-sdhci.2",
1215 .parent = &clk_dout_mmc2.clk,
1216 .enable = exynos4_clksrc_mask_fsys_ctrl,
1217 .ctrlbit = (1 << 8),
1218 },
1219 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1220};
1221
1222static struct clksrc_clk clk_sclk_mmc3 = {
1223 .clk = {
1224 .name = "sclk_mmc",
1225 .devname = "s3c-sdhci.3",
1226 .parent = &clk_dout_mmc3.clk,
1227 .enable = exynos4_clksrc_mask_fsys_ctrl,
1228 .ctrlbit = (1 << 12),
1229 },
1230 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1231};
1232
1233static struct clksrc_clk clk_sclk_spi0 = {
1234 .clk = {
1235 .name = "sclk_spi",
1236 .devname = "s3c64xx-spi.0",
1237 .enable = exynos4_clksrc_mask_peril1_ctrl,
1238 .ctrlbit = (1 << 16),
1239 },
1240 .sources = &clkset_group,
1241 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1242 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1243};
1244
1245static struct clksrc_clk clk_sclk_spi1 = {
1246 .clk = {
1247 .name = "sclk_spi",
1248 .devname = "s3c64xx-spi.1",
1249 .enable = exynos4_clksrc_mask_peril1_ctrl,
1250 .ctrlbit = (1 << 20),
1251 },
1252 .sources = &clkset_group,
1253 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1254 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1255};
1256
1257static struct clksrc_clk clk_sclk_spi2 = {
1258 .clk = {
1259 .name = "sclk_spi",
1260 .devname = "s3c64xx-spi.2",
1261 .enable = exynos4_clksrc_mask_peril1_ctrl,
1262 .ctrlbit = (1 << 24),
1263 },
1264 .sources = &clkset_group,
1265 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1266 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1267};
1268
1269/* Clock initialization code */
1270static struct clksrc_clk *sysclks[] = {
1271 &clk_mout_apll,
1272 &clk_sclk_apll,
1273 &clk_mout_epll,
1274 &clk_mout_mpll,
1275 &clk_moutcore,
1276 &clk_coreclk,
1277 &clk_armclk,
1278 &clk_aclk_corem0,
1279 &clk_aclk_cores,
1280 &clk_aclk_corem1,
1281 &clk_periphclk,
1282 &clk_mout_corebus,
1283 &clk_sclk_dmc,
1284 &clk_aclk_cored,
1285 &clk_aclk_corep,
1286 &clk_aclk_acp,
1287 &clk_pclk_acp,
1288 &clk_vpllsrc,
1289 &clk_sclk_vpll,
1290 &clk_aclk_200,
1291 &clk_aclk_100,
1292 &clk_aclk_160,
1293 &clk_aclk_133,
1294 &clk_dout_mmc0,
1295 &clk_dout_mmc1,
1296 &clk_dout_mmc2,
1297 &clk_dout_mmc3,
1298 &clk_dout_mmc4,
1299 &clk_mout_mfc0,
1300 &clk_mout_mfc1,
1301};
1302
1303static struct clk *clk_cdev[] = {
1304 &clk_pdma0,
1305 &clk_pdma1,
1306};
1307
1308static struct clksrc_clk *clksrc_cdev[] = {
1309 &clk_sclk_uart0,
1310 &clk_sclk_uart1,
1311 &clk_sclk_uart2,
1312 &clk_sclk_uart3,
1313 &clk_sclk_mmc0,
1314 &clk_sclk_mmc1,
1315 &clk_sclk_mmc2,
1316 &clk_sclk_mmc3,
1317 &clk_sclk_spi0,
1318 &clk_sclk_spi1,
1319 &clk_sclk_spi2,
1320
1321};
1322
1323static struct clk_lookup exynos4_clk_lookup[] = {
1324 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &clk_sclk_uart0.clk),
1325 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &clk_sclk_uart1.clk),
1326 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &clk_sclk_uart2.clk),
1327 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &clk_sclk_uart3.clk),
1328 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1329 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1330 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1331 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
1332 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1333 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
1334 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &clk_sclk_spi0.clk),
1335 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &clk_sclk_spi1.clk),
1336 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &clk_sclk_spi2.clk),
1337};
1338
1339static int xtal_rate;
1340
1341static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1342{
1343 if (soc_is_exynos4210())
1344 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0),
1345 pll_4508);
1346 else if (soc_is_exynos4212() || soc_is_exynos4412())
1347 return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0));
1348 else
1349 return 0;
1350}
1351
1352static struct clk_ops exynos4_fout_apll_ops = {
1353 .get_rate = exynos4_fout_apll_get_rate,
1354};
1355
1356static u32 vpll_div[][8] = {
1357 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1358 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1359};
1360
1361static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1362{
1363 return clk->rate;
1364}
1365
1366static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1367{
1368 unsigned int vpll_con0, vpll_con1 = 0;
1369 unsigned int i;
1370
1371 /* Return if nothing changed */
1372 if (clk->rate == rate)
1373 return 0;
1374
1375 vpll_con0 = __raw_readl(S5P_VPLL_CON0);
1376 vpll_con0 &= ~(0x1 << 27 | \
1377 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1378 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1379 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1380
1381 vpll_con1 = __raw_readl(S5P_VPLL_CON1);
1382 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1383 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1384 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1385
1386 for (i = 0; i < ARRAY_SIZE(vpll_div); i++) {
1387 if (vpll_div[i][0] == rate) {
1388 vpll_con0 |= vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1389 vpll_con0 |= vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1390 vpll_con0 |= vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1391 vpll_con1 |= vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1392 vpll_con1 |= vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1393 vpll_con1 |= vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1394 vpll_con0 |= vpll_div[i][7] << 27;
1395 break;
1396 }
1397 }
1398
1399 if (i == ARRAY_SIZE(vpll_div)) {
1400 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1401 __func__);
1402 return -EINVAL;
1403 }
1404
1405 __raw_writel(vpll_con0, S5P_VPLL_CON0);
1406 __raw_writel(vpll_con1, S5P_VPLL_CON1);
1407
1408 /* Wait for VPLL lock */
1409 while (!(__raw_readl(S5P_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1410 continue;
1411
1412 clk->rate = rate;
1413 return 0;
1414}
1415
1416static struct clk_ops exynos4_vpll_ops = {
1417 .get_rate = exynos4_vpll_get_rate,
1418 .set_rate = exynos4_vpll_set_rate,
1419};
1420
1421void __init_or_cpufreq exynos4_setup_clocks(void)
1422{
1423 struct clk *xtal_clk;
1424 unsigned long apll = 0;
1425 unsigned long mpll = 0;
1426 unsigned long epll = 0;
1427 unsigned long vpll = 0;
1428 unsigned long vpllsrc;
1429 unsigned long xtal;
1430 unsigned long armclk;
1431 unsigned long sclk_dmc;
1432 unsigned long aclk_200;
1433 unsigned long aclk_100;
1434 unsigned long aclk_160;
1435 unsigned long aclk_133;
1436 unsigned int ptr;
1437
1438 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1439
1440 xtal_clk = clk_get(NULL, "xtal");
1441 BUG_ON(IS_ERR(xtal_clk));
1442
1443 xtal = clk_get_rate(xtal_clk);
1444
1445 xtal_rate = xtal;
1446
1447 clk_put(xtal_clk);
1448
1449 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1450
1451 if (soc_is_exynos4210()) {
1452 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0),
1453 pll_4508);
1454 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0),
1455 pll_4508);
1456 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1457 __raw_readl(S5P_EPLL_CON1), pll_4600);
1458
1459 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1460 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1461 __raw_readl(S5P_VPLL_CON1), pll_4650c);
1462 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1463 apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0));
1464 mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0));
1465 epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0),
1466 __raw_readl(S5P_EPLL_CON1));
1467
1468 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1469 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1470 __raw_readl(S5P_VPLL_CON1));
1471 } else {
1472 /* nothing */
1473 }
1474
1475 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1476 clk_fout_mpll.rate = mpll;
1477 clk_fout_epll.rate = epll;
1478 clk_fout_vpll.ops = &exynos4_vpll_ops;
1479 clk_fout_vpll.rate = vpll;
1480
1481 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1482 apll, mpll, epll, vpll);
1483
1484 armclk = clk_get_rate(&clk_armclk.clk);
1485 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
1486
1487 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
1488 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
1489 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
1490 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
1491
1492 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1493 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1494 armclk, sclk_dmc, aclk_200,
1495 aclk_100, aclk_160, aclk_133);
1496
1497 clk_f.rate = armclk;
1498 clk_h.rate = sclk_dmc;
1499 clk_p.rate = aclk_100;
1500
1501 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1502 s3c_set_clksrc(&clksrcs[ptr], true);
1503}
1504
1505static struct clk *clks[] __initdata = {
1506 &clk_sclk_hdmi27m,
1507 &clk_sclk_hdmiphy,
1508 &clk_sclk_usbphy0,
1509 &clk_sclk_usbphy1,
1510};
1511
1512#ifdef CONFIG_PM_SLEEP
1513static int exynos4_clock_suspend(void)
1514{
1515 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1516 return 0;
1517}
1518
1519static void exynos4_clock_resume(void)
1520{
1521 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1522}
1523
1524#else
1525#define exynos4_clock_suspend NULL
1526#define exynos4_clock_resume NULL
1527#endif
1528
1529struct syscore_ops exynos4_clock_syscore_ops = {
1530 .suspend = exynos4_clock_suspend,
1531 .resume = exynos4_clock_resume,
1532};
1533
1534void __init exynos4_register_clocks(void)
1535{
1536 int ptr;
1537
1538 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1539
1540 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1541 s3c_register_clksrc(sysclks[ptr], 1);
1542
1543 for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++)
1544 s3c_register_clksrc(sclk_tv[ptr], 1);
1545
1546 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1547 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1548
1549 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1550 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1551
1552 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1553 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1554 s3c_disable_clocks(clk_cdev[ptr], 1);
1555
1556 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1557 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1558 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1559
1560 register_syscore_ops(&exynos4_clock_syscore_ops);
1561 s3c24xx_register_clock(&dummy_apb_pclk);
1562
1563 s3c_pwmclk_init();
1564}
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 031c1e5b3dfe..cbbaca54966a 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -49,6 +49,14 @@
49static const char name_exynos4210[] = "EXYNOS4210"; 49static const char name_exynos4210[] = "EXYNOS4210";
50static const char name_exynos4212[] = "EXYNOS4212"; 50static const char name_exynos4212[] = "EXYNOS4212";
51static const char name_exynos4412[] = "EXYNOS4412"; 51static const char name_exynos4412[] = "EXYNOS4412";
52static const char name_exynos5250[] = "EXYNOS5250";
53
54static void exynos4_map_io(void);
55static void exynos5_map_io(void);
56static void exynos4_init_clocks(int xtal);
57static void exynos5_init_clocks(int xtal);
58static void exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no);
59static int exynos_init(void);
52 60
53static struct cpu_table cpu_ids[] __initdata = { 61static struct cpu_table cpu_ids[] __initdata = {
54 { 62 {
@@ -56,7 +64,7 @@ static struct cpu_table cpu_ids[] __initdata = {
56 .idmask = EXYNOS4_CPU_MASK, 64 .idmask = EXYNOS4_CPU_MASK,
57 .map_io = exynos4_map_io, 65 .map_io = exynos4_map_io,
58 .init_clocks = exynos4_init_clocks, 66 .init_clocks = exynos4_init_clocks,
59 .init_uarts = exynos4_init_uarts, 67 .init_uarts = exynos_init_uarts,
60 .init = exynos_init, 68 .init = exynos_init,
61 .name = name_exynos4210, 69 .name = name_exynos4210,
62 }, { 70 }, {
@@ -64,7 +72,7 @@ static struct cpu_table cpu_ids[] __initdata = {
64 .idmask = EXYNOS4_CPU_MASK, 72 .idmask = EXYNOS4_CPU_MASK,
65 .map_io = exynos4_map_io, 73 .map_io = exynos4_map_io,
66 .init_clocks = exynos4_init_clocks, 74 .init_clocks = exynos4_init_clocks,
67 .init_uarts = exynos4_init_uarts, 75 .init_uarts = exynos_init_uarts,
68 .init = exynos_init, 76 .init = exynos_init,
69 .name = name_exynos4212, 77 .name = name_exynos4212,
70 }, { 78 }, {
@@ -72,9 +80,17 @@ static struct cpu_table cpu_ids[] __initdata = {
72 .idmask = EXYNOS4_CPU_MASK, 80 .idmask = EXYNOS4_CPU_MASK,
73 .map_io = exynos4_map_io, 81 .map_io = exynos4_map_io,
74 .init_clocks = exynos4_init_clocks, 82 .init_clocks = exynos4_init_clocks,
75 .init_uarts = exynos4_init_uarts, 83 .init_uarts = exynos_init_uarts,
76 .init = exynos_init, 84 .init = exynos_init,
77 .name = name_exynos4412, 85 .name = name_exynos4412,
86 }, {
87 .idcode = EXYNOS5250_SOC_ID,
88 .idmask = EXYNOS5_SOC_MASK,
89 .map_io = exynos5_map_io,
90 .init_clocks = exynos5_init_clocks,
91 .init_uarts = exynos_init_uarts,
92 .init = exynos_init,
93 .name = name_exynos5250,
78 }, 94 },
79}; 95};
80 96
@@ -83,10 +99,14 @@ static struct cpu_table cpu_ids[] __initdata = {
83static struct map_desc exynos_iodesc[] __initdata = { 99static struct map_desc exynos_iodesc[] __initdata = {
84 { 100 {
85 .virtual = (unsigned long)S5P_VA_CHIPID, 101 .virtual = (unsigned long)S5P_VA_CHIPID,
86 .pfn = __phys_to_pfn(EXYNOS4_PA_CHIPID), 102 .pfn = __phys_to_pfn(EXYNOS_PA_CHIPID),
87 .length = SZ_4K, 103 .length = SZ_4K,
88 .type = MT_DEVICE, 104 .type = MT_DEVICE,
89 }, { 105 },
106};
107
108static struct map_desc exynos4_iodesc[] __initdata = {
109 {
90 .virtual = (unsigned long)S3C_VA_SYS, 110 .virtual = (unsigned long)S3C_VA_SYS,
91 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON), 111 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON),
92 .length = SZ_64K, 112 .length = SZ_64K,
@@ -136,11 +156,7 @@ static struct map_desc exynos_iodesc[] __initdata = {
136 .pfn = __phys_to_pfn(EXYNOS4_PA_UART), 156 .pfn = __phys_to_pfn(EXYNOS4_PA_UART),
137 .length = SZ_512K, 157 .length = SZ_512K,
138 .type = MT_DEVICE, 158 .type = MT_DEVICE,
139 }, 159 }, {
140};
141
142static struct map_desc exynos4_iodesc[] __initdata = {
143 {
144 .virtual = (unsigned long)S5P_VA_CMU, 160 .virtual = (unsigned long)S5P_VA_CMU,
145 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), 161 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
146 .length = SZ_128K, 162 .length = SZ_128K,
@@ -201,11 +217,80 @@ static struct map_desc exynos4_iodesc1[] __initdata = {
201 }, 217 },
202}; 218};
203 219
220static struct map_desc exynos5_iodesc[] __initdata = {
221 {
222 .virtual = (unsigned long)S3C_VA_SYS,
223 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSCON),
224 .length = SZ_64K,
225 .type = MT_DEVICE,
226 }, {
227 .virtual = (unsigned long)S3C_VA_TIMER,
228 .pfn = __phys_to_pfn(EXYNOS5_PA_TIMER),
229 .length = SZ_16K,
230 .type = MT_DEVICE,
231 }, {
232 .virtual = (unsigned long)S3C_VA_WATCHDOG,
233 .pfn = __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
234 .length = SZ_4K,
235 .type = MT_DEVICE,
236 }, {
237 .virtual = (unsigned long)S5P_VA_SROMC,
238 .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC),
239 .length = SZ_4K,
240 .type = MT_DEVICE,
241 }, {
242 .virtual = (unsigned long)S5P_VA_SYSTIMER,
243 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER),
244 .length = SZ_4K,
245 .type = MT_DEVICE,
246 }, {
247 .virtual = (unsigned long)S5P_VA_SYSRAM,
248 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
249 .length = SZ_4K,
250 .type = MT_DEVICE,
251 }, {
252 .virtual = (unsigned long)S5P_VA_CMU,
253 .pfn = __phys_to_pfn(EXYNOS5_PA_CMU),
254 .length = 144 * SZ_1K,
255 .type = MT_DEVICE,
256 }, {
257 .virtual = (unsigned long)S5P_VA_PMU,
258 .pfn = __phys_to_pfn(EXYNOS5_PA_PMU),
259 .length = SZ_64K,
260 .type = MT_DEVICE,
261 }, {
262 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
263 .pfn = __phys_to_pfn(EXYNOS5_PA_COMBINER),
264 .length = SZ_4K,
265 .type = MT_DEVICE,
266 }, {
267 .virtual = (unsigned long)S3C_VA_UART,
268 .pfn = __phys_to_pfn(EXYNOS5_PA_UART),
269 .length = SZ_512K,
270 .type = MT_DEVICE,
271 }, {
272 .virtual = (unsigned long)S5P_VA_GIC_CPU,
273 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_CPU),
274 .length = SZ_64K,
275 .type = MT_DEVICE,
276 }, {
277 .virtual = (unsigned long)S5P_VA_GIC_DIST,
278 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_DIST),
279 .length = SZ_64K,
280 .type = MT_DEVICE,
281 },
282};
283
204void exynos4_restart(char mode, const char *cmd) 284void exynos4_restart(char mode, const char *cmd)
205{ 285{
206 __raw_writel(0x1, S5P_SWRESET); 286 __raw_writel(0x1, S5P_SWRESET);
207} 287}
208 288
289void exynos5_restart(char mode, const char *cmd)
290{
291 __raw_writel(0x1, EXYNOS_SWRESET);
292}
293
209/* 294/*
210 * exynos_map_io 295 * exynos_map_io
211 * 296 *
@@ -225,7 +310,7 @@ void __init exynos_init_io(struct map_desc *mach_desc, int size)
225 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); 310 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
226} 311}
227 312
228void __init exynos4_map_io(void) 313static void __init exynos4_map_io(void)
229{ 314{
230 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); 315 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
231 316
@@ -256,7 +341,22 @@ void __init exynos4_map_io(void)
256 s5p_hdmi_setname("exynos4-hdmi"); 341 s5p_hdmi_setname("exynos4-hdmi");
257} 342}
258 343
259void __init exynos4_init_clocks(int xtal) 344static void __init exynos5_map_io(void)
345{
346 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
347
348 s3c_device_i2c0.resource[0].start = EXYNOS5_PA_IIC(0);
349 s3c_device_i2c0.resource[0].end = EXYNOS5_PA_IIC(0) + SZ_4K - 1;
350 s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC;
351 s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC;
352
353 /* The I2C bus controllers are directly compatible with s3c2440 */
354 s3c_i2c0_setname("s3c2440-i2c");
355 s3c_i2c1_setname("s3c2440-i2c");
356 s3c_i2c2_setname("s3c2440-i2c");
357}
358
359static void __init exynos4_init_clocks(int xtal)
260{ 360{
261 printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 361 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
262 362
@@ -272,6 +372,17 @@ void __init exynos4_init_clocks(int xtal)
272 exynos4_setup_clocks(); 372 exynos4_setup_clocks();
273} 373}
274 374
375static void __init exynos5_init_clocks(int xtal)
376{
377 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
378
379 s3c24xx_register_baseclocks(xtal);
380 s5p_register_clocks(xtal);
381
382 exynos5_register_clocks();
383 exynos5_setup_clocks();
384}
385
275#define COMBINER_ENABLE_SET 0x0 386#define COMBINER_ENABLE_SET 0x0
276#define COMBINER_ENABLE_CLEAR 0x4 387#define COMBINER_ENABLE_CLEAR 0x4
277#define COMBINER_INT_STATUS 0xC 388#define COMBINER_INT_STATUS 0xC
@@ -345,7 +456,14 @@ static struct irq_chip combiner_chip = {
345 456
346static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) 457static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq)
347{ 458{
348 if (combiner_nr >= MAX_COMBINER_NR) 459 unsigned int max_nr;
460
461 if (soc_is_exynos5250())
462 max_nr = EXYNOS5_MAX_COMBINER_NR;
463 else
464 max_nr = EXYNOS4_MAX_COMBINER_NR;
465
466 if (combiner_nr >= max_nr)
349 BUG(); 467 BUG();
350 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) 468 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
351 BUG(); 469 BUG();
@@ -356,8 +474,14 @@ static void __init combiner_init(unsigned int combiner_nr, void __iomem *base,
356 unsigned int irq_start) 474 unsigned int irq_start)
357{ 475{
358 unsigned int i; 476 unsigned int i;
477 unsigned int max_nr;
478
479 if (soc_is_exynos5250())
480 max_nr = EXYNOS5_MAX_COMBINER_NR;
481 else
482 max_nr = EXYNOS4_MAX_COMBINER_NR;
359 483
360 if (combiner_nr >= MAX_COMBINER_NR) 484 if (combiner_nr >= max_nr)
361 BUG(); 485 BUG();
362 486
363 combiner_data[combiner_nr].base = base; 487 combiner_data[combiner_nr].base = base;
@@ -400,8 +524,28 @@ void __init exynos4_init_irq(void)
400 of_irq_init(exynos4_dt_irq_match); 524 of_irq_init(exynos4_dt_irq_match);
401#endif 525#endif
402 526
403 for (irq = 0; irq < MAX_COMBINER_NR; irq++) { 527 for (irq = 0; irq < EXYNOS4_MAX_COMBINER_NR; irq++) {
528
529 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
530 COMBINER_IRQ(irq, 0));
531 combiner_cascade_irq(irq, IRQ_SPI(irq));
532 }
533
534 /*
535 * The parameters of s5p_init_irq() are for VIC init.
536 * Theses parameters should be NULL and 0 because EXYNOS4
537 * uses GIC instead of VIC.
538 */
539 s5p_init_irq(NULL, 0);
540}
541
542void __init exynos5_init_irq(void)
543{
544 int irq;
545
546 gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
404 547
548 for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) {
405 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), 549 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
406 COMBINER_IRQ(irq, 0)); 550 COMBINER_IRQ(irq, 0));
407 combiner_cascade_irq(irq, IRQ_SPI(irq)); 551 combiner_cascade_irq(irq, IRQ_SPI(irq));
@@ -420,19 +564,34 @@ struct bus_type exynos4_subsys = {
420 .dev_name = "exynos4-core", 564 .dev_name = "exynos4-core",
421}; 565};
422 566
567struct bus_type exynos5_subsys = {
568 .name = "exynos5-core",
569 .dev_name = "exynos5-core",
570};
571
423static struct device exynos4_dev = { 572static struct device exynos4_dev = {
424 .bus = &exynos4_subsys, 573 .bus = &exynos4_subsys,
425}; 574};
426 575
427static int __init exynos4_core_init(void) 576static struct device exynos5_dev = {
577 .bus = &exynos5_subsys,
578};
579
580static int __init exynos_core_init(void)
428{ 581{
429 return subsys_system_register(&exynos4_subsys, NULL); 582 if (soc_is_exynos5250())
583 return subsys_system_register(&exynos5_subsys, NULL);
584 else
585 return subsys_system_register(&exynos4_subsys, NULL);
430} 586}
431core_initcall(exynos4_core_init); 587core_initcall(exynos_core_init);
432 588
433#ifdef CONFIG_CACHE_L2X0 589#ifdef CONFIG_CACHE_L2X0
434static int __init exynos4_l2x0_cache_init(void) 590static int __init exynos4_l2x0_cache_init(void)
435{ 591{
592 if (soc_is_exynos5250())
593 return 0;
594
436 /* TAG, Data Latency Control: 2cycle */ 595 /* TAG, Data Latency Control: 2cycle */
437 __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL); 596 __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
438 597
@@ -452,19 +611,47 @@ static int __init exynos4_l2x0_cache_init(void)
452 611
453 return 0; 612 return 0;
454} 613}
455
456early_initcall(exynos4_l2x0_cache_init); 614early_initcall(exynos4_l2x0_cache_init);
457#endif 615#endif
458 616
459int __init exynos_init(void) 617static int __init exynos5_l2_cache_init(void)
618{
619 unsigned int val;
620
621 if (!soc_is_exynos5250())
622 return 0;
623
624 asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
625 "bic %0, %0, #(1 << 2)\n" /* cache disable */
626 "mcr p15, 0, %0, c1, c0, 0\n"
627 "mrc p15, 1, %0, c9, c0, 2\n"
628 : "=r"(val));
629
630 val |= (1 << 9) | (1 << 5) | (2 << 6) | (2 << 0);
631
632 asm volatile("mcr p15, 1, %0, c9, c0, 2\n" : : "r"(val));
633 asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
634 "orr %0, %0, #(1 << 2)\n" /* cache enable */
635 "mcr p15, 0, %0, c1, c0, 0\n"
636 : : "r"(val));
637
638 return 0;
639}
640early_initcall(exynos5_l2_cache_init);
641
642static int __init exynos_init(void)
460{ 643{
461 printk(KERN_INFO "EXYNOS: Initializing architecture\n"); 644 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
462 return device_register(&exynos4_dev); 645
646 if (soc_is_exynos5250())
647 return device_register(&exynos5_dev);
648 else
649 return device_register(&exynos4_dev);
463} 650}
464 651
465/* uart registration process */ 652/* uart registration process */
466 653
467void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no) 654static void __init exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no)
468{ 655{
469 struct s3c2410_uartcfg *tcfg = cfg; 656 struct s3c2410_uartcfg *tcfg = cfg;
470 u32 ucnt; 657 u32 ucnt;
@@ -472,69 +659,138 @@ void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
472 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) 659 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
473 tcfg->has_fracval = 1; 660 tcfg->has_fracval = 1;
474 661
475 s3c24xx_init_uartdevs("exynos4210-uart", s5p_uart_resources, cfg, no); 662 if (soc_is_exynos5250())
663 s3c24xx_init_uartdevs("exynos4210-uart", exynos5_uart_resources, cfg, no);
664 else
665 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
476} 666}
477 667
668static void __iomem *exynos_eint_base;
669
478static DEFINE_SPINLOCK(eint_lock); 670static DEFINE_SPINLOCK(eint_lock);
479 671
480static unsigned int eint0_15_data[16]; 672static unsigned int eint0_15_data[16];
481 673
482static unsigned int exynos4_get_irq_nr(unsigned int number) 674static inline int exynos4_irq_to_gpio(unsigned int irq)
483{ 675{
484 u32 ret = 0; 676 if (irq < IRQ_EINT(0))
677 return -EINVAL;
485 678
486 switch (number) { 679 irq -= IRQ_EINT(0);
487 case 0 ... 3: 680 if (irq < 8)
488 ret = (number + IRQ_EINT0); 681 return EXYNOS4_GPX0(irq);
489 break; 682
490 case 4 ... 7: 683 irq -= 8;
491 ret = (number + (IRQ_EINT4 - 4)); 684 if (irq < 8)
492 break; 685 return EXYNOS4_GPX1(irq);
493 case 8 ... 15: 686
494 ret = (number + (IRQ_EINT8 - 8)); 687 irq -= 8;
495 break; 688 if (irq < 8)
496 default: 689 return EXYNOS4_GPX2(irq);
497 printk(KERN_ERR "number available : %d\n", number);
498 }
499 690
500 return ret; 691 irq -= 8;
692 if (irq < 8)
693 return EXYNOS4_GPX3(irq);
694
695 return -EINVAL;
501} 696}
502 697
503static inline void exynos4_irq_eint_mask(struct irq_data *data) 698static inline int exynos5_irq_to_gpio(unsigned int irq)
699{
700 if (irq < IRQ_EINT(0))
701 return -EINVAL;
702
703 irq -= IRQ_EINT(0);
704 if (irq < 8)
705 return EXYNOS5_GPX0(irq);
706
707 irq -= 8;
708 if (irq < 8)
709 return EXYNOS5_GPX1(irq);
710
711 irq -= 8;
712 if (irq < 8)
713 return EXYNOS5_GPX2(irq);
714
715 irq -= 8;
716 if (irq < 8)
717 return EXYNOS5_GPX3(irq);
718
719 return -EINVAL;
720}
721
722static unsigned int exynos4_eint0_15_src_int[16] = {
723 EXYNOS4_IRQ_EINT0,
724 EXYNOS4_IRQ_EINT1,
725 EXYNOS4_IRQ_EINT2,
726 EXYNOS4_IRQ_EINT3,
727 EXYNOS4_IRQ_EINT4,
728 EXYNOS4_IRQ_EINT5,
729 EXYNOS4_IRQ_EINT6,
730 EXYNOS4_IRQ_EINT7,
731 EXYNOS4_IRQ_EINT8,
732 EXYNOS4_IRQ_EINT9,
733 EXYNOS4_IRQ_EINT10,
734 EXYNOS4_IRQ_EINT11,
735 EXYNOS4_IRQ_EINT12,
736 EXYNOS4_IRQ_EINT13,
737 EXYNOS4_IRQ_EINT14,
738 EXYNOS4_IRQ_EINT15,
739};
740
741static unsigned int exynos5_eint0_15_src_int[16] = {
742 EXYNOS5_IRQ_EINT0,
743 EXYNOS5_IRQ_EINT1,
744 EXYNOS5_IRQ_EINT2,
745 EXYNOS5_IRQ_EINT3,
746 EXYNOS5_IRQ_EINT4,
747 EXYNOS5_IRQ_EINT5,
748 EXYNOS5_IRQ_EINT6,
749 EXYNOS5_IRQ_EINT7,
750 EXYNOS5_IRQ_EINT8,
751 EXYNOS5_IRQ_EINT9,
752 EXYNOS5_IRQ_EINT10,
753 EXYNOS5_IRQ_EINT11,
754 EXYNOS5_IRQ_EINT12,
755 EXYNOS5_IRQ_EINT13,
756 EXYNOS5_IRQ_EINT14,
757 EXYNOS5_IRQ_EINT15,
758};
759static inline void exynos_irq_eint_mask(struct irq_data *data)
504{ 760{
505 u32 mask; 761 u32 mask;
506 762
507 spin_lock(&eint_lock); 763 spin_lock(&eint_lock);
508 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); 764 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
509 mask |= eint_irq_to_bit(data->irq); 765 mask |= EINT_OFFSET_BIT(data->irq);
510 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); 766 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
511 spin_unlock(&eint_lock); 767 spin_unlock(&eint_lock);
512} 768}
513 769
514static void exynos4_irq_eint_unmask(struct irq_data *data) 770static void exynos_irq_eint_unmask(struct irq_data *data)
515{ 771{
516 u32 mask; 772 u32 mask;
517 773
518 spin_lock(&eint_lock); 774 spin_lock(&eint_lock);
519 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); 775 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
520 mask &= ~(eint_irq_to_bit(data->irq)); 776 mask &= ~(EINT_OFFSET_BIT(data->irq));
521 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); 777 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
522 spin_unlock(&eint_lock); 778 spin_unlock(&eint_lock);
523} 779}
524 780
525static inline void exynos4_irq_eint_ack(struct irq_data *data) 781static inline void exynos_irq_eint_ack(struct irq_data *data)
526{ 782{
527 __raw_writel(eint_irq_to_bit(data->irq), 783 __raw_writel(EINT_OFFSET_BIT(data->irq),
528 S5P_EINT_PEND(EINT_REG_NR(data->irq))); 784 EINT_PEND(exynos_eint_base, data->irq));
529} 785}
530 786
531static void exynos4_irq_eint_maskack(struct irq_data *data) 787static void exynos_irq_eint_maskack(struct irq_data *data)
532{ 788{
533 exynos4_irq_eint_mask(data); 789 exynos_irq_eint_mask(data);
534 exynos4_irq_eint_ack(data); 790 exynos_irq_eint_ack(data);
535} 791}
536 792
537static int exynos4_irq_eint_set_type(struct irq_data *data, unsigned int type) 793static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
538{ 794{
539 int offs = EINT_OFFSET(data->irq); 795 int offs = EINT_OFFSET(data->irq);
540 int shift; 796 int shift;
@@ -571,39 +827,27 @@ static int exynos4_irq_eint_set_type(struct irq_data *data, unsigned int type)
571 mask = 0x7 << shift; 827 mask = 0x7 << shift;
572 828
573 spin_lock(&eint_lock); 829 spin_lock(&eint_lock);
574 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq))); 830 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
575 ctrl &= ~mask; 831 ctrl &= ~mask;
576 ctrl |= newvalue << shift; 832 ctrl |= newvalue << shift;
577 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq))); 833 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
578 spin_unlock(&eint_lock); 834 spin_unlock(&eint_lock);
579 835
580 switch (offs) { 836 if (soc_is_exynos5250())
581 case 0 ... 7: 837 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
582 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE); 838 else
583 break; 839 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
584 case 8 ... 15:
585 s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE);
586 break;
587 case 16 ... 23:
588 s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE);
589 break;
590 case 24 ... 31:
591 s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE);
592 break;
593 default:
594 printk(KERN_ERR "No such irq number %d", offs);
595 }
596 840
597 return 0; 841 return 0;
598} 842}
599 843
600static struct irq_chip exynos4_irq_eint = { 844static struct irq_chip exynos_irq_eint = {
601 .name = "exynos4-eint", 845 .name = "exynos-eint",
602 .irq_mask = exynos4_irq_eint_mask, 846 .irq_mask = exynos_irq_eint_mask,
603 .irq_unmask = exynos4_irq_eint_unmask, 847 .irq_unmask = exynos_irq_eint_unmask,
604 .irq_mask_ack = exynos4_irq_eint_maskack, 848 .irq_mask_ack = exynos_irq_eint_maskack,
605 .irq_ack = exynos4_irq_eint_ack, 849 .irq_ack = exynos_irq_eint_ack,
606 .irq_set_type = exynos4_irq_eint_set_type, 850 .irq_set_type = exynos_irq_eint_set_type,
607#ifdef CONFIG_PM 851#ifdef CONFIG_PM
608 .irq_set_wake = s3c_irqext_wake, 852 .irq_set_wake = s3c_irqext_wake,
609#endif 853#endif
@@ -618,12 +862,12 @@ static struct irq_chip exynos4_irq_eint = {
618 * 862 *
619 * Each EINT pend/mask registers handle eight of them. 863 * Each EINT pend/mask registers handle eight of them.
620 */ 864 */
621static inline void exynos4_irq_demux_eint(unsigned int start) 865static inline void exynos_irq_demux_eint(unsigned int start)
622{ 866{
623 unsigned int irq; 867 unsigned int irq;
624 868
625 u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start))); 869 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
626 u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start))); 870 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
627 871
628 status &= ~mask; 872 status &= ~mask;
629 status &= 0xff; 873 status &= 0xff;
@@ -635,16 +879,16 @@ static inline void exynos4_irq_demux_eint(unsigned int start)
635 } 879 }
636} 880}
637 881
638static void exynos4_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) 882static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
639{ 883{
640 struct irq_chip *chip = irq_get_chip(irq); 884 struct irq_chip *chip = irq_get_chip(irq);
641 chained_irq_enter(chip, desc); 885 chained_irq_enter(chip, desc);
642 exynos4_irq_demux_eint(IRQ_EINT(16)); 886 exynos_irq_demux_eint(IRQ_EINT(16));
643 exynos4_irq_demux_eint(IRQ_EINT(24)); 887 exynos_irq_demux_eint(IRQ_EINT(24));
644 chained_irq_exit(chip, desc); 888 chained_irq_exit(chip, desc);
645} 889}
646 890
647static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc) 891static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
648{ 892{
649 u32 *irq_data = irq_get_handler_data(irq); 893 u32 *irq_data = irq_get_handler_data(irq);
650 struct irq_chip *chip = irq_get_chip(irq); 894 struct irq_chip *chip = irq_get_chip(irq);
@@ -661,27 +905,44 @@ static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
661 chained_irq_exit(chip, desc); 905 chained_irq_exit(chip, desc);
662} 906}
663 907
664int __init exynos4_init_irq_eint(void) 908static int __init exynos_init_irq_eint(void)
665{ 909{
666 int irq; 910 int irq;
667 911
912 if (soc_is_exynos5250())
913 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
914 else
915 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
916
917 if (exynos_eint_base == NULL) {
918 pr_err("unable to ioremap for EINT base address\n");
919 return -ENOMEM;
920 }
921
668 for (irq = 0 ; irq <= 31 ; irq++) { 922 for (irq = 0 ; irq <= 31 ; irq++) {
669 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos4_irq_eint, 923 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
670 handle_level_irq); 924 handle_level_irq);
671 set_irq_flags(IRQ_EINT(irq), IRQF_VALID); 925 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
672 } 926 }
673 927
674 irq_set_chained_handler(IRQ_EINT16_31, exynos4_irq_demux_eint16_31); 928 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
675 929
676 for (irq = 0 ; irq <= 15 ; irq++) { 930 for (irq = 0 ; irq <= 15 ; irq++) {
677 eint0_15_data[irq] = IRQ_EINT(irq); 931 eint0_15_data[irq] = IRQ_EINT(irq);
678 932
679 irq_set_handler_data(exynos4_get_irq_nr(irq), 933 if (soc_is_exynos5250()) {
680 &eint0_15_data[irq]); 934 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
681 irq_set_chained_handler(exynos4_get_irq_nr(irq), 935 &eint0_15_data[irq]);
682 exynos4_irq_eint0_15); 936 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
937 exynos_irq_eint0_15);
938 } else {
939 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
940 &eint0_15_data[irq]);
941 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
942 exynos_irq_eint0_15);
943 }
683 } 944 }
684 945
685 return 0; 946 return 0;
686} 947}
687arch_initcall(exynos4_init_irq_eint); 948arch_initcall(exynos_init_irq_eint);
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 1ac49de0f398..677b5467df18 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,30 +12,44 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15extern struct sys_timer exynos4_timer;
16
15void exynos_init_io(struct map_desc *mach_desc, int size); 17void exynos_init_io(struct map_desc *mach_desc, int size);
16void exynos4_init_irq(void); 18void exynos4_init_irq(void);
19void exynos5_init_irq(void);
20void exynos4_restart(char mode, const char *cmd);
21void exynos5_restart(char mode, const char *cmd);
17 22
23#ifdef CONFIG_ARCH_EXYNOS4
18void exynos4_register_clocks(void); 24void exynos4_register_clocks(void);
19void exynos4_setup_clocks(void); 25void exynos4_setup_clocks(void);
20 26
21void exynos4210_register_clocks(void); 27#else
22void exynos4212_register_clocks(void); 28#define exynos4_register_clocks()
29#define exynos4_setup_clocks()
30#endif
23 31
24void exynos4_restart(char mode, const char *cmd); 32#ifdef CONFIG_ARCH_EXYNOS5
33void exynos5_register_clocks(void);
34void exynos5_setup_clocks(void);
25 35
26extern struct sys_timer exynos4_timer; 36#else
37#define exynos5_register_clocks()
38#define exynos5_setup_clocks()
39#endif
40
41#ifdef CONFIG_CPU_EXYNOS4210
42void exynos4210_register_clocks(void);
27 43
28#ifdef CONFIG_ARCH_EXYNOS 44#else
29extern int exynos_init(void); 45#define exynos4210_register_clocks()
30extern void exynos4_map_io(void); 46#endif
31extern void exynos4_init_clocks(int xtal); 47
32extern void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no); 48#ifdef CONFIG_SOC_EXYNOS4212
49void exynos4212_register_clocks(void);
33 50
34#else 51#else
35#define exynos4_init_clocks NULL 52#define exynos4212_register_clocks()
36#define exynos4_init_uarts NULL
37#define exynos4_map_io NULL
38#define exynos_init NULL
39#endif 53#endif
40 54
41#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ 55#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/dev-ahci.c b/arch/arm/mach-exynos/dev-ahci.c
index f57a3de8e1d2..50ce5b0adcf1 100644
--- a/arch/arm/mach-exynos/dev-ahci.c
+++ b/arch/arm/mach-exynos/dev-ahci.c
@@ -242,8 +242,8 @@ static struct resource exynos4_ahci_resource[] = {
242 .flags = IORESOURCE_MEM, 242 .flags = IORESOURCE_MEM,
243 }, 243 },
244 [1] = { 244 [1] = {
245 .start = IRQ_SATA, 245 .start = EXYNOS4_IRQ_SATA,
246 .end = IRQ_SATA, 246 .end = EXYNOS4_IRQ_SATA,
247 .flags = IORESOURCE_IRQ, 247 .flags = IORESOURCE_IRQ,
248 }, 248 },
249}; 249};
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
index 5a9f9c2e53bf..7199e1ae79b4 100644
--- a/arch/arm/mach-exynos/dev-audio.c
+++ b/arch/arm/mach-exynos/dev-audio.c
@@ -304,8 +304,8 @@ static struct resource exynos4_ac97_resource[] = {
304 .flags = IORESOURCE_DMA, 304 .flags = IORESOURCE_DMA,
305 }, 305 },
306 [4] = { 306 [4] = {
307 .start = IRQ_AC97, 307 .start = EXYNOS4_IRQ_AC97,
308 .end = IRQ_AC97, 308 .end = EXYNOS4_IRQ_AC97,
309 .flags = IORESOURCE_IRQ, 309 .flags = IORESOURCE_IRQ,
310 }, 310 },
311}; 311};
diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
new file mode 100644
index 000000000000..2e85c022fd16
--- /dev/null
+++ b/arch/arm/mach-exynos/dev-uart.c
@@ -0,0 +1,78 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Base EXYNOS UART resource and device definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/ioport.h>
17#include <linux/platform_device.h>
18
19#include <asm/mach/arch.h>
20#include <asm/mach/irq.h>
21#include <mach/hardware.h>
22#include <mach/map.h>
23
24#include <plat/devs.h>
25
26#define EXYNOS_UART_RESOURCE(_series, _nr) \
27static struct resource exynos##_series##_uart##_nr##_resource[] = { \
28 [0] = DEFINE_RES_MEM(EXYNOS##_series##_PA_UART##_nr, EXYNOS##_series##_SZ_UART), \
29 [1] = DEFINE_RES_IRQ(EXYNOS##_series##_IRQ_UART##_nr), \
30};
31
32EXYNOS_UART_RESOURCE(4, 0)
33EXYNOS_UART_RESOURCE(4, 1)
34EXYNOS_UART_RESOURCE(4, 2)
35EXYNOS_UART_RESOURCE(4, 3)
36
37struct s3c24xx_uart_resources exynos4_uart_resources[] __initdata = {
38 [0] = {
39 .resources = exynos4_uart0_resource,
40 .nr_resources = ARRAY_SIZE(exynos4_uart0_resource),
41 },
42 [1] = {
43 .resources = exynos4_uart1_resource,
44 .nr_resources = ARRAY_SIZE(exynos4_uart1_resource),
45 },
46 [2] = {
47 .resources = exynos4_uart2_resource,
48 .nr_resources = ARRAY_SIZE(exynos4_uart2_resource),
49 },
50 [3] = {
51 .resources = exynos4_uart3_resource,
52 .nr_resources = ARRAY_SIZE(exynos4_uart3_resource),
53 },
54};
55
56EXYNOS_UART_RESOURCE(5, 0)
57EXYNOS_UART_RESOURCE(5, 1)
58EXYNOS_UART_RESOURCE(5, 2)
59EXYNOS_UART_RESOURCE(5, 3)
60
61struct s3c24xx_uart_resources exynos5_uart_resources[] __initdata = {
62 [0] = {
63 .resources = exynos5_uart0_resource,
64 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
65 },
66 [1] = {
67 .resources = exynos5_uart1_resource,
68 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
69 },
70 [2] = {
71 .resources = exynos5_uart2_resource,
72 .nr_resources = ARRAY_SIZE(exynos5_uart2_resource),
73 },
74 [3] = {
75 .resources = exynos5_uart3_resource,
76 .nr_resources = ARRAY_SIZE(exynos5_uart3_resource),
77 },
78};
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
index 91370def4a70..3983abee4264 100644
--- a/arch/arm/mach-exynos/dma.c
+++ b/arch/arm/mach-exynos/dma.c
@@ -29,6 +29,7 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <plat/devs.h> 30#include <plat/devs.h>
31#include <plat/irqs.h> 31#include <plat/irqs.h>
32#include <plat/cpu.h>
32 33
33#include <mach/map.h> 34#include <mach/map.h>
34#include <mach/irqs.h> 35#include <mach/irqs.h>
@@ -36,7 +37,7 @@
36 37
37static u64 dma_dmamask = DMA_BIT_MASK(32); 38static u64 dma_dmamask = DMA_BIT_MASK(32);
38 39
39u8 pdma0_peri[] = { 40static u8 exynos4210_pdma0_peri[] = {
40 DMACH_PCM0_RX, 41 DMACH_PCM0_RX,
41 DMACH_PCM0_TX, 42 DMACH_PCM0_TX,
42 DMACH_PCM2_RX, 43 DMACH_PCM2_RX,
@@ -69,15 +70,47 @@ u8 pdma0_peri[] = {
69 DMACH_AC97_PCMOUT, 70 DMACH_AC97_PCMOUT,
70}; 71};
71 72
72struct dma_pl330_platdata exynos4_pdma0_pdata = { 73static u8 exynos4212_pdma0_peri[] = {
73 .nr_valid_peri = ARRAY_SIZE(pdma0_peri), 74 DMACH_PCM0_RX,
74 .peri_id = pdma0_peri, 75 DMACH_PCM0_TX,
76 DMACH_PCM2_RX,
77 DMACH_PCM2_TX,
78 DMACH_MIPI_HSI0,
79 DMACH_MIPI_HSI1,
80 DMACH_SPI0_RX,
81 DMACH_SPI0_TX,
82 DMACH_SPI2_RX,
83 DMACH_SPI2_TX,
84 DMACH_I2S0S_TX,
85 DMACH_I2S0_RX,
86 DMACH_I2S0_TX,
87 DMACH_I2S2_RX,
88 DMACH_I2S2_TX,
89 DMACH_UART0_RX,
90 DMACH_UART0_TX,
91 DMACH_UART2_RX,
92 DMACH_UART2_TX,
93 DMACH_UART4_RX,
94 DMACH_UART4_TX,
95 DMACH_SLIMBUS0_RX,
96 DMACH_SLIMBUS0_TX,
97 DMACH_SLIMBUS2_RX,
98 DMACH_SLIMBUS2_TX,
99 DMACH_SLIMBUS4_RX,
100 DMACH_SLIMBUS4_TX,
101 DMACH_AC97_MICIN,
102 DMACH_AC97_PCMIN,
103 DMACH_AC97_PCMOUT,
104 DMACH_MIPI_HSI4,
105 DMACH_MIPI_HSI5,
75}; 106};
76 107
77AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, EXYNOS4_PA_PDMA0, 108struct dma_pl330_platdata exynos4_pdma0_pdata;
78 {IRQ_PDMA0}, &exynos4_pdma0_pdata); 109
110static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330,
111 EXYNOS4_PA_PDMA0, {EXYNOS4_IRQ_PDMA0}, &exynos4_pdma0_pdata);
79 112
80u8 pdma1_peri[] = { 113static u8 exynos4210_pdma1_peri[] = {
81 DMACH_PCM0_RX, 114 DMACH_PCM0_RX,
82 DMACH_PCM0_TX, 115 DMACH_PCM0_TX,
83 DMACH_PCM1_RX, 116 DMACH_PCM1_RX,
@@ -105,19 +138,84 @@ u8 pdma1_peri[] = {
105 DMACH_SLIMBUS5_TX, 138 DMACH_SLIMBUS5_TX,
106}; 139};
107 140
108struct dma_pl330_platdata exynos4_pdma1_pdata = { 141static u8 exynos4212_pdma1_peri[] = {
109 .nr_valid_peri = ARRAY_SIZE(pdma1_peri), 142 DMACH_PCM0_RX,
110 .peri_id = pdma1_peri, 143 DMACH_PCM0_TX,
144 DMACH_PCM1_RX,
145 DMACH_PCM1_TX,
146 DMACH_MIPI_HSI2,
147 DMACH_MIPI_HSI3,
148 DMACH_SPI1_RX,
149 DMACH_SPI1_TX,
150 DMACH_I2S0S_TX,
151 DMACH_I2S0_RX,
152 DMACH_I2S0_TX,
153 DMACH_I2S1_RX,
154 DMACH_I2S1_TX,
155 DMACH_UART0_RX,
156 DMACH_UART0_TX,
157 DMACH_UART1_RX,
158 DMACH_UART1_TX,
159 DMACH_UART3_RX,
160 DMACH_UART3_TX,
161 DMACH_SLIMBUS1_RX,
162 DMACH_SLIMBUS1_TX,
163 DMACH_SLIMBUS3_RX,
164 DMACH_SLIMBUS3_TX,
165 DMACH_SLIMBUS5_RX,
166 DMACH_SLIMBUS5_TX,
167 DMACH_SLIMBUS0AUX_RX,
168 DMACH_SLIMBUS0AUX_TX,
169 DMACH_SPDIF,
170 DMACH_MIPI_HSI6,
171 DMACH_MIPI_HSI7,
172};
173
174static struct dma_pl330_platdata exynos4_pdma1_pdata;
175
176static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330,
177 EXYNOS4_PA_PDMA1, {EXYNOS4_IRQ_PDMA1}, &exynos4_pdma1_pdata);
178
179static u8 mdma_peri[] = {
180 DMACH_MTOM_0,
181 DMACH_MTOM_1,
182 DMACH_MTOM_2,
183 DMACH_MTOM_3,
184 DMACH_MTOM_4,
185 DMACH_MTOM_5,
186 DMACH_MTOM_6,
187 DMACH_MTOM_7,
111}; 188};
112 189
113AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, EXYNOS4_PA_PDMA1, 190static struct dma_pl330_platdata exynos4_mdma1_pdata = {
114 {IRQ_PDMA1}, &exynos4_pdma1_pdata); 191 .nr_valid_peri = ARRAY_SIZE(mdma_peri),
192 .peri_id = mdma_peri,
193};
194
195static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330,
196 EXYNOS4_PA_MDMA1, {EXYNOS4_IRQ_MDMA1}, &exynos4_mdma1_pdata);
115 197
116static int __init exynos4_dma_init(void) 198static int __init exynos4_dma_init(void)
117{ 199{
118 if (of_have_populated_dt()) 200 if (of_have_populated_dt())
119 return 0; 201 return 0;
120 202
203 if (soc_is_exynos4210()) {
204 exynos4_pdma0_pdata.nr_valid_peri =
205 ARRAY_SIZE(exynos4210_pdma0_peri);
206 exynos4_pdma0_pdata.peri_id = exynos4210_pdma0_peri;
207 exynos4_pdma1_pdata.nr_valid_peri =
208 ARRAY_SIZE(exynos4210_pdma1_peri);
209 exynos4_pdma1_pdata.peri_id = exynos4210_pdma1_peri;
210 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
211 exynos4_pdma0_pdata.nr_valid_peri =
212 ARRAY_SIZE(exynos4212_pdma0_peri);
213 exynos4_pdma0_pdata.peri_id = exynos4212_pdma0_peri;
214 exynos4_pdma1_pdata.nr_valid_peri =
215 ARRAY_SIZE(exynos4212_pdma1_peri);
216 exynos4_pdma1_pdata.peri_id = exynos4212_pdma1_peri;
217 }
218
121 dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); 219 dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask);
122 dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); 220 dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask);
123 amba_device_register(&exynos4_pdma0_device, &iomem_resource); 221 amba_device_register(&exynos4_pdma0_device, &iomem_resource);
@@ -126,6 +224,9 @@ static int __init exynos4_dma_init(void)
126 dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); 224 dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask);
127 amba_device_register(&exynos4_pdma1_device, &iomem_resource); 225 amba_device_register(&exynos4_pdma1_device, &iomem_resource);
128 226
227 dma_cap_set(DMA_MEMCPY, exynos4_mdma1_pdata.cap_mask);
228 amba_device_register(&exynos4_mdma1_device, &iomem_resource);
229
129 return 0; 230 return 0;
130} 231}
131arch_initcall(exynos4_dma_init); 232arch_initcall(exynos4_dma_init);
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/mach-exynos/include/mach/debug-macro.S
index 6cacf16a67a6..6c857ff0b5d8 100644
--- a/arch/arm/mach-exynos/include/mach/debug-macro.S
+++ b/arch/arm/mach-exynos/include/mach/debug-macro.S
@@ -21,8 +21,13 @@
21 */ 21 */
22 22
23 .macro addruart, rp, rv, tmp 23 .macro addruart, rp, rv, tmp
24 ldr \rp, = S3C_PA_UART 24 mov \rp, #0x10000000
25 ldr \rv, = S3C_VA_UART 25 ldr \rp, [\rp, #0x0]
26 and \rp, \rp, #0xf00000
27 teq \rp, #0x500000 @@ EXYNOS5
28 ldreq \rp, =EXYNOS5_PA_UART
29 movne \rp, #EXYNOS4_PA_UART @@ EXYNOS4
30 ldr \rv, =S3C_VA_UART
26#if CONFIG_DEBUG_S3C_UART != 0 31#if CONFIG_DEBUG_S3C_UART != 0
27 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART) 32 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
28 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART) 33 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
diff --git a/arch/arm/mach-exynos/include/mach/exynos4-clock.h b/arch/arm/mach-exynos/include/mach/exynos4-clock.h
deleted file mode 100644
index a07fcbf55251..000000000000
--- a/arch/arm/mach-exynos/include/mach/exynos4-clock.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/include/mach/exynos4-clock.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Header file for exynos4 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#ifndef __ASM_ARCH_CLOCK_H
15#define __ASM_ARCH_CLOCK_H __FILE__
16
17#include <linux/clk.h>
18
19extern struct clk clk_sclk_hdmi27m;
20extern struct clk clk_sclk_usbphy0;
21extern struct clk clk_sclk_usbphy1;
22extern struct clk clk_sclk_hdmiphy;
23
24extern struct clksrc_clk clk_sclk_apll;
25extern struct clksrc_clk clk_mout_mpll;
26extern struct clksrc_clk clk_aclk_133;
27extern struct clksrc_clk clk_mout_epll;
28extern struct clksrc_clk clk_sclk_vpll;
29
30extern struct clk *clkset_corebus_list[];
31extern struct clksrc_sources clkset_mout_corebus;
32
33extern struct clk *clkset_aclk_top_list[];
34extern struct clksrc_sources clkset_aclk;
35
36extern struct clk *clkset_group_list[];
37extern struct clksrc_sources clkset_group;
38
39extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
40extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
41extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
42
43#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index f77bce04789a..9bee8535d9e0 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -1,9 +1,8 @@
1/* linux/arch/arm/mach-exynos4/include/mach/irqs.h 1/*
2 * 2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * EXYNOS4 - IRQ definitions 5 * EXYNOS - IRQ definitions
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -17,158 +16,450 @@
17 16
18/* PPI: Private Peripheral Interrupt */ 17/* PPI: Private Peripheral Interrupt */
19 18
20#define IRQ_PPI(x) (x+16) 19#define IRQ_PPI(x) (x + 16)
21
22#define IRQ_MCT_LOCALTIMER IRQ_PPI(12)
23 20
24/* SPI: Shared Peripheral Interrupt */ 21/* SPI: Shared Peripheral Interrupt */
25 22
26#define IRQ_SPI(x) (x+32) 23#define IRQ_SPI(x) (x + 32)
27 24
28#define IRQ_EINT0 IRQ_SPI(16) 25/* COMBINER */
29#define IRQ_EINT1 IRQ_SPI(17) 26
30#define IRQ_EINT2 IRQ_SPI(18) 27#define MAX_IRQ_IN_COMBINER 8
31#define IRQ_EINT3 IRQ_SPI(19) 28#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128))
32#define IRQ_EINT4 IRQ_SPI(20) 29#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y)
33#define IRQ_EINT5 IRQ_SPI(21) 30
34#define IRQ_EINT6 IRQ_SPI(22) 31/* For EXYNOS4 and EXYNOS5 */
35#define IRQ_EINT7 IRQ_SPI(23) 32
36#define IRQ_EINT8 IRQ_SPI(24) 33#define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12)
37#define IRQ_EINT9 IRQ_SPI(25) 34
38#define IRQ_EINT10 IRQ_SPI(26) 35#define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32)
39#define IRQ_EINT11 IRQ_SPI(27) 36
40#define IRQ_EINT12 IRQ_SPI(28) 37/* For EXYNOS4 SoCs */
41#define IRQ_EINT13 IRQ_SPI(29) 38
42#define IRQ_EINT14 IRQ_SPI(30) 39#define EXYNOS4_IRQ_EINT0 IRQ_SPI(16)
43#define IRQ_EINT15 IRQ_SPI(31) 40#define EXYNOS4_IRQ_EINT1 IRQ_SPI(17)
44#define IRQ_EINT16_31 IRQ_SPI(32) 41#define EXYNOS4_IRQ_EINT2 IRQ_SPI(18)
45 42#define EXYNOS4_IRQ_EINT3 IRQ_SPI(19)
46#define IRQ_PDMA0 IRQ_SPI(35) 43#define EXYNOS4_IRQ_EINT4 IRQ_SPI(20)
47#define IRQ_PDMA1 IRQ_SPI(36) 44#define EXYNOS4_IRQ_EINT5 IRQ_SPI(21)
48#define IRQ_TIMER0_VIC IRQ_SPI(37) 45#define EXYNOS4_IRQ_EINT6 IRQ_SPI(22)
49#define IRQ_TIMER1_VIC IRQ_SPI(38) 46#define EXYNOS4_IRQ_EINT7 IRQ_SPI(23)
50#define IRQ_TIMER2_VIC IRQ_SPI(39) 47#define EXYNOS4_IRQ_EINT8 IRQ_SPI(24)
51#define IRQ_TIMER3_VIC IRQ_SPI(40) 48#define EXYNOS4_IRQ_EINT9 IRQ_SPI(25)
52#define IRQ_TIMER4_VIC IRQ_SPI(41) 49#define EXYNOS4_IRQ_EINT10 IRQ_SPI(26)
53#define IRQ_MCT_L0 IRQ_SPI(42) 50#define EXYNOS4_IRQ_EINT11 IRQ_SPI(27)
54#define IRQ_WDT IRQ_SPI(43) 51#define EXYNOS4_IRQ_EINT12 IRQ_SPI(28)
55#define IRQ_RTC_ALARM IRQ_SPI(44) 52#define EXYNOS4_IRQ_EINT13 IRQ_SPI(29)
56#define IRQ_RTC_TIC IRQ_SPI(45) 53#define EXYNOS4_IRQ_EINT14 IRQ_SPI(30)
57#define IRQ_GPIO_XB IRQ_SPI(46) 54#define EXYNOS4_IRQ_EINT15 IRQ_SPI(31)
58#define IRQ_GPIO_XA IRQ_SPI(47) 55
59#define IRQ_MCT_L1 IRQ_SPI(48) 56#define EXYNOS4_IRQ_MDMA0 IRQ_SPI(33)
60 57#define EXYNOS4_IRQ_MDMA1 IRQ_SPI(34)
61#define IRQ_UART0 IRQ_SPI(52) 58#define EXYNOS4_IRQ_PDMA0 IRQ_SPI(35)
62#define IRQ_UART1 IRQ_SPI(53) 59#define EXYNOS4_IRQ_PDMA1 IRQ_SPI(36)
63#define IRQ_UART2 IRQ_SPI(54) 60#define EXYNOS4_IRQ_TIMER0_VIC IRQ_SPI(37)
64#define IRQ_UART3 IRQ_SPI(55) 61#define EXYNOS4_IRQ_TIMER1_VIC IRQ_SPI(38)
65#define IRQ_UART4 IRQ_SPI(56) 62#define EXYNOS4_IRQ_TIMER2_VIC IRQ_SPI(39)
66#define IRQ_MCT_G0 IRQ_SPI(57) 63#define EXYNOS4_IRQ_TIMER3_VIC IRQ_SPI(40)
67#define IRQ_IIC IRQ_SPI(58) 64#define EXYNOS4_IRQ_TIMER4_VIC IRQ_SPI(41)
68#define IRQ_IIC1 IRQ_SPI(59) 65#define EXYNOS4_IRQ_MCT_L0 IRQ_SPI(42)
69#define IRQ_IIC2 IRQ_SPI(60) 66#define EXYNOS4_IRQ_WDT IRQ_SPI(43)
70#define IRQ_IIC3 IRQ_SPI(61) 67#define EXYNOS4_IRQ_RTC_ALARM IRQ_SPI(44)
71#define IRQ_IIC4 IRQ_SPI(62) 68#define EXYNOS4_IRQ_RTC_TIC IRQ_SPI(45)
72#define IRQ_IIC5 IRQ_SPI(63) 69#define EXYNOS4_IRQ_GPIO_XB IRQ_SPI(46)
73#define IRQ_IIC6 IRQ_SPI(64) 70#define EXYNOS4_IRQ_GPIO_XA IRQ_SPI(47)
74#define IRQ_IIC7 IRQ_SPI(65) 71#define EXYNOS4_IRQ_MCT_L1 IRQ_SPI(48)
75#define IRQ_SPI0 IRQ_SPI(66) 72
76#define IRQ_SPI1 IRQ_SPI(67) 73#define EXYNOS4_IRQ_UART0 IRQ_SPI(52)
77#define IRQ_SPI2 IRQ_SPI(68) 74#define EXYNOS4_IRQ_UART1 IRQ_SPI(53)
78 75#define EXYNOS4_IRQ_UART2 IRQ_SPI(54)
79#define IRQ_USB_HOST IRQ_SPI(70) 76#define EXYNOS4_IRQ_UART3 IRQ_SPI(55)
80#define IRQ_USB_HSOTG IRQ_SPI(71) 77#define EXYNOS4_IRQ_UART4 IRQ_SPI(56)
81#define IRQ_MODEM_IF IRQ_SPI(72) 78#define EXYNOS4_IRQ_MCT_G0 IRQ_SPI(57)
82#define IRQ_HSMMC0 IRQ_SPI(73) 79#define EXYNOS4_IRQ_IIC IRQ_SPI(58)
83#define IRQ_HSMMC1 IRQ_SPI(74) 80#define EXYNOS4_IRQ_IIC1 IRQ_SPI(59)
84#define IRQ_HSMMC2 IRQ_SPI(75) 81#define EXYNOS4_IRQ_IIC2 IRQ_SPI(60)
85#define IRQ_HSMMC3 IRQ_SPI(76) 82#define EXYNOS4_IRQ_IIC3 IRQ_SPI(61)
86#define IRQ_DWMCI IRQ_SPI(77) 83#define EXYNOS4_IRQ_IIC4 IRQ_SPI(62)
87 84#define EXYNOS4_IRQ_IIC5 IRQ_SPI(63)
88#define IRQ_MIPI_CSIS0 IRQ_SPI(78) 85#define EXYNOS4_IRQ_IIC6 IRQ_SPI(64)
89#define IRQ_MIPI_CSIS1 IRQ_SPI(80) 86#define EXYNOS4_IRQ_IIC7 IRQ_SPI(65)
90 87#define EXYNOS4_IRQ_SPI0 IRQ_SPI(66)
91#define IRQ_ONENAND_AUDI IRQ_SPI(82) 88#define EXYNOS4_IRQ_SPI1 IRQ_SPI(67)
92#define IRQ_ROTATOR IRQ_SPI(83) 89#define EXYNOS4_IRQ_SPI2 IRQ_SPI(68)
93#define IRQ_FIMC0 IRQ_SPI(84) 90
94#define IRQ_FIMC1 IRQ_SPI(85) 91#define EXYNOS4_IRQ_USB_HOST IRQ_SPI(70)
95#define IRQ_FIMC2 IRQ_SPI(86) 92#define EXYNOS4_IRQ_USB_HSOTG IRQ_SPI(71)
96#define IRQ_FIMC3 IRQ_SPI(87) 93#define EXYNOS4_IRQ_MODEM_IF IRQ_SPI(72)
97#define IRQ_JPEG IRQ_SPI(88) 94#define EXYNOS4_IRQ_HSMMC0 IRQ_SPI(73)
98#define IRQ_2D IRQ_SPI(89) 95#define EXYNOS4_IRQ_HSMMC1 IRQ_SPI(74)
99#define IRQ_PCIE IRQ_SPI(90) 96#define EXYNOS4_IRQ_HSMMC2 IRQ_SPI(75)
100 97#define EXYNOS4_IRQ_HSMMC3 IRQ_SPI(76)
101#define IRQ_MIXER IRQ_SPI(91) 98#define EXYNOS4_IRQ_DWMCI IRQ_SPI(77)
102#define IRQ_HDMI IRQ_SPI(92) 99
103#define IRQ_IIC_HDMIPHY IRQ_SPI(93) 100#define EXYNOS4_IRQ_MIPI_CSIS0 IRQ_SPI(78)
104#define IRQ_MFC IRQ_SPI(94) 101#define EXYNOS4_IRQ_MIPI_CSIS1 IRQ_SPI(80)
105#define IRQ_SDO IRQ_SPI(95) 102
106 103#define EXYNOS4_IRQ_ONENAND_AUDI IRQ_SPI(82)
107#define IRQ_AUDIO_SS IRQ_SPI(96) 104#define EXYNOS4_IRQ_ROTATOR IRQ_SPI(83)
108#define IRQ_I2S0 IRQ_SPI(97) 105#define EXYNOS4_IRQ_FIMC0 IRQ_SPI(84)
109#define IRQ_I2S1 IRQ_SPI(98) 106#define EXYNOS4_IRQ_FIMC1 IRQ_SPI(85)
110#define IRQ_I2S2 IRQ_SPI(99) 107#define EXYNOS4_IRQ_FIMC2 IRQ_SPI(86)
111#define IRQ_AC97 IRQ_SPI(100) 108#define EXYNOS4_IRQ_FIMC3 IRQ_SPI(87)
112 109#define EXYNOS4_IRQ_JPEG IRQ_SPI(88)
113#define IRQ_SPDIF IRQ_SPI(104) 110#define EXYNOS4_IRQ_2D IRQ_SPI(89)
114#define IRQ_ADC0 IRQ_SPI(105) 111#define EXYNOS4_IRQ_PCIE IRQ_SPI(90)
115#define IRQ_PEN0 IRQ_SPI(106) 112
116#define IRQ_ADC1 IRQ_SPI(107) 113#define EXYNOS4_IRQ_MIXER IRQ_SPI(91)
117#define IRQ_PEN1 IRQ_SPI(108) 114#define EXYNOS4_IRQ_HDMI IRQ_SPI(92)
118#define IRQ_KEYPAD IRQ_SPI(109) 115#define EXYNOS4_IRQ_IIC_HDMIPHY IRQ_SPI(93)
119#define IRQ_PMU IRQ_SPI(110) 116#define EXYNOS4_IRQ_MFC IRQ_SPI(94)
120#define IRQ_GPS IRQ_SPI(111) 117#define EXYNOS4_IRQ_SDO IRQ_SPI(95)
121#define IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) 118
122#define IRQ_SLIMBUS IRQ_SPI(113) 119#define EXYNOS4_IRQ_AUDIO_SS IRQ_SPI(96)
123 120#define EXYNOS4_IRQ_I2S0 IRQ_SPI(97)
124#define IRQ_TSI IRQ_SPI(115) 121#define EXYNOS4_IRQ_I2S1 IRQ_SPI(98)
125#define IRQ_SATA IRQ_SPI(116) 122#define EXYNOS4_IRQ_I2S2 IRQ_SPI(99)
126 123#define EXYNOS4_IRQ_AC97 IRQ_SPI(100)
127#define MAX_IRQ_IN_COMBINER 8 124
128#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128)) 125#define EXYNOS4_IRQ_SPDIF IRQ_SPI(104)
129#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) 126#define EXYNOS4_IRQ_ADC0 IRQ_SPI(105)
130 127#define EXYNOS4_IRQ_PEN0 IRQ_SPI(106)
131#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) 128#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)
132#define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1) 129#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)
133#define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2) 130#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109)
134#define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3) 131#define EXYNOS4_IRQ_PMU IRQ_SPI(110)
135#define IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4) 132#define EXYNOS4_IRQ_GPS IRQ_SPI(111)
136#define IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5) 133#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
137#define IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6) 134#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
138#define IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7) 135
139 136#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
140#define IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0) 137#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
141#define IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1) 138
142#define IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2) 139#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
143#define IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3) 140#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)
144#define IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4) 141#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
145#define IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5) 142#define EXYNOS4_IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3)
146#define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6) 143#define EXYNOS4_IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4)
147#define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7) 144#define EXYNOS4_IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5)
148 145#define EXYNOS4_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6)
149#define IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0) 146#define EXYNOS4_IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7)
150#define IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) 147
151#define IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) 148#define EXYNOS4_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0)
152 149#define EXYNOS4_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1)
153#define MAX_COMBINER_NR 16 150#define EXYNOS4_IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2)
154 151#define EXYNOS4_IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3)
155#define IRQ_ADC IRQ_ADC0 152#define EXYNOS4_IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4)
156#define IRQ_TC IRQ_PEN0 153#define EXYNOS4_IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5)
157 154#define EXYNOS4_IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6)
158#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) 155#define EXYNOS4_IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7)
159 156
160#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE + 0) 157#define EXYNOS4_IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0)
161#define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE + 16) 158#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)
162 159#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
163/* optional GPIO interrupts */ 160
164#define S5P_GPIOINT_BASE (S5P_IRQ_EINT_BASE + 32) 161#define EXYNOS4_MAX_COMBINER_NR 16
165#define IRQ_GPIO1_NR_GROUPS 16 162
166#define IRQ_GPIO2_NR_GROUPS 9 163#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16
167#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT) 164#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9
168 165
169#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64) 166/*
167 * For Compatibility:
168 * the default is for EXYNOS4, and
169 * for exynos5, should be re-mapped at function
170 */
171
172#define IRQ_TIMER0_VIC EXYNOS4_IRQ_TIMER0_VIC
173#define IRQ_TIMER1_VIC EXYNOS4_IRQ_TIMER1_VIC
174#define IRQ_TIMER2_VIC EXYNOS4_IRQ_TIMER2_VIC
175#define IRQ_TIMER3_VIC EXYNOS4_IRQ_TIMER3_VIC
176#define IRQ_TIMER4_VIC EXYNOS4_IRQ_TIMER4_VIC
177
178#define IRQ_WDT EXYNOS4_IRQ_WDT
179#define IRQ_RTC_ALARM EXYNOS4_IRQ_RTC_ALARM
180#define IRQ_RTC_TIC EXYNOS4_IRQ_RTC_TIC
181#define IRQ_GPIO_XB EXYNOS4_IRQ_GPIO_XB
182#define IRQ_GPIO_XA EXYNOS4_IRQ_GPIO_XA
183
184#define IRQ_IIC EXYNOS4_IRQ_IIC
185#define IRQ_IIC1 EXYNOS4_IRQ_IIC1
186#define IRQ_IIC3 EXYNOS4_IRQ_IIC3
187#define IRQ_IIC5 EXYNOS4_IRQ_IIC5
188#define IRQ_IIC6 EXYNOS4_IRQ_IIC6
189#define IRQ_IIC7 EXYNOS4_IRQ_IIC7
190
191#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST
192
193#define IRQ_HSMMC0 EXYNOS4_IRQ_HSMMC0
194#define IRQ_HSMMC1 EXYNOS4_IRQ_HSMMC1
195#define IRQ_HSMMC2 EXYNOS4_IRQ_HSMMC2
196#define IRQ_HSMMC3 EXYNOS4_IRQ_HSMMC3
197
198#define IRQ_MIPI_CSIS0 EXYNOS4_IRQ_MIPI_CSIS0
199
200#define IRQ_ONENAND_AUDI EXYNOS4_IRQ_ONENAND_AUDI
201
202#define IRQ_FIMC0 EXYNOS4_IRQ_FIMC0
203#define IRQ_FIMC1 EXYNOS4_IRQ_FIMC1
204#define IRQ_FIMC2 EXYNOS4_IRQ_FIMC2
205#define IRQ_FIMC3 EXYNOS4_IRQ_FIMC3
206#define IRQ_JPEG EXYNOS4_IRQ_JPEG
207#define IRQ_2D EXYNOS4_IRQ_2D
208
209#define IRQ_MIXER EXYNOS4_IRQ_MIXER
210#define IRQ_HDMI EXYNOS4_IRQ_HDMI
211#define IRQ_IIC_HDMIPHY EXYNOS4_IRQ_IIC_HDMIPHY
212#define IRQ_MFC EXYNOS4_IRQ_MFC
213#define IRQ_SDO EXYNOS4_IRQ_SDO
214
215#define IRQ_ADC EXYNOS4_IRQ_ADC0
216#define IRQ_TC EXYNOS4_IRQ_PEN0
217
218#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD
219#define IRQ_PMU EXYNOS4_IRQ_PMU
220
221#define IRQ_SYSMMU_MDMA0_0 EXYNOS4_IRQ_SYSMMU_MDMA0_0
222#define IRQ_SYSMMU_SSS_0 EXYNOS4_IRQ_SYSMMU_SSS_0
223#define IRQ_SYSMMU_FIMC0_0 EXYNOS4_IRQ_SYSMMU_FIMC0_0
224#define IRQ_SYSMMU_FIMC1_0 EXYNOS4_IRQ_SYSMMU_FIMC1_0
225#define IRQ_SYSMMU_FIMC2_0 EXYNOS4_IRQ_SYSMMU_FIMC2_0
226#define IRQ_SYSMMU_FIMC3_0 EXYNOS4_IRQ_SYSMMU_FIMC3_0
227#define IRQ_SYSMMU_JPEG_0 EXYNOS4_IRQ_SYSMMU_JPEG_0
228#define IRQ_SYSMMU_2D_0 EXYNOS4_IRQ_SYSMMU_2D_0
229
230#define IRQ_SYSMMU_ROTATOR_0 EXYNOS4_IRQ_SYSMMU_ROTATOR_0
231#define IRQ_SYSMMU_MDMA1_0 EXYNOS4_IRQ_SYSMMU_MDMA1_0
232#define IRQ_SYSMMU_LCD0_M0_0 EXYNOS4_IRQ_SYSMMU_LCD0_M0_0
233#define IRQ_SYSMMU_LCD1_M1_0 EXYNOS4_IRQ_SYSMMU_LCD1_M1_0
234#define IRQ_SYSMMU_TV_M0_0 EXYNOS4_IRQ_SYSMMU_TV_M0_0
235#define IRQ_SYSMMU_MFC_M0_0 EXYNOS4_IRQ_SYSMMU_MFC_M0_0
236#define IRQ_SYSMMU_MFC_M1_0 EXYNOS4_IRQ_SYSMMU_MFC_M1_0
237#define IRQ_SYSMMU_PCIE_0 EXYNOS4_IRQ_SYSMMU_PCIE_0
238
239#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO
240#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
241#define IRQ_FIMD0_SYSTEM EXYNOS4_IRQ_FIMD0_SYSTEM
242
243#define IRQ_GPIO1_NR_GROUPS EXYNOS4_IRQ_GPIO1_NR_GROUPS
244#define IRQ_GPIO2_NR_GROUPS EXYNOS4_IRQ_GPIO2_NR_GROUPS
245
246/* For EXYNOS5 SoCs */
247
248#define EXYNOS5_IRQ_MDMA0 IRQ_SPI(33)
249#define EXYNOS5_IRQ_PDMA0 IRQ_SPI(34)
250#define EXYNOS5_IRQ_PDMA1 IRQ_SPI(35)
251#define EXYNOS5_IRQ_TIMER0_VIC IRQ_SPI(36)
252#define EXYNOS5_IRQ_TIMER1_VIC IRQ_SPI(37)
253#define EXYNOS5_IRQ_TIMER2_VIC IRQ_SPI(38)
254#define EXYNOS5_IRQ_TIMER3_VIC IRQ_SPI(39)
255#define EXYNOS5_IRQ_TIMER4_VIC IRQ_SPI(40)
256#define EXYNOS5_IRQ_RTIC IRQ_SPI(41)
257#define EXYNOS5_IRQ_WDT IRQ_SPI(42)
258#define EXYNOS5_IRQ_RTC_ALARM IRQ_SPI(43)
259#define EXYNOS5_IRQ_RTC_TIC IRQ_SPI(44)
260#define EXYNOS5_IRQ_GPIO_XB IRQ_SPI(45)
261#define EXYNOS5_IRQ_GPIO_XA IRQ_SPI(46)
262#define EXYNOS5_IRQ_GPIO IRQ_SPI(47)
263#define EXYNOS5_IRQ_IEM_IEC IRQ_SPI(48)
264#define EXYNOS5_IRQ_IEM_APC IRQ_SPI(49)
265#define EXYNOS5_IRQ_GPIO_C2C IRQ_SPI(50)
266#define EXYNOS5_IRQ_UART0 IRQ_SPI(51)
267#define EXYNOS5_IRQ_UART1 IRQ_SPI(52)
268#define EXYNOS5_IRQ_UART2 IRQ_SPI(53)
269#define EXYNOS5_IRQ_UART3 IRQ_SPI(54)
270#define EXYNOS5_IRQ_UART4 IRQ_SPI(55)
271#define EXYNOS5_IRQ_IIC IRQ_SPI(56)
272#define EXYNOS5_IRQ_IIC1 IRQ_SPI(57)
273#define EXYNOS5_IRQ_IIC2 IRQ_SPI(58)
274#define EXYNOS5_IRQ_IIC3 IRQ_SPI(59)
275#define EXYNOS5_IRQ_IIC4 IRQ_SPI(60)
276#define EXYNOS5_IRQ_IIC5 IRQ_SPI(61)
277#define EXYNOS5_IRQ_IIC6 IRQ_SPI(62)
278#define EXYNOS5_IRQ_IIC7 IRQ_SPI(63)
279#define EXYNOS5_IRQ_IIC_HDMIPHY IRQ_SPI(64)
280#define EXYNOS5_IRQ_TMU IRQ_SPI(65)
281#define EXYNOS5_IRQ_FIQ_0 IRQ_SPI(66)
282#define EXYNOS5_IRQ_FIQ_1 IRQ_SPI(67)
283#define EXYNOS5_IRQ_SPI0 IRQ_SPI(68)
284#define EXYNOS5_IRQ_SPI1 IRQ_SPI(69)
285#define EXYNOS5_IRQ_SPI2 IRQ_SPI(70)
286#define EXYNOS5_IRQ_USB_HOST IRQ_SPI(71)
287#define EXYNOS5_IRQ_USB3_DRD IRQ_SPI(72)
288#define EXYNOS5_IRQ_MIPI_HSI IRQ_SPI(73)
289#define EXYNOS5_IRQ_USB_HSOTG IRQ_SPI(74)
290#define EXYNOS5_IRQ_HSMMC0 IRQ_SPI(75)
291#define EXYNOS5_IRQ_HSMMC1 IRQ_SPI(76)
292#define EXYNOS5_IRQ_HSMMC2 IRQ_SPI(77)
293#define EXYNOS5_IRQ_HSMMC3 IRQ_SPI(78)
294#define EXYNOS5_IRQ_MIPICSI0 IRQ_SPI(79)
295#define EXYNOS5_IRQ_MIPICSI1 IRQ_SPI(80)
296#define EXYNOS5_IRQ_EFNFCON_DMA_ABORT IRQ_SPI(81)
297#define EXYNOS5_IRQ_MIPIDSI0 IRQ_SPI(82)
298#define EXYNOS5_IRQ_ROTATOR IRQ_SPI(84)
299#define EXYNOS5_IRQ_GSC0 IRQ_SPI(85)
300#define EXYNOS5_IRQ_GSC1 IRQ_SPI(86)
301#define EXYNOS5_IRQ_GSC2 IRQ_SPI(87)
302#define EXYNOS5_IRQ_GSC3 IRQ_SPI(88)
303#define EXYNOS5_IRQ_JPEG IRQ_SPI(89)
304#define EXYNOS5_IRQ_EFNFCON_DMA IRQ_SPI(90)
305#define EXYNOS5_IRQ_2D IRQ_SPI(91)
306#define EXYNOS5_IRQ_SFMC0 IRQ_SPI(92)
307#define EXYNOS5_IRQ_SFMC1 IRQ_SPI(93)
308#define EXYNOS5_IRQ_MIXER IRQ_SPI(94)
309#define EXYNOS5_IRQ_HDMI IRQ_SPI(95)
310#define EXYNOS5_IRQ_MFC IRQ_SPI(96)
311#define EXYNOS5_IRQ_AUDIO_SS IRQ_SPI(97)
312#define EXYNOS5_IRQ_I2S0 IRQ_SPI(98)
313#define EXYNOS5_IRQ_I2S1 IRQ_SPI(99)
314#define EXYNOS5_IRQ_I2S2 IRQ_SPI(100)
315#define EXYNOS5_IRQ_AC97 IRQ_SPI(101)
316#define EXYNOS5_IRQ_PCM0 IRQ_SPI(102)
317#define EXYNOS5_IRQ_PCM1 IRQ_SPI(103)
318#define EXYNOS5_IRQ_PCM2 IRQ_SPI(104)
319#define EXYNOS5_IRQ_SPDIF IRQ_SPI(105)
320#define EXYNOS5_IRQ_ADC0 IRQ_SPI(106)
321
322#define EXYNOS5_IRQ_SATA_PHY IRQ_SPI(108)
323#define EXYNOS5_IRQ_SATA_PMEMREQ IRQ_SPI(109)
324#define EXYNOS5_IRQ_CAM_C IRQ_SPI(110)
325#define EXYNOS5_IRQ_EAGLE_PMU IRQ_SPI(111)
326#define EXYNOS5_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
327#define EXYNOS5_IRQ_DP1_INTP1 IRQ_SPI(113)
328#define EXYNOS5_IRQ_CEC IRQ_SPI(114)
329#define EXYNOS5_IRQ_SATA IRQ_SPI(115)
330#define EXYNOS5_IRQ_NFCON IRQ_SPI(116)
331
332#define EXYNOS5_IRQ_MMC44 IRQ_SPI(123)
333#define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124)
334#define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125)
335#define EXYNOS5_IRQ_FIMC_LITE1 IRQ_SPI(126)
336#define EXYNOS5_IRQ_RP_TIMER IRQ_SPI(127)
337
338#define EXYNOS5_IRQ_PMU COMBINER_IRQ(1, 2)
339#define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(1, 6)
340
341#define EXYNOS5_IRQ_SYSMMU_GSC0_0 COMBINER_IRQ(2, 0)
342#define EXYNOS5_IRQ_SYSMMU_GSC0_1 COMBINER_IRQ(2, 1)
343#define EXYNOS5_IRQ_SYSMMU_GSC1_0 COMBINER_IRQ(2, 2)
344#define EXYNOS5_IRQ_SYSMMU_GSC1_1 COMBINER_IRQ(2, 3)
345#define EXYNOS5_IRQ_SYSMMU_GSC2_0 COMBINER_IRQ(2, 4)
346#define EXYNOS5_IRQ_SYSMMU_GSC2_1 COMBINER_IRQ(2, 5)
347#define EXYNOS5_IRQ_SYSMMU_GSC3_0 COMBINER_IRQ(2, 6)
348#define EXYNOS5_IRQ_SYSMMU_GSC3_1 COMBINER_IRQ(2, 7)
349
350#define EXYNOS5_IRQ_SYSMMU_FIMD1_0 COMBINER_IRQ(3, 2)
351#define EXYNOS5_IRQ_SYSMMU_FIMD1_1 COMBINER_IRQ(3, 3)
352#define EXYNOS5_IRQ_SYSMMU_LITE0_0 COMBINER_IRQ(3, 4)
353#define EXYNOS5_IRQ_SYSMMU_LITE0_1 COMBINER_IRQ(3, 5)
354#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_0 COMBINER_IRQ(3, 6)
355#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_1 COMBINER_IRQ(3, 7)
356
357#define EXYNOS5_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(4, 0)
358#define EXYNOS5_IRQ_SYSMMU_ROTATOR_1 COMBINER_IRQ(4, 1)
359#define EXYNOS5_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 2)
360#define EXYNOS5_IRQ_SYSMMU_JPEG_1 COMBINER_IRQ(4, 3)
361
362#define EXYNOS5_IRQ_SYSMMU_FD_0 COMBINER_IRQ(5, 0)
363#define EXYNOS5_IRQ_SYSMMU_FD_1 COMBINER_IRQ(5, 1)
364#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_0 COMBINER_IRQ(5, 2)
365#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_1 COMBINER_IRQ(5, 3)
366#define EXYNOS5_IRQ_SYSMMU_MCUISP_0 COMBINER_IRQ(5, 4)
367#define EXYNOS5_IRQ_SYSMMU_MCUISP_1 COMBINER_IRQ(5, 5)
368#define EXYNOS5_IRQ_SYSMMU_3DNR_0 COMBINER_IRQ(5, 6)
369#define EXYNOS5_IRQ_SYSMMU_3DNR_1 COMBINER_IRQ(5, 7)
370
371#define EXYNOS5_IRQ_SYSMMU_ARM_0 COMBINER_IRQ(6, 0)
372#define EXYNOS5_IRQ_SYSMMU_ARM_1 COMBINER_IRQ(6, 1)
373#define EXYNOS5_IRQ_SYSMMU_MFC_L_0 COMBINER_IRQ(6, 2)
374#define EXYNOS5_IRQ_SYSMMU_MFC_L_1 COMBINER_IRQ(6, 3)
375#define EXYNOS5_IRQ_SYSMMU_RTIC_0 COMBINER_IRQ(6, 4)
376#define EXYNOS5_IRQ_SYSMMU_RTIC_1 COMBINER_IRQ(6, 5)
377#define EXYNOS5_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(6, 6)
378#define EXYNOS5_IRQ_SYSMMU_SSS_1 COMBINER_IRQ(6, 7)
379
380#define EXYNOS5_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(7, 0)
381#define EXYNOS5_IRQ_SYSMMU_MDMA0_1 COMBINER_IRQ(7, 1)
382#define EXYNOS5_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(7, 2)
383#define EXYNOS5_IRQ_SYSMMU_MDMA1_1 COMBINER_IRQ(7, 3)
384#define EXYNOS5_IRQ_SYSMMU_TV_0 COMBINER_IRQ(7, 4)
385#define EXYNOS5_IRQ_SYSMMU_TV_1 COMBINER_IRQ(7, 5)
386#define EXYNOS5_IRQ_SYSMMU_GPSX_0 COMBINER_IRQ(7, 6)
387#define EXYNOS5_IRQ_SYSMMU_GPSX_1 COMBINER_IRQ(7, 7)
388
389#define EXYNOS5_IRQ_SYSMMU_MFC_R_0 COMBINER_IRQ(8, 5)
390#define EXYNOS5_IRQ_SYSMMU_MFC_R_1 COMBINER_IRQ(8, 6)
391
392#define EXYNOS5_IRQ_SYSMMU_DIS1_0 COMBINER_IRQ(9, 4)
393#define EXYNOS5_IRQ_SYSMMU_DIS1_1 COMBINER_IRQ(9, 5)
394
395#define EXYNOS5_IRQ_DP COMBINER_IRQ(10, 3)
396#define EXYNOS5_IRQ_SYSMMU_DIS0_0 COMBINER_IRQ(10, 4)
397#define EXYNOS5_IRQ_SYSMMU_DIS0_1 COMBINER_IRQ(10, 5)
398#define EXYNOS5_IRQ_SYSMMU_ISP_0 COMBINER_IRQ(10, 6)
399#define EXYNOS5_IRQ_SYSMMU_ISP_1 COMBINER_IRQ(10, 7)
400
401#define EXYNOS5_IRQ_SYSMMU_ODC_0 COMBINER_IRQ(11, 0)
402#define EXYNOS5_IRQ_SYSMMU_ODC_1 COMBINER_IRQ(11, 1)
403#define EXYNOS5_IRQ_SYSMMU_DRC_0 COMBINER_IRQ(11, 6)
404#define EXYNOS5_IRQ_SYSMMU_DRC_1 COMBINER_IRQ(11, 7)
405
406#define EXYNOS5_IRQ_FIMD1_FIFO COMBINER_IRQ(18, 4)
407#define EXYNOS5_IRQ_FIMD1_VSYNC COMBINER_IRQ(18, 5)
408#define EXYNOS5_IRQ_FIMD1_SYSTEM COMBINER_IRQ(18, 6)
409
410#define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0)
411#define EXYNOS5_IRQ_MCT_L0 COMBINER_IRQ(23, 1)
412#define EXYNOS5_IRQ_MCT_L1 COMBINER_IRQ(23, 2)
413#define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3)
414#define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4)
415#define EXYNOS5_IRQ_MCT_G2 COMBINER_IRQ(23, 5)
416#define EXYNOS5_IRQ_MCT_G3 COMBINER_IRQ(23, 6)
417
418#define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0)
419#define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1)
420#define EXYNOS5_IRQ_SYSMMU_LITE1_1 COMBINER_IRQ(24, 2)
421#define EXYNOS5_IRQ_SYSMMU_2D_0 COMBINER_IRQ(24, 5)
422#define EXYNOS5_IRQ_SYSMMU_2D_1 COMBINER_IRQ(24, 6)
423
424#define EXYNOS5_IRQ_EINT2 COMBINER_IRQ(25, 0)
425#define EXYNOS5_IRQ_EINT3 COMBINER_IRQ(25, 1)
426
427#define EXYNOS5_IRQ_EINT4 COMBINER_IRQ(26, 0)
428#define EXYNOS5_IRQ_EINT5 COMBINER_IRQ(26, 1)
429
430#define EXYNOS5_IRQ_EINT6 COMBINER_IRQ(27, 0)
431#define EXYNOS5_IRQ_EINT7 COMBINER_IRQ(27, 1)
432
433#define EXYNOS5_IRQ_EINT8 COMBINER_IRQ(28, 0)
434#define EXYNOS5_IRQ_EINT9 COMBINER_IRQ(28, 1)
435
436#define EXYNOS5_IRQ_EINT10 COMBINER_IRQ(29, 0)
437#define EXYNOS5_IRQ_EINT11 COMBINER_IRQ(29, 1)
438
439#define EXYNOS5_IRQ_EINT12 COMBINER_IRQ(30, 0)
440#define EXYNOS5_IRQ_EINT13 COMBINER_IRQ(30, 1)
441
442#define EXYNOS5_IRQ_EINT14 COMBINER_IRQ(31, 0)
443#define EXYNOS5_IRQ_EINT15 COMBINER_IRQ(31, 1)
444
445#define EXYNOS5_MAX_COMBINER_NR 32
446
447#define EXYNOS5_IRQ_GPIO1_NR_GROUPS 13
448#define EXYNOS5_IRQ_GPIO2_NR_GROUPS 9
449#define EXYNOS5_IRQ_GPIO3_NR_GROUPS 5
450#define EXYNOS5_IRQ_GPIO4_NR_GROUPS 1
451
452#define MAX_COMBINER_NR (EXYNOS4_MAX_COMBINER_NR > EXYNOS5_MAX_COMBINER_NR ? \
453 EXYNOS4_MAX_COMBINER_NR : EXYNOS5_MAX_COMBINER_NR)
454
455#define S5P_EINT_BASE1 COMBINER_IRQ(MAX_COMBINER_NR, 0)
456#define S5P_EINT_BASE2 (S5P_EINT_BASE1 + 16)
457#define S5P_GPIOINT_BASE (S5P_EINT_BASE1 + 32)
458#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
459#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64)
170 460
171/* Set the default NR_IRQS */ 461/* Set the default NR_IRQS */
172#define NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT) 462
463#define NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
173 464
174#endif /* __ASM_ARCH_IRQS_H */ 465#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index c754a22a2bb3..bf90bb0ab2b8 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -25,6 +25,7 @@
25 25
26#define EXYNOS4_PA_SYSRAM0 0x02025000 26#define EXYNOS4_PA_SYSRAM0 0x02025000
27#define EXYNOS4_PA_SYSRAM1 0x02020000 27#define EXYNOS4_PA_SYSRAM1 0x02020000
28#define EXYNOS5_PA_SYSRAM 0x02020000
28 29
29#define EXYNOS4_PA_FIMC0 0x11800000 30#define EXYNOS4_PA_FIMC0 0x11800000
30#define EXYNOS4_PA_FIMC1 0x11810000 31#define EXYNOS4_PA_FIMC1 0x11810000
@@ -44,14 +45,23 @@
44#define EXYNOS4_PA_ONENAND 0x0C000000 45#define EXYNOS4_PA_ONENAND 0x0C000000
45#define EXYNOS4_PA_ONENAND_DMA 0x0C600000 46#define EXYNOS4_PA_ONENAND_DMA 0x0C600000
46 47
47#define EXYNOS4_PA_CHIPID 0x10000000 48#define EXYNOS_PA_CHIPID 0x10000000
48 49
49#define EXYNOS4_PA_SYSCON 0x10010000 50#define EXYNOS4_PA_SYSCON 0x10010000
51#define EXYNOS5_PA_SYSCON 0x10050100
52
50#define EXYNOS4_PA_PMU 0x10020000 53#define EXYNOS4_PA_PMU 0x10020000
54#define EXYNOS5_PA_PMU 0x10040000
55
51#define EXYNOS4_PA_CMU 0x10030000 56#define EXYNOS4_PA_CMU 0x10030000
57#define EXYNOS5_PA_CMU 0x10010000
52 58
53#define EXYNOS4_PA_SYSTIMER 0x10050000 59#define EXYNOS4_PA_SYSTIMER 0x10050000
60#define EXYNOS5_PA_SYSTIMER 0x101C0000
61
54#define EXYNOS4_PA_WATCHDOG 0x10060000 62#define EXYNOS4_PA_WATCHDOG 0x10060000
63#define EXYNOS5_PA_WATCHDOG 0x101D0000
64
55#define EXYNOS4_PA_RTC 0x10070000 65#define EXYNOS4_PA_RTC 0x10070000
56 66
57#define EXYNOS4_PA_KEYPAD 0x100A0000 67#define EXYNOS4_PA_KEYPAD 0x100A0000
@@ -59,15 +69,19 @@
59#define EXYNOS4_PA_DMC0 0x10400000 69#define EXYNOS4_PA_DMC0 0x10400000
60 70
61#define EXYNOS4_PA_COMBINER 0x10440000 71#define EXYNOS4_PA_COMBINER 0x10440000
72#define EXYNOS5_PA_COMBINER 0x10440000
62 73
63#define EXYNOS4_PA_GIC_CPU 0x10480000 74#define EXYNOS4_PA_GIC_CPU 0x10480000
64#define EXYNOS4_PA_GIC_DIST 0x10490000 75#define EXYNOS4_PA_GIC_DIST 0x10490000
76#define EXYNOS5_PA_GIC_CPU 0x10480000
77#define EXYNOS5_PA_GIC_DIST 0x10490000
65 78
66#define EXYNOS4_PA_COREPERI 0x10500000 79#define EXYNOS4_PA_COREPERI 0x10500000
67#define EXYNOS4_PA_TWD 0x10500600 80#define EXYNOS4_PA_TWD 0x10500600
68#define EXYNOS4_PA_L2CC 0x10502000 81#define EXYNOS4_PA_L2CC 0x10502000
69 82
70#define EXYNOS4_PA_MDMA 0x10810000 83#define EXYNOS4_PA_MDMA0 0x10810000
84#define EXYNOS4_PA_MDMA1 0x12840000
71#define EXYNOS4_PA_PDMA0 0x12680000 85#define EXYNOS4_PA_PDMA0 0x12680000
72#define EXYNOS4_PA_PDMA1 0x12690000 86#define EXYNOS4_PA_PDMA1 0x12690000
73 87
@@ -91,7 +105,6 @@
91#define EXYNOS4_PA_SPI1 0x13930000 105#define EXYNOS4_PA_SPI1 0x13930000
92#define EXYNOS4_PA_SPI2 0x13940000 106#define EXYNOS4_PA_SPI2 0x13940000
93 107
94
95#define EXYNOS4_PA_GPIO1 0x11400000 108#define EXYNOS4_PA_GPIO1 0x11400000
96#define EXYNOS4_PA_GPIO2 0x11000000 109#define EXYNOS4_PA_GPIO2 0x11000000
97#define EXYNOS4_PA_GPIO3 0x03860000 110#define EXYNOS4_PA_GPIO3 0x03860000
@@ -109,6 +122,7 @@
109#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000 122#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000
110 123
111#define EXYNOS4_PA_SROMC 0x12570000 124#define EXYNOS4_PA_SROMC 0x12570000
125#define EXYNOS5_PA_SROMC 0x12250000
112 126
113#define EXYNOS4_PA_EHCI 0x12580000 127#define EXYNOS4_PA_EHCI 0x12580000
114#define EXYNOS4_PA_OHCI 0x12590000 128#define EXYNOS4_PA_OHCI 0x12590000
@@ -116,6 +130,7 @@
116#define EXYNOS4_PA_MFC 0x13400000 130#define EXYNOS4_PA_MFC 0x13400000
117 131
118#define EXYNOS4_PA_UART 0x13800000 132#define EXYNOS4_PA_UART 0x13800000
133#define EXYNOS5_PA_UART 0x12C00000
119 134
120#define EXYNOS4_PA_VP 0x12C00000 135#define EXYNOS4_PA_VP 0x12C00000
121#define EXYNOS4_PA_MIXER 0x12C10000 136#define EXYNOS4_PA_MIXER 0x12C10000
@@ -124,6 +139,7 @@
124#define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000 139#define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000
125 140
126#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) 141#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
142#define EXYNOS5_PA_IIC(x) (0x12C60000 + ((x) * 0x10000))
127 143
128#define EXYNOS4_PA_ADC 0x13910000 144#define EXYNOS4_PA_ADC 0x13910000
129#define EXYNOS4_PA_ADC1 0x13911000 145#define EXYNOS4_PA_ADC1 0x13911000
@@ -133,8 +149,10 @@
133#define EXYNOS4_PA_SPDIF 0x139B0000 149#define EXYNOS4_PA_SPDIF 0x139B0000
134 150
135#define EXYNOS4_PA_TIMER 0x139D0000 151#define EXYNOS4_PA_TIMER 0x139D0000
152#define EXYNOS5_PA_TIMER 0x12DD0000
136 153
137#define EXYNOS4_PA_SDRAM 0x40000000 154#define EXYNOS4_PA_SDRAM 0x40000000
155#define EXYNOS5_PA_SDRAM 0x40000000
138 156
139/* Compatibiltiy Defines */ 157/* Compatibiltiy Defines */
140 158
@@ -152,7 +170,6 @@
152#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7) 170#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7)
153#define S3C_PA_RTC EXYNOS4_PA_RTC 171#define S3C_PA_RTC EXYNOS4_PA_RTC
154#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG 172#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
155#define S3C_PA_UART EXYNOS4_PA_UART
156#define S3C_PA_SPI0 EXYNOS4_PA_SPI0 173#define S3C_PA_SPI0 EXYNOS4_PA_SPI0
157#define S3C_PA_SPI1 EXYNOS4_PA_SPI1 174#define S3C_PA_SPI1 EXYNOS4_PA_SPI1
158#define S3C_PA_SPI2 EXYNOS4_PA_SPI2 175#define S3C_PA_SPI2 EXYNOS4_PA_SPI2
@@ -181,15 +198,18 @@
181 198
182/* Compatibility UART */ 199/* Compatibility UART */
183 200
184#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 201#define EXYNOS4_PA_UART0 0x13800000
202#define EXYNOS4_PA_UART1 0x13810000
203#define EXYNOS4_PA_UART2 0x13820000
204#define EXYNOS4_PA_UART3 0x13830000
205#define EXYNOS4_SZ_UART SZ_256
185 206
186#define S5P_PA_UART(x) (EXYNOS4_PA_UART + ((x) * S3C_UART_OFFSET)) 207#define EXYNOS5_PA_UART0 0x12C00000
187#define S5P_PA_UART0 S5P_PA_UART(0) 208#define EXYNOS5_PA_UART1 0x12C10000
188#define S5P_PA_UART1 S5P_PA_UART(1) 209#define EXYNOS5_PA_UART2 0x12C20000
189#define S5P_PA_UART2 S5P_PA_UART(2) 210#define EXYNOS5_PA_UART3 0x12C30000
190#define S5P_PA_UART3 S5P_PA_UART(3) 211#define EXYNOS5_SZ_UART SZ_256
191#define S5P_PA_UART4 S5P_PA_UART(4)
192 212
193#define S5P_SZ_UART SZ_256 213#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
194 214
195#endif /* __ASM_ARCH_MAP_H */ 215#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
index 6c37ebe94829..e141c1fd68d8 100644
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos/include/mach/regs-clock.h
@@ -16,195 +16,309 @@
16#include <plat/cpu.h> 16#include <plat/cpu.h>
17#include <mach/map.h> 17#include <mach/map.h>
18 18
19#define S5P_CLKREG(x) (S5P_VA_CMU + (x)) 19#define EXYNOS_CLKREG(x) (S5P_VA_CMU + (x))
20 20
21#define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500) 21#define EXYNOS4_CLKDIV_LEFTBUS EXYNOS_CLKREG(0x04500)
22#define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600) 22#define EXYNOS4_CLKDIV_STAT_LEFTBUS EXYNOS_CLKREG(0x04600)
23#define S5P_CLKGATE_IP_LEFTBUS S5P_CLKREG(0x04800) 23#define EXYNOS4_CLKGATE_IP_LEFTBUS EXYNOS_CLKREG(0x04800)
24 24
25#define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500) 25#define EXYNOS4_CLKDIV_RIGHTBUS EXYNOS_CLKREG(0x08500)
26#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) 26#define EXYNOS4_CLKDIV_STAT_RIGHTBUS EXYNOS_CLKREG(0x08600)
27#define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) 27#define EXYNOS4_CLKGATE_IP_RIGHTBUS EXYNOS_CLKREG(0x08800)
28 28
29#define S5P_EPLL_LOCK S5P_CLKREG(0x0C010) 29#define EXYNOS4_EPLL_LOCK EXYNOS_CLKREG(0x0C010)
30#define S5P_VPLL_LOCK S5P_CLKREG(0x0C020) 30#define EXYNOS4_VPLL_LOCK EXYNOS_CLKREG(0x0C020)
31 31
32#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) 32#define EXYNOS4_EPLL_CON0 EXYNOS_CLKREG(0x0C110)
33#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) 33#define EXYNOS4_EPLL_CON1 EXYNOS_CLKREG(0x0C114)
34#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) 34#define EXYNOS4_VPLL_CON0 EXYNOS_CLKREG(0x0C120)
35#define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) 35#define EXYNOS4_VPLL_CON1 EXYNOS_CLKREG(0x0C124)
36 36
37#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) 37#define EXYNOS4_CLKSRC_TOP0 EXYNOS_CLKREG(0x0C210)
38#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) 38#define EXYNOS4_CLKSRC_TOP1 EXYNOS_CLKREG(0x0C214)
39#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) 39#define EXYNOS4_CLKSRC_CAM EXYNOS_CLKREG(0x0C220)
40#define S5P_CLKSRC_TV S5P_CLKREG(0x0C224) 40#define EXYNOS4_CLKSRC_TV EXYNOS_CLKREG(0x0C224)
41#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) 41#define EXYNOS4_CLKSRC_MFC EXYNOS_CLKREG(0x0C228)
42#define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C) 42#define EXYNOS4_CLKSRC_G3D EXYNOS_CLKREG(0x0C22C)
43#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) 43#define EXYNOS4_CLKSRC_IMAGE EXYNOS_CLKREG(0x0C230)
44#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) 44#define EXYNOS4_CLKSRC_LCD0 EXYNOS_CLKREG(0x0C234)
45#define S5P_CLKSRC_MAUDIO S5P_CLKREG(0x0C23C) 45#define EXYNOS4_CLKSRC_MAUDIO EXYNOS_CLKREG(0x0C23C)
46#define S5P_CLKSRC_FSYS S5P_CLKREG(0x0C240) 46#define EXYNOS4_CLKSRC_FSYS EXYNOS_CLKREG(0x0C240)
47#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) 47#define EXYNOS4_CLKSRC_PERIL0 EXYNOS_CLKREG(0x0C250)
48#define S5P_CLKSRC_PERIL1 S5P_CLKREG(0x0C254) 48#define EXYNOS4_CLKSRC_PERIL1 EXYNOS_CLKREG(0x0C254)
49 49
50#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) 50#define EXYNOS4_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x0C310)
51#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) 51#define EXYNOS4_CLKSRC_MASK_CAM EXYNOS_CLKREG(0x0C320)
52#define S5P_CLKSRC_MASK_TV S5P_CLKREG(0x0C324) 52#define EXYNOS4_CLKSRC_MASK_TV EXYNOS_CLKREG(0x0C324)
53#define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334) 53#define EXYNOS4_CLKSRC_MASK_LCD0 EXYNOS_CLKREG(0x0C334)
54#define S5P_CLKSRC_MASK_MAUDIO S5P_CLKREG(0x0C33C) 54#define EXYNOS4_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x0C33C)
55#define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340) 55#define EXYNOS4_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x0C340)
56#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) 56#define EXYNOS4_CLKSRC_MASK_PERIL0 EXYNOS_CLKREG(0x0C350)
57#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) 57#define EXYNOS4_CLKSRC_MASK_PERIL1 EXYNOS_CLKREG(0x0C354)
58 58
59#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) 59#define EXYNOS4_CLKDIV_TOP EXYNOS_CLKREG(0x0C510)
60#define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520) 60#define EXYNOS4_CLKDIV_CAM EXYNOS_CLKREG(0x0C520)
61#define S5P_CLKDIV_TV S5P_CLKREG(0x0C524) 61#define EXYNOS4_CLKDIV_TV EXYNOS_CLKREG(0x0C524)
62#define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528) 62#define EXYNOS4_CLKDIV_MFC EXYNOS_CLKREG(0x0C528)
63#define S5P_CLKDIV_G3D S5P_CLKREG(0x0C52C) 63#define EXYNOS4_CLKDIV_G3D EXYNOS_CLKREG(0x0C52C)
64#define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530) 64#define EXYNOS4_CLKDIV_IMAGE EXYNOS_CLKREG(0x0C530)
65#define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534) 65#define EXYNOS4_CLKDIV_LCD0 EXYNOS_CLKREG(0x0C534)
66#define S5P_CLKDIV_MAUDIO S5P_CLKREG(0x0C53C) 66#define EXYNOS4_CLKDIV_MAUDIO EXYNOS_CLKREG(0x0C53C)
67#define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540) 67#define EXYNOS4_CLKDIV_FSYS0 EXYNOS_CLKREG(0x0C540)
68#define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544) 68#define EXYNOS4_CLKDIV_FSYS1 EXYNOS_CLKREG(0x0C544)
69#define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548) 69#define EXYNOS4_CLKDIV_FSYS2 EXYNOS_CLKREG(0x0C548)
70#define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C) 70#define EXYNOS4_CLKDIV_FSYS3 EXYNOS_CLKREG(0x0C54C)
71#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) 71#define EXYNOS4_CLKDIV_PERIL0 EXYNOS_CLKREG(0x0C550)
72#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) 72#define EXYNOS4_CLKDIV_PERIL1 EXYNOS_CLKREG(0x0C554)
73#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) 73#define EXYNOS4_CLKDIV_PERIL2 EXYNOS_CLKREG(0x0C558)
74#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) 74#define EXYNOS4_CLKDIV_PERIL3 EXYNOS_CLKREG(0x0C55C)
75#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) 75#define EXYNOS4_CLKDIV_PERIL4 EXYNOS_CLKREG(0x0C560)
76#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) 76#define EXYNOS4_CLKDIV_PERIL5 EXYNOS_CLKREG(0x0C564)
77#define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580) 77#define EXYNOS4_CLKDIV2_RATIO EXYNOS_CLKREG(0x0C580)
78 78
79#define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610) 79#define EXYNOS4_CLKDIV_STAT_TOP EXYNOS_CLKREG(0x0C610)
80 80#define EXYNOS4_CLKDIV_STAT_MFC EXYNOS_CLKREG(0x0C628)
81#define S5P_CLKGATE_SCLKCAM S5P_CLKREG(0x0C820) 81
82#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) 82#define EXYNOS4_CLKGATE_SCLKCAM EXYNOS_CLKREG(0x0C820)
83#define S5P_CLKGATE_IP_TV S5P_CLKREG(0x0C924) 83#define EXYNOS4_CLKGATE_IP_CAM EXYNOS_CLKREG(0x0C920)
84#define S5P_CLKGATE_IP_MFC S5P_CLKREG(0x0C928) 84#define EXYNOS4_CLKGATE_IP_TV EXYNOS_CLKREG(0x0C924)
85#define S5P_CLKGATE_IP_G3D S5P_CLKREG(0x0C92C) 85#define EXYNOS4_CLKGATE_IP_MFC EXYNOS_CLKREG(0x0C928)
86#define S5P_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \ 86#define EXYNOS4_CLKGATE_IP_G3D EXYNOS_CLKREG(0x0C92C)
87 S5P_CLKREG(0x0C930) : \ 87#define EXYNOS4_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \
88 S5P_CLKREG(0x04930)) 88 EXYNOS_CLKREG(0x0C930) : \
89#define S5P_CLKGATE_IP_IMAGE_4210 S5P_CLKREG(0x0C930) 89 EXYNOS_CLKREG(0x04930))
90#define S5P_CLKGATE_IP_IMAGE_4212 S5P_CLKREG(0x04930) 90#define EXYNOS4210_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x0C930)
91#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) 91#define EXYNOS4212_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x04930)
92#define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940) 92#define EXYNOS4_CLKGATE_IP_LCD0 EXYNOS_CLKREG(0x0C934)
93#define S5P_CLKGATE_IP_GPS S5P_CLKREG(0x0C94C) 93#define EXYNOS4_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x0C940)
94#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) 94#define EXYNOS4_CLKGATE_IP_GPS EXYNOS_CLKREG(0x0C94C)
95#define S5P_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \ 95#define EXYNOS4_CLKGATE_IP_PERIL EXYNOS_CLKREG(0x0C950)
96 S5P_CLKREG(0x0C960) : \ 96#define EXYNOS4_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \
97 S5P_CLKREG(0x08960)) 97 EXYNOS_CLKREG(0x0C960) : \
98#define S5P_CLKGATE_IP_PERIR_4210 S5P_CLKREG(0x0C960) 98 EXYNOS_CLKREG(0x08960))
99#define S5P_CLKGATE_IP_PERIR_4212 S5P_CLKREG(0x08960) 99#define EXYNOS4210_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x0C960)
100#define S5P_CLKGATE_BLOCK S5P_CLKREG(0x0C970) 100#define EXYNOS4212_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x08960)
101 101#define EXYNOS4_CLKGATE_BLOCK EXYNOS_CLKREG(0x0C970)
102#define S5P_CLKSRC_MASK_DMC S5P_CLKREG(0x10300) 102
103#define S5P_CLKSRC_DMC S5P_CLKREG(0x10200) 103#define EXYNOS4_CLKSRC_MASK_DMC EXYNOS_CLKREG(0x10300)
104#define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500) 104#define EXYNOS4_CLKSRC_DMC EXYNOS_CLKREG(0x10200)
105#define S5P_CLKDIV_DMC1 S5P_CLKREG(0x10504) 105#define EXYNOS4_CLKDIV_DMC0 EXYNOS_CLKREG(0x10500)
106#define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600) 106#define EXYNOS4_CLKDIV_DMC1 EXYNOS_CLKREG(0x10504)
107#define S5P_CLKGATE_IP_DMC S5P_CLKREG(0x10900) 107#define EXYNOS4_CLKDIV_STAT_DMC0 EXYNOS_CLKREG(0x10600)
108 108#define EXYNOS4_CLKDIV_STAT_DMC1 EXYNOS_CLKREG(0x10604)
109#define S5P_APLL_LOCK S5P_CLKREG(0x14000) 109#define EXYNOS4_CLKGATE_IP_DMC EXYNOS_CLKREG(0x10900)
110#define S5P_MPLL_LOCK (soc_is_exynos4210() ? \ 110
111 S5P_CLKREG(0x14004) : \ 111#define EXYNOS4_DMC_PAUSE_CTRL EXYNOS_CLKREG(0x11094)
112 S5P_CLKREG(0x10008)) 112#define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0)
113#define S5P_APLL_CON0 S5P_CLKREG(0x14100) 113
114#define S5P_APLL_CON1 S5P_CLKREG(0x14104) 114#define EXYNOS4_APLL_LOCK EXYNOS_CLKREG(0x14000)
115#define S5P_MPLL_CON0 (soc_is_exynos4210() ? \ 115#define EXYNOS4_MPLL_LOCK (soc_is_exynos4210() ? \
116 S5P_CLKREG(0x14108) : \ 116 EXYNOS_CLKREG(0x14004) : \
117 S5P_CLKREG(0x10108)) 117 EXYNOS_CLKREG(0x10008))
118#define S5P_MPLL_CON1 (soc_is_exynos4210() ? \ 118#define EXYNOS4_APLL_CON0 EXYNOS_CLKREG(0x14100)
119 S5P_CLKREG(0x1410C) : \ 119#define EXYNOS4_APLL_CON1 EXYNOS_CLKREG(0x14104)
120 S5P_CLKREG(0x1010C)) 120#define EXYNOS4_MPLL_CON0 (soc_is_exynos4210() ? \
121 121 EXYNOS_CLKREG(0x14108) : \
122#define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) 122 EXYNOS_CLKREG(0x10108))
123#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) 123#define EXYNOS4_MPLL_CON1 (soc_is_exynos4210() ? \
124 124 EXYNOS_CLKREG(0x1410C) : \
125#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) 125 EXYNOS_CLKREG(0x1010C))
126#define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504) 126
127#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) 127#define EXYNOS4_CLKSRC_CPU EXYNOS_CLKREG(0x14200)
128#define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604) 128#define EXYNOS4_CLKMUX_STATCPU EXYNOS_CLKREG(0x14400)
129 129
130#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) 130#define EXYNOS4_CLKDIV_CPU EXYNOS_CLKREG(0x14500)
131#define S5P_CLKGATE_IP_CPU S5P_CLKREG(0x14900) 131#define EXYNOS4_CLKDIV_CPU1 EXYNOS_CLKREG(0x14504)
132 132#define EXYNOS4_CLKDIV_STATCPU EXYNOS_CLKREG(0x14600)
133#define S5P_APLL_LOCKTIME (0x1C20) /* 300us */ 133#define EXYNOS4_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x14604)
134 134
135#define S5P_APLLCON0_ENABLE_SHIFT (31) 135#define EXYNOS4_CLKGATE_SCLKCPU EXYNOS_CLKREG(0x14800)
136#define S5P_APLLCON0_LOCKED_SHIFT (29) 136#define EXYNOS4_CLKGATE_IP_CPU EXYNOS_CLKREG(0x14900)
137#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) 137
138#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) 138#define EXYNOS4_APLL_LOCKTIME (0x1C20) /* 300us */
139 139
140#define S5P_EPLLCON0_ENABLE_SHIFT (31) 140#define EXYNOS4_APLLCON0_ENABLE_SHIFT (31)
141#define S5P_EPLLCON0_LOCKED_SHIFT (29) 141#define EXYNOS4_APLLCON0_LOCKED_SHIFT (29)
142 142#define EXYNOS4_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
143#define S5P_VPLLCON0_ENABLE_SHIFT (31) 143#define EXYNOS4_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
144#define S5P_VPLLCON0_LOCKED_SHIFT (29) 144
145 145#define EXYNOS4_EPLLCON0_ENABLE_SHIFT (31)
146#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) 146#define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29)
147#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) 147
148 148#define EXYNOS4_VPLLCON0_ENABLE_SHIFT (31)
149#define S5P_CLKDIV_CPU0_CORE_SHIFT (0) 149#define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29)
150#define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT) 150
151#define S5P_CLKDIV_CPU0_COREM0_SHIFT (4) 151#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
152#define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT) 152#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
153#define S5P_CLKDIV_CPU0_COREM1_SHIFT (8) 153
154#define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT) 154#define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT (0)
155#define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12) 155#define EXYNOS4_CLKDIV_CPU0_CORE_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT)
156#define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT) 156#define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT (4)
157#define S5P_CLKDIV_CPU0_ATB_SHIFT (16) 157#define EXYNOS4_CLKDIV_CPU0_COREM0_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT)
158#define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT) 158#define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT (8)
159#define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20) 159#define EXYNOS4_CLKDIV_CPU0_COREM1_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT)
160#define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) 160#define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT (12)
161#define S5P_CLKDIV_CPU0_APLL_SHIFT (24) 161#define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT)
162#define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT) 162#define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT (16)
163 163#define EXYNOS4_CLKDIV_CPU0_ATB_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT)
164#define S5P_CLKDIV_DMC0_ACP_SHIFT (0) 164#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT (20)
165#define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT) 165#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT)
166#define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4) 166#define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT (24)
167#define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) 167#define EXYNOS4_CLKDIV_CPU0_APLL_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT)
168#define S5P_CLKDIV_DMC0_DPHY_SHIFT (8) 168#define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT 28
169#define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT) 169#define EXYNOS4_CLKDIV_CPU0_CORE2_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT)
170#define S5P_CLKDIV_DMC0_DMC_SHIFT (12) 170
171#define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT) 171#define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT 0
172#define S5P_CLKDIV_DMC0_DMCD_SHIFT (16) 172#define EXYNOS4_CLKDIV_CPU1_COPY_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT)
173#define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT) 173#define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT 4
174#define S5P_CLKDIV_DMC0_DMCP_SHIFT (20) 174#define EXYNOS4_CLKDIV_CPU1_HPM_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT)
175#define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT) 175#define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT 8
176#define S5P_CLKDIV_DMC0_COPY2_SHIFT (24) 176#define EXYNOS4_CLKDIV_CPU1_CORES_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT)
177#define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT) 177
178#define S5P_CLKDIV_DMC0_CORETI_SHIFT (28) 178#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0)
179#define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT) 179#define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
180 180#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4)
181#define S5P_CLKDIV_TOP_ACLK200_SHIFT (0) 181#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
182#define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT) 182#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8)
183#define S5P_CLKDIV_TOP_ACLK100_SHIFT (4) 183#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
184#define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT) 184#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12)
185#define S5P_CLKDIV_TOP_ACLK160_SHIFT (8) 185#define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
186#define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT) 186#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16)
187#define S5P_CLKDIV_TOP_ACLK133_SHIFT (12) 187#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
188#define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT) 188#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20)
189#define S5P_CLKDIV_TOP_ONENAND_SHIFT (16) 189#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
190#define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT) 190#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24)
191 191#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
192#define S5P_CLKDIV_BUS_GDLR_SHIFT (0) 192#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28)
193#define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT) 193#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
194#define S5P_CLKDIV_BUS_GPLR_SHIFT (4) 194
195#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) 195#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0)
196#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
197#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4)
198#define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
199#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8)
200#define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
201#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12)
202#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
203#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16)
204#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
205#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24)
206#define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
207
208#define EXYNOS4_CLKDIV_MFC_SHIFT (0)
209#define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
210
211#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0)
212#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
213#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4)
214#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
215#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8)
216#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
217#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12)
218#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
219#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16)
220#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
221#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20)
222#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
223#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24)
224#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
225
226#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0)
227#define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
228#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4)
229#define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
230
231#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0)
232#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
233#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4)
234#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
235#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8)
236#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
237#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12)
238#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
196 239
197/* Only for EXYNOS4210 */ 240/* Only for EXYNOS4210 */
198 241
199#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) 242#define EXYNOS4210_CLKSRC_LCD1 EXYNOS_CLKREG(0x0C238)
200#define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338) 243#define EXYNOS4210_CLKSRC_MASK_LCD1 EXYNOS_CLKREG(0x0C338)
201#define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538) 244#define EXYNOS4210_CLKDIV_LCD1 EXYNOS_CLKREG(0x0C538)
202#define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938) 245#define EXYNOS4210_CLKGATE_IP_LCD1 EXYNOS_CLKREG(0x0C938)
246
247/* Only for EXYNOS4212 */
248
249#define EXYNOS4_CLKDIV_CAM1 EXYNOS_CLKREG(0x0C568)
250
251#define EXYNOS4_CLKDIV_STAT_CAM1 EXYNOS_CLKREG(0x0C668)
252
253#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0)
254#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
255
256/* For EXYNOS5250 */
257
258#define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100)
259#define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200)
260#define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500)
261#define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100)
262#define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204)
263
264#define EXYNOS5_CLKGATE_IP_CORE EXYNOS_CLKREG(0x04900)
265
266#define EXYNOS5_CLKDIV_ACP EXYNOS_CLKREG(0x08500)
267
268#define EXYNOS5_CLKSRC_TOP2 EXYNOS_CLKREG(0x10218)
269#define EXYNOS5_EPLL_CON0 EXYNOS_CLKREG(0x10130)
270#define EXYNOS5_EPLL_CON1 EXYNOS_CLKREG(0x10134)
271#define EXYNOS5_VPLL_CON0 EXYNOS_CLKREG(0x10140)
272#define EXYNOS5_VPLL_CON1 EXYNOS_CLKREG(0x10144)
273#define EXYNOS5_CPLL_CON0 EXYNOS_CLKREG(0x10120)
274
275#define EXYNOS5_CLKSRC_TOP0 EXYNOS_CLKREG(0x10210)
276#define EXYNOS5_CLKSRC_TOP3 EXYNOS_CLKREG(0x1021C)
277#define EXYNOS5_CLKSRC_GSCL EXYNOS_CLKREG(0x10220)
278#define EXYNOS5_CLKSRC_DISP1_0 EXYNOS_CLKREG(0x1022C)
279#define EXYNOS5_CLKSRC_FSYS EXYNOS_CLKREG(0x10244)
280#define EXYNOS5_CLKSRC_PERIC0 EXYNOS_CLKREG(0x10250)
281
282#define EXYNOS5_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x10310)
283#define EXYNOS5_CLKSRC_MASK_GSCL EXYNOS_CLKREG(0x10320)
284#define EXYNOS5_CLKSRC_MASK_DISP1_0 EXYNOS_CLKREG(0x1032C)
285#define EXYNOS5_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x10340)
286#define EXYNOS5_CLKSRC_MASK_PERIC0 EXYNOS_CLKREG(0x10350)
287
288#define EXYNOS5_CLKDIV_TOP0 EXYNOS_CLKREG(0x10510)
289#define EXYNOS5_CLKDIV_TOP1 EXYNOS_CLKREG(0x10514)
290#define EXYNOS5_CLKDIV_GSCL EXYNOS_CLKREG(0x10520)
291#define EXYNOS5_CLKDIV_DISP1_0 EXYNOS_CLKREG(0x1052C)
292#define EXYNOS5_CLKDIV_GEN EXYNOS_CLKREG(0x1053C)
293#define EXYNOS5_CLKDIV_FSYS0 EXYNOS_CLKREG(0x10548)
294#define EXYNOS5_CLKDIV_FSYS1 EXYNOS_CLKREG(0x1054C)
295#define EXYNOS5_CLKDIV_FSYS2 EXYNOS_CLKREG(0x10550)
296#define EXYNOS5_CLKDIV_FSYS3 EXYNOS_CLKREG(0x10554)
297#define EXYNOS5_CLKDIV_PERIC0 EXYNOS_CLKREG(0x10558)
298
299#define EXYNOS5_CLKGATE_IP_ACP EXYNOS_CLKREG(0x08800)
300#define EXYNOS5_CLKGATE_IP_GSCL EXYNOS_CLKREG(0x10920)
301#define EXYNOS5_CLKGATE_IP_DISP1 EXYNOS_CLKREG(0x10928)
302#define EXYNOS5_CLKGATE_IP_MFC EXYNOS_CLKREG(0x1092C)
303#define EXYNOS5_CLKGATE_IP_GEN EXYNOS_CLKREG(0x10934)
304#define EXYNOS5_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x10944)
305#define EXYNOS5_CLKGATE_IP_GPS EXYNOS_CLKREG(0x1094C)
306#define EXYNOS5_CLKGATE_IP_PERIC EXYNOS_CLKREG(0x10950)
307#define EXYNOS5_CLKGATE_IP_PERIS EXYNOS_CLKREG(0x10960)
308#define EXYNOS5_CLKGATE_BLOCK EXYNOS_CLKREG(0x10980)
309
310#define EXYNOS5_BPLL_CON0 EXYNOS_CLKREG(0x20110)
311#define EXYNOS5_CLKSRC_CDREX EXYNOS_CLKREG(0x20200)
312#define EXYNOS5_CLKDIV_CDREX EXYNOS_CLKREG(0x20500)
313
314#define EXYNOS5_EPLL_LOCK EXYNOS_CLKREG(0x10030)
315
316#define EXYNOS5_EPLLCON0_LOCKED_SHIFT (29)
203 317
204/* Compatibility defines and inclusion */ 318/* Compatibility defines and inclusion */
205 319
206#include <mach/regs-pmu.h> 320#include <mach/regs-pmu.h>
207 321
208#define S5P_EPLL_CON S5P_EPLL_CON0 322#define S5P_EPLL_CON EXYNOS4_EPLL_CON0
209 323
210#endif /* __ASM_ARCH_REGS_CLOCK_H */ 324#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-gpio.h b/arch/arm/mach-exynos/include/mach/regs-gpio.h
index 1401b21663a5..e4b5b60dcb85 100644
--- a/arch/arm/mach-exynos/include/mach/regs-gpio.h
+++ b/arch/arm/mach-exynos/include/mach/regs-gpio.h
@@ -16,6 +16,15 @@
16#include <mach/map.h> 16#include <mach/map.h>
17#include <mach/irqs.h> 17#include <mach/irqs.h>
18 18
19#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
20#define EINT_CON(b, x) (b + 0xE00 + (EINT_REG_NR(x) * 4))
21#define EINT_FLTCON(b, x) (b + 0xE80 + (EINT_REG_NR(x) * 4))
22#define EINT_MASK(b, x) (b + 0xF00 + (EINT_REG_NR(x) * 4))
23#define EINT_PEND(b, x) (b + 0xF40 + (EINT_REG_NR(x) * 4))
24
25#define EINT_OFFSET_BIT(x) (1 << (EINT_OFFSET(x) & 0x7))
26
27/* compatibility for plat-s5p/irq-pm.c */
19#define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00) 28#define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00)
20#define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4)) 29#define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4))
21 30
@@ -28,15 +37,4 @@
28#define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40) 37#define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40)
29#define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4)) 38#define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4))
30 39
31#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
32
33#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
34
35#define EINT_MODE S3C_GPIO_SFN(0xf)
36
37#define EINT_GPIO_0(x) EXYNOS4_GPX0(x)
38#define EINT_GPIO_1(x) EXYNOS4_GPX1(x)
39#define EINT_GPIO_2(x) EXYNOS4_GPX2(x)
40#define EINT_GPIO_3(x) EXYNOS4_GPX3(x)
41
42#endif /* __ASM_ARCH_REGS_GPIO_H */ 40#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 4fff8e938fec..4c53f38b5a9e 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -31,6 +31,7 @@
31#define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26) 31#define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26)
32 32
33#define S5P_SWRESET S5P_PMUREG(0x0400) 33#define S5P_SWRESET S5P_PMUREG(0x0400)
34#define EXYNOS_SWRESET S5P_PMUREG(0x0400)
34 35
35#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 36#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600)
36#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) 37#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604)
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h
index 21d97bcd9acb..493f4f365ddf 100644
--- a/arch/arm/mach-exynos/include/mach/uncompress.h
+++ b/arch/arm/mach-exynos/include/mach/uncompress.h
@@ -1,9 +1,8 @@
1/* linux/arch/arm/mach-exynos4/include/mach/uncompress.h 1/*
2 * 2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * EXYNOS4 - uncompress code 5 * EXYNOS - uncompress code
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -13,12 +12,20 @@
13#ifndef __ASM_ARCH_UNCOMPRESS_H 12#ifndef __ASM_ARCH_UNCOMPRESS_H
14#define __ASM_ARCH_UNCOMPRESS_H __FILE__ 13#define __ASM_ARCH_UNCOMPRESS_H __FILE__
15 14
15#include <asm/mach-types.h>
16
16#include <mach/map.h> 17#include <mach/map.h>
18
19volatile u8 *uart_base;
20
17#include <plat/uncompress.h> 21#include <plat/uncompress.h>
18 22
19static void arch_detect_cpu(void) 23static void arch_detect_cpu(void)
20{ 24{
21 /* we do not need to do any cpu detection here at the moment. */ 25 if (machine_is_smdk5250())
26 uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
27 else
28 uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
22 29
23 /* 30 /*
24 * For preventing FIFO overrun or infinite loop of UART console, 31 * For preventing FIFO overrun or infinite loop of UART console,
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index e6b02fdf1b09..8245f1c761d9 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -37,13 +37,13 @@
37 * data from the device tree. 37 * data from the device tree.
38 */ 38 */
39static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { 39static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = {
40 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART0, 40 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0,
41 "exynos4210-uart.0", NULL), 41 "exynos4210-uart.0", NULL),
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART1, 42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1,
43 "exynos4210-uart.1", NULL), 43 "exynos4210-uart.1", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART2, 44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2,
45 "exynos4210-uart.2", NULL), 45 "exynos4210-uart.2", NULL),
46 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART3, 46 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3,
47 "exynos4210-uart.3", NULL), 47 "exynos4210-uart.3", NULL),
48 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0), 48 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0),
49 "exynos4-sdhci.0", NULL), 49 "exynos4-sdhci.0", NULL),
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
new file mode 100644
index 000000000000..0d26f50081ad
--- /dev/null
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -0,0 +1,78 @@
1/*
2 * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/of_platform.h>
13#include <linux/serial_core.h>
14
15#include <asm/mach/arch.h>
16#include <asm/hardware/gic.h>
17#include <mach/map.h>
18
19#include <plat/cpu.h>
20#include <plat/regs-serial.h>
21
22#include "common.h"
23
24/*
25 * The following lookup table is used to override device names when devices
26 * are registered from device tree. This is temporarily added to enable
27 * device tree support addition for the EXYNOS5 architecture.
28 *
29 * For drivers that require platform data to be provided from the machine
30 * file, a platform data pointer can also be supplied along with the
31 * devices names. Usually, the platform data elements that cannot be parsed
32 * from the device tree by the drivers (example: function pointers) are
33 * supplied. But it should be noted that this is a temporary mechanism and
34 * at some point, the drivers should be capable of parsing all the platform
35 * data from the device tree.
36 */
37static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
38 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
39 "exynos4210-uart.0", NULL),
40 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
41 "exynos4210-uart.1", NULL),
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
43 "exynos4210-uart.2", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
45 "exynos4210-uart.3", NULL),
46 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
47 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
48 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL),
49 {},
50};
51
52static void __init exynos5250_dt_map_io(void)
53{
54 exynos_init_io(NULL, 0);
55 s3c24xx_init_clocks(24000000);
56}
57
58static void __init exynos5250_dt_machine_init(void)
59{
60 of_platform_populate(NULL, of_default_bus_match_table,
61 exynos5250_auxdata_lookup, NULL);
62}
63
64static char const *exynos5250_dt_compat[] __initdata = {
65 "samsung,exynos5250",
66 NULL
67};
68
69DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
70 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
71 .init_irq = exynos5_init_irq,
72 .map_io = exynos5250_dt_map_io,
73 .handle_irq = gic_handle_irq,
74 .init_machine = exynos5250_dt_machine_init,
75 .timer = &exynos4_timer,
76 .dt_compat = exynos5250_dt_compat,
77 .restart = exynos5_restart,
78MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 0679b8ad2d1e..3ec3ccf9f35c 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -412,7 +412,7 @@ static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
412 { MAX8997_BUCK7, &max8997_buck7_data }, 412 { MAX8997_BUCK7, &max8997_buck7_data },
413}; 413};
414 414
415struct max8997_platform_data __initdata origen_max8997_pdata = { 415static struct max8997_platform_data __initdata origen_max8997_pdata = {
416 .num_regulators = ARRAY_SIZE(origen_max8997_regulators), 416 .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
417 .regulators = origen_max8997_regulators, 417 .regulators = origen_max8997_regulators,
418 418
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 0fc65ffde8ff..e00d8e26d525 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -997,7 +997,7 @@ static void __init universal_map_io(void)
997 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 997 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
998} 998}
999 999
1000void s5p_tv_setup(void) 1000static void s5p_tv_setup(void)
1001{ 1001{
1002 /* direct HPD to HDMI chip */ 1002 /* direct HPD to HDMI chip */
1003 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug"); 1003 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index 85b5527d0918..1016515dc9a8 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -258,7 +258,10 @@ static void exynos4_clockevent_init(void)
258 mct_comp_device.cpumask = cpumask_of(0); 258 mct_comp_device.cpumask = cpumask_of(0);
259 clockevents_register_device(&mct_comp_device); 259 clockevents_register_device(&mct_comp_device);
260 260
261 setup_irq(IRQ_MCT_G0, &mct_comp_event_irq); 261 if (soc_is_exynos5250())
262 setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq);
263 else
264 setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq);
262} 265}
263 266
264#ifdef CONFIG_LOCAL_TIMERS 267#ifdef CONFIG_LOCAL_TIMERS
@@ -406,16 +409,16 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
406 if (mct_int_type == MCT_INT_SPI) { 409 if (mct_int_type == MCT_INT_SPI) {
407 if (cpu == 0) { 410 if (cpu == 0) {
408 mct_tick0_event_irq.dev_id = mevt; 411 mct_tick0_event_irq.dev_id = mevt;
409 evt->irq = IRQ_MCT_L0; 412 evt->irq = EXYNOS4_IRQ_MCT_L0;
410 setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq); 413 setup_irq(EXYNOS4_IRQ_MCT_L0, &mct_tick0_event_irq);
411 } else { 414 } else {
412 mct_tick1_event_irq.dev_id = mevt; 415 mct_tick1_event_irq.dev_id = mevt;
413 evt->irq = IRQ_MCT_L1; 416 evt->irq = EXYNOS4_IRQ_MCT_L1;
414 setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq); 417 setup_irq(EXYNOS4_IRQ_MCT_L1, &mct_tick1_event_irq);
415 irq_set_affinity(IRQ_MCT_L1, cpumask_of(1)); 418 irq_set_affinity(EXYNOS4_IRQ_MCT_L1, cpumask_of(1));
416 } 419 }
417 } else { 420 } else {
418 enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0); 421 enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0);
419 } 422 }
420} 423}
421 424
@@ -437,7 +440,7 @@ void local_timer_stop(struct clock_event_device *evt)
437 else 440 else
438 remove_irq(evt->irq, &mct_tick1_event_irq); 441 remove_irq(evt->irq, &mct_tick1_event_irq);
439 else 442 else
440 disable_percpu_irq(IRQ_MCT_LOCALTIMER); 443 disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER);
441} 444}
442#endif /* CONFIG_LOCAL_TIMERS */ 445#endif /* CONFIG_LOCAL_TIMERS */
443 446
@@ -452,11 +455,11 @@ static void __init exynos4_timer_resources(void)
452 if (mct_int_type == MCT_INT_PPI) { 455 if (mct_int_type == MCT_INT_PPI) {
453 int err; 456 int err;
454 457
455 err = request_percpu_irq(IRQ_MCT_LOCALTIMER, 458 err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER,
456 exynos4_mct_tick_isr, "MCT", 459 exynos4_mct_tick_isr, "MCT",
457 &percpu_mct_tick); 460 &percpu_mct_tick);
458 WARN(err, "MCT: can't request IRQ %d (%d)\n", 461 WARN(err, "MCT: can't request IRQ %d (%d)\n",
459 IRQ_MCT_LOCALTIMER, err); 462 EXYNOS_IRQ_MCT_LOCALTIMER, err);
460 } 463 }
461#endif /* CONFIG_LOCAL_TIMERS */ 464#endif /* CONFIG_LOCAL_TIMERS */
462} 465}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 0f2035a1eb6e..36c3984aaa47 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -166,7 +166,10 @@ void __init smp_init_cpus(void)
166 void __iomem *scu_base = scu_base_addr(); 166 void __iomem *scu_base = scu_base_addr();
167 unsigned int i, ncores; 167 unsigned int i, ncores;
168 168
169 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 169 if (soc_is_exynos5250())
170 ncores = 2;
171 else
172 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
170 173
171 /* sanity check */ 174 /* sanity check */
172 if (ncores > nr_cpu_ids) { 175 if (ncores > nr_cpu_ids) {
@@ -183,8 +186,8 @@ void __init smp_init_cpus(void)
183 186
184void __init platform_smp_prepare_cpus(unsigned int max_cpus) 187void __init platform_smp_prepare_cpus(unsigned int max_cpus)
185{ 188{
186 189 if (!soc_is_exynos5250())
187 scu_enable(scu_base_addr()); 190 scu_enable(scu_base_addr());
188 191
189 /* 192 /*
190 * Write the address of secondary startup into the 193 * Write the address of secondary startup into the
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e19013051772..f105bd2b6765 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -38,29 +38,29 @@
38#include <mach/pmu.h> 38#include <mach/pmu.h>
39 39
40static struct sleep_save exynos4_set_clksrc[] = { 40static struct sleep_save exynos4_set_clksrc[] = {
41 { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, }, 41 { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, },
42 { .reg = S5P_CLKSRC_MASK_CAM , .val = 0x11111111, }, 42 { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, },
43 { .reg = S5P_CLKSRC_MASK_TV , .val = 0x00000111, }, 43 { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, },
44 { .reg = S5P_CLKSRC_MASK_LCD0 , .val = 0x00001111, }, 44 { .reg = EXYNOS4_CLKSRC_MASK_LCD0 , .val = 0x00001111, },
45 { .reg = S5P_CLKSRC_MASK_MAUDIO , .val = 0x00000001, }, 45 { .reg = EXYNOS4_CLKSRC_MASK_MAUDIO , .val = 0x00000001, },
46 { .reg = S5P_CLKSRC_MASK_FSYS , .val = 0x01011111, }, 46 { .reg = EXYNOS4_CLKSRC_MASK_FSYS , .val = 0x01011111, },
47 { .reg = S5P_CLKSRC_MASK_PERIL0 , .val = 0x01111111, }, 47 { .reg = EXYNOS4_CLKSRC_MASK_PERIL0 , .val = 0x01111111, },
48 { .reg = S5P_CLKSRC_MASK_PERIL1 , .val = 0x01110111, }, 48 { .reg = EXYNOS4_CLKSRC_MASK_PERIL1 , .val = 0x01110111, },
49 { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, 49 { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, },
50}; 50};
51 51
52static struct sleep_save exynos4210_set_clksrc[] = { 52static struct sleep_save exynos4210_set_clksrc[] = {
53 { .reg = S5P_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, 53 { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, },
54}; 54};
55 55
56static struct sleep_save exynos4_epll_save[] = { 56static struct sleep_save exynos4_epll_save[] = {
57 SAVE_ITEM(S5P_EPLL_CON0), 57 SAVE_ITEM(EXYNOS4_EPLL_CON0),
58 SAVE_ITEM(S5P_EPLL_CON1), 58 SAVE_ITEM(EXYNOS4_EPLL_CON1),
59}; 59};
60 60
61static struct sleep_save exynos4_vpll_save[] = { 61static struct sleep_save exynos4_vpll_save[] = {
62 SAVE_ITEM(S5P_VPLL_CON0), 62 SAVE_ITEM(EXYNOS4_VPLL_CON0),
63 SAVE_ITEM(S5P_VPLL_CON1), 63 SAVE_ITEM(EXYNOS4_VPLL_CON1),
64}; 64};
65 65
66static struct sleep_save exynos4_core_save[] = { 66static struct sleep_save exynos4_core_save[] = {
@@ -239,7 +239,7 @@ static void exynos4_restore_pll(void)
239 locktime = (3000 / pll_in_rate) * p_div; 239 locktime = (3000 / pll_in_rate) * p_div;
240 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 240 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
241 241
242 __raw_writel(lockcnt, S5P_EPLL_LOCK); 242 __raw_writel(lockcnt, EXYNOS4_EPLL_LOCK);
243 243
244 s3c_pm_do_restore_core(exynos4_epll_save, 244 s3c_pm_do_restore_core(exynos4_epll_save,
245 ARRAY_SIZE(exynos4_epll_save)); 245 ARRAY_SIZE(exynos4_epll_save));
@@ -257,7 +257,7 @@ static void exynos4_restore_pll(void)
257 locktime = 750; 257 locktime = 750;
258 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 258 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
259 259
260 __raw_writel(lockcnt, S5P_VPLL_LOCK); 260 __raw_writel(lockcnt, EXYNOS4_VPLL_LOCK);
261 261
262 s3c_pm_do_restore_core(exynos4_vpll_save, 262 s3c_pm_do_restore_core(exynos4_vpll_save,
263 ARRAY_SIZE(exynos4_vpll_save)); 263 ARRAY_SIZE(exynos4_vpll_save));
@@ -268,14 +268,14 @@ static void exynos4_restore_pll(void)
268 268
269 do { 269 do {
270 if (epll_wait) { 270 if (epll_wait) {
271 pll_con = __raw_readl(S5P_EPLL_CON0); 271 pll_con = __raw_readl(EXYNOS4_EPLL_CON0);
272 if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT)) 272 if (pll_con & (1 << EXYNOS4_EPLLCON0_LOCKED_SHIFT))
273 epll_wait = 0; 273 epll_wait = 0;
274 } 274 }
275 275
276 if (vpll_wait) { 276 if (vpll_wait) {
277 pll_con = __raw_readl(S5P_VPLL_CON0); 277 pll_con = __raw_readl(EXYNOS4_VPLL_CON0);
278 if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT)) 278 if (pll_con & (1 << EXYNOS4_VPLLCON0_LOCKED_SHIFT))
279 vpll_wait = 0; 279 vpll_wait = 0;
280 } 280 }
281 } while (epll_wait || vpll_wait); 281 } while (epll_wait || vpll_wait);
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c
index d395bd17c38b..b90d94c17f7c 100644
--- a/arch/arm/mach-exynos/setup-i2c0.c
+++ b/arch/arm/mach-exynos/setup-i2c0.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c0.c 2 * Copyright (c) 2009-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/ 3 * http://www.samsung.com/
6 * 4 *
7 * I2C0 GPIO configuration. 5 * I2C0 GPIO configuration.
@@ -18,9 +16,14 @@ struct platform_device; /* don't need the contents */
18#include <linux/gpio.h> 16#include <linux/gpio.h>
19#include <plat/iic.h> 17#include <plat/iic.h>
20#include <plat/gpio-cfg.h> 18#include <plat/gpio-cfg.h>
19#include <plat/cpu.h>
21 20
22void s3c_i2c0_cfg_gpio(struct platform_device *dev) 21void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{ 22{
23 if (soc_is_exynos5250())
24 /* will be implemented with gpio function */
25 return;
26
24 s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2, 27 s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2,
25 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); 28 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
26} 29}