diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-11-06 00:54:56 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-11-06 00:54:56 -0400 |
commit | 830145796a5c8f1ca3f87ea619063c1d99a57df5 (patch) | |
tree | e72a0ecacfcce228c46d93c946cfd65a44cc1fd3 /arch/arm/mach-exynos | |
parent | e700e41d9abfbf9fee01e979a41b185695132c19 (diff) |
ARM: EXYNOS: Add ARCH_EXYNOS and reorganize arch/arm/mach-exynos
The arch/arm/mach-exynos4 directory (CONFIG_ARCH_EXYNOS4) has
made for plaforms based on EXYNOS4 SoCs. But since upcoming
Samsung's SoCs such as EXYNOS5 (ARM Cortex A15) can reuse most
codes in current mach-exynos4, one mach-exynos directory will
be used for them.
This patch changes to CONFIG_ARCH_EXYNOS (arch/arm/mach-exynos)
but keeps original CONFIG_ARCH_EXYNOS4 in mach-exynos/Kconfig to
avoid changing in driver side.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos')
70 files changed, 12158 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig new file mode 100644 index 000000000000..724ec0f3560d --- /dev/null +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -0,0 +1,349 @@ | |||
1 | # arch/arm/mach-exynos/Kconfig | ||
2 | # | ||
3 | # Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | # Configuration options for the EXYNOS4 | ||
9 | |||
10 | if ARCH_EXYNOS | ||
11 | |||
12 | menu "SAMSUNG EXYNOS SoCs Support" | ||
13 | |||
14 | choice | ||
15 | prompt "EXYNOS System Type" | ||
16 | default ARCH_EXYNOS4 | ||
17 | |||
18 | config ARCH_EXYNOS4 | ||
19 | bool "SAMSUNG EXYNOS4" | ||
20 | help | ||
21 | Samsung EXYNOS4 SoCs based systems | ||
22 | |||
23 | endchoice | ||
24 | |||
25 | comment "EXYNOS SoCs" | ||
26 | |||
27 | config CPU_EXYNOS4210 | ||
28 | bool "SAMSUNG EXYNOS4210" | ||
29 | default y | ||
30 | depends on ARCH_EXYNOS4 | ||
31 | select SAMSUNG_DMADEV | ||
32 | select ARM_CPU_SUSPEND if PM | ||
33 | select S5P_PM if PM | ||
34 | select S5P_SLEEP if PM | ||
35 | help | ||
36 | Enable EXYNOS4210 CPU support | ||
37 | |||
38 | config SOC_EXYNOS4212 | ||
39 | bool "SAMSUNG EXYNOS4212" | ||
40 | default y | ||
41 | depends on ARCH_EXYNOS4 | ||
42 | select S5P_PM if PM | ||
43 | select S5P_SLEEP if PM | ||
44 | help | ||
45 | Enable EXYNOS4212 SoC support | ||
46 | |||
47 | config SOC_EXYNOS4412 | ||
48 | bool "SAMSUNG EXYNOS4412" | ||
49 | default y | ||
50 | depends on ARCH_EXYNOS4 | ||
51 | help | ||
52 | Enable EXYNOS4412 SoC support | ||
53 | |||
54 | config EXYNOS4_MCT | ||
55 | bool | ||
56 | default y | ||
57 | help | ||
58 | Use MCT (Multi Core Timer) as kernel timers | ||
59 | |||
60 | config EXYNOS4_DEV_AHCI | ||
61 | bool | ||
62 | help | ||
63 | Compile in platform device definitions for AHCI | ||
64 | |||
65 | config EXYNOS4_SETUP_FIMD0 | ||
66 | bool | ||
67 | help | ||
68 | Common setup code for FIMD0. | ||
69 | |||
70 | config EXYNOS4_DEV_PD | ||
71 | bool | ||
72 | help | ||
73 | Compile in platform device definitions for Power Domain | ||
74 | |||
75 | config EXYNOS4_DEV_SYSMMU | ||
76 | bool | ||
77 | help | ||
78 | Common setup code for SYSTEM MMU in EXYNOS4 | ||
79 | |||
80 | config EXYNOS4_DEV_DWMCI | ||
81 | bool | ||
82 | help | ||
83 | Compile in platform device definitions for DWMCI | ||
84 | |||
85 | config EXYNOS4_SETUP_I2C1 | ||
86 | bool | ||
87 | help | ||
88 | Common setup code for i2c bus 1. | ||
89 | |||
90 | config EXYNOS4_SETUP_I2C2 | ||
91 | bool | ||
92 | help | ||
93 | Common setup code for i2c bus 2. | ||
94 | |||
95 | config EXYNOS4_SETUP_I2C3 | ||
96 | bool | ||
97 | help | ||
98 | Common setup code for i2c bus 3. | ||
99 | |||
100 | config EXYNOS4_SETUP_I2C4 | ||
101 | bool | ||
102 | help | ||
103 | Common setup code for i2c bus 4. | ||
104 | |||
105 | config EXYNOS4_SETUP_I2C5 | ||
106 | bool | ||
107 | help | ||
108 | Common setup code for i2c bus 5. | ||
109 | |||
110 | config EXYNOS4_SETUP_I2C6 | ||
111 | bool | ||
112 | help | ||
113 | Common setup code for i2c bus 6. | ||
114 | |||
115 | config EXYNOS4_SETUP_I2C7 | ||
116 | bool | ||
117 | help | ||
118 | Common setup code for i2c bus 7. | ||
119 | |||
120 | config EXYNOS4_SETUP_KEYPAD | ||
121 | bool | ||
122 | help | ||
123 | Common setup code for keypad. | ||
124 | |||
125 | config EXYNOS4_SETUP_SDHCI | ||
126 | bool | ||
127 | select EXYNOS4_SETUP_SDHCI_GPIO | ||
128 | help | ||
129 | Internal helper functions for EXYNOS4 based SDHCI systems. | ||
130 | |||
131 | config EXYNOS4_SETUP_SDHCI_GPIO | ||
132 | bool | ||
133 | help | ||
134 | Common setup code for SDHCI gpio. | ||
135 | |||
136 | config EXYNOS4_SETUP_FIMC | ||
137 | bool | ||
138 | help | ||
139 | Common setup code for the camera interfaces. | ||
140 | |||
141 | config EXYNOS4_SETUP_USB_PHY | ||
142 | bool | ||
143 | help | ||
144 | Common setup code for USB PHY controller | ||
145 | |||
146 | # machine support | ||
147 | |||
148 | if ARCH_EXYNOS4 | ||
149 | |||
150 | comment "EXYNOS4210 Boards" | ||
151 | |||
152 | config MACH_SMDKC210 | ||
153 | bool "SMDKC210" | ||
154 | select MACH_SMDKV310 | ||
155 | help | ||
156 | Machine support for Samsung SMDKC210 | ||
157 | |||
158 | config MACH_SMDKV310 | ||
159 | bool "SMDKV310" | ||
160 | select CPU_EXYNOS4210 | ||
161 | select S5P_DEV_FIMD0 | ||
162 | select S3C_DEV_RTC | ||
163 | select S3C_DEV_WDT | ||
164 | select S3C_DEV_I2C1 | ||
165 | select S5P_DEV_FIMC0 | ||
166 | select S5P_DEV_FIMC1 | ||
167 | select S5P_DEV_FIMC2 | ||
168 | select S5P_DEV_FIMC3 | ||
169 | select S5P_DEV_I2C_HDMIPHY | ||
170 | select S5P_DEV_MFC | ||
171 | select S5P_DEV_TV | ||
172 | select S5P_DEV_USB_EHCI | ||
173 | select S3C_DEV_HSMMC | ||
174 | select S3C_DEV_HSMMC1 | ||
175 | select S3C_DEV_HSMMC2 | ||
176 | select S3C_DEV_HSMMC3 | ||
177 | select SAMSUNG_DEV_BACKLIGHT | ||
178 | select EXYNOS4_DEV_AHCI | ||
179 | select SAMSUNG_DEV_KEYPAD | ||
180 | select EXYNOS4_DEV_PD | ||
181 | select SAMSUNG_DEV_PWM | ||
182 | select EXYNOS4_DEV_SYSMMU | ||
183 | select EXYNOS4_SETUP_FIMD0 | ||
184 | select EXYNOS4_SETUP_I2C1 | ||
185 | select EXYNOS4_SETUP_KEYPAD | ||
186 | select EXYNOS4_SETUP_SDHCI | ||
187 | select EXYNOS4_SETUP_USB_PHY | ||
188 | help | ||
189 | Machine support for Samsung SMDKV310 | ||
190 | |||
191 | config MACH_ARMLEX4210 | ||
192 | bool "ARMLEX4210" | ||
193 | select CPU_EXYNOS4210 | ||
194 | select S3C_DEV_RTC | ||
195 | select S3C_DEV_WDT | ||
196 | select S3C_DEV_HSMMC | ||
197 | select S3C_DEV_HSMMC2 | ||
198 | select S3C_DEV_HSMMC3 | ||
199 | select EXYNOS4_DEV_AHCI | ||
200 | select EXYNOS4_DEV_SYSMMU | ||
201 | select EXYNOS4_SETUP_SDHCI | ||
202 | help | ||
203 | Machine support for Samsung ARMLEX4210 based on EXYNOS4210 | ||
204 | |||
205 | config MACH_UNIVERSAL_C210 | ||
206 | bool "Mobile UNIVERSAL_C210 Board" | ||
207 | select CPU_EXYNOS4210 | ||
208 | select S5P_GPIO_INT | ||
209 | select S5P_DEV_FIMC0 | ||
210 | select S5P_DEV_FIMC1 | ||
211 | select S5P_DEV_FIMC2 | ||
212 | select S5P_DEV_FIMC3 | ||
213 | select S5P_DEV_CSIS0 | ||
214 | select S5P_DEV_FIMD0 | ||
215 | select S3C_DEV_HSMMC | ||
216 | select S3C_DEV_HSMMC2 | ||
217 | select S3C_DEV_HSMMC3 | ||
218 | select S3C_DEV_I2C1 | ||
219 | select S3C_DEV_I2C3 | ||
220 | select S3C_DEV_I2C5 | ||
221 | select S5P_DEV_I2C_HDMIPHY | ||
222 | select S5P_DEV_MFC | ||
223 | select S5P_DEV_ONENAND | ||
224 | select S5P_DEV_TV | ||
225 | select EXYNOS4_DEV_PD | ||
226 | select EXYNOS4_SETUP_FIMD0 | ||
227 | select EXYNOS4_SETUP_I2C1 | ||
228 | select EXYNOS4_SETUP_I2C3 | ||
229 | select EXYNOS4_SETUP_I2C5 | ||
230 | select EXYNOS4_SETUP_SDHCI | ||
231 | select EXYNOS4_SETUP_FIMC | ||
232 | select S5P_SETUP_MIPIPHY | ||
233 | help | ||
234 | Machine support for Samsung Mobile Universal S5PC210 Reference | ||
235 | Board. | ||
236 | |||
237 | config MACH_NURI | ||
238 | bool "Mobile NURI Board" | ||
239 | select CPU_EXYNOS4210 | ||
240 | select S5P_GPIO_INT | ||
241 | select S3C_DEV_WDT | ||
242 | select S3C_DEV_RTC | ||
243 | select S5P_DEV_FIMD0 | ||
244 | select S3C_DEV_HSMMC | ||
245 | select S3C_DEV_HSMMC2 | ||
246 | select S3C_DEV_HSMMC3 | ||
247 | select S3C_DEV_I2C1 | ||
248 | select S3C_DEV_I2C3 | ||
249 | select S3C_DEV_I2C5 | ||
250 | select S5P_DEV_CSIS0 | ||
251 | select S5P_DEV_FIMC0 | ||
252 | select S5P_DEV_FIMC1 | ||
253 | select S5P_DEV_FIMC2 | ||
254 | select S5P_DEV_FIMC3 | ||
255 | select S5P_DEV_MFC | ||
256 | select S5P_DEV_USB_EHCI | ||
257 | select S5P_SETUP_MIPIPHY | ||
258 | select EXYNOS4_DEV_PD | ||
259 | select EXYNOS4_SETUP_FIMC | ||
260 | select EXYNOS4_SETUP_FIMD0 | ||
261 | select EXYNOS4_SETUP_I2C1 | ||
262 | select EXYNOS4_SETUP_I2C3 | ||
263 | select EXYNOS4_SETUP_I2C5 | ||
264 | select EXYNOS4_SETUP_SDHCI | ||
265 | select EXYNOS4_SETUP_USB_PHY | ||
266 | select S5P_SETUP_MIPIPHY | ||
267 | select SAMSUNG_DEV_PWM | ||
268 | select SAMSUNG_DEV_ADC | ||
269 | help | ||
270 | Machine support for Samsung Mobile NURI Board. | ||
271 | |||
272 | config MACH_ORIGEN | ||
273 | bool "ORIGEN" | ||
274 | select CPU_EXYNOS4210 | ||
275 | select S3C_DEV_RTC | ||
276 | select S3C_DEV_WDT | ||
277 | select S3C_DEV_HSMMC | ||
278 | select S3C_DEV_HSMMC2 | ||
279 | select S5P_DEV_FIMC0 | ||
280 | select S5P_DEV_FIMC1 | ||
281 | select S5P_DEV_FIMC2 | ||
282 | select S5P_DEV_FIMC3 | ||
283 | select S5P_DEV_FIMD0 | ||
284 | select S5P_DEV_I2C_HDMIPHY | ||
285 | select S5P_DEV_MFC | ||
286 | select S5P_DEV_TV | ||
287 | select S5P_DEV_USB_EHCI | ||
288 | select SAMSUNG_DEV_BACKLIGHT | ||
289 | select SAMSUNG_DEV_PWM | ||
290 | select EXYNOS4_DEV_PD | ||
291 | select EXYNOS4_SETUP_FIMD0 | ||
292 | select EXYNOS4_SETUP_SDHCI | ||
293 | select EXYNOS4_SETUP_USB_PHY | ||
294 | help | ||
295 | Machine support for ORIGEN based on Samsung EXYNOS4210 | ||
296 | |||
297 | comment "EXYNOS4212 Boards" | ||
298 | |||
299 | config MACH_SMDK4212 | ||
300 | bool "SMDK4212" | ||
301 | select SOC_EXYNOS4212 | ||
302 | select S3C_DEV_HSMMC2 | ||
303 | select S3C_DEV_HSMMC3 | ||
304 | select S3C_DEV_I2C1 | ||
305 | select S3C_DEV_I2C3 | ||
306 | select S3C_DEV_I2C7 | ||
307 | select S3C_DEV_RTC | ||
308 | select S3C_DEV_WDT | ||
309 | select SAMSUNG_DEV_BACKLIGHT | ||
310 | select SAMSUNG_DEV_KEYPAD | ||
311 | select SAMSUNG_DEV_PWM | ||
312 | select EXYNOS4_SETUP_I2C1 | ||
313 | select EXYNOS4_SETUP_I2C3 | ||
314 | select EXYNOS4_SETUP_I2C7 | ||
315 | select EXYNOS4_SETUP_KEYPAD | ||
316 | select EXYNOS4_SETUP_SDHCI | ||
317 | help | ||
318 | Machine support for Samsung SMDK4212 | ||
319 | |||
320 | comment "EXYNOS4412 Boards" | ||
321 | |||
322 | config MACH_SMDK4412 | ||
323 | bool "SMDK4412" | ||
324 | select SOC_EXYNOS4412 | ||
325 | select MACH_SMDK4212 | ||
326 | help | ||
327 | Machine support for Samsung SMDK4412 | ||
328 | endif | ||
329 | |||
330 | if ARCH_EXYNOS4 | ||
331 | |||
332 | comment "Configuration for HSMMC 8-bit bus width" | ||
333 | |||
334 | config EXYNOS4_SDHCI_CH0_8BIT | ||
335 | bool "Channel 0 with 8-bit bus" | ||
336 | help | ||
337 | Support HSMMC Channel 0 8-bit bus. | ||
338 | If selected, Channel 1 is disabled. | ||
339 | |||
340 | config EXYNOS4_SDHCI_CH2_8BIT | ||
341 | bool "Channel 2 with 8-bit bus" | ||
342 | help | ||
343 | Support HSMMC Channel 2 8-bit bus. | ||
344 | If selected, Channel 3 is disabled. | ||
345 | endif | ||
346 | |||
347 | endmenu | ||
348 | |||
349 | endif | ||
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile new file mode 100644 index 000000000000..59069a35e40b --- /dev/null +++ b/arch/arm/mach-exynos/Makefile | |||
@@ -0,0 +1,60 @@ | |||
1 | # arch/arm/mach-exynos/Makefile | ||
2 | # | ||
3 | # Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | obj-y := | ||
9 | obj-m := | ||
10 | obj-n := | ||
11 | obj- := | ||
12 | |||
13 | # Core support for EXYNOS4 system | ||
14 | |||
15 | obj-$(CONFIG_ARCH_EXYNOS4) += cpu.o init.o clock.o irq-combiner.o setup-i2c0.o | ||
16 | obj-$(CONFIG_ARCH_EXYNOS4) += irq-eint.o dma.o pmu.o | ||
17 | obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o | ||
18 | obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o | ||
19 | obj-$(CONFIG_PM) += pm.o | ||
20 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
21 | |||
22 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | ||
23 | |||
24 | obj-$(CONFIG_EXYNOS4_MCT) += mct.o | ||
25 | |||
26 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | ||
27 | |||
28 | # machine support | ||
29 | |||
30 | obj-$(CONFIG_MACH_SMDKC210) += mach-smdkv310.o | ||
31 | obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o | ||
32 | obj-$(CONFIG_MACH_ARMLEX4210) += mach-armlex4210.o | ||
33 | obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o | ||
34 | obj-$(CONFIG_MACH_NURI) += mach-nuri.o | ||
35 | obj-$(CONFIG_MACH_ORIGEN) += mach-origen.o | ||
36 | |||
37 | obj-$(CONFIG_MACH_SMDK4212) += mach-smdk4x12.o | ||
38 | obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o | ||
39 | |||
40 | # device support | ||
41 | |||
42 | obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o | ||
43 | obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o | ||
44 | obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o | ||
45 | obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o | ||
46 | obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o | ||
47 | |||
48 | obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o | ||
49 | obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o | ||
50 | obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o | ||
51 | obj-$(CONFIG_EXYNOS4_SETUP_I2C2) += setup-i2c2.o | ||
52 | obj-$(CONFIG_EXYNOS4_SETUP_I2C3) += setup-i2c3.o | ||
53 | obj-$(CONFIG_EXYNOS4_SETUP_I2C4) += setup-i2c4.o | ||
54 | obj-$(CONFIG_EXYNOS4_SETUP_I2C5) += setup-i2c5.o | ||
55 | obj-$(CONFIG_EXYNOS4_SETUP_I2C6) += setup-i2c6.o | ||
56 | obj-$(CONFIG_EXYNOS4_SETUP_I2C7) += setup-i2c7.o | ||
57 | obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o | ||
58 | obj-$(CONFIG_EXYNOS4_SETUP_SDHCI) += setup-sdhci.o | ||
59 | obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | ||
60 | obj-$(CONFIG_EXYNOS4_SETUP_USB_PHY) += setup-usb-phy.o | ||
diff --git a/arch/arm/mach-exynos/Makefile.boot b/arch/arm/mach-exynos/Makefile.boot new file mode 100644 index 000000000000..b9862e22bf10 --- /dev/null +++ b/arch/arm/mach-exynos/Makefile.boot | |||
@@ -0,0 +1,2 @@ | |||
1 | zreladdr-y += 0x40008000 | ||
2 | params_phys-y := 0x40000100 | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c new file mode 100644 index 000000000000..b9d5ef670eb4 --- /dev/null +++ b/arch/arm/mach-exynos/clock-exynos4210.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/clock-exynos4210.c | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * EXYNOS4210 - Clock support | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/clk.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/syscore_ops.h> | ||
19 | |||
20 | #include <plat/cpu-freq.h> | ||
21 | #include <plat/clock.h> | ||
22 | #include <plat/cpu.h> | ||
23 | #include <plat/pll.h> | ||
24 | #include <plat/s5p-clock.h> | ||
25 | #include <plat/clock-clksrc.h> | ||
26 | #include <plat/exynos4.h> | ||
27 | #include <plat/pm.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/map.h> | ||
31 | #include <mach/regs-clock.h> | ||
32 | #include <mach/exynos4-clock.h> | ||
33 | |||
34 | static struct sleep_save exynos4210_clock_save[] = { | ||
35 | SAVE_ITEM(S5P_CLKSRC_IMAGE), | ||
36 | SAVE_ITEM(S5P_CLKSRC_LCD1), | ||
37 | SAVE_ITEM(S5P_CLKDIV_IMAGE), | ||
38 | SAVE_ITEM(S5P_CLKDIV_LCD1), | ||
39 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD1), | ||
40 | SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4210), | ||
41 | SAVE_ITEM(S5P_CLKGATE_IP_LCD1), | ||
42 | SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4210), | ||
43 | }; | ||
44 | |||
45 | static struct clksrc_clk *sysclks[] = { | ||
46 | /* nothing here yet */ | ||
47 | }; | ||
48 | |||
49 | static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) | ||
50 | { | ||
51 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); | ||
52 | } | ||
53 | |||
54 | static struct clksrc_clk clksrcs[] = { | ||
55 | { | ||
56 | .clk = { | ||
57 | .name = "sclk_sata", | ||
58 | .id = -1, | ||
59 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
60 | .ctrlbit = (1 << 24), | ||
61 | }, | ||
62 | .sources = &clkset_mout_corebus, | ||
63 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, | ||
64 | .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, | ||
65 | }, { | ||
66 | .clk = { | ||
67 | .name = "sclk_fimd", | ||
68 | .devname = "exynos4-fb.1", | ||
69 | .enable = exynos4_clksrc_mask_lcd1_ctrl, | ||
70 | .ctrlbit = (1 << 0), | ||
71 | }, | ||
72 | .sources = &clkset_group, | ||
73 | .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, | ||
74 | .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static struct clk init_clocks_off[] = { | ||
79 | { | ||
80 | .name = "sataphy", | ||
81 | .id = -1, | ||
82 | .parent = &clk_aclk_133.clk, | ||
83 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
84 | .ctrlbit = (1 << 3), | ||
85 | }, { | ||
86 | .name = "sata", | ||
87 | .id = -1, | ||
88 | .parent = &clk_aclk_133.clk, | ||
89 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
90 | .ctrlbit = (1 << 10), | ||
91 | }, { | ||
92 | .name = "fimd", | ||
93 | .devname = "exynos4-fb.1", | ||
94 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
95 | .ctrlbit = (1 << 0), | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | #ifdef CONFIG_PM_SLEEP | ||
100 | static int exynos4210_clock_suspend(void) | ||
101 | { | ||
102 | s3c_pm_do_save(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static void exynos4210_clock_resume(void) | ||
108 | { | ||
109 | s3c_pm_do_restore_core(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); | ||
110 | } | ||
111 | |||
112 | #else | ||
113 | #define exynos4210_clock_suspend NULL | ||
114 | #define exynos4210_clock_resume NULL | ||
115 | #endif | ||
116 | |||
117 | struct syscore_ops exynos4210_clock_syscore_ops = { | ||
118 | .suspend = exynos4210_clock_suspend, | ||
119 | .resume = exynos4210_clock_resume, | ||
120 | }; | ||
121 | |||
122 | void __init exynos4210_register_clocks(void) | ||
123 | { | ||
124 | int ptr; | ||
125 | |||
126 | clk_mout_mpll.reg_src.reg = S5P_CLKSRC_CPU; | ||
127 | clk_mout_mpll.reg_src.shift = 8; | ||
128 | clk_mout_mpll.reg_src.size = 1; | ||
129 | |||
130 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
131 | s3c_register_clksrc(sysclks[ptr], 1); | ||
132 | |||
133 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
134 | |||
135 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
136 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
137 | |||
138 | register_syscore_ops(&exynos4210_clock_syscore_ops); | ||
139 | } | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c new file mode 100644 index 000000000000..77d5decb34fd --- /dev/null +++ b/arch/arm/mach-exynos/clock-exynos4212.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/clock-exynos4212.c | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * EXYNOS4212 - Clock support | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/clk.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/syscore_ops.h> | ||
19 | |||
20 | #include <plat/cpu-freq.h> | ||
21 | #include <plat/clock.h> | ||
22 | #include <plat/cpu.h> | ||
23 | #include <plat/pll.h> | ||
24 | #include <plat/s5p-clock.h> | ||
25 | #include <plat/clock-clksrc.h> | ||
26 | #include <plat/exynos4.h> | ||
27 | #include <plat/pm.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/map.h> | ||
31 | #include <mach/regs-clock.h> | ||
32 | #include <mach/exynos4-clock.h> | ||
33 | |||
34 | static struct sleep_save exynos4212_clock_save[] = { | ||
35 | SAVE_ITEM(S5P_CLKSRC_IMAGE), | ||
36 | SAVE_ITEM(S5P_CLKDIV_IMAGE), | ||
37 | SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4212), | ||
38 | SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4212), | ||
39 | }; | ||
40 | |||
41 | static struct clk *clk_src_mpll_user_list[] = { | ||
42 | [0] = &clk_fin_mpll, | ||
43 | [1] = &clk_mout_mpll.clk, | ||
44 | }; | ||
45 | |||
46 | static struct clksrc_sources clk_src_mpll_user = { | ||
47 | .sources = clk_src_mpll_user_list, | ||
48 | .nr_sources = ARRAY_SIZE(clk_src_mpll_user_list), | ||
49 | }; | ||
50 | |||
51 | static struct clksrc_clk clk_mout_mpll_user = { | ||
52 | .clk = { | ||
53 | .name = "mout_mpll_user", | ||
54 | }, | ||
55 | .sources = &clk_src_mpll_user, | ||
56 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 24, .size = 1 }, | ||
57 | }; | ||
58 | |||
59 | static struct clksrc_clk *sysclks[] = { | ||
60 | &clk_mout_mpll_user, | ||
61 | }; | ||
62 | |||
63 | static struct clksrc_clk clksrcs[] = { | ||
64 | /* nothing here yet */ | ||
65 | }; | ||
66 | |||
67 | static struct clk init_clocks_off[] = { | ||
68 | /* nothing here yet */ | ||
69 | }; | ||
70 | |||
71 | #ifdef CONFIG_PM_SLEEP | ||
72 | static int exynos4212_clock_suspend(void) | ||
73 | { | ||
74 | s3c_pm_do_save(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static void exynos4212_clock_resume(void) | ||
80 | { | ||
81 | s3c_pm_do_restore_core(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); | ||
82 | } | ||
83 | |||
84 | #else | ||
85 | #define exynos4212_clock_suspend NULL | ||
86 | #define exynos4212_clock_resume NULL | ||
87 | #endif | ||
88 | |||
89 | struct syscore_ops exynos4212_clock_syscore_ops = { | ||
90 | .suspend = exynos4212_clock_suspend, | ||
91 | .resume = exynos4212_clock_resume, | ||
92 | }; | ||
93 | |||
94 | void __init exynos4212_register_clocks(void) | ||
95 | { | ||
96 | int ptr; | ||
97 | |||
98 | /* usbphy1 is removed */ | ||
99 | clkset_group_list[4] = NULL; | ||
100 | |||
101 | /* mout_mpll_user is used */ | ||
102 | clkset_group_list[6] = &clk_mout_mpll_user.clk; | ||
103 | clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; | ||
104 | |||
105 | clk_mout_mpll.reg_src.reg = S5P_CLKSRC_DMC; | ||
106 | clk_mout_mpll.reg_src.shift = 12; | ||
107 | clk_mout_mpll.reg_src.size = 1; | ||
108 | |||
109 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
110 | s3c_register_clksrc(sysclks[ptr], 1); | ||
111 | |||
112 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
113 | |||
114 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
115 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
116 | |||
117 | register_syscore_ops(&exynos4212_clock_syscore_ops); | ||
118 | } | ||
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c new file mode 100644 index 000000000000..2894f0adef5c --- /dev/null +++ b/arch/arm/mach-exynos/clock.c | |||
@@ -0,0 +1,1491 @@ | |||
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/exynos4.h> | ||
25 | #include <plat/pm.h> | ||
26 | |||
27 | #include <mach/map.h> | ||
28 | #include <mach/regs-clock.h> | ||
29 | #include <mach/sysmmu.h> | ||
30 | #include <mach/exynos4-clock.h> | ||
31 | |||
32 | static struct sleep_save exynos4_clock_save[] = { | ||
33 | SAVE_ITEM(S5P_CLKDIV_LEFTBUS), | ||
34 | SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), | ||
35 | SAVE_ITEM(S5P_CLKDIV_RIGHTBUS), | ||
36 | SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS), | ||
37 | SAVE_ITEM(S5P_CLKSRC_TOP0), | ||
38 | SAVE_ITEM(S5P_CLKSRC_TOP1), | ||
39 | SAVE_ITEM(S5P_CLKSRC_CAM), | ||
40 | SAVE_ITEM(S5P_CLKSRC_TV), | ||
41 | SAVE_ITEM(S5P_CLKSRC_MFC), | ||
42 | SAVE_ITEM(S5P_CLKSRC_G3D), | ||
43 | SAVE_ITEM(S5P_CLKSRC_LCD0), | ||
44 | SAVE_ITEM(S5P_CLKSRC_MAUDIO), | ||
45 | SAVE_ITEM(S5P_CLKSRC_FSYS), | ||
46 | SAVE_ITEM(S5P_CLKSRC_PERIL0), | ||
47 | SAVE_ITEM(S5P_CLKSRC_PERIL1), | ||
48 | SAVE_ITEM(S5P_CLKDIV_CAM), | ||
49 | SAVE_ITEM(S5P_CLKDIV_TV), | ||
50 | SAVE_ITEM(S5P_CLKDIV_MFC), | ||
51 | SAVE_ITEM(S5P_CLKDIV_G3D), | ||
52 | SAVE_ITEM(S5P_CLKDIV_LCD0), | ||
53 | SAVE_ITEM(S5P_CLKDIV_MAUDIO), | ||
54 | SAVE_ITEM(S5P_CLKDIV_FSYS0), | ||
55 | SAVE_ITEM(S5P_CLKDIV_FSYS1), | ||
56 | SAVE_ITEM(S5P_CLKDIV_FSYS2), | ||
57 | SAVE_ITEM(S5P_CLKDIV_FSYS3), | ||
58 | SAVE_ITEM(S5P_CLKDIV_PERIL0), | ||
59 | SAVE_ITEM(S5P_CLKDIV_PERIL1), | ||
60 | SAVE_ITEM(S5P_CLKDIV_PERIL2), | ||
61 | SAVE_ITEM(S5P_CLKDIV_PERIL3), | ||
62 | SAVE_ITEM(S5P_CLKDIV_PERIL4), | ||
63 | SAVE_ITEM(S5P_CLKDIV_PERIL5), | ||
64 | SAVE_ITEM(S5P_CLKDIV_TOP), | ||
65 | SAVE_ITEM(S5P_CLKSRC_MASK_TOP), | ||
66 | SAVE_ITEM(S5P_CLKSRC_MASK_CAM), | ||
67 | SAVE_ITEM(S5P_CLKSRC_MASK_TV), | ||
68 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD0), | ||
69 | SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO), | ||
70 | SAVE_ITEM(S5P_CLKSRC_MASK_FSYS), | ||
71 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0), | ||
72 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1), | ||
73 | SAVE_ITEM(S5P_CLKDIV2_RATIO), | ||
74 | SAVE_ITEM(S5P_CLKGATE_SCLKCAM), | ||
75 | SAVE_ITEM(S5P_CLKGATE_IP_CAM), | ||
76 | SAVE_ITEM(S5P_CLKGATE_IP_TV), | ||
77 | SAVE_ITEM(S5P_CLKGATE_IP_MFC), | ||
78 | SAVE_ITEM(S5P_CLKGATE_IP_G3D), | ||
79 | SAVE_ITEM(S5P_CLKGATE_IP_LCD0), | ||
80 | SAVE_ITEM(S5P_CLKGATE_IP_FSYS), | ||
81 | SAVE_ITEM(S5P_CLKGATE_IP_GPS), | ||
82 | SAVE_ITEM(S5P_CLKGATE_IP_PERIL), | ||
83 | SAVE_ITEM(S5P_CLKGATE_BLOCK), | ||
84 | SAVE_ITEM(S5P_CLKSRC_MASK_DMC), | ||
85 | SAVE_ITEM(S5P_CLKSRC_DMC), | ||
86 | SAVE_ITEM(S5P_CLKDIV_DMC0), | ||
87 | SAVE_ITEM(S5P_CLKDIV_DMC1), | ||
88 | SAVE_ITEM(S5P_CLKGATE_IP_DMC), | ||
89 | SAVE_ITEM(S5P_CLKSRC_CPU), | ||
90 | SAVE_ITEM(S5P_CLKDIV_CPU), | ||
91 | SAVE_ITEM(S5P_CLKDIV_CPU + 0x4), | ||
92 | SAVE_ITEM(S5P_CLKGATE_SCLKCPU), | ||
93 | SAVE_ITEM(S5P_CLKGATE_IP_CPU), | ||
94 | }; | ||
95 | |||
96 | struct clk clk_sclk_hdmi27m = { | ||
97 | .name = "sclk_hdmi27m", | ||
98 | .rate = 27000000, | ||
99 | }; | ||
100 | |||
101 | struct clk clk_sclk_hdmiphy = { | ||
102 | .name = "sclk_hdmiphy", | ||
103 | }; | ||
104 | |||
105 | struct clk clk_sclk_usbphy0 = { | ||
106 | .name = "sclk_usbphy0", | ||
107 | .rate = 27000000, | ||
108 | }; | ||
109 | |||
110 | struct clk clk_sclk_usbphy1 = { | ||
111 | .name = "sclk_usbphy1", | ||
112 | }; | ||
113 | |||
114 | static struct clk dummy_apb_pclk = { | ||
115 | .name = "apb_pclk", | ||
116 | .id = -1, | ||
117 | }; | ||
118 | |||
119 | static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable) | ||
120 | { | ||
121 | return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable); | ||
122 | } | ||
123 | |||
124 | static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable) | ||
125 | { | ||
126 | return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable); | ||
127 | } | ||
128 | |||
129 | static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable) | ||
130 | { | ||
131 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable); | ||
132 | } | ||
133 | |||
134 | int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) | ||
135 | { | ||
136 | return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable); | ||
137 | } | ||
138 | |||
139 | static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) | ||
140 | { | ||
141 | return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable); | ||
142 | } | ||
143 | |||
144 | static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable) | ||
145 | { | ||
146 | return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable); | ||
147 | } | ||
148 | |||
149 | static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable) | ||
150 | { | ||
151 | return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable); | ||
152 | } | ||
153 | |||
154 | static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable) | ||
155 | { | ||
156 | return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable); | ||
157 | } | ||
158 | |||
159 | static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable) | ||
160 | { | ||
161 | return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable); | ||
162 | } | ||
163 | |||
164 | static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable) | ||
165 | { | ||
166 | return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable); | ||
167 | } | ||
168 | |||
169 | static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable) | ||
170 | { | ||
171 | return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable); | ||
172 | } | ||
173 | |||
174 | static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable) | ||
175 | { | ||
176 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable); | ||
177 | } | ||
178 | |||
179 | int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) | ||
180 | { | ||
181 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable); | ||
182 | } | ||
183 | |||
184 | int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) | ||
185 | { | ||
186 | return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable); | ||
187 | } | ||
188 | |||
189 | static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable) | ||
190 | { | ||
191 | return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable); | ||
192 | } | ||
193 | |||
194 | static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable) | ||
195 | { | ||
196 | return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable); | ||
197 | } | ||
198 | |||
199 | static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable) | ||
200 | { | ||
201 | return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); | ||
202 | } | ||
203 | |||
204 | static int exynos4_clk_dac_ctrl(struct clk *clk, int enable) | ||
205 | { | ||
206 | return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable); | ||
207 | } | ||
208 | |||
209 | /* Core list of CMU_CPU side */ | ||
210 | |||
211 | static struct clksrc_clk clk_mout_apll = { | ||
212 | .clk = { | ||
213 | .name = "mout_apll", | ||
214 | }, | ||
215 | .sources = &clk_src_apll, | ||
216 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, | ||
217 | }; | ||
218 | |||
219 | struct clksrc_clk clk_sclk_apll = { | ||
220 | .clk = { | ||
221 | .name = "sclk_apll", | ||
222 | .parent = &clk_mout_apll.clk, | ||
223 | }, | ||
224 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, | ||
225 | }; | ||
226 | |||
227 | struct clksrc_clk clk_mout_epll = { | ||
228 | .clk = { | ||
229 | .name = "mout_epll", | ||
230 | }, | ||
231 | .sources = &clk_src_epll, | ||
232 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, | ||
233 | }; | ||
234 | |||
235 | struct clksrc_clk clk_mout_mpll = { | ||
236 | .clk = { | ||
237 | .name = "mout_mpll", | ||
238 | }, | ||
239 | .sources = &clk_src_mpll, | ||
240 | |||
241 | /* reg_src will be added in each SoCs' clock */ | ||
242 | }; | ||
243 | |||
244 | static struct clk *clkset_moutcore_list[] = { | ||
245 | [0] = &clk_mout_apll.clk, | ||
246 | [1] = &clk_mout_mpll.clk, | ||
247 | }; | ||
248 | |||
249 | static struct clksrc_sources clkset_moutcore = { | ||
250 | .sources = clkset_moutcore_list, | ||
251 | .nr_sources = ARRAY_SIZE(clkset_moutcore_list), | ||
252 | }; | ||
253 | |||
254 | static struct clksrc_clk clk_moutcore = { | ||
255 | .clk = { | ||
256 | .name = "moutcore", | ||
257 | }, | ||
258 | .sources = &clkset_moutcore, | ||
259 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 }, | ||
260 | }; | ||
261 | |||
262 | static struct clksrc_clk clk_coreclk = { | ||
263 | .clk = { | ||
264 | .name = "core_clk", | ||
265 | .parent = &clk_moutcore.clk, | ||
266 | }, | ||
267 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 }, | ||
268 | }; | ||
269 | |||
270 | static struct clksrc_clk clk_armclk = { | ||
271 | .clk = { | ||
272 | .name = "armclk", | ||
273 | .parent = &clk_coreclk.clk, | ||
274 | }, | ||
275 | }; | ||
276 | |||
277 | static struct clksrc_clk clk_aclk_corem0 = { | ||
278 | .clk = { | ||
279 | .name = "aclk_corem0", | ||
280 | .parent = &clk_coreclk.clk, | ||
281 | }, | ||
282 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
283 | }; | ||
284 | |||
285 | static struct clksrc_clk clk_aclk_cores = { | ||
286 | .clk = { | ||
287 | .name = "aclk_cores", | ||
288 | .parent = &clk_coreclk.clk, | ||
289 | }, | ||
290 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
291 | }; | ||
292 | |||
293 | static struct clksrc_clk clk_aclk_corem1 = { | ||
294 | .clk = { | ||
295 | .name = "aclk_corem1", | ||
296 | .parent = &clk_coreclk.clk, | ||
297 | }, | ||
298 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 }, | ||
299 | }; | ||
300 | |||
301 | static struct clksrc_clk clk_periphclk = { | ||
302 | .clk = { | ||
303 | .name = "periphclk", | ||
304 | .parent = &clk_coreclk.clk, | ||
305 | }, | ||
306 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 }, | ||
307 | }; | ||
308 | |||
309 | /* Core list of CMU_CORE side */ | ||
310 | |||
311 | struct clk *clkset_corebus_list[] = { | ||
312 | [0] = &clk_mout_mpll.clk, | ||
313 | [1] = &clk_sclk_apll.clk, | ||
314 | }; | ||
315 | |||
316 | struct clksrc_sources clkset_mout_corebus = { | ||
317 | .sources = clkset_corebus_list, | ||
318 | .nr_sources = ARRAY_SIZE(clkset_corebus_list), | ||
319 | }; | ||
320 | |||
321 | static struct clksrc_clk clk_mout_corebus = { | ||
322 | .clk = { | ||
323 | .name = "mout_corebus", | ||
324 | }, | ||
325 | .sources = &clkset_mout_corebus, | ||
326 | .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 }, | ||
327 | }; | ||
328 | |||
329 | static struct clksrc_clk clk_sclk_dmc = { | ||
330 | .clk = { | ||
331 | .name = "sclk_dmc", | ||
332 | .parent = &clk_mout_corebus.clk, | ||
333 | }, | ||
334 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 }, | ||
335 | }; | ||
336 | |||
337 | static struct clksrc_clk clk_aclk_cored = { | ||
338 | .clk = { | ||
339 | .name = "aclk_cored", | ||
340 | .parent = &clk_sclk_dmc.clk, | ||
341 | }, | ||
342 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 }, | ||
343 | }; | ||
344 | |||
345 | static struct clksrc_clk clk_aclk_corep = { | ||
346 | .clk = { | ||
347 | .name = "aclk_corep", | ||
348 | .parent = &clk_aclk_cored.clk, | ||
349 | }, | ||
350 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 }, | ||
351 | }; | ||
352 | |||
353 | static struct clksrc_clk clk_aclk_acp = { | ||
354 | .clk = { | ||
355 | .name = "aclk_acp", | ||
356 | .parent = &clk_mout_corebus.clk, | ||
357 | }, | ||
358 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 }, | ||
359 | }; | ||
360 | |||
361 | static struct clksrc_clk clk_pclk_acp = { | ||
362 | .clk = { | ||
363 | .name = "pclk_acp", | ||
364 | .parent = &clk_aclk_acp.clk, | ||
365 | }, | ||
366 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 }, | ||
367 | }; | ||
368 | |||
369 | /* Core list of CMU_TOP side */ | ||
370 | |||
371 | struct clk *clkset_aclk_top_list[] = { | ||
372 | [0] = &clk_mout_mpll.clk, | ||
373 | [1] = &clk_sclk_apll.clk, | ||
374 | }; | ||
375 | |||
376 | struct clksrc_sources clkset_aclk = { | ||
377 | .sources = clkset_aclk_top_list, | ||
378 | .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), | ||
379 | }; | ||
380 | |||
381 | static struct clksrc_clk clk_aclk_200 = { | ||
382 | .clk = { | ||
383 | .name = "aclk_200", | ||
384 | }, | ||
385 | .sources = &clkset_aclk, | ||
386 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 }, | ||
387 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 }, | ||
388 | }; | ||
389 | |||
390 | static struct clksrc_clk clk_aclk_100 = { | ||
391 | .clk = { | ||
392 | .name = "aclk_100", | ||
393 | }, | ||
394 | .sources = &clkset_aclk, | ||
395 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 }, | ||
396 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 }, | ||
397 | }; | ||
398 | |||
399 | static struct clksrc_clk clk_aclk_160 = { | ||
400 | .clk = { | ||
401 | .name = "aclk_160", | ||
402 | }, | ||
403 | .sources = &clkset_aclk, | ||
404 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 }, | ||
405 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, | ||
406 | }; | ||
407 | |||
408 | struct clksrc_clk clk_aclk_133 = { | ||
409 | .clk = { | ||
410 | .name = "aclk_133", | ||
411 | }, | ||
412 | .sources = &clkset_aclk, | ||
413 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 }, | ||
414 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 }, | ||
415 | }; | ||
416 | |||
417 | static struct clk *clkset_vpllsrc_list[] = { | ||
418 | [0] = &clk_fin_vpll, | ||
419 | [1] = &clk_sclk_hdmi27m, | ||
420 | }; | ||
421 | |||
422 | static struct clksrc_sources clkset_vpllsrc = { | ||
423 | .sources = clkset_vpllsrc_list, | ||
424 | .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list), | ||
425 | }; | ||
426 | |||
427 | static struct clksrc_clk clk_vpllsrc = { | ||
428 | .clk = { | ||
429 | .name = "vpll_src", | ||
430 | .enable = exynos4_clksrc_mask_top_ctrl, | ||
431 | .ctrlbit = (1 << 0), | ||
432 | }, | ||
433 | .sources = &clkset_vpllsrc, | ||
434 | .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 }, | ||
435 | }; | ||
436 | |||
437 | static struct clk *clkset_sclk_vpll_list[] = { | ||
438 | [0] = &clk_vpllsrc.clk, | ||
439 | [1] = &clk_fout_vpll, | ||
440 | }; | ||
441 | |||
442 | static struct clksrc_sources clkset_sclk_vpll = { | ||
443 | .sources = clkset_sclk_vpll_list, | ||
444 | .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), | ||
445 | }; | ||
446 | |||
447 | struct clksrc_clk clk_sclk_vpll = { | ||
448 | .clk = { | ||
449 | .name = "sclk_vpll", | ||
450 | }, | ||
451 | .sources = &clkset_sclk_vpll, | ||
452 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, | ||
453 | }; | ||
454 | |||
455 | static struct clk init_clocks_off[] = { | ||
456 | { | ||
457 | .name = "timers", | ||
458 | .parent = &clk_aclk_100.clk, | ||
459 | .enable = exynos4_clk_ip_peril_ctrl, | ||
460 | .ctrlbit = (1<<24), | ||
461 | }, { | ||
462 | .name = "csis", | ||
463 | .devname = "s5p-mipi-csis.0", | ||
464 | .enable = exynos4_clk_ip_cam_ctrl, | ||
465 | .ctrlbit = (1 << 4), | ||
466 | }, { | ||
467 | .name = "csis", | ||
468 | .devname = "s5p-mipi-csis.1", | ||
469 | .enable = exynos4_clk_ip_cam_ctrl, | ||
470 | .ctrlbit = (1 << 5), | ||
471 | }, { | ||
472 | .name = "fimc", | ||
473 | .devname = "exynos4-fimc.0", | ||
474 | .enable = exynos4_clk_ip_cam_ctrl, | ||
475 | .ctrlbit = (1 << 0), | ||
476 | }, { | ||
477 | .name = "fimc", | ||
478 | .devname = "exynos4-fimc.1", | ||
479 | .enable = exynos4_clk_ip_cam_ctrl, | ||
480 | .ctrlbit = (1 << 1), | ||
481 | }, { | ||
482 | .name = "fimc", | ||
483 | .devname = "exynos4-fimc.2", | ||
484 | .enable = exynos4_clk_ip_cam_ctrl, | ||
485 | .ctrlbit = (1 << 2), | ||
486 | }, { | ||
487 | .name = "fimc", | ||
488 | .devname = "exynos4-fimc.3", | ||
489 | .enable = exynos4_clk_ip_cam_ctrl, | ||
490 | .ctrlbit = (1 << 3), | ||
491 | }, { | ||
492 | .name = "fimd", | ||
493 | .devname = "exynos4-fb.0", | ||
494 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
495 | .ctrlbit = (1 << 0), | ||
496 | }, { | ||
497 | .name = "hsmmc", | ||
498 | .devname = "s3c-sdhci.0", | ||
499 | .parent = &clk_aclk_133.clk, | ||
500 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
501 | .ctrlbit = (1 << 5), | ||
502 | }, { | ||
503 | .name = "hsmmc", | ||
504 | .devname = "s3c-sdhci.1", | ||
505 | .parent = &clk_aclk_133.clk, | ||
506 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
507 | .ctrlbit = (1 << 6), | ||
508 | }, { | ||
509 | .name = "hsmmc", | ||
510 | .devname = "s3c-sdhci.2", | ||
511 | .parent = &clk_aclk_133.clk, | ||
512 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
513 | .ctrlbit = (1 << 7), | ||
514 | }, { | ||
515 | .name = "hsmmc", | ||
516 | .devname = "s3c-sdhci.3", | ||
517 | .parent = &clk_aclk_133.clk, | ||
518 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
519 | .ctrlbit = (1 << 8), | ||
520 | }, { | ||
521 | .name = "dwmmc", | ||
522 | .parent = &clk_aclk_133.clk, | ||
523 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
524 | .ctrlbit = (1 << 9), | ||
525 | }, { | ||
526 | .name = "dac", | ||
527 | .devname = "s5p-sdo", | ||
528 | .enable = exynos4_clk_ip_tv_ctrl, | ||
529 | .ctrlbit = (1 << 2), | ||
530 | }, { | ||
531 | .name = "mixer", | ||
532 | .devname = "s5p-mixer", | ||
533 | .enable = exynos4_clk_ip_tv_ctrl, | ||
534 | .ctrlbit = (1 << 1), | ||
535 | }, { | ||
536 | .name = "vp", | ||
537 | .devname = "s5p-mixer", | ||
538 | .enable = exynos4_clk_ip_tv_ctrl, | ||
539 | .ctrlbit = (1 << 0), | ||
540 | }, { | ||
541 | .name = "hdmi", | ||
542 | .devname = "exynos4-hdmi", | ||
543 | .enable = exynos4_clk_ip_tv_ctrl, | ||
544 | .ctrlbit = (1 << 3), | ||
545 | }, { | ||
546 | .name = "hdmiphy", | ||
547 | .devname = "exynos4-hdmi", | ||
548 | .enable = exynos4_clk_hdmiphy_ctrl, | ||
549 | .ctrlbit = (1 << 0), | ||
550 | }, { | ||
551 | .name = "dacphy", | ||
552 | .devname = "s5p-sdo", | ||
553 | .enable = exynos4_clk_dac_ctrl, | ||
554 | .ctrlbit = (1 << 0), | ||
555 | }, { | ||
556 | .name = "dma", | ||
557 | .devname = "dma-pl330.0", | ||
558 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
559 | .ctrlbit = (1 << 0), | ||
560 | }, { | ||
561 | .name = "dma", | ||
562 | .devname = "dma-pl330.1", | ||
563 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
564 | .ctrlbit = (1 << 1), | ||
565 | }, { | ||
566 | .name = "adc", | ||
567 | .enable = exynos4_clk_ip_peril_ctrl, | ||
568 | .ctrlbit = (1 << 15), | ||
569 | }, { | ||
570 | .name = "keypad", | ||
571 | .enable = exynos4_clk_ip_perir_ctrl, | ||
572 | .ctrlbit = (1 << 16), | ||
573 | }, { | ||
574 | .name = "rtc", | ||
575 | .enable = exynos4_clk_ip_perir_ctrl, | ||
576 | .ctrlbit = (1 << 15), | ||
577 | }, { | ||
578 | .name = "watchdog", | ||
579 | .parent = &clk_aclk_100.clk, | ||
580 | .enable = exynos4_clk_ip_perir_ctrl, | ||
581 | .ctrlbit = (1 << 14), | ||
582 | }, { | ||
583 | .name = "usbhost", | ||
584 | .enable = exynos4_clk_ip_fsys_ctrl , | ||
585 | .ctrlbit = (1 << 12), | ||
586 | }, { | ||
587 | .name = "otg", | ||
588 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
589 | .ctrlbit = (1 << 13), | ||
590 | }, { | ||
591 | .name = "spi", | ||
592 | .devname = "s3c64xx-spi.0", | ||
593 | .enable = exynos4_clk_ip_peril_ctrl, | ||
594 | .ctrlbit = (1 << 16), | ||
595 | }, { | ||
596 | .name = "spi", | ||
597 | .devname = "s3c64xx-spi.1", | ||
598 | .enable = exynos4_clk_ip_peril_ctrl, | ||
599 | .ctrlbit = (1 << 17), | ||
600 | }, { | ||
601 | .name = "spi", | ||
602 | .devname = "s3c64xx-spi.2", | ||
603 | .enable = exynos4_clk_ip_peril_ctrl, | ||
604 | .ctrlbit = (1 << 18), | ||
605 | }, { | ||
606 | .name = "iis", | ||
607 | .devname = "samsung-i2s.0", | ||
608 | .enable = exynos4_clk_ip_peril_ctrl, | ||
609 | .ctrlbit = (1 << 19), | ||
610 | }, { | ||
611 | .name = "iis", | ||
612 | .devname = "samsung-i2s.1", | ||
613 | .enable = exynos4_clk_ip_peril_ctrl, | ||
614 | .ctrlbit = (1 << 20), | ||
615 | }, { | ||
616 | .name = "iis", | ||
617 | .devname = "samsung-i2s.2", | ||
618 | .enable = exynos4_clk_ip_peril_ctrl, | ||
619 | .ctrlbit = (1 << 21), | ||
620 | }, { | ||
621 | .name = "ac97", | ||
622 | .devname = "samsung-ac97", | ||
623 | .enable = exynos4_clk_ip_peril_ctrl, | ||
624 | .ctrlbit = (1 << 27), | ||
625 | }, { | ||
626 | .name = "fimg2d", | ||
627 | .enable = exynos4_clk_ip_image_ctrl, | ||
628 | .ctrlbit = (1 << 0), | ||
629 | }, { | ||
630 | .name = "mfc", | ||
631 | .devname = "s5p-mfc", | ||
632 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
633 | .ctrlbit = (1 << 0), | ||
634 | }, { | ||
635 | .name = "i2c", | ||
636 | .devname = "s3c2440-i2c.0", | ||
637 | .parent = &clk_aclk_100.clk, | ||
638 | .enable = exynos4_clk_ip_peril_ctrl, | ||
639 | .ctrlbit = (1 << 6), | ||
640 | }, { | ||
641 | .name = "i2c", | ||
642 | .devname = "s3c2440-i2c.1", | ||
643 | .parent = &clk_aclk_100.clk, | ||
644 | .enable = exynos4_clk_ip_peril_ctrl, | ||
645 | .ctrlbit = (1 << 7), | ||
646 | }, { | ||
647 | .name = "i2c", | ||
648 | .devname = "s3c2440-i2c.2", | ||
649 | .parent = &clk_aclk_100.clk, | ||
650 | .enable = exynos4_clk_ip_peril_ctrl, | ||
651 | .ctrlbit = (1 << 8), | ||
652 | }, { | ||
653 | .name = "i2c", | ||
654 | .devname = "s3c2440-i2c.3", | ||
655 | .parent = &clk_aclk_100.clk, | ||
656 | .enable = exynos4_clk_ip_peril_ctrl, | ||
657 | .ctrlbit = (1 << 9), | ||
658 | }, { | ||
659 | .name = "i2c", | ||
660 | .devname = "s3c2440-i2c.4", | ||
661 | .parent = &clk_aclk_100.clk, | ||
662 | .enable = exynos4_clk_ip_peril_ctrl, | ||
663 | .ctrlbit = (1 << 10), | ||
664 | }, { | ||
665 | .name = "i2c", | ||
666 | .devname = "s3c2440-i2c.5", | ||
667 | .parent = &clk_aclk_100.clk, | ||
668 | .enable = exynos4_clk_ip_peril_ctrl, | ||
669 | .ctrlbit = (1 << 11), | ||
670 | }, { | ||
671 | .name = "i2c", | ||
672 | .devname = "s3c2440-i2c.6", | ||
673 | .parent = &clk_aclk_100.clk, | ||
674 | .enable = exynos4_clk_ip_peril_ctrl, | ||
675 | .ctrlbit = (1 << 12), | ||
676 | }, { | ||
677 | .name = "i2c", | ||
678 | .devname = "s3c2440-i2c.7", | ||
679 | .parent = &clk_aclk_100.clk, | ||
680 | .enable = exynos4_clk_ip_peril_ctrl, | ||
681 | .ctrlbit = (1 << 13), | ||
682 | }, { | ||
683 | .name = "i2c", | ||
684 | .devname = "s3c2440-hdmiphy-i2c", | ||
685 | .parent = &clk_aclk_100.clk, | ||
686 | .enable = exynos4_clk_ip_peril_ctrl, | ||
687 | .ctrlbit = (1 << 14), | ||
688 | }, { | ||
689 | .name = "SYSMMU_MDMA", | ||
690 | .enable = exynos4_clk_ip_image_ctrl, | ||
691 | .ctrlbit = (1 << 5), | ||
692 | }, { | ||
693 | .name = "SYSMMU_FIMC0", | ||
694 | .enable = exynos4_clk_ip_cam_ctrl, | ||
695 | .ctrlbit = (1 << 7), | ||
696 | }, { | ||
697 | .name = "SYSMMU_FIMC1", | ||
698 | .enable = exynos4_clk_ip_cam_ctrl, | ||
699 | .ctrlbit = (1 << 8), | ||
700 | }, { | ||
701 | .name = "SYSMMU_FIMC2", | ||
702 | .enable = exynos4_clk_ip_cam_ctrl, | ||
703 | .ctrlbit = (1 << 9), | ||
704 | }, { | ||
705 | .name = "SYSMMU_FIMC3", | ||
706 | .enable = exynos4_clk_ip_cam_ctrl, | ||
707 | .ctrlbit = (1 << 10), | ||
708 | }, { | ||
709 | .name = "SYSMMU_JPEG", | ||
710 | .enable = exynos4_clk_ip_cam_ctrl, | ||
711 | .ctrlbit = (1 << 11), | ||
712 | }, { | ||
713 | .name = "SYSMMU_FIMD0", | ||
714 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
715 | .ctrlbit = (1 << 4), | ||
716 | }, { | ||
717 | .name = "SYSMMU_FIMD1", | ||
718 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
719 | .ctrlbit = (1 << 4), | ||
720 | }, { | ||
721 | .name = "SYSMMU_PCIe", | ||
722 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
723 | .ctrlbit = (1 << 18), | ||
724 | }, { | ||
725 | .name = "SYSMMU_G2D", | ||
726 | .enable = exynos4_clk_ip_image_ctrl, | ||
727 | .ctrlbit = (1 << 3), | ||
728 | }, { | ||
729 | .name = "SYSMMU_ROTATOR", | ||
730 | .enable = exynos4_clk_ip_image_ctrl, | ||
731 | .ctrlbit = (1 << 4), | ||
732 | }, { | ||
733 | .name = "SYSMMU_TV", | ||
734 | .enable = exynos4_clk_ip_tv_ctrl, | ||
735 | .ctrlbit = (1 << 4), | ||
736 | }, { | ||
737 | .name = "SYSMMU_MFC_L", | ||
738 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
739 | .ctrlbit = (1 << 1), | ||
740 | }, { | ||
741 | .name = "SYSMMU_MFC_R", | ||
742 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
743 | .ctrlbit = (1 << 2), | ||
744 | } | ||
745 | }; | ||
746 | |||
747 | static struct clk init_clocks[] = { | ||
748 | { | ||
749 | .name = "uart", | ||
750 | .devname = "s5pv210-uart.0", | ||
751 | .enable = exynos4_clk_ip_peril_ctrl, | ||
752 | .ctrlbit = (1 << 0), | ||
753 | }, { | ||
754 | .name = "uart", | ||
755 | .devname = "s5pv210-uart.1", | ||
756 | .enable = exynos4_clk_ip_peril_ctrl, | ||
757 | .ctrlbit = (1 << 1), | ||
758 | }, { | ||
759 | .name = "uart", | ||
760 | .devname = "s5pv210-uart.2", | ||
761 | .enable = exynos4_clk_ip_peril_ctrl, | ||
762 | .ctrlbit = (1 << 2), | ||
763 | }, { | ||
764 | .name = "uart", | ||
765 | .devname = "s5pv210-uart.3", | ||
766 | .enable = exynos4_clk_ip_peril_ctrl, | ||
767 | .ctrlbit = (1 << 3), | ||
768 | }, { | ||
769 | .name = "uart", | ||
770 | .devname = "s5pv210-uart.4", | ||
771 | .enable = exynos4_clk_ip_peril_ctrl, | ||
772 | .ctrlbit = (1 << 4), | ||
773 | }, { | ||
774 | .name = "uart", | ||
775 | .devname = "s5pv210-uart.5", | ||
776 | .enable = exynos4_clk_ip_peril_ctrl, | ||
777 | .ctrlbit = (1 << 5), | ||
778 | } | ||
779 | }; | ||
780 | |||
781 | struct clk *clkset_group_list[] = { | ||
782 | [0] = &clk_ext_xtal_mux, | ||
783 | [1] = &clk_xusbxti, | ||
784 | [2] = &clk_sclk_hdmi27m, | ||
785 | [3] = &clk_sclk_usbphy0, | ||
786 | [4] = &clk_sclk_usbphy1, | ||
787 | [5] = &clk_sclk_hdmiphy, | ||
788 | [6] = &clk_mout_mpll.clk, | ||
789 | [7] = &clk_mout_epll.clk, | ||
790 | [8] = &clk_sclk_vpll.clk, | ||
791 | }; | ||
792 | |||
793 | struct clksrc_sources clkset_group = { | ||
794 | .sources = clkset_group_list, | ||
795 | .nr_sources = ARRAY_SIZE(clkset_group_list), | ||
796 | }; | ||
797 | |||
798 | static struct clk *clkset_mout_g2d0_list[] = { | ||
799 | [0] = &clk_mout_mpll.clk, | ||
800 | [1] = &clk_sclk_apll.clk, | ||
801 | }; | ||
802 | |||
803 | static struct clksrc_sources clkset_mout_g2d0 = { | ||
804 | .sources = clkset_mout_g2d0_list, | ||
805 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list), | ||
806 | }; | ||
807 | |||
808 | static struct clksrc_clk clk_mout_g2d0 = { | ||
809 | .clk = { | ||
810 | .name = "mout_g2d0", | ||
811 | }, | ||
812 | .sources = &clkset_mout_g2d0, | ||
813 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 }, | ||
814 | }; | ||
815 | |||
816 | static struct clk *clkset_mout_g2d1_list[] = { | ||
817 | [0] = &clk_mout_epll.clk, | ||
818 | [1] = &clk_sclk_vpll.clk, | ||
819 | }; | ||
820 | |||
821 | static struct clksrc_sources clkset_mout_g2d1 = { | ||
822 | .sources = clkset_mout_g2d1_list, | ||
823 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list), | ||
824 | }; | ||
825 | |||
826 | static struct clksrc_clk clk_mout_g2d1 = { | ||
827 | .clk = { | ||
828 | .name = "mout_g2d1", | ||
829 | }, | ||
830 | .sources = &clkset_mout_g2d1, | ||
831 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 }, | ||
832 | }; | ||
833 | |||
834 | static struct clk *clkset_mout_g2d_list[] = { | ||
835 | [0] = &clk_mout_g2d0.clk, | ||
836 | [1] = &clk_mout_g2d1.clk, | ||
837 | }; | ||
838 | |||
839 | static struct clksrc_sources clkset_mout_g2d = { | ||
840 | .sources = clkset_mout_g2d_list, | ||
841 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list), | ||
842 | }; | ||
843 | |||
844 | static struct clk *clkset_mout_mfc0_list[] = { | ||
845 | [0] = &clk_mout_mpll.clk, | ||
846 | [1] = &clk_sclk_apll.clk, | ||
847 | }; | ||
848 | |||
849 | static struct clksrc_sources clkset_mout_mfc0 = { | ||
850 | .sources = clkset_mout_mfc0_list, | ||
851 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list), | ||
852 | }; | ||
853 | |||
854 | static struct clksrc_clk clk_mout_mfc0 = { | ||
855 | .clk = { | ||
856 | .name = "mout_mfc0", | ||
857 | }, | ||
858 | .sources = &clkset_mout_mfc0, | ||
859 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 }, | ||
860 | }; | ||
861 | |||
862 | static struct clk *clkset_mout_mfc1_list[] = { | ||
863 | [0] = &clk_mout_epll.clk, | ||
864 | [1] = &clk_sclk_vpll.clk, | ||
865 | }; | ||
866 | |||
867 | static struct clksrc_sources clkset_mout_mfc1 = { | ||
868 | .sources = clkset_mout_mfc1_list, | ||
869 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list), | ||
870 | }; | ||
871 | |||
872 | static struct clksrc_clk clk_mout_mfc1 = { | ||
873 | .clk = { | ||
874 | .name = "mout_mfc1", | ||
875 | }, | ||
876 | .sources = &clkset_mout_mfc1, | ||
877 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 }, | ||
878 | }; | ||
879 | |||
880 | static struct clk *clkset_mout_mfc_list[] = { | ||
881 | [0] = &clk_mout_mfc0.clk, | ||
882 | [1] = &clk_mout_mfc1.clk, | ||
883 | }; | ||
884 | |||
885 | static struct clksrc_sources clkset_mout_mfc = { | ||
886 | .sources = clkset_mout_mfc_list, | ||
887 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list), | ||
888 | }; | ||
889 | |||
890 | static struct clk *clkset_sclk_dac_list[] = { | ||
891 | [0] = &clk_sclk_vpll.clk, | ||
892 | [1] = &clk_sclk_hdmiphy, | ||
893 | }; | ||
894 | |||
895 | static struct clksrc_sources clkset_sclk_dac = { | ||
896 | .sources = clkset_sclk_dac_list, | ||
897 | .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list), | ||
898 | }; | ||
899 | |||
900 | static struct clksrc_clk clk_sclk_dac = { | ||
901 | .clk = { | ||
902 | .name = "sclk_dac", | ||
903 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
904 | .ctrlbit = (1 << 8), | ||
905 | }, | ||
906 | .sources = &clkset_sclk_dac, | ||
907 | .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 }, | ||
908 | }; | ||
909 | |||
910 | static struct clksrc_clk clk_sclk_pixel = { | ||
911 | .clk = { | ||
912 | .name = "sclk_pixel", | ||
913 | .parent = &clk_sclk_vpll.clk, | ||
914 | }, | ||
915 | .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 }, | ||
916 | }; | ||
917 | |||
918 | static struct clk *clkset_sclk_hdmi_list[] = { | ||
919 | [0] = &clk_sclk_pixel.clk, | ||
920 | [1] = &clk_sclk_hdmiphy, | ||
921 | }; | ||
922 | |||
923 | static struct clksrc_sources clkset_sclk_hdmi = { | ||
924 | .sources = clkset_sclk_hdmi_list, | ||
925 | .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list), | ||
926 | }; | ||
927 | |||
928 | static struct clksrc_clk clk_sclk_hdmi = { | ||
929 | .clk = { | ||
930 | .name = "sclk_hdmi", | ||
931 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
932 | .ctrlbit = (1 << 0), | ||
933 | }, | ||
934 | .sources = &clkset_sclk_hdmi, | ||
935 | .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 0, .size = 1 }, | ||
936 | }; | ||
937 | |||
938 | static struct clk *clkset_sclk_mixer_list[] = { | ||
939 | [0] = &clk_sclk_dac.clk, | ||
940 | [1] = &clk_sclk_hdmi.clk, | ||
941 | }; | ||
942 | |||
943 | static struct clksrc_sources clkset_sclk_mixer = { | ||
944 | .sources = clkset_sclk_mixer_list, | ||
945 | .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list), | ||
946 | }; | ||
947 | |||
948 | static struct clksrc_clk clk_sclk_mixer = { | ||
949 | .clk = { | ||
950 | .name = "sclk_mixer", | ||
951 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
952 | .ctrlbit = (1 << 4), | ||
953 | }, | ||
954 | .sources = &clkset_sclk_mixer, | ||
955 | .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 4, .size = 1 }, | ||
956 | }; | ||
957 | |||
958 | static struct clksrc_clk *sclk_tv[] = { | ||
959 | &clk_sclk_dac, | ||
960 | &clk_sclk_pixel, | ||
961 | &clk_sclk_hdmi, | ||
962 | &clk_sclk_mixer, | ||
963 | }; | ||
964 | |||
965 | static struct clksrc_clk clk_dout_mmc0 = { | ||
966 | .clk = { | ||
967 | .name = "dout_mmc0", | ||
968 | }, | ||
969 | .sources = &clkset_group, | ||
970 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 }, | ||
971 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 }, | ||
972 | }; | ||
973 | |||
974 | static struct clksrc_clk clk_dout_mmc1 = { | ||
975 | .clk = { | ||
976 | .name = "dout_mmc1", | ||
977 | }, | ||
978 | .sources = &clkset_group, | ||
979 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 }, | ||
980 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 }, | ||
981 | }; | ||
982 | |||
983 | static struct clksrc_clk clk_dout_mmc2 = { | ||
984 | .clk = { | ||
985 | .name = "dout_mmc2", | ||
986 | }, | ||
987 | .sources = &clkset_group, | ||
988 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 }, | ||
989 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 }, | ||
990 | }; | ||
991 | |||
992 | static struct clksrc_clk clk_dout_mmc3 = { | ||
993 | .clk = { | ||
994 | .name = "dout_mmc3", | ||
995 | }, | ||
996 | .sources = &clkset_group, | ||
997 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 }, | ||
998 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 }, | ||
999 | }; | ||
1000 | |||
1001 | static struct clksrc_clk clk_dout_mmc4 = { | ||
1002 | .clk = { | ||
1003 | .name = "dout_mmc4", | ||
1004 | }, | ||
1005 | .sources = &clkset_group, | ||
1006 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 }, | ||
1007 | .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 }, | ||
1008 | }; | ||
1009 | |||
1010 | static struct clksrc_clk clksrcs[] = { | ||
1011 | { | ||
1012 | .clk = { | ||
1013 | .name = "uclk1", | ||
1014 | .devname = "s5pv210-uart.0", | ||
1015 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1016 | .ctrlbit = (1 << 0), | ||
1017 | }, | ||
1018 | .sources = &clkset_group, | ||
1019 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 }, | ||
1020 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 }, | ||
1021 | }, { | ||
1022 | .clk = { | ||
1023 | .name = "uclk1", | ||
1024 | .devname = "s5pv210-uart.1", | ||
1025 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1026 | .ctrlbit = (1 << 4), | ||
1027 | }, | ||
1028 | .sources = &clkset_group, | ||
1029 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 }, | ||
1030 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 }, | ||
1031 | }, { | ||
1032 | .clk = { | ||
1033 | .name = "uclk1", | ||
1034 | .devname = "s5pv210-uart.2", | ||
1035 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1036 | .ctrlbit = (1 << 8), | ||
1037 | }, | ||
1038 | .sources = &clkset_group, | ||
1039 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 }, | ||
1040 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 }, | ||
1041 | }, { | ||
1042 | .clk = { | ||
1043 | .name = "uclk1", | ||
1044 | .devname = "s5pv210-uart.3", | ||
1045 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1046 | .ctrlbit = (1 << 12), | ||
1047 | }, | ||
1048 | .sources = &clkset_group, | ||
1049 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 }, | ||
1050 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 }, | ||
1051 | }, { | ||
1052 | .clk = { | ||
1053 | .name = "sclk_pwm", | ||
1054 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1055 | .ctrlbit = (1 << 24), | ||
1056 | }, | ||
1057 | .sources = &clkset_group, | ||
1058 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 }, | ||
1059 | .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 }, | ||
1060 | }, { | ||
1061 | .clk = { | ||
1062 | .name = "sclk_csis", | ||
1063 | .devname = "s5p-mipi-csis.0", | ||
1064 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1065 | .ctrlbit = (1 << 24), | ||
1066 | }, | ||
1067 | .sources = &clkset_group, | ||
1068 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 }, | ||
1069 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 }, | ||
1070 | }, { | ||
1071 | .clk = { | ||
1072 | .name = "sclk_csis", | ||
1073 | .devname = "s5p-mipi-csis.1", | ||
1074 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1075 | .ctrlbit = (1 << 28), | ||
1076 | }, | ||
1077 | .sources = &clkset_group, | ||
1078 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 }, | ||
1079 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 }, | ||
1080 | }, { | ||
1081 | .clk = { | ||
1082 | .name = "sclk_cam0", | ||
1083 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1084 | .ctrlbit = (1 << 16), | ||
1085 | }, | ||
1086 | .sources = &clkset_group, | ||
1087 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 }, | ||
1088 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 }, | ||
1089 | }, { | ||
1090 | .clk = { | ||
1091 | .name = "sclk_cam1", | ||
1092 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1093 | .ctrlbit = (1 << 20), | ||
1094 | }, | ||
1095 | .sources = &clkset_group, | ||
1096 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 }, | ||
1097 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 }, | ||
1098 | }, { | ||
1099 | .clk = { | ||
1100 | .name = "sclk_fimc", | ||
1101 | .devname = "exynos4-fimc.0", | ||
1102 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1103 | .ctrlbit = (1 << 0), | ||
1104 | }, | ||
1105 | .sources = &clkset_group, | ||
1106 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 }, | ||
1107 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 }, | ||
1108 | }, { | ||
1109 | .clk = { | ||
1110 | .name = "sclk_fimc", | ||
1111 | .devname = "exynos4-fimc.1", | ||
1112 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1113 | .ctrlbit = (1 << 4), | ||
1114 | }, | ||
1115 | .sources = &clkset_group, | ||
1116 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 }, | ||
1117 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 }, | ||
1118 | }, { | ||
1119 | .clk = { | ||
1120 | .name = "sclk_fimc", | ||
1121 | .devname = "exynos4-fimc.2", | ||
1122 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1123 | .ctrlbit = (1 << 8), | ||
1124 | }, | ||
1125 | .sources = &clkset_group, | ||
1126 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 }, | ||
1127 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 }, | ||
1128 | }, { | ||
1129 | .clk = { | ||
1130 | .name = "sclk_fimc", | ||
1131 | .devname = "exynos4-fimc.3", | ||
1132 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1133 | .ctrlbit = (1 << 12), | ||
1134 | }, | ||
1135 | .sources = &clkset_group, | ||
1136 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 }, | ||
1137 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 }, | ||
1138 | }, { | ||
1139 | .clk = { | ||
1140 | .name = "sclk_fimd", | ||
1141 | .devname = "exynos4-fb.0", | ||
1142 | .enable = exynos4_clksrc_mask_lcd0_ctrl, | ||
1143 | .ctrlbit = (1 << 0), | ||
1144 | }, | ||
1145 | .sources = &clkset_group, | ||
1146 | .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 }, | ||
1147 | .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 }, | ||
1148 | }, { | ||
1149 | .clk = { | ||
1150 | .name = "sclk_spi", | ||
1151 | .devname = "s3c64xx-spi.0", | ||
1152 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1153 | .ctrlbit = (1 << 16), | ||
1154 | }, | ||
1155 | .sources = &clkset_group, | ||
1156 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 }, | ||
1157 | .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 }, | ||
1158 | }, { | ||
1159 | .clk = { | ||
1160 | .name = "sclk_spi", | ||
1161 | .devname = "s3c64xx-spi.1", | ||
1162 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1163 | .ctrlbit = (1 << 20), | ||
1164 | }, | ||
1165 | .sources = &clkset_group, | ||
1166 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 }, | ||
1167 | .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 }, | ||
1168 | }, { | ||
1169 | .clk = { | ||
1170 | .name = "sclk_spi", | ||
1171 | .devname = "s3c64xx-spi.2", | ||
1172 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1173 | .ctrlbit = (1 << 24), | ||
1174 | }, | ||
1175 | .sources = &clkset_group, | ||
1176 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 }, | ||
1177 | .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 }, | ||
1178 | }, { | ||
1179 | .clk = { | ||
1180 | .name = "sclk_fimg2d", | ||
1181 | }, | ||
1182 | .sources = &clkset_mout_g2d, | ||
1183 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 }, | ||
1184 | .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 }, | ||
1185 | }, { | ||
1186 | .clk = { | ||
1187 | .name = "sclk_mfc", | ||
1188 | .devname = "s5p-mfc", | ||
1189 | }, | ||
1190 | .sources = &clkset_mout_mfc, | ||
1191 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 }, | ||
1192 | .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 }, | ||
1193 | }, { | ||
1194 | .clk = { | ||
1195 | .name = "sclk_mmc", | ||
1196 | .devname = "s3c-sdhci.0", | ||
1197 | .parent = &clk_dout_mmc0.clk, | ||
1198 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1199 | .ctrlbit = (1 << 0), | ||
1200 | }, | ||
1201 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 }, | ||
1202 | }, { | ||
1203 | .clk = { | ||
1204 | .name = "sclk_mmc", | ||
1205 | .devname = "s3c-sdhci.1", | ||
1206 | .parent = &clk_dout_mmc1.clk, | ||
1207 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1208 | .ctrlbit = (1 << 4), | ||
1209 | }, | ||
1210 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 }, | ||
1211 | }, { | ||
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 | .clk = { | ||
1222 | .name = "sclk_mmc", | ||
1223 | .devname = "s3c-sdhci.3", | ||
1224 | .parent = &clk_dout_mmc3.clk, | ||
1225 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1226 | .ctrlbit = (1 << 12), | ||
1227 | }, | ||
1228 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 }, | ||
1229 | }, { | ||
1230 | .clk = { | ||
1231 | .name = "sclk_dwmmc", | ||
1232 | .parent = &clk_dout_mmc4.clk, | ||
1233 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1234 | .ctrlbit = (1 << 16), | ||
1235 | }, | ||
1236 | .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 }, | ||
1237 | } | ||
1238 | }; | ||
1239 | |||
1240 | /* Clock initialization code */ | ||
1241 | static struct clksrc_clk *sysclks[] = { | ||
1242 | &clk_mout_apll, | ||
1243 | &clk_sclk_apll, | ||
1244 | &clk_mout_epll, | ||
1245 | &clk_mout_mpll, | ||
1246 | &clk_moutcore, | ||
1247 | &clk_coreclk, | ||
1248 | &clk_armclk, | ||
1249 | &clk_aclk_corem0, | ||
1250 | &clk_aclk_cores, | ||
1251 | &clk_aclk_corem1, | ||
1252 | &clk_periphclk, | ||
1253 | &clk_mout_corebus, | ||
1254 | &clk_sclk_dmc, | ||
1255 | &clk_aclk_cored, | ||
1256 | &clk_aclk_corep, | ||
1257 | &clk_aclk_acp, | ||
1258 | &clk_pclk_acp, | ||
1259 | &clk_vpllsrc, | ||
1260 | &clk_sclk_vpll, | ||
1261 | &clk_aclk_200, | ||
1262 | &clk_aclk_100, | ||
1263 | &clk_aclk_160, | ||
1264 | &clk_aclk_133, | ||
1265 | &clk_dout_mmc0, | ||
1266 | &clk_dout_mmc1, | ||
1267 | &clk_dout_mmc2, | ||
1268 | &clk_dout_mmc3, | ||
1269 | &clk_dout_mmc4, | ||
1270 | &clk_mout_mfc0, | ||
1271 | &clk_mout_mfc1, | ||
1272 | }; | ||
1273 | |||
1274 | static int xtal_rate; | ||
1275 | |||
1276 | static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) | ||
1277 | { | ||
1278 | if (soc_is_exynos4210()) | ||
1279 | return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), | ||
1280 | pll_4508); | ||
1281 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
1282 | return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0)); | ||
1283 | else | ||
1284 | return 0; | ||
1285 | } | ||
1286 | |||
1287 | static struct clk_ops exynos4_fout_apll_ops = { | ||
1288 | .get_rate = exynos4_fout_apll_get_rate, | ||
1289 | }; | ||
1290 | |||
1291 | static u32 vpll_div[][8] = { | ||
1292 | { 54000000, 3, 53, 3, 1024, 0, 17, 0 }, | ||
1293 | { 108000000, 3, 53, 2, 1024, 0, 17, 0 }, | ||
1294 | }; | ||
1295 | |||
1296 | static unsigned long exynos4_vpll_get_rate(struct clk *clk) | ||
1297 | { | ||
1298 | return clk->rate; | ||
1299 | } | ||
1300 | |||
1301 | static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate) | ||
1302 | { | ||
1303 | unsigned int vpll_con0, vpll_con1 = 0; | ||
1304 | unsigned int i; | ||
1305 | |||
1306 | /* Return if nothing changed */ | ||
1307 | if (clk->rate == rate) | ||
1308 | return 0; | ||
1309 | |||
1310 | vpll_con0 = __raw_readl(S5P_VPLL_CON0); | ||
1311 | vpll_con0 &= ~(0x1 << 27 | \ | ||
1312 | PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \ | ||
1313 | PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \ | ||
1314 | PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); | ||
1315 | |||
1316 | vpll_con1 = __raw_readl(S5P_VPLL_CON1); | ||
1317 | vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \ | ||
1318 | PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \ | ||
1319 | PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT); | ||
1320 | |||
1321 | for (i = 0; i < ARRAY_SIZE(vpll_div); i++) { | ||
1322 | if (vpll_div[i][0] == rate) { | ||
1323 | vpll_con0 |= vpll_div[i][1] << PLL46XX_PDIV_SHIFT; | ||
1324 | vpll_con0 |= vpll_div[i][2] << PLL46XX_MDIV_SHIFT; | ||
1325 | vpll_con0 |= vpll_div[i][3] << PLL46XX_SDIV_SHIFT; | ||
1326 | vpll_con1 |= vpll_div[i][4] << PLL46XX_KDIV_SHIFT; | ||
1327 | vpll_con1 |= vpll_div[i][5] << PLL46XX_MFR_SHIFT; | ||
1328 | vpll_con1 |= vpll_div[i][6] << PLL46XX_MRR_SHIFT; | ||
1329 | vpll_con0 |= vpll_div[i][7] << 27; | ||
1330 | break; | ||
1331 | } | ||
1332 | } | ||
1333 | |||
1334 | if (i == ARRAY_SIZE(vpll_div)) { | ||
1335 | printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n", | ||
1336 | __func__); | ||
1337 | return -EINVAL; | ||
1338 | } | ||
1339 | |||
1340 | __raw_writel(vpll_con0, S5P_VPLL_CON0); | ||
1341 | __raw_writel(vpll_con1, S5P_VPLL_CON1); | ||
1342 | |||
1343 | /* Wait for VPLL lock */ | ||
1344 | while (!(__raw_readl(S5P_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT))) | ||
1345 | continue; | ||
1346 | |||
1347 | clk->rate = rate; | ||
1348 | return 0; | ||
1349 | } | ||
1350 | |||
1351 | static struct clk_ops exynos4_vpll_ops = { | ||
1352 | .get_rate = exynos4_vpll_get_rate, | ||
1353 | .set_rate = exynos4_vpll_set_rate, | ||
1354 | }; | ||
1355 | |||
1356 | void __init_or_cpufreq exynos4_setup_clocks(void) | ||
1357 | { | ||
1358 | struct clk *xtal_clk; | ||
1359 | unsigned long apll = 0; | ||
1360 | unsigned long mpll = 0; | ||
1361 | unsigned long epll = 0; | ||
1362 | unsigned long vpll = 0; | ||
1363 | unsigned long vpllsrc; | ||
1364 | unsigned long xtal; | ||
1365 | unsigned long armclk; | ||
1366 | unsigned long sclk_dmc; | ||
1367 | unsigned long aclk_200; | ||
1368 | unsigned long aclk_100; | ||
1369 | unsigned long aclk_160; | ||
1370 | unsigned long aclk_133; | ||
1371 | unsigned int ptr; | ||
1372 | |||
1373 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); | ||
1374 | |||
1375 | xtal_clk = clk_get(NULL, "xtal"); | ||
1376 | BUG_ON(IS_ERR(xtal_clk)); | ||
1377 | |||
1378 | xtal = clk_get_rate(xtal_clk); | ||
1379 | |||
1380 | xtal_rate = xtal; | ||
1381 | |||
1382 | clk_put(xtal_clk); | ||
1383 | |||
1384 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | ||
1385 | |||
1386 | if (soc_is_exynos4210()) { | ||
1387 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), | ||
1388 | pll_4508); | ||
1389 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), | ||
1390 | pll_4508); | ||
1391 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), | ||
1392 | __raw_readl(S5P_EPLL_CON1), pll_4600); | ||
1393 | |||
1394 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | ||
1395 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | ||
1396 | __raw_readl(S5P_VPLL_CON1), pll_4650c); | ||
1397 | } else if (soc_is_exynos4212() || soc_is_exynos4412()) { | ||
1398 | apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0)); | ||
1399 | mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0)); | ||
1400 | epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0), | ||
1401 | __raw_readl(S5P_EPLL_CON1)); | ||
1402 | |||
1403 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | ||
1404 | vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | ||
1405 | __raw_readl(S5P_VPLL_CON1)); | ||
1406 | } else { | ||
1407 | /* nothing */ | ||
1408 | } | ||
1409 | |||
1410 | clk_fout_apll.ops = &exynos4_fout_apll_ops; | ||
1411 | clk_fout_mpll.rate = mpll; | ||
1412 | clk_fout_epll.rate = epll; | ||
1413 | clk_fout_vpll.ops = &exynos4_vpll_ops; | ||
1414 | clk_fout_vpll.rate = vpll; | ||
1415 | |||
1416 | printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld", | ||
1417 | apll, mpll, epll, vpll); | ||
1418 | |||
1419 | armclk = clk_get_rate(&clk_armclk.clk); | ||
1420 | sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk); | ||
1421 | |||
1422 | aclk_200 = clk_get_rate(&clk_aclk_200.clk); | ||
1423 | aclk_100 = clk_get_rate(&clk_aclk_100.clk); | ||
1424 | aclk_160 = clk_get_rate(&clk_aclk_160.clk); | ||
1425 | aclk_133 = clk_get_rate(&clk_aclk_133.clk); | ||
1426 | |||
1427 | printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n" | ||
1428 | "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n", | ||
1429 | armclk, sclk_dmc, aclk_200, | ||
1430 | aclk_100, aclk_160, aclk_133); | ||
1431 | |||
1432 | clk_f.rate = armclk; | ||
1433 | clk_h.rate = sclk_dmc; | ||
1434 | clk_p.rate = aclk_100; | ||
1435 | |||
1436 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
1437 | s3c_set_clksrc(&clksrcs[ptr], true); | ||
1438 | } | ||
1439 | |||
1440 | static struct clk *clks[] __initdata = { | ||
1441 | &clk_sclk_hdmi27m, | ||
1442 | &clk_sclk_hdmiphy, | ||
1443 | &clk_sclk_usbphy0, | ||
1444 | &clk_sclk_usbphy1, | ||
1445 | }; | ||
1446 | |||
1447 | #ifdef CONFIG_PM_SLEEP | ||
1448 | static int exynos4_clock_suspend(void) | ||
1449 | { | ||
1450 | s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1451 | return 0; | ||
1452 | } | ||
1453 | |||
1454 | static void exynos4_clock_resume(void) | ||
1455 | { | ||
1456 | s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1457 | } | ||
1458 | |||
1459 | #else | ||
1460 | #define exynos4_clock_suspend NULL | ||
1461 | #define exynos4_clock_resume NULL | ||
1462 | #endif | ||
1463 | |||
1464 | struct syscore_ops exynos4_clock_syscore_ops = { | ||
1465 | .suspend = exynos4_clock_suspend, | ||
1466 | .resume = exynos4_clock_resume, | ||
1467 | }; | ||
1468 | |||
1469 | void __init exynos4_register_clocks(void) | ||
1470 | { | ||
1471 | int ptr; | ||
1472 | |||
1473 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
1474 | |||
1475 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
1476 | s3c_register_clksrc(sysclks[ptr], 1); | ||
1477 | |||
1478 | for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++) | ||
1479 | s3c_register_clksrc(sclk_tv[ptr], 1); | ||
1480 | |||
1481 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
1482 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
1483 | |||
1484 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
1485 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
1486 | |||
1487 | register_syscore_ops(&exynos4_clock_syscore_ops); | ||
1488 | s3c24xx_register_clock(&dummy_apb_pclk); | ||
1489 | |||
1490 | s3c_pwmclk_init(); | ||
1491 | } | ||
diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c new file mode 100644 index 000000000000..90ec247f3b37 --- /dev/null +++ b/arch/arm/mach-exynos/cpu.c | |||
@@ -0,0 +1,298 @@ | |||
1 | /* linux/arch/arm/mach-exynos/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/sched.h> | ||
12 | #include <linux/sysdev.h> | ||
13 | |||
14 | #include <asm/mach/map.h> | ||
15 | #include <asm/mach/irq.h> | ||
16 | |||
17 | #include <asm/proc-fns.h> | ||
18 | #include <asm/hardware/cache-l2x0.h> | ||
19 | #include <asm/hardware/gic.h> | ||
20 | |||
21 | #include <plat/cpu.h> | ||
22 | #include <plat/clock.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/exynos4.h> | ||
25 | #include <plat/adc-core.h> | ||
26 | #include <plat/sdhci.h> | ||
27 | #include <plat/fb-core.h> | ||
28 | #include <plat/fimc-core.h> | ||
29 | #include <plat/iic-core.h> | ||
30 | #include <plat/reset.h> | ||
31 | #include <plat/tv-core.h> | ||
32 | |||
33 | #include <mach/regs-irq.h> | ||
34 | #include <mach/regs-pmu.h> | ||
35 | |||
36 | unsigned int gic_bank_offset __read_mostly; | ||
37 | |||
38 | extern int combiner_init(unsigned int combiner_nr, void __iomem *base, | ||
39 | unsigned int irq_start); | ||
40 | extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq); | ||
41 | |||
42 | /* Initial IO mappings */ | ||
43 | static struct map_desc exynos_iodesc[] __initdata = { | ||
44 | { | ||
45 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
46 | .pfn = __phys_to_pfn(EXYNOS_PA_SYSTIMER), | ||
47 | .length = SZ_4K, | ||
48 | .type = MT_DEVICE, | ||
49 | }, { | ||
50 | .virtual = (unsigned long)S5P_VA_PMU, | ||
51 | .pfn = __phys_to_pfn(EXYNOS_PA_PMU), | ||
52 | .length = SZ_64K, | ||
53 | .type = MT_DEVICE, | ||
54 | }, { | ||
55 | .virtual = (unsigned long)S5P_VA_COMBINER_BASE, | ||
56 | .pfn = __phys_to_pfn(EXYNOS_PA_COMBINER), | ||
57 | .length = SZ_4K, | ||
58 | .type = MT_DEVICE, | ||
59 | }, { | ||
60 | .virtual = (unsigned long)S5P_VA_GIC_CPU, | ||
61 | .pfn = __phys_to_pfn(EXYNOS_PA_GIC_CPU), | ||
62 | .length = SZ_64K, | ||
63 | .type = MT_DEVICE, | ||
64 | }, { | ||
65 | .virtual = (unsigned long)S5P_VA_GIC_DIST, | ||
66 | .pfn = __phys_to_pfn(EXYNOS_PA_GIC_DIST), | ||
67 | .length = SZ_64K, | ||
68 | .type = MT_DEVICE, | ||
69 | }, { | ||
70 | .virtual = (unsigned long)S3C_VA_UART, | ||
71 | .pfn = __phys_to_pfn(S3C_PA_UART), | ||
72 | .length = SZ_512K, | ||
73 | .type = MT_DEVICE, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static struct map_desc exynos4_iodesc[] __initdata = { | ||
78 | { | ||
79 | .virtual = (unsigned long)S5P_VA_CMU, | ||
80 | .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), | ||
81 | .length = SZ_128K, | ||
82 | .type = MT_DEVICE, | ||
83 | }, { | ||
84 | .virtual = (unsigned long)S5P_VA_COREPERI_BASE, | ||
85 | .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI), | ||
86 | .length = SZ_8K, | ||
87 | .type = MT_DEVICE, | ||
88 | }, { | ||
89 | .virtual = (unsigned long)S5P_VA_L2CC, | ||
90 | .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC), | ||
91 | .length = SZ_4K, | ||
92 | .type = MT_DEVICE, | ||
93 | }, { | ||
94 | .virtual = (unsigned long)S5P_VA_GPIO1, | ||
95 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO1), | ||
96 | .length = SZ_4K, | ||
97 | .type = MT_DEVICE, | ||
98 | }, { | ||
99 | .virtual = (unsigned long)S5P_VA_GPIO2, | ||
100 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO2), | ||
101 | .length = SZ_4K, | ||
102 | .type = MT_DEVICE, | ||
103 | }, { | ||
104 | .virtual = (unsigned long)S5P_VA_GPIO3, | ||
105 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO3), | ||
106 | .length = SZ_256, | ||
107 | .type = MT_DEVICE, | ||
108 | }, { | ||
109 | .virtual = (unsigned long)S5P_VA_DMC0, | ||
110 | .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), | ||
111 | .length = SZ_4K, | ||
112 | .type = MT_DEVICE, | ||
113 | }, { | ||
114 | .virtual = (unsigned long)S5P_VA_SROMC, | ||
115 | .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC), | ||
116 | .length = SZ_4K, | ||
117 | .type = MT_DEVICE, | ||
118 | }, { | ||
119 | .virtual = (unsigned long)S3C_VA_USB_HSPHY, | ||
120 | .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY), | ||
121 | .length = SZ_4K, | ||
122 | .type = MT_DEVICE, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | static struct map_desc exynos4_iodesc0[] __initdata = { | ||
127 | { | ||
128 | .virtual = (unsigned long)S5P_VA_SYSRAM, | ||
129 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM0), | ||
130 | .length = SZ_4K, | ||
131 | .type = MT_DEVICE, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | static struct map_desc exynos4_iodesc1[] __initdata = { | ||
136 | { | ||
137 | .virtual = (unsigned long)S5P_VA_SYSRAM, | ||
138 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM1), | ||
139 | .length = SZ_4K, | ||
140 | .type = MT_DEVICE, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static void exynos_idle(void) | ||
145 | { | ||
146 | if (!need_resched()) | ||
147 | cpu_do_idle(); | ||
148 | |||
149 | local_irq_enable(); | ||
150 | } | ||
151 | |||
152 | static void exynos4_sw_reset(void) | ||
153 | { | ||
154 | __raw_writel(0x1, S5P_SWRESET); | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * exynos_map_io | ||
159 | * | ||
160 | * register the standard cpu IO areas | ||
161 | */ | ||
162 | void __init exynos4_map_io(void) | ||
163 | { | ||
164 | iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc)); | ||
165 | iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); | ||
166 | |||
167 | if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0) | ||
168 | iotable_init(exynos4_iodesc0, ARRAY_SIZE(exynos4_iodesc0)); | ||
169 | else | ||
170 | iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1)); | ||
171 | |||
172 | /* initialize device information early */ | ||
173 | exynos4_default_sdhci0(); | ||
174 | exynos4_default_sdhci1(); | ||
175 | exynos4_default_sdhci2(); | ||
176 | exynos4_default_sdhci3(); | ||
177 | |||
178 | s3c_adc_setname("samsung-adc-v3"); | ||
179 | |||
180 | s3c_fimc_setname(0, "exynos4-fimc"); | ||
181 | s3c_fimc_setname(1, "exynos4-fimc"); | ||
182 | s3c_fimc_setname(2, "exynos4-fimc"); | ||
183 | s3c_fimc_setname(3, "exynos4-fimc"); | ||
184 | |||
185 | /* The I2C bus controllers are directly compatible with s3c2440 */ | ||
186 | s3c_i2c0_setname("s3c2440-i2c"); | ||
187 | s3c_i2c1_setname("s3c2440-i2c"); | ||
188 | s3c_i2c2_setname("s3c2440-i2c"); | ||
189 | |||
190 | s5p_fb_setname(0, "exynos4-fb"); | ||
191 | s5p_hdmi_setname("exynos4-hdmi"); | ||
192 | } | ||
193 | |||
194 | void __init exynos4_init_clocks(int xtal) | ||
195 | { | ||
196 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
197 | |||
198 | s3c24xx_register_baseclocks(xtal); | ||
199 | s5p_register_clocks(xtal); | ||
200 | |||
201 | if (soc_is_exynos4210()) | ||
202 | exynos4210_register_clocks(); | ||
203 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
204 | exynos4212_register_clocks(); | ||
205 | |||
206 | exynos4_register_clocks(); | ||
207 | exynos4_setup_clocks(); | ||
208 | } | ||
209 | |||
210 | static void exynos4_gic_irq_fix_base(struct irq_data *d) | ||
211 | { | ||
212 | struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d); | ||
213 | |||
214 | gic_data->cpu_base = S5P_VA_GIC_CPU + | ||
215 | (gic_bank_offset * smp_processor_id()); | ||
216 | |||
217 | gic_data->dist_base = S5P_VA_GIC_DIST + | ||
218 | (gic_bank_offset * smp_processor_id()); | ||
219 | } | ||
220 | |||
221 | void __init exynos4_init_irq(void) | ||
222 | { | ||
223 | int irq; | ||
224 | |||
225 | gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000; | ||
226 | |||
227 | gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); | ||
228 | gic_arch_extn.irq_eoi = exynos4_gic_irq_fix_base; | ||
229 | gic_arch_extn.irq_unmask = exynos4_gic_irq_fix_base; | ||
230 | gic_arch_extn.irq_mask = exynos4_gic_irq_fix_base; | ||
231 | |||
232 | for (irq = 0; irq < MAX_COMBINER_NR; irq++) { | ||
233 | |||
234 | combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), | ||
235 | COMBINER_IRQ(irq, 0)); | ||
236 | combiner_cascade_irq(irq, IRQ_SPI(irq)); | ||
237 | } | ||
238 | |||
239 | /* The parameters of s5p_init_irq() are for VIC init. | ||
240 | * Theses parameters should be NULL and 0 because EXYNOS4 | ||
241 | * uses GIC instead of VIC. | ||
242 | */ | ||
243 | s5p_init_irq(NULL, 0); | ||
244 | } | ||
245 | |||
246 | struct sysdev_class exynos4_sysclass = { | ||
247 | .name = "exynos4-core", | ||
248 | }; | ||
249 | |||
250 | static struct sys_device exynos4_sysdev = { | ||
251 | .cls = &exynos4_sysclass, | ||
252 | }; | ||
253 | |||
254 | static int __init exynos4_core_init(void) | ||
255 | { | ||
256 | return sysdev_class_register(&exynos4_sysclass); | ||
257 | } | ||
258 | core_initcall(exynos4_core_init); | ||
259 | |||
260 | #ifdef CONFIG_CACHE_L2X0 | ||
261 | static int __init exynos4_l2x0_cache_init(void) | ||
262 | { | ||
263 | /* TAG, Data Latency Control: 2cycle */ | ||
264 | __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL); | ||
265 | |||
266 | if (soc_is_exynos4210()) | ||
267 | __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL); | ||
268 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
269 | __raw_writel(0x120, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL); | ||
270 | |||
271 | /* L2X0 Prefetch Control */ | ||
272 | __raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL); | ||
273 | |||
274 | /* L2X0 Power Control */ | ||
275 | __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, | ||
276 | S5P_VA_L2CC + L2X0_POWER_CTRL); | ||
277 | |||
278 | l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff); | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | early_initcall(exynos4_l2x0_cache_init); | ||
284 | #endif | ||
285 | |||
286 | int __init exynos_init(void) | ||
287 | { | ||
288 | printk(KERN_INFO "EXYNOS: Initializing architecture\n"); | ||
289 | |||
290 | /* set idle function */ | ||
291 | pm_idle = exynos_idle; | ||
292 | |||
293 | /* set sw_reset function */ | ||
294 | if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412()) | ||
295 | s5p_reset_hook = exynos4_sw_reset; | ||
296 | |||
297 | return sysdev_register(&exynos4_sysdev); | ||
298 | } | ||
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c new file mode 100644 index 000000000000..bf7e96f2793a --- /dev/null +++ b/arch/arm/mach-exynos/cpuidle.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/cpuidle.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/cpuidle.h> | ||
14 | #include <linux/io.h> | ||
15 | |||
16 | #include <asm/proc-fns.h> | ||
17 | |||
18 | static int exynos4_enter_idle(struct cpuidle_device *dev, | ||
19 | struct cpuidle_state *state); | ||
20 | |||
21 | static struct cpuidle_state exynos4_cpuidle_set[] = { | ||
22 | [0] = { | ||
23 | .enter = exynos4_enter_idle, | ||
24 | .exit_latency = 1, | ||
25 | .target_residency = 100000, | ||
26 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
27 | .name = "IDLE", | ||
28 | .desc = "ARM clock gating(WFI)", | ||
29 | }, | ||
30 | }; | ||
31 | |||
32 | static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); | ||
33 | |||
34 | static struct cpuidle_driver exynos4_idle_driver = { | ||
35 | .name = "exynos4_idle", | ||
36 | .owner = THIS_MODULE, | ||
37 | }; | ||
38 | |||
39 | static int exynos4_enter_idle(struct cpuidle_device *dev, | ||
40 | struct cpuidle_state *state) | ||
41 | { | ||
42 | struct timeval before, after; | ||
43 | int idle_time; | ||
44 | |||
45 | local_irq_disable(); | ||
46 | do_gettimeofday(&before); | ||
47 | |||
48 | cpu_do_idle(); | ||
49 | |||
50 | do_gettimeofday(&after); | ||
51 | local_irq_enable(); | ||
52 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
53 | (after.tv_usec - before.tv_usec); | ||
54 | |||
55 | return idle_time; | ||
56 | } | ||
57 | |||
58 | static int __init exynos4_init_cpuidle(void) | ||
59 | { | ||
60 | int i, max_cpuidle_state, cpu_id; | ||
61 | struct cpuidle_device *device; | ||
62 | |||
63 | cpuidle_register_driver(&exynos4_idle_driver); | ||
64 | |||
65 | for_each_cpu(cpu_id, cpu_online_mask) { | ||
66 | device = &per_cpu(exynos4_cpuidle_device, cpu_id); | ||
67 | device->cpu = cpu_id; | ||
68 | |||
69 | device->state_count = (sizeof(exynos4_cpuidle_set) / | ||
70 | sizeof(struct cpuidle_state)); | ||
71 | |||
72 | max_cpuidle_state = device->state_count; | ||
73 | |||
74 | for (i = 0; i < max_cpuidle_state; i++) { | ||
75 | memcpy(&device->states[i], &exynos4_cpuidle_set[i], | ||
76 | sizeof(struct cpuidle_state)); | ||
77 | } | ||
78 | |||
79 | if (cpuidle_register_device(device)) { | ||
80 | printk(KERN_ERR "CPUidle register device failed\n,"); | ||
81 | return -EIO; | ||
82 | } | ||
83 | } | ||
84 | return 0; | ||
85 | } | ||
86 | device_initcall(exynos4_init_cpuidle); | ||
diff --git a/arch/arm/mach-exynos/dev-ahci.c b/arch/arm/mach-exynos/dev-ahci.c new file mode 100644 index 000000000000..f57a3de8e1d2 --- /dev/null +++ b/arch/arm/mach-exynos/dev-ahci.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/dev-ahci.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - AHCI 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/clk.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/ahci_platform.h> | ||
18 | |||
19 | #include <plat/cpu.h> | ||
20 | |||
21 | #include <mach/irqs.h> | ||
22 | #include <mach/map.h> | ||
23 | #include <mach/regs-pmu.h> | ||
24 | |||
25 | /* PHY Control Register */ | ||
26 | #define SATA_CTRL0 0x0 | ||
27 | /* PHY Link Control Register */ | ||
28 | #define SATA_CTRL1 0x4 | ||
29 | /* PHY Status Register */ | ||
30 | #define SATA_PHY_STATUS 0x8 | ||
31 | |||
32 | #define SATA_CTRL0_RX_DATA_VALID(x) (x << 27) | ||
33 | #define SATA_CTRL0_SPEED_MODE (1 << 26) | ||
34 | #define SATA_CTRL0_M_PHY_CAL (1 << 19) | ||
35 | #define SATA_CTRL0_PHY_CMU_RST_N (1 << 10) | ||
36 | #define SATA_CTRL0_M_PHY_LN_RST_N (1 << 9) | ||
37 | #define SATA_CTRL0_PHY_POR_N (1 << 8) | ||
38 | |||
39 | #define SATA_CTRL1_RST_PMALIVE_N (1 << 8) | ||
40 | #define SATA_CTRL1_RST_RXOOB_N (1 << 7) | ||
41 | #define SATA_CTRL1_RST_RX_N (1 << 6) | ||
42 | #define SATA_CTRL1_RST_TX_N (1 << 5) | ||
43 | |||
44 | #define SATA_PHY_STATUS_CMU_OK (1 << 18) | ||
45 | #define SATA_PHY_STATUS_LANE_OK (1 << 16) | ||
46 | |||
47 | #define LANE0 0x200 | ||
48 | #define COM_LANE 0xA00 | ||
49 | |||
50 | #define HOST_PORTS_IMPL 0xC | ||
51 | #define SCLK_SATA_FREQ (67 * MHZ) | ||
52 | |||
53 | static void __iomem *phy_base, *phy_ctrl; | ||
54 | |||
55 | struct phy_reg { | ||
56 | u8 reg; | ||
57 | u8 val; | ||
58 | }; | ||
59 | |||
60 | /* SATA PHY setup */ | ||
61 | static const struct phy_reg exynos4_sataphy_cmu[] = { | ||
62 | { 0x00, 0x06 }, { 0x02, 0x80 }, { 0x22, 0xa0 }, { 0x23, 0x42 }, | ||
63 | { 0x2e, 0x04 }, { 0x2f, 0x50 }, { 0x30, 0x70 }, { 0x31, 0x02 }, | ||
64 | { 0x32, 0x25 }, { 0x33, 0x40 }, { 0x34, 0x01 }, { 0x35, 0x40 }, | ||
65 | { 0x61, 0x2e }, { 0x63, 0x5e }, { 0x65, 0x42 }, { 0x66, 0xd1 }, | ||
66 | { 0x67, 0x20 }, { 0x68, 0x28 }, { 0x69, 0x78 }, { 0x6a, 0x04 }, | ||
67 | { 0x6b, 0xc8 }, { 0x6c, 0x06 }, | ||
68 | }; | ||
69 | |||
70 | static const struct phy_reg exynos4_sataphy_lane[] = { | ||
71 | { 0x00, 0x02 }, { 0x05, 0x10 }, { 0x06, 0x84 }, { 0x07, 0x04 }, | ||
72 | { 0x08, 0xe0 }, { 0x10, 0x23 }, { 0x13, 0x05 }, { 0x14, 0x30 }, | ||
73 | { 0x15, 0x00 }, { 0x17, 0x70 }, { 0x18, 0xf2 }, { 0x19, 0x1e }, | ||
74 | { 0x1a, 0x18 }, { 0x1b, 0x0d }, { 0x1c, 0x08 }, { 0x50, 0x60 }, | ||
75 | { 0x51, 0x0f }, | ||
76 | }; | ||
77 | |||
78 | static const struct phy_reg exynos4_sataphy_comlane[] = { | ||
79 | { 0x01, 0x20 }, { 0x03, 0x40 }, { 0x04, 0x3c }, { 0x05, 0x7d }, | ||
80 | { 0x06, 0x1d }, { 0x07, 0xcf }, { 0x08, 0x05 }, { 0x09, 0x63 }, | ||
81 | { 0x0a, 0x29 }, { 0x0b, 0xc4 }, { 0x0c, 0x01 }, { 0x0d, 0x03 }, | ||
82 | { 0x0e, 0x28 }, { 0x0f, 0x98 }, { 0x10, 0x19 }, { 0x13, 0x80 }, | ||
83 | { 0x14, 0xf0 }, { 0x15, 0xd0 }, { 0x39, 0xa0 }, { 0x3a, 0xa0 }, | ||
84 | { 0x3b, 0xa0 }, { 0x3c, 0xa0 }, { 0x3d, 0xa0 }, { 0x3e, 0xa0 }, | ||
85 | { 0x3f, 0xa0 }, { 0x40, 0x42 }, { 0x42, 0x80 }, { 0x43, 0x58 }, | ||
86 | { 0x45, 0x44 }, { 0x46, 0x5c }, { 0x47, 0x86 }, { 0x48, 0x8d }, | ||
87 | { 0x49, 0xd0 }, { 0x4a, 0x09 }, { 0x4b, 0x90 }, { 0x4c, 0x07 }, | ||
88 | { 0x4d, 0x40 }, { 0x51, 0x20 }, { 0x52, 0x32 }, { 0x7f, 0xd8 }, | ||
89 | { 0x80, 0x1a }, { 0x81, 0xff }, { 0x82, 0x11 }, { 0x83, 0x00 }, | ||
90 | { 0x87, 0xf0 }, { 0x87, 0xff }, { 0x87, 0xff }, { 0x87, 0xff }, | ||
91 | { 0x87, 0xff }, { 0x8c, 0x1c }, { 0x8d, 0xc2 }, { 0x8e, 0xc3 }, | ||
92 | { 0x8f, 0x3f }, { 0x90, 0x0a }, { 0x96, 0xf8 }, | ||
93 | }; | ||
94 | |||
95 | static int wait_for_phy_ready(void __iomem *reg, unsigned long bit) | ||
96 | { | ||
97 | unsigned long timeout; | ||
98 | |||
99 | /* wait for maximum of 3 sec */ | ||
100 | timeout = jiffies + msecs_to_jiffies(3000); | ||
101 | while (!(__raw_readl(reg) & bit)) { | ||
102 | if (time_after(jiffies, timeout)) | ||
103 | return -1; | ||
104 | cpu_relax(); | ||
105 | } | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static int ahci_phy_init(void __iomem *mmio) | ||
110 | { | ||
111 | int i, ctrl0; | ||
112 | |||
113 | for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_cmu); i++) | ||
114 | __raw_writeb(exynos4_sataphy_cmu[i].val, | ||
115 | phy_base + (exynos4_sataphy_cmu[i].reg * 4)); | ||
116 | |||
117 | for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_lane); i++) | ||
118 | __raw_writeb(exynos4_sataphy_lane[i].val, | ||
119 | phy_base + (LANE0 + exynos4_sataphy_lane[i].reg) * 4); | ||
120 | |||
121 | for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_comlane); i++) | ||
122 | __raw_writeb(exynos4_sataphy_comlane[i].val, | ||
123 | phy_base + (COM_LANE + exynos4_sataphy_comlane[i].reg) * 4); | ||
124 | |||
125 | __raw_writeb(0x07, phy_base); | ||
126 | |||
127 | ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0); | ||
128 | ctrl0 |= SATA_CTRL0_PHY_CMU_RST_N; | ||
129 | __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0); | ||
130 | |||
131 | if (wait_for_phy_ready(phy_ctrl + SATA_PHY_STATUS, | ||
132 | SATA_PHY_STATUS_CMU_OK) < 0) { | ||
133 | printk(KERN_ERR "PHY CMU not ready\n"); | ||
134 | return -EBUSY; | ||
135 | } | ||
136 | |||
137 | __raw_writeb(0x03, phy_base + (COM_LANE * 4)); | ||
138 | |||
139 | ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0); | ||
140 | ctrl0 |= SATA_CTRL0_M_PHY_LN_RST_N; | ||
141 | __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0); | ||
142 | |||
143 | if (wait_for_phy_ready(phy_ctrl + SATA_PHY_STATUS, | ||
144 | SATA_PHY_STATUS_LANE_OK) < 0) { | ||
145 | printk(KERN_ERR "PHY LANE not ready\n"); | ||
146 | return -EBUSY; | ||
147 | } | ||
148 | |||
149 | ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0); | ||
150 | ctrl0 |= SATA_CTRL0_M_PHY_CAL; | ||
151 | __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0); | ||
152 | |||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static int exynos4_ahci_init(struct device *dev, void __iomem *mmio) | ||
157 | { | ||
158 | struct clk *clk_sata, *clk_sataphy, *clk_sclk_sata; | ||
159 | int val, ret; | ||
160 | |||
161 | phy_base = ioremap(EXYNOS4_PA_SATAPHY, SZ_64K); | ||
162 | if (!phy_base) { | ||
163 | dev_err(dev, "failed to allocate memory for SATA PHY\n"); | ||
164 | return -ENOMEM; | ||
165 | } | ||
166 | |||
167 | phy_ctrl = ioremap(EXYNOS4_PA_SATAPHY_CTRL, SZ_16); | ||
168 | if (!phy_ctrl) { | ||
169 | dev_err(dev, "failed to allocate memory for SATA PHY CTRL\n"); | ||
170 | ret = -ENOMEM; | ||
171 | goto err1; | ||
172 | } | ||
173 | |||
174 | clk_sata = clk_get(dev, "sata"); | ||
175 | if (IS_ERR(clk_sata)) { | ||
176 | dev_err(dev, "failed to get sata clock\n"); | ||
177 | ret = PTR_ERR(clk_sata); | ||
178 | clk_sata = NULL; | ||
179 | goto err2; | ||
180 | |||
181 | } | ||
182 | clk_enable(clk_sata); | ||
183 | |||
184 | clk_sataphy = clk_get(dev, "sataphy"); | ||
185 | if (IS_ERR(clk_sataphy)) { | ||
186 | dev_err(dev, "failed to get sataphy clock\n"); | ||
187 | ret = PTR_ERR(clk_sataphy); | ||
188 | clk_sataphy = NULL; | ||
189 | goto err3; | ||
190 | } | ||
191 | clk_enable(clk_sataphy); | ||
192 | |||
193 | clk_sclk_sata = clk_get(dev, "sclk_sata"); | ||
194 | if (IS_ERR(clk_sclk_sata)) { | ||
195 | dev_err(dev, "failed to get sclk_sata\n"); | ||
196 | ret = PTR_ERR(clk_sclk_sata); | ||
197 | clk_sclk_sata = NULL; | ||
198 | goto err4; | ||
199 | } | ||
200 | clk_enable(clk_sclk_sata); | ||
201 | clk_set_rate(clk_sclk_sata, SCLK_SATA_FREQ); | ||
202 | |||
203 | __raw_writel(S5P_PMU_SATA_PHY_CONTROL_EN, S5P_PMU_SATA_PHY_CONTROL); | ||
204 | |||
205 | /* Enable PHY link control */ | ||
206 | val = SATA_CTRL1_RST_PMALIVE_N | SATA_CTRL1_RST_RXOOB_N | | ||
207 | SATA_CTRL1_RST_RX_N | SATA_CTRL1_RST_TX_N; | ||
208 | __raw_writel(val, phy_ctrl + SATA_CTRL1); | ||
209 | |||
210 | /* Set communication speed as 3Gbps and enable PHY power */ | ||
211 | val = SATA_CTRL0_RX_DATA_VALID(3) | SATA_CTRL0_SPEED_MODE | | ||
212 | SATA_CTRL0_PHY_POR_N; | ||
213 | __raw_writel(val, phy_ctrl + SATA_CTRL0); | ||
214 | |||
215 | /* Port0 is available */ | ||
216 | __raw_writel(0x1, mmio + HOST_PORTS_IMPL); | ||
217 | |||
218 | return ahci_phy_init(mmio); | ||
219 | |||
220 | err4: | ||
221 | clk_disable(clk_sataphy); | ||
222 | clk_put(clk_sataphy); | ||
223 | err3: | ||
224 | clk_disable(clk_sata); | ||
225 | clk_put(clk_sata); | ||
226 | err2: | ||
227 | iounmap(phy_ctrl); | ||
228 | err1: | ||
229 | iounmap(phy_base); | ||
230 | |||
231 | return ret; | ||
232 | } | ||
233 | |||
234 | static struct ahci_platform_data exynos4_ahci_pdata = { | ||
235 | .init = exynos4_ahci_init, | ||
236 | }; | ||
237 | |||
238 | static struct resource exynos4_ahci_resource[] = { | ||
239 | [0] = { | ||
240 | .start = EXYNOS4_PA_SATA, | ||
241 | .end = EXYNOS4_PA_SATA + SZ_64K - 1, | ||
242 | .flags = IORESOURCE_MEM, | ||
243 | }, | ||
244 | [1] = { | ||
245 | .start = IRQ_SATA, | ||
246 | .end = IRQ_SATA, | ||
247 | .flags = IORESOURCE_IRQ, | ||
248 | }, | ||
249 | }; | ||
250 | |||
251 | static u64 exynos4_ahci_dmamask = DMA_BIT_MASK(32); | ||
252 | |||
253 | struct platform_device exynos4_device_ahci = { | ||
254 | .name = "ahci", | ||
255 | .id = -1, | ||
256 | .resource = exynos4_ahci_resource, | ||
257 | .num_resources = ARRAY_SIZE(exynos4_ahci_resource), | ||
258 | .dev = { | ||
259 | .platform_data = &exynos4_ahci_pdata, | ||
260 | .dma_mask = &exynos4_ahci_dmamask, | ||
261 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
262 | }, | ||
263 | }; | ||
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c new file mode 100644 index 000000000000..5a9f9c2e53bf --- /dev/null +++ b/arch/arm/mach-exynos/dev-audio.c | |||
@@ -0,0 +1,369 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/dev-audio.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2010 Samsung Electronics Co. Ltd | ||
7 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/gpio.h> | ||
17 | |||
18 | #include <plat/gpio-cfg.h> | ||
19 | #include <plat/audio.h> | ||
20 | |||
21 | #include <mach/map.h> | ||
22 | #include <mach/dma.h> | ||
23 | #include <mach/irqs.h> | ||
24 | #include <mach/regs-audss.h> | ||
25 | |||
26 | static const char *rclksrc[] = { | ||
27 | [0] = "busclk", | ||
28 | [1] = "i2sclk", | ||
29 | }; | ||
30 | |||
31 | static int exynos4_cfg_i2s(struct platform_device *pdev) | ||
32 | { | ||
33 | /* configure GPIO for i2s port */ | ||
34 | switch (pdev->id) { | ||
35 | case 0: | ||
36 | s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2)); | ||
37 | break; | ||
38 | case 1: | ||
39 | s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2)); | ||
40 | break; | ||
41 | case 2: | ||
42 | s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4)); | ||
43 | break; | ||
44 | default: | ||
45 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | ||
46 | return -EINVAL; | ||
47 | } | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static struct s3c_audio_pdata i2sv5_pdata = { | ||
53 | .cfg_gpio = exynos4_cfg_i2s, | ||
54 | .type = { | ||
55 | .i2s = { | ||
56 | .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | ||
57 | | QUIRK_NEED_RSTCLR, | ||
58 | .src_clk = rclksrc, | ||
59 | .idma_addr = EXYNOS4_AUDSS_INT_MEM, | ||
60 | }, | ||
61 | }, | ||
62 | }; | ||
63 | |||
64 | static struct resource exynos4_i2s0_resource[] = { | ||
65 | [0] = { | ||
66 | .start = EXYNOS4_PA_I2S0, | ||
67 | .end = EXYNOS4_PA_I2S0 + 0x100 - 1, | ||
68 | .flags = IORESOURCE_MEM, | ||
69 | }, | ||
70 | [1] = { | ||
71 | .start = DMACH_I2S0_TX, | ||
72 | .end = DMACH_I2S0_TX, | ||
73 | .flags = IORESOURCE_DMA, | ||
74 | }, | ||
75 | [2] = { | ||
76 | .start = DMACH_I2S0_RX, | ||
77 | .end = DMACH_I2S0_RX, | ||
78 | .flags = IORESOURCE_DMA, | ||
79 | }, | ||
80 | [3] = { | ||
81 | .start = DMACH_I2S0S_TX, | ||
82 | .end = DMACH_I2S0S_TX, | ||
83 | .flags = IORESOURCE_DMA, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | struct platform_device exynos4_device_i2s0 = { | ||
88 | .name = "samsung-i2s", | ||
89 | .id = 0, | ||
90 | .num_resources = ARRAY_SIZE(exynos4_i2s0_resource), | ||
91 | .resource = exynos4_i2s0_resource, | ||
92 | .dev = { | ||
93 | .platform_data = &i2sv5_pdata, | ||
94 | }, | ||
95 | }; | ||
96 | |||
97 | static const char *rclksrc_v3[] = { | ||
98 | [0] = "sclk_i2s", | ||
99 | [1] = "no_such_clock", | ||
100 | }; | ||
101 | |||
102 | static struct s3c_audio_pdata i2sv3_pdata = { | ||
103 | .cfg_gpio = exynos4_cfg_i2s, | ||
104 | .type = { | ||
105 | .i2s = { | ||
106 | .quirks = QUIRK_NO_MUXPSR, | ||
107 | .src_clk = rclksrc_v3, | ||
108 | }, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | static struct resource exynos4_i2s1_resource[] = { | ||
113 | [0] = { | ||
114 | .start = EXYNOS4_PA_I2S1, | ||
115 | .end = EXYNOS4_PA_I2S1 + 0x100 - 1, | ||
116 | .flags = IORESOURCE_MEM, | ||
117 | }, | ||
118 | [1] = { | ||
119 | .start = DMACH_I2S1_TX, | ||
120 | .end = DMACH_I2S1_TX, | ||
121 | .flags = IORESOURCE_DMA, | ||
122 | }, | ||
123 | [2] = { | ||
124 | .start = DMACH_I2S1_RX, | ||
125 | .end = DMACH_I2S1_RX, | ||
126 | .flags = IORESOURCE_DMA, | ||
127 | }, | ||
128 | }; | ||
129 | |||
130 | struct platform_device exynos4_device_i2s1 = { | ||
131 | .name = "samsung-i2s", | ||
132 | .id = 1, | ||
133 | .num_resources = ARRAY_SIZE(exynos4_i2s1_resource), | ||
134 | .resource = exynos4_i2s1_resource, | ||
135 | .dev = { | ||
136 | .platform_data = &i2sv3_pdata, | ||
137 | }, | ||
138 | }; | ||
139 | |||
140 | static struct resource exynos4_i2s2_resource[] = { | ||
141 | [0] = { | ||
142 | .start = EXYNOS4_PA_I2S2, | ||
143 | .end = EXYNOS4_PA_I2S2 + 0x100 - 1, | ||
144 | .flags = IORESOURCE_MEM, | ||
145 | }, | ||
146 | [1] = { | ||
147 | .start = DMACH_I2S2_TX, | ||
148 | .end = DMACH_I2S2_TX, | ||
149 | .flags = IORESOURCE_DMA, | ||
150 | }, | ||
151 | [2] = { | ||
152 | .start = DMACH_I2S2_RX, | ||
153 | .end = DMACH_I2S2_RX, | ||
154 | .flags = IORESOURCE_DMA, | ||
155 | }, | ||
156 | }; | ||
157 | |||
158 | struct platform_device exynos4_device_i2s2 = { | ||
159 | .name = "samsung-i2s", | ||
160 | .id = 2, | ||
161 | .num_resources = ARRAY_SIZE(exynos4_i2s2_resource), | ||
162 | .resource = exynos4_i2s2_resource, | ||
163 | .dev = { | ||
164 | .platform_data = &i2sv3_pdata, | ||
165 | }, | ||
166 | }; | ||
167 | |||
168 | /* PCM Controller platform_devices */ | ||
169 | |||
170 | static int exynos4_pcm_cfg_gpio(struct platform_device *pdev) | ||
171 | { | ||
172 | switch (pdev->id) { | ||
173 | case 0: | ||
174 | s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3)); | ||
175 | break; | ||
176 | case 1: | ||
177 | s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3)); | ||
178 | break; | ||
179 | case 2: | ||
180 | s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3)); | ||
181 | break; | ||
182 | default: | ||
183 | printk(KERN_DEBUG "Invalid PCM Controller number!"); | ||
184 | return -EINVAL; | ||
185 | } | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static struct s3c_audio_pdata s3c_pcm_pdata = { | ||
191 | .cfg_gpio = exynos4_pcm_cfg_gpio, | ||
192 | }; | ||
193 | |||
194 | static struct resource exynos4_pcm0_resource[] = { | ||
195 | [0] = { | ||
196 | .start = EXYNOS4_PA_PCM0, | ||
197 | .end = EXYNOS4_PA_PCM0 + 0x100 - 1, | ||
198 | .flags = IORESOURCE_MEM, | ||
199 | }, | ||
200 | [1] = { | ||
201 | .start = DMACH_PCM0_TX, | ||
202 | .end = DMACH_PCM0_TX, | ||
203 | .flags = IORESOURCE_DMA, | ||
204 | }, | ||
205 | [2] = { | ||
206 | .start = DMACH_PCM0_RX, | ||
207 | .end = DMACH_PCM0_RX, | ||
208 | .flags = IORESOURCE_DMA, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | struct platform_device exynos4_device_pcm0 = { | ||
213 | .name = "samsung-pcm", | ||
214 | .id = 0, | ||
215 | .num_resources = ARRAY_SIZE(exynos4_pcm0_resource), | ||
216 | .resource = exynos4_pcm0_resource, | ||
217 | .dev = { | ||
218 | .platform_data = &s3c_pcm_pdata, | ||
219 | }, | ||
220 | }; | ||
221 | |||
222 | static struct resource exynos4_pcm1_resource[] = { | ||
223 | [0] = { | ||
224 | .start = EXYNOS4_PA_PCM1, | ||
225 | .end = EXYNOS4_PA_PCM1 + 0x100 - 1, | ||
226 | .flags = IORESOURCE_MEM, | ||
227 | }, | ||
228 | [1] = { | ||
229 | .start = DMACH_PCM1_TX, | ||
230 | .end = DMACH_PCM1_TX, | ||
231 | .flags = IORESOURCE_DMA, | ||
232 | }, | ||
233 | [2] = { | ||
234 | .start = DMACH_PCM1_RX, | ||
235 | .end = DMACH_PCM1_RX, | ||
236 | .flags = IORESOURCE_DMA, | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | struct platform_device exynos4_device_pcm1 = { | ||
241 | .name = "samsung-pcm", | ||
242 | .id = 1, | ||
243 | .num_resources = ARRAY_SIZE(exynos4_pcm1_resource), | ||
244 | .resource = exynos4_pcm1_resource, | ||
245 | .dev = { | ||
246 | .platform_data = &s3c_pcm_pdata, | ||
247 | }, | ||
248 | }; | ||
249 | |||
250 | static struct resource exynos4_pcm2_resource[] = { | ||
251 | [0] = { | ||
252 | .start = EXYNOS4_PA_PCM2, | ||
253 | .end = EXYNOS4_PA_PCM2 + 0x100 - 1, | ||
254 | .flags = IORESOURCE_MEM, | ||
255 | }, | ||
256 | [1] = { | ||
257 | .start = DMACH_PCM2_TX, | ||
258 | .end = DMACH_PCM2_TX, | ||
259 | .flags = IORESOURCE_DMA, | ||
260 | }, | ||
261 | [2] = { | ||
262 | .start = DMACH_PCM2_RX, | ||
263 | .end = DMACH_PCM2_RX, | ||
264 | .flags = IORESOURCE_DMA, | ||
265 | }, | ||
266 | }; | ||
267 | |||
268 | struct platform_device exynos4_device_pcm2 = { | ||
269 | .name = "samsung-pcm", | ||
270 | .id = 2, | ||
271 | .num_resources = ARRAY_SIZE(exynos4_pcm2_resource), | ||
272 | .resource = exynos4_pcm2_resource, | ||
273 | .dev = { | ||
274 | .platform_data = &s3c_pcm_pdata, | ||
275 | }, | ||
276 | }; | ||
277 | |||
278 | /* AC97 Controller platform devices */ | ||
279 | |||
280 | static int exynos4_ac97_cfg_gpio(struct platform_device *pdev) | ||
281 | { | ||
282 | return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4)); | ||
283 | } | ||
284 | |||
285 | static struct resource exynos4_ac97_resource[] = { | ||
286 | [0] = { | ||
287 | .start = EXYNOS4_PA_AC97, | ||
288 | .end = EXYNOS4_PA_AC97 + 0x100 - 1, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | }, | ||
291 | [1] = { | ||
292 | .start = DMACH_AC97_PCMOUT, | ||
293 | .end = DMACH_AC97_PCMOUT, | ||
294 | .flags = IORESOURCE_DMA, | ||
295 | }, | ||
296 | [2] = { | ||
297 | .start = DMACH_AC97_PCMIN, | ||
298 | .end = DMACH_AC97_PCMIN, | ||
299 | .flags = IORESOURCE_DMA, | ||
300 | }, | ||
301 | [3] = { | ||
302 | .start = DMACH_AC97_MICIN, | ||
303 | .end = DMACH_AC97_MICIN, | ||
304 | .flags = IORESOURCE_DMA, | ||
305 | }, | ||
306 | [4] = { | ||
307 | .start = IRQ_AC97, | ||
308 | .end = IRQ_AC97, | ||
309 | .flags = IORESOURCE_IRQ, | ||
310 | }, | ||
311 | }; | ||
312 | |||
313 | static struct s3c_audio_pdata s3c_ac97_pdata = { | ||
314 | .cfg_gpio = exynos4_ac97_cfg_gpio, | ||
315 | }; | ||
316 | |||
317 | static u64 exynos4_ac97_dmamask = DMA_BIT_MASK(32); | ||
318 | |||
319 | struct platform_device exynos4_device_ac97 = { | ||
320 | .name = "samsung-ac97", | ||
321 | .id = -1, | ||
322 | .num_resources = ARRAY_SIZE(exynos4_ac97_resource), | ||
323 | .resource = exynos4_ac97_resource, | ||
324 | .dev = { | ||
325 | .platform_data = &s3c_ac97_pdata, | ||
326 | .dma_mask = &exynos4_ac97_dmamask, | ||
327 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
328 | }, | ||
329 | }; | ||
330 | |||
331 | /* S/PDIF Controller platform_device */ | ||
332 | |||
333 | static int exynos4_spdif_cfg_gpio(struct platform_device *pdev) | ||
334 | { | ||
335 | s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4)); | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static struct resource exynos4_spdif_resource[] = { | ||
341 | [0] = { | ||
342 | .start = EXYNOS4_PA_SPDIF, | ||
343 | .end = EXYNOS4_PA_SPDIF + 0x100 - 1, | ||
344 | .flags = IORESOURCE_MEM, | ||
345 | }, | ||
346 | [1] = { | ||
347 | .start = DMACH_SPDIF, | ||
348 | .end = DMACH_SPDIF, | ||
349 | .flags = IORESOURCE_DMA, | ||
350 | }, | ||
351 | }; | ||
352 | |||
353 | static struct s3c_audio_pdata samsung_spdif_pdata = { | ||
354 | .cfg_gpio = exynos4_spdif_cfg_gpio, | ||
355 | }; | ||
356 | |||
357 | static u64 exynos4_spdif_dmamask = DMA_BIT_MASK(32); | ||
358 | |||
359 | struct platform_device exynos4_device_spdif = { | ||
360 | .name = "samsung-spdif", | ||
361 | .id = -1, | ||
362 | .num_resources = ARRAY_SIZE(exynos4_spdif_resource), | ||
363 | .resource = exynos4_spdif_resource, | ||
364 | .dev = { | ||
365 | .platform_data = &samsung_spdif_pdata, | ||
366 | .dma_mask = &exynos4_spdif_dmamask, | ||
367 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
368 | }, | ||
369 | }; | ||
diff --git a/arch/arm/mach-exynos/dev-dwmci.c b/arch/arm/mach-exynos/dev-dwmci.c new file mode 100644 index 000000000000..b025db4bf602 --- /dev/null +++ b/arch/arm/mach-exynos/dev-dwmci.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/dev-dwmci.c | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * Platform device for Synopsys DesignWare Mobile Storage IP | ||
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 as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/dma-mapping.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/mmc/dw_mmc.h> | ||
20 | |||
21 | #include <plat/devs.h> | ||
22 | |||
23 | #include <mach/map.h> | ||
24 | |||
25 | static int exynos4_dwmci_get_bus_wd(u32 slot_id) | ||
26 | { | ||
27 | return 4; | ||
28 | } | ||
29 | |||
30 | static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static struct resource exynos4_dwmci_resource[] = { | ||
36 | [0] = { | ||
37 | .start = EXYNOS4_PA_DWMCI, | ||
38 | .end = EXYNOS4_PA_DWMCI + SZ_4K - 1, | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }, | ||
41 | [1] = { | ||
42 | .start = IRQ_DWMCI, | ||
43 | .end = IRQ_DWMCI, | ||
44 | .flags = IORESOURCE_IRQ, | ||
45 | } | ||
46 | }; | ||
47 | |||
48 | static struct dw_mci_board exynos4_dwci_pdata = { | ||
49 | .num_slots = 1, | ||
50 | .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION, | ||
51 | .bus_hz = 80 * 1000 * 1000, | ||
52 | .detect_delay_ms = 200, | ||
53 | .init = exynos4_dwmci_init, | ||
54 | .get_bus_wd = exynos4_dwmci_get_bus_wd, | ||
55 | }; | ||
56 | |||
57 | static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32); | ||
58 | |||
59 | struct platform_device exynos4_device_dwmci = { | ||
60 | .name = "dw_mmc", | ||
61 | .id = -1, | ||
62 | .num_resources = ARRAY_SIZE(exynos4_dwmci_resource), | ||
63 | .resource = exynos4_dwmci_resource, | ||
64 | .dev = { | ||
65 | .dma_mask = &exynos4_dwmci_dmamask, | ||
66 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
67 | .platform_data = &exynos4_dwci_pdata, | ||
68 | }, | ||
69 | }; | ||
70 | |||
71 | void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd) | ||
72 | { | ||
73 | struct dw_mci_board *npd; | ||
74 | |||
75 | npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board), | ||
76 | &exynos4_device_dwmci); | ||
77 | |||
78 | if (!npd->init) | ||
79 | npd->init = exynos4_dwmci_init; | ||
80 | if (!npd->get_bus_wd) | ||
81 | npd->get_bus_wd = exynos4_dwmci_get_bus_wd; | ||
82 | } | ||
diff --git a/arch/arm/mach-exynos/dev-pd.c b/arch/arm/mach-exynos/dev-pd.c new file mode 100644 index 000000000000..3273f25d6a75 --- /dev/null +++ b/arch/arm/mach-exynos/dev-pd.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/dev-pd.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Power Domain 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/io.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/delay.h> | ||
17 | |||
18 | #include <mach/regs-pmu.h> | ||
19 | |||
20 | #include <plat/pd.h> | ||
21 | |||
22 | static int exynos4_pd_enable(struct device *dev) | ||
23 | { | ||
24 | struct samsung_pd_info *pdata = dev->platform_data; | ||
25 | u32 timeout; | ||
26 | |||
27 | __raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base); | ||
28 | |||
29 | /* Wait max 1ms */ | ||
30 | timeout = 10; | ||
31 | while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) | ||
32 | != S5P_INT_LOCAL_PWR_EN) { | ||
33 | if (timeout == 0) { | ||
34 | printk(KERN_ERR "Power domain %s enable failed.\n", | ||
35 | dev_name(dev)); | ||
36 | return -ETIMEDOUT; | ||
37 | } | ||
38 | timeout--; | ||
39 | udelay(100); | ||
40 | } | ||
41 | |||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int exynos4_pd_disable(struct device *dev) | ||
46 | { | ||
47 | struct samsung_pd_info *pdata = dev->platform_data; | ||
48 | u32 timeout; | ||
49 | |||
50 | __raw_writel(0, pdata->base); | ||
51 | |||
52 | /* Wait max 1ms */ | ||
53 | timeout = 10; | ||
54 | while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) { | ||
55 | if (timeout == 0) { | ||
56 | printk(KERN_ERR "Power domain %s disable failed.\n", | ||
57 | dev_name(dev)); | ||
58 | return -ETIMEDOUT; | ||
59 | } | ||
60 | timeout--; | ||
61 | udelay(100); | ||
62 | } | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | struct platform_device exynos4_device_pd[] = { | ||
68 | { | ||
69 | .name = "samsung-pd", | ||
70 | .id = 0, | ||
71 | .dev = { | ||
72 | .platform_data = &(struct samsung_pd_info) { | ||
73 | .enable = exynos4_pd_enable, | ||
74 | .disable = exynos4_pd_disable, | ||
75 | .base = S5P_PMU_MFC_CONF, | ||
76 | }, | ||
77 | }, | ||
78 | }, { | ||
79 | .name = "samsung-pd", | ||
80 | .id = 1, | ||
81 | .dev = { | ||
82 | .platform_data = &(struct samsung_pd_info) { | ||
83 | .enable = exynos4_pd_enable, | ||
84 | .disable = exynos4_pd_disable, | ||
85 | .base = S5P_PMU_G3D_CONF, | ||
86 | }, | ||
87 | }, | ||
88 | }, { | ||
89 | .name = "samsung-pd", | ||
90 | .id = 2, | ||
91 | .dev = { | ||
92 | .platform_data = &(struct samsung_pd_info) { | ||
93 | .enable = exynos4_pd_enable, | ||
94 | .disable = exynos4_pd_disable, | ||
95 | .base = S5P_PMU_LCD0_CONF, | ||
96 | }, | ||
97 | }, | ||
98 | }, { | ||
99 | .name = "samsung-pd", | ||
100 | .id = 3, | ||
101 | .dev = { | ||
102 | .platform_data = &(struct samsung_pd_info) { | ||
103 | .enable = exynos4_pd_enable, | ||
104 | .disable = exynos4_pd_disable, | ||
105 | .base = S5P_PMU_LCD1_CONF, | ||
106 | }, | ||
107 | }, | ||
108 | }, { | ||
109 | .name = "samsung-pd", | ||
110 | .id = 4, | ||
111 | .dev = { | ||
112 | .platform_data = &(struct samsung_pd_info) { | ||
113 | .enable = exynos4_pd_enable, | ||
114 | .disable = exynos4_pd_disable, | ||
115 | .base = S5P_PMU_TV_CONF, | ||
116 | }, | ||
117 | }, | ||
118 | }, { | ||
119 | .name = "samsung-pd", | ||
120 | .id = 5, | ||
121 | .dev = { | ||
122 | .platform_data = &(struct samsung_pd_info) { | ||
123 | .enable = exynos4_pd_enable, | ||
124 | .disable = exynos4_pd_disable, | ||
125 | .base = S5P_PMU_CAM_CONF, | ||
126 | }, | ||
127 | }, | ||
128 | }, { | ||
129 | .name = "samsung-pd", | ||
130 | .id = 6, | ||
131 | .dev = { | ||
132 | .platform_data = &(struct samsung_pd_info) { | ||
133 | .enable = exynos4_pd_enable, | ||
134 | .disable = exynos4_pd_disable, | ||
135 | .base = S5P_PMU_GPS_CONF, | ||
136 | }, | ||
137 | }, | ||
138 | }, | ||
139 | }; | ||
diff --git a/arch/arm/mach-exynos/dev-sysmmu.c b/arch/arm/mach-exynos/dev-sysmmu.c new file mode 100644 index 000000000000..3b7cae0fe23e --- /dev/null +++ b/arch/arm/mach-exynos/dev-sysmmu.c | |||
@@ -0,0 +1,232 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/dev-sysmmu.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - System MMU 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/platform_device.h> | ||
14 | #include <linux/dma-mapping.h> | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <mach/irqs.h> | ||
18 | #include <mach/sysmmu.h> | ||
19 | #include <plat/s5p-clock.h> | ||
20 | |||
21 | /* These names must be equal to the clock names in mach-exynos4/clock.c */ | ||
22 | const char *sysmmu_ips_name[EXYNOS4_SYSMMU_TOTAL_IPNUM] = { | ||
23 | "SYSMMU_MDMA" , | ||
24 | "SYSMMU_SSS" , | ||
25 | "SYSMMU_FIMC0" , | ||
26 | "SYSMMU_FIMC1" , | ||
27 | "SYSMMU_FIMC2" , | ||
28 | "SYSMMU_FIMC3" , | ||
29 | "SYSMMU_JPEG" , | ||
30 | "SYSMMU_FIMD0" , | ||
31 | "SYSMMU_FIMD1" , | ||
32 | "SYSMMU_PCIe" , | ||
33 | "SYSMMU_G2D" , | ||
34 | "SYSMMU_ROTATOR", | ||
35 | "SYSMMU_MDMA2" , | ||
36 | "SYSMMU_TV" , | ||
37 | "SYSMMU_MFC_L" , | ||
38 | "SYSMMU_MFC_R" , | ||
39 | }; | ||
40 | |||
41 | static struct resource exynos4_sysmmu_resource[] = { | ||
42 | [0] = { | ||
43 | .start = EXYNOS4_PA_SYSMMU_MDMA, | ||
44 | .end = EXYNOS4_PA_SYSMMU_MDMA + SZ_64K - 1, | ||
45 | .flags = IORESOURCE_MEM, | ||
46 | }, | ||
47 | [1] = { | ||
48 | .start = IRQ_SYSMMU_MDMA0_0, | ||
49 | .end = IRQ_SYSMMU_MDMA0_0, | ||
50 | .flags = IORESOURCE_IRQ, | ||
51 | }, | ||
52 | [2] = { | ||
53 | .start = EXYNOS4_PA_SYSMMU_SSS, | ||
54 | .end = EXYNOS4_PA_SYSMMU_SSS + SZ_64K - 1, | ||
55 | .flags = IORESOURCE_MEM, | ||
56 | }, | ||
57 | [3] = { | ||
58 | .start = IRQ_SYSMMU_SSS_0, | ||
59 | .end = IRQ_SYSMMU_SSS_0, | ||
60 | .flags = IORESOURCE_IRQ, | ||
61 | }, | ||
62 | [4] = { | ||
63 | .start = EXYNOS4_PA_SYSMMU_FIMC0, | ||
64 | .end = EXYNOS4_PA_SYSMMU_FIMC0 + SZ_64K - 1, | ||
65 | .flags = IORESOURCE_MEM, | ||
66 | }, | ||
67 | [5] = { | ||
68 | .start = IRQ_SYSMMU_FIMC0_0, | ||
69 | .end = IRQ_SYSMMU_FIMC0_0, | ||
70 | .flags = IORESOURCE_IRQ, | ||
71 | }, | ||
72 | [6] = { | ||
73 | .start = EXYNOS4_PA_SYSMMU_FIMC1, | ||
74 | .end = EXYNOS4_PA_SYSMMU_FIMC1 + SZ_64K - 1, | ||
75 | .flags = IORESOURCE_MEM, | ||
76 | }, | ||
77 | [7] = { | ||
78 | .start = IRQ_SYSMMU_FIMC1_0, | ||
79 | .end = IRQ_SYSMMU_FIMC1_0, | ||
80 | .flags = IORESOURCE_IRQ, | ||
81 | }, | ||
82 | [8] = { | ||
83 | .start = EXYNOS4_PA_SYSMMU_FIMC2, | ||
84 | .end = EXYNOS4_PA_SYSMMU_FIMC2 + SZ_64K - 1, | ||
85 | .flags = IORESOURCE_MEM, | ||
86 | }, | ||
87 | [9] = { | ||
88 | .start = IRQ_SYSMMU_FIMC2_0, | ||
89 | .end = IRQ_SYSMMU_FIMC2_0, | ||
90 | .flags = IORESOURCE_IRQ, | ||
91 | }, | ||
92 | [10] = { | ||
93 | .start = EXYNOS4_PA_SYSMMU_FIMC3, | ||
94 | .end = EXYNOS4_PA_SYSMMU_FIMC3 + SZ_64K - 1, | ||
95 | .flags = IORESOURCE_MEM, | ||
96 | }, | ||
97 | [11] = { | ||
98 | .start = IRQ_SYSMMU_FIMC3_0, | ||
99 | .end = IRQ_SYSMMU_FIMC3_0, | ||
100 | .flags = IORESOURCE_IRQ, | ||
101 | }, | ||
102 | [12] = { | ||
103 | .start = EXYNOS4_PA_SYSMMU_JPEG, | ||
104 | .end = EXYNOS4_PA_SYSMMU_JPEG + SZ_64K - 1, | ||
105 | .flags = IORESOURCE_MEM, | ||
106 | }, | ||
107 | [13] = { | ||
108 | .start = IRQ_SYSMMU_JPEG_0, | ||
109 | .end = IRQ_SYSMMU_JPEG_0, | ||
110 | .flags = IORESOURCE_IRQ, | ||
111 | }, | ||
112 | [14] = { | ||
113 | .start = EXYNOS4_PA_SYSMMU_FIMD0, | ||
114 | .end = EXYNOS4_PA_SYSMMU_FIMD0 + SZ_64K - 1, | ||
115 | .flags = IORESOURCE_MEM, | ||
116 | }, | ||
117 | [15] = { | ||
118 | .start = IRQ_SYSMMU_LCD0_M0_0, | ||
119 | .end = IRQ_SYSMMU_LCD0_M0_0, | ||
120 | .flags = IORESOURCE_IRQ, | ||
121 | }, | ||
122 | [16] = { | ||
123 | .start = EXYNOS4_PA_SYSMMU_FIMD1, | ||
124 | .end = EXYNOS4_PA_SYSMMU_FIMD1 + SZ_64K - 1, | ||
125 | .flags = IORESOURCE_MEM, | ||
126 | }, | ||
127 | [17] = { | ||
128 | .start = IRQ_SYSMMU_LCD1_M1_0, | ||
129 | .end = IRQ_SYSMMU_LCD1_M1_0, | ||
130 | .flags = IORESOURCE_IRQ, | ||
131 | }, | ||
132 | [18] = { | ||
133 | .start = EXYNOS4_PA_SYSMMU_PCIe, | ||
134 | .end = EXYNOS4_PA_SYSMMU_PCIe + SZ_64K - 1, | ||
135 | .flags = IORESOURCE_MEM, | ||
136 | }, | ||
137 | [19] = { | ||
138 | .start = IRQ_SYSMMU_PCIE_0, | ||
139 | .end = IRQ_SYSMMU_PCIE_0, | ||
140 | .flags = IORESOURCE_IRQ, | ||
141 | }, | ||
142 | [20] = { | ||
143 | .start = EXYNOS4_PA_SYSMMU_G2D, | ||
144 | .end = EXYNOS4_PA_SYSMMU_G2D + SZ_64K - 1, | ||
145 | .flags = IORESOURCE_MEM, | ||
146 | }, | ||
147 | [21] = { | ||
148 | .start = IRQ_SYSMMU_2D_0, | ||
149 | .end = IRQ_SYSMMU_2D_0, | ||
150 | .flags = IORESOURCE_IRQ, | ||
151 | }, | ||
152 | [22] = { | ||
153 | .start = EXYNOS4_PA_SYSMMU_ROTATOR, | ||
154 | .end = EXYNOS4_PA_SYSMMU_ROTATOR + SZ_64K - 1, | ||
155 | .flags = IORESOURCE_MEM, | ||
156 | }, | ||
157 | [23] = { | ||
158 | .start = IRQ_SYSMMU_ROTATOR_0, | ||
159 | .end = IRQ_SYSMMU_ROTATOR_0, | ||
160 | .flags = IORESOURCE_IRQ, | ||
161 | }, | ||
162 | [24] = { | ||
163 | .start = EXYNOS4_PA_SYSMMU_MDMA2, | ||
164 | .end = EXYNOS4_PA_SYSMMU_MDMA2 + SZ_64K - 1, | ||
165 | .flags = IORESOURCE_MEM, | ||
166 | }, | ||
167 | [25] = { | ||
168 | .start = IRQ_SYSMMU_MDMA1_0, | ||
169 | .end = IRQ_SYSMMU_MDMA1_0, | ||
170 | .flags = IORESOURCE_IRQ, | ||
171 | }, | ||
172 | [26] = { | ||
173 | .start = EXYNOS4_PA_SYSMMU_TV, | ||
174 | .end = EXYNOS4_PA_SYSMMU_TV + SZ_64K - 1, | ||
175 | .flags = IORESOURCE_MEM, | ||
176 | }, | ||
177 | [27] = { | ||
178 | .start = IRQ_SYSMMU_TV_M0_0, | ||
179 | .end = IRQ_SYSMMU_TV_M0_0, | ||
180 | .flags = IORESOURCE_IRQ, | ||
181 | }, | ||
182 | [28] = { | ||
183 | .start = EXYNOS4_PA_SYSMMU_MFC_L, | ||
184 | .end = EXYNOS4_PA_SYSMMU_MFC_L + SZ_64K - 1, | ||
185 | .flags = IORESOURCE_MEM, | ||
186 | }, | ||
187 | [29] = { | ||
188 | .start = IRQ_SYSMMU_MFC_M0_0, | ||
189 | .end = IRQ_SYSMMU_MFC_M0_0, | ||
190 | .flags = IORESOURCE_IRQ, | ||
191 | }, | ||
192 | [30] = { | ||
193 | .start = EXYNOS4_PA_SYSMMU_MFC_R, | ||
194 | .end = EXYNOS4_PA_SYSMMU_MFC_R + SZ_64K - 1, | ||
195 | .flags = IORESOURCE_MEM, | ||
196 | }, | ||
197 | [31] = { | ||
198 | .start = IRQ_SYSMMU_MFC_M1_0, | ||
199 | .end = IRQ_SYSMMU_MFC_M1_0, | ||
200 | .flags = IORESOURCE_IRQ, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | struct platform_device exynos4_device_sysmmu = { | ||
205 | .name = "s5p-sysmmu", | ||
206 | .id = 32, | ||
207 | .num_resources = ARRAY_SIZE(exynos4_sysmmu_resource), | ||
208 | .resource = exynos4_sysmmu_resource, | ||
209 | }; | ||
210 | EXPORT_SYMBOL(exynos4_device_sysmmu); | ||
211 | |||
212 | static struct clk *sysmmu_clk[S5P_SYSMMU_TOTAL_IPNUM]; | ||
213 | void sysmmu_clk_init(struct device *dev, sysmmu_ips ips) | ||
214 | { | ||
215 | sysmmu_clk[ips] = clk_get(dev, sysmmu_ips_name[ips]); | ||
216 | if (IS_ERR(sysmmu_clk[ips])) | ||
217 | sysmmu_clk[ips] = NULL; | ||
218 | else | ||
219 | clk_put(sysmmu_clk[ips]); | ||
220 | } | ||
221 | |||
222 | void sysmmu_clk_enable(sysmmu_ips ips) | ||
223 | { | ||
224 | if (sysmmu_clk[ips]) | ||
225 | clk_enable(sysmmu_clk[ips]); | ||
226 | } | ||
227 | |||
228 | void sysmmu_clk_disable(sysmmu_ips ips) | ||
229 | { | ||
230 | if (sysmmu_clk[ips]) | ||
231 | clk_disable(sysmmu_clk[ips]); | ||
232 | } | ||
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c new file mode 100644 index 000000000000..9667c61e64fb --- /dev/null +++ b/arch/arm/mach-exynos/dma.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
7 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
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 as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | #include <linux/dma-mapping.h> | ||
25 | #include <linux/amba/bus.h> | ||
26 | #include <linux/amba/pl330.h> | ||
27 | |||
28 | #include <asm/irq.h> | ||
29 | #include <plat/devs.h> | ||
30 | #include <plat/irqs.h> | ||
31 | |||
32 | #include <mach/map.h> | ||
33 | #include <mach/irqs.h> | ||
34 | #include <mach/dma.h> | ||
35 | |||
36 | static u64 dma_dmamask = DMA_BIT_MASK(32); | ||
37 | |||
38 | struct dma_pl330_peri pdma0_peri[28] = { | ||
39 | { | ||
40 | .peri_id = (u8)DMACH_PCM0_RX, | ||
41 | .rqtype = DEVTOMEM, | ||
42 | }, { | ||
43 | .peri_id = (u8)DMACH_PCM0_TX, | ||
44 | .rqtype = MEMTODEV, | ||
45 | }, { | ||
46 | .peri_id = (u8)DMACH_PCM2_RX, | ||
47 | .rqtype = DEVTOMEM, | ||
48 | }, { | ||
49 | .peri_id = (u8)DMACH_PCM2_TX, | ||
50 | .rqtype = MEMTODEV, | ||
51 | }, { | ||
52 | .peri_id = (u8)DMACH_MSM_REQ0, | ||
53 | }, { | ||
54 | .peri_id = (u8)DMACH_MSM_REQ2, | ||
55 | }, { | ||
56 | .peri_id = (u8)DMACH_SPI0_RX, | ||
57 | .rqtype = DEVTOMEM, | ||
58 | }, { | ||
59 | .peri_id = (u8)DMACH_SPI0_TX, | ||
60 | .rqtype = MEMTODEV, | ||
61 | }, { | ||
62 | .peri_id = (u8)DMACH_SPI2_RX, | ||
63 | .rqtype = DEVTOMEM, | ||
64 | }, { | ||
65 | .peri_id = (u8)DMACH_SPI2_TX, | ||
66 | .rqtype = MEMTODEV, | ||
67 | }, { | ||
68 | .peri_id = (u8)DMACH_I2S0S_TX, | ||
69 | .rqtype = MEMTODEV, | ||
70 | }, { | ||
71 | .peri_id = (u8)DMACH_I2S0_RX, | ||
72 | .rqtype = DEVTOMEM, | ||
73 | }, { | ||
74 | .peri_id = (u8)DMACH_I2S0_TX, | ||
75 | .rqtype = MEMTODEV, | ||
76 | }, { | ||
77 | .peri_id = (u8)DMACH_UART0_RX, | ||
78 | .rqtype = DEVTOMEM, | ||
79 | }, { | ||
80 | .peri_id = (u8)DMACH_UART0_TX, | ||
81 | .rqtype = MEMTODEV, | ||
82 | }, { | ||
83 | .peri_id = (u8)DMACH_UART2_RX, | ||
84 | .rqtype = DEVTOMEM, | ||
85 | }, { | ||
86 | .peri_id = (u8)DMACH_UART2_TX, | ||
87 | .rqtype = MEMTODEV, | ||
88 | }, { | ||
89 | .peri_id = (u8)DMACH_UART4_RX, | ||
90 | .rqtype = DEVTOMEM, | ||
91 | }, { | ||
92 | .peri_id = (u8)DMACH_UART4_TX, | ||
93 | .rqtype = MEMTODEV, | ||
94 | }, { | ||
95 | .peri_id = (u8)DMACH_SLIMBUS0_RX, | ||
96 | .rqtype = DEVTOMEM, | ||
97 | }, { | ||
98 | .peri_id = (u8)DMACH_SLIMBUS0_TX, | ||
99 | .rqtype = MEMTODEV, | ||
100 | }, { | ||
101 | .peri_id = (u8)DMACH_SLIMBUS2_RX, | ||
102 | .rqtype = DEVTOMEM, | ||
103 | }, { | ||
104 | .peri_id = (u8)DMACH_SLIMBUS2_TX, | ||
105 | .rqtype = MEMTODEV, | ||
106 | }, { | ||
107 | .peri_id = (u8)DMACH_SLIMBUS4_RX, | ||
108 | .rqtype = DEVTOMEM, | ||
109 | }, { | ||
110 | .peri_id = (u8)DMACH_SLIMBUS4_TX, | ||
111 | .rqtype = MEMTODEV, | ||
112 | }, { | ||
113 | .peri_id = (u8)DMACH_AC97_MICIN, | ||
114 | .rqtype = DEVTOMEM, | ||
115 | }, { | ||
116 | .peri_id = (u8)DMACH_AC97_PCMIN, | ||
117 | .rqtype = DEVTOMEM, | ||
118 | }, { | ||
119 | .peri_id = (u8)DMACH_AC97_PCMOUT, | ||
120 | .rqtype = MEMTODEV, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | struct dma_pl330_platdata exynos4_pdma0_pdata = { | ||
125 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), | ||
126 | .peri = pdma0_peri, | ||
127 | }; | ||
128 | |||
129 | struct amba_device exynos4_device_pdma0 = { | ||
130 | .dev = { | ||
131 | .init_name = "dma-pl330.0", | ||
132 | .dma_mask = &dma_dmamask, | ||
133 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
134 | .platform_data = &exynos4_pdma0_pdata, | ||
135 | }, | ||
136 | .res = { | ||
137 | .start = EXYNOS4_PA_PDMA0, | ||
138 | .end = EXYNOS4_PA_PDMA0 + SZ_4K, | ||
139 | .flags = IORESOURCE_MEM, | ||
140 | }, | ||
141 | .irq = {IRQ_PDMA0, NO_IRQ}, | ||
142 | .periphid = 0x00041330, | ||
143 | }; | ||
144 | |||
145 | struct dma_pl330_peri pdma1_peri[25] = { | ||
146 | { | ||
147 | .peri_id = (u8)DMACH_PCM0_RX, | ||
148 | .rqtype = DEVTOMEM, | ||
149 | }, { | ||
150 | .peri_id = (u8)DMACH_PCM0_TX, | ||
151 | .rqtype = MEMTODEV, | ||
152 | }, { | ||
153 | .peri_id = (u8)DMACH_PCM1_RX, | ||
154 | .rqtype = DEVTOMEM, | ||
155 | }, { | ||
156 | .peri_id = (u8)DMACH_PCM1_TX, | ||
157 | .rqtype = MEMTODEV, | ||
158 | }, { | ||
159 | .peri_id = (u8)DMACH_MSM_REQ1, | ||
160 | }, { | ||
161 | .peri_id = (u8)DMACH_MSM_REQ3, | ||
162 | }, { | ||
163 | .peri_id = (u8)DMACH_SPI1_RX, | ||
164 | .rqtype = DEVTOMEM, | ||
165 | }, { | ||
166 | .peri_id = (u8)DMACH_SPI1_TX, | ||
167 | .rqtype = MEMTODEV, | ||
168 | }, { | ||
169 | .peri_id = (u8)DMACH_I2S0S_TX, | ||
170 | .rqtype = MEMTODEV, | ||
171 | }, { | ||
172 | .peri_id = (u8)DMACH_I2S0_RX, | ||
173 | .rqtype = DEVTOMEM, | ||
174 | }, { | ||
175 | .peri_id = (u8)DMACH_I2S0_TX, | ||
176 | .rqtype = MEMTODEV, | ||
177 | }, { | ||
178 | .peri_id = (u8)DMACH_I2S1_RX, | ||
179 | .rqtype = DEVTOMEM, | ||
180 | }, { | ||
181 | .peri_id = (u8)DMACH_I2S1_TX, | ||
182 | .rqtype = MEMTODEV, | ||
183 | }, { | ||
184 | .peri_id = (u8)DMACH_UART0_RX, | ||
185 | .rqtype = DEVTOMEM, | ||
186 | }, { | ||
187 | .peri_id = (u8)DMACH_UART0_TX, | ||
188 | .rqtype = MEMTODEV, | ||
189 | }, { | ||
190 | .peri_id = (u8)DMACH_UART1_RX, | ||
191 | .rqtype = DEVTOMEM, | ||
192 | }, { | ||
193 | .peri_id = (u8)DMACH_UART1_TX, | ||
194 | .rqtype = MEMTODEV, | ||
195 | }, { | ||
196 | .peri_id = (u8)DMACH_UART3_RX, | ||
197 | .rqtype = DEVTOMEM, | ||
198 | }, { | ||
199 | .peri_id = (u8)DMACH_UART3_TX, | ||
200 | .rqtype = MEMTODEV, | ||
201 | }, { | ||
202 | .peri_id = (u8)DMACH_SLIMBUS1_RX, | ||
203 | .rqtype = DEVTOMEM, | ||
204 | }, { | ||
205 | .peri_id = (u8)DMACH_SLIMBUS1_TX, | ||
206 | .rqtype = MEMTODEV, | ||
207 | }, { | ||
208 | .peri_id = (u8)DMACH_SLIMBUS3_RX, | ||
209 | .rqtype = DEVTOMEM, | ||
210 | }, { | ||
211 | .peri_id = (u8)DMACH_SLIMBUS3_TX, | ||
212 | .rqtype = MEMTODEV, | ||
213 | }, { | ||
214 | .peri_id = (u8)DMACH_SLIMBUS5_RX, | ||
215 | .rqtype = DEVTOMEM, | ||
216 | }, { | ||
217 | .peri_id = (u8)DMACH_SLIMBUS5_TX, | ||
218 | .rqtype = MEMTODEV, | ||
219 | }, | ||
220 | }; | ||
221 | |||
222 | struct dma_pl330_platdata exynos4_pdma1_pdata = { | ||
223 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), | ||
224 | .peri = pdma1_peri, | ||
225 | }; | ||
226 | |||
227 | struct amba_device exynos4_device_pdma1 = { | ||
228 | .dev = { | ||
229 | .init_name = "dma-pl330.1", | ||
230 | .dma_mask = &dma_dmamask, | ||
231 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
232 | .platform_data = &exynos4_pdma1_pdata, | ||
233 | }, | ||
234 | .res = { | ||
235 | .start = EXYNOS4_PA_PDMA1, | ||
236 | .end = EXYNOS4_PA_PDMA1 + SZ_4K, | ||
237 | .flags = IORESOURCE_MEM, | ||
238 | }, | ||
239 | .irq = {IRQ_PDMA1, NO_IRQ}, | ||
240 | .periphid = 0x00041330, | ||
241 | }; | ||
242 | |||
243 | static int __init exynos4_dma_init(void) | ||
244 | { | ||
245 | amba_device_register(&exynos4_device_pdma0, &iomem_resource); | ||
246 | amba_device_register(&exynos4_device_pdma1, &iomem_resource); | ||
247 | |||
248 | return 0; | ||
249 | } | ||
250 | arch_initcall(exynos4_dma_init); | ||
diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S new file mode 100644 index 000000000000..3cdeb3647542 --- /dev/null +++ b/arch/arm/mach-exynos/headsmp.S | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/headsmp.S | ||
3 | * | ||
4 | * Cloned from linux/arch/arm/mach-realview/headsmp.S | ||
5 | * | ||
6 | * Copyright (c) 2003 ARM Limited | ||
7 | * All Rights Reserved | ||
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 | #include <linux/linkage.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | __CPUINIT | ||
17 | |||
18 | /* | ||
19 | * exynos4 specific entry point for secondary CPUs. This provides | ||
20 | * a "holding pen" into which all secondary cores are held until we're | ||
21 | * ready for them to initialise. | ||
22 | */ | ||
23 | ENTRY(exynos4_secondary_startup) | ||
24 | mrc p15, 0, r0, c0, c0, 5 | ||
25 | and r0, r0, #15 | ||
26 | adr r4, 1f | ||
27 | ldmia r4, {r5, r6} | ||
28 | sub r4, r4, r5 | ||
29 | add r6, r6, r4 | ||
30 | pen: ldr r7, [r6] | ||
31 | cmp r7, r0 | ||
32 | bne pen | ||
33 | |||
34 | /* | ||
35 | * we've been released from the holding pen: secondary_stack | ||
36 | * should now contain the SVC stack for this core | ||
37 | */ | ||
38 | b secondary_startup | ||
39 | |||
40 | 1: .long . | ||
41 | .long pen_release | ||
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c new file mode 100644 index 000000000000..da70e7e39937 --- /dev/null +++ b/arch/arm/mach-exynos/hotplug.c | |||
@@ -0,0 +1,133 @@ | |||
1 | /* linux arch/arm/mach-exynos4/hotplug.c | ||
2 | * | ||
3 | * Cloned from linux/arch/arm/mach-realview/hotplug.c | ||
4 | * | ||
5 | * Copyright (C) 2002 ARM Ltd. | ||
6 | * All Rights Reserved | ||
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/errno.h> | ||
15 | #include <linux/smp.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <asm/cacheflush.h> | ||
19 | |||
20 | #include <mach/regs-pmu.h> | ||
21 | |||
22 | extern volatile int pen_release; | ||
23 | |||
24 | static inline void cpu_enter_lowpower(void) | ||
25 | { | ||
26 | unsigned int v; | ||
27 | |||
28 | flush_cache_all(); | ||
29 | asm volatile( | ||
30 | " mcr p15, 0, %1, c7, c5, 0\n" | ||
31 | " mcr p15, 0, %1, c7, c10, 4\n" | ||
32 | /* | ||
33 | * Turn off coherency | ||
34 | */ | ||
35 | " mrc p15, 0, %0, c1, c0, 1\n" | ||
36 | " bic %0, %0, %3\n" | ||
37 | " mcr p15, 0, %0, c1, c0, 1\n" | ||
38 | " mrc p15, 0, %0, c1, c0, 0\n" | ||
39 | " bic %0, %0, %2\n" | ||
40 | " mcr p15, 0, %0, c1, c0, 0\n" | ||
41 | : "=&r" (v) | ||
42 | : "r" (0), "Ir" (CR_C), "Ir" (0x40) | ||
43 | : "cc"); | ||
44 | } | ||
45 | |||
46 | static inline void cpu_leave_lowpower(void) | ||
47 | { | ||
48 | unsigned int v; | ||
49 | |||
50 | asm volatile( | ||
51 | "mrc p15, 0, %0, c1, c0, 0\n" | ||
52 | " orr %0, %0, %1\n" | ||
53 | " mcr p15, 0, %0, c1, c0, 0\n" | ||
54 | " mrc p15, 0, %0, c1, c0, 1\n" | ||
55 | " orr %0, %0, %2\n" | ||
56 | " mcr p15, 0, %0, c1, c0, 1\n" | ||
57 | : "=&r" (v) | ||
58 | : "Ir" (CR_C), "Ir" (0x40) | ||
59 | : "cc"); | ||
60 | } | ||
61 | |||
62 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | ||
63 | { | ||
64 | for (;;) { | ||
65 | |||
66 | /* make cpu1 to be turned off at next WFI command */ | ||
67 | if (cpu == 1) | ||
68 | __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); | ||
69 | |||
70 | /* | ||
71 | * here's the WFI | ||
72 | */ | ||
73 | asm(".word 0xe320f003\n" | ||
74 | : | ||
75 | : | ||
76 | : "memory", "cc"); | ||
77 | |||
78 | if (pen_release == cpu_logical_map(cpu)) { | ||
79 | /* | ||
80 | * OK, proper wakeup, we're done | ||
81 | */ | ||
82 | break; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * Getting here, means that we have come out of WFI without | ||
87 | * having been woken up - this shouldn't happen | ||
88 | * | ||
89 | * Just note it happening - when we're woken, we can report | ||
90 | * its occurrence. | ||
91 | */ | ||
92 | (*spurious)++; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | int platform_cpu_kill(unsigned int cpu) | ||
97 | { | ||
98 | return 1; | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * platform-specific code to shutdown a CPU | ||
103 | * | ||
104 | * Called with IRQs disabled | ||
105 | */ | ||
106 | void platform_cpu_die(unsigned int cpu) | ||
107 | { | ||
108 | int spurious = 0; | ||
109 | |||
110 | /* | ||
111 | * we're ready for shutdown now, so do it | ||
112 | */ | ||
113 | cpu_enter_lowpower(); | ||
114 | platform_do_lowpower(cpu, &spurious); | ||
115 | |||
116 | /* | ||
117 | * bring this CPU back into the world of cache | ||
118 | * coherency, and then restore interrupts | ||
119 | */ | ||
120 | cpu_leave_lowpower(); | ||
121 | |||
122 | if (spurious) | ||
123 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); | ||
124 | } | ||
125 | |||
126 | int platform_cpu_disable(unsigned int cpu) | ||
127 | { | ||
128 | /* | ||
129 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
130 | * e.g. clock tick interrupts) | ||
131 | */ | ||
132 | return cpu == 0 ? -EPERM : 0; | ||
133 | } | ||
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/mach-exynos/include/mach/debug-macro.S new file mode 100644 index 000000000000..6cacf16a67a6 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/debug-macro.S | |||
@@ -0,0 +1,35 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/debug-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S | ||
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 | /* pull in the relevant register and map files. */ | ||
14 | |||
15 | #include <mach/map.h> | ||
16 | |||
17 | /* note, for the boot process to work we have to keep the UART | ||
18 | * virtual address aligned to an 1MiB boundary for the L1 | ||
19 | * mapping the head code makes. We keep the UART virtual address | ||
20 | * aligned and add in the offset when we load the value here. | ||
21 | */ | ||
22 | |||
23 | .macro addruart, rp, rv, tmp | ||
24 | ldr \rp, = S3C_PA_UART | ||
25 | ldr \rv, = S3C_VA_UART | ||
26 | #if CONFIG_DEBUG_S3C_UART != 0 | ||
27 | add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART) | ||
28 | add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART) | ||
29 | #endif | ||
30 | .endm | ||
31 | |||
32 | #define fifo_full fifo_full_s5pv210 | ||
33 | #define fifo_level fifo_level_s5pv210 | ||
34 | |||
35 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-exynos/include/mach/dma.h b/arch/arm/mach-exynos/include/mach/dma.h new file mode 100644 index 000000000000..201842a3769e --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/dma.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
3 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef __MACH_DMA_H | ||
21 | #define __MACH_DMA_H | ||
22 | |||
23 | /* This platform uses the common DMA API driver for PL330 */ | ||
24 | #include <plat/dma-pl330.h> | ||
25 | |||
26 | #endif /* __MACH_DMA_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/dwmci.h b/arch/arm/mach-exynos/include/mach/dwmci.h new file mode 100644 index 000000000000..7ce657459cc0 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/dwmci.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/dwmci.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Synopsys DesignWare Mobile Storage for EXYNOS4210 | ||
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 | #ifndef __ASM_ARM_ARCH_DWMCI_H | ||
14 | #define __ASM_ARM_ARCH_DWMCI_H __FILE__ | ||
15 | |||
16 | #include <linux/mmc/dw_mmc.h> | ||
17 | |||
18 | extern void exynos4_dwmci_set_platdata(struct dw_mci_board *pd); | ||
19 | |||
20 | #endif /* __ASM_ARM_ARCH_DWMCI_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/entry-macro.S b/arch/arm/mach-exynos/include/mach/entry-macro.S new file mode 100644 index 000000000000..f5e9fd8e37b4 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/entry-macro.S | |||
@@ -0,0 +1,91 @@ | |||
1 | /* arch/arm/mach-exynos4/include/mach/entry-macro.S | ||
2 | * | ||
3 | * Cloned from arch/arm/mach-realview/include/mach/entry-macro.S | ||
4 | * | ||
5 | * Low-level IRQ helper macros for EXYNOS4 platforms | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <mach/hardware.h> | ||
13 | #include <mach/map.h> | ||
14 | #include <asm/hardware/gic.h> | ||
15 | |||
16 | .macro disable_fiq | ||
17 | .endm | ||
18 | |||
19 | .macro get_irqnr_preamble, base, tmp | ||
20 | mov \tmp, #0 | ||
21 | |||
22 | mrc p15, 0, \base, c0, c0, 5 | ||
23 | and \base, \base, #3 | ||
24 | cmp \base, #0 | ||
25 | beq 1f | ||
26 | |||
27 | ldr \tmp, =gic_bank_offset | ||
28 | ldr \tmp, [\tmp] | ||
29 | cmp \base, #1 | ||
30 | beq 1f | ||
31 | |||
32 | cmp \base, #2 | ||
33 | addeq \tmp, \tmp, \tmp | ||
34 | addne \tmp, \tmp, \tmp, LSL #1 | ||
35 | |||
36 | 1: ldr \base, =gic_cpu_base_addr | ||
37 | ldr \base, [\base] | ||
38 | add \base, \base, \tmp | ||
39 | .endm | ||
40 | |||
41 | .macro arch_ret_to_user, tmp1, tmp2 | ||
42 | .endm | ||
43 | |||
44 | /* | ||
45 | * The interrupt numbering scheme is defined in the | ||
46 | * interrupt controller spec. To wit: | ||
47 | * | ||
48 | * Interrupts 0-15 are IPI | ||
49 | * 16-28 are reserved | ||
50 | * 29-31 are local. We allow 30 to be used for the watchdog. | ||
51 | * 32-1020 are global | ||
52 | * 1021-1022 are reserved | ||
53 | * 1023 is "spurious" (no interrupt) | ||
54 | * | ||
55 | * For now, we ignore all local interrupts so only return an interrupt if it's | ||
56 | * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs. | ||
57 | * | ||
58 | * A simple read from the controller will tell us the number of the highest | ||
59 | * priority enabled interrupt. We then just need to check whether it is in the | ||
60 | * valid range for an IRQ (30-1020 inclusive). | ||
61 | */ | ||
62 | |||
63 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
64 | |||
65 | ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */ | ||
66 | |||
67 | ldr \tmp, =1021 | ||
68 | |||
69 | bic \irqnr, \irqstat, #0x1c00 | ||
70 | |||
71 | cmp \irqnr, #15 | ||
72 | cmpcc \irqnr, \irqnr | ||
73 | cmpne \irqnr, \tmp | ||
74 | cmpcs \irqnr, \irqnr | ||
75 | addne \irqnr, \irqnr, #32 | ||
76 | |||
77 | .endm | ||
78 | |||
79 | /* We assume that irqstat (the raw value of the IRQ acknowledge | ||
80 | * register) is preserved from the macro above. | ||
81 | * If there is an IPI, we immediately signal end of interrupt on the | ||
82 | * controller, since this requires the original irqstat value which | ||
83 | * we won't easily be able to recreate later. | ||
84 | */ | ||
85 | |||
86 | .macro test_for_ipi, irqnr, irqstat, base, tmp | ||
87 | bic \irqnr, \irqstat, #0x1c00 | ||
88 | cmp \irqnr, #16 | ||
89 | strcc \irqstat, [\base, #GIC_CPU_EOI] | ||
90 | cmpcs \irqnr, \irqnr | ||
91 | .endm | ||
diff --git a/arch/arm/mach-exynos/include/mach/exynos4-clock.h b/arch/arm/mach-exynos/include/mach/exynos4-clock.h new file mode 100644 index 000000000000..a07fcbf55251 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/exynos4-clock.h | |||
@@ -0,0 +1,43 @@ | |||
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 | |||
19 | extern struct clk clk_sclk_hdmi27m; | ||
20 | extern struct clk clk_sclk_usbphy0; | ||
21 | extern struct clk clk_sclk_usbphy1; | ||
22 | extern struct clk clk_sclk_hdmiphy; | ||
23 | |||
24 | extern struct clksrc_clk clk_sclk_apll; | ||
25 | extern struct clksrc_clk clk_mout_mpll; | ||
26 | extern struct clksrc_clk clk_aclk_133; | ||
27 | extern struct clksrc_clk clk_mout_epll; | ||
28 | extern struct clksrc_clk clk_sclk_vpll; | ||
29 | |||
30 | extern struct clk *clkset_corebus_list[]; | ||
31 | extern struct clksrc_sources clkset_mout_corebus; | ||
32 | |||
33 | extern struct clk *clkset_aclk_top_list[]; | ||
34 | extern struct clksrc_sources clkset_aclk; | ||
35 | |||
36 | extern struct clk *clkset_group_list[]; | ||
37 | extern struct clksrc_sources clkset_group; | ||
38 | |||
39 | extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable); | ||
40 | extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable); | ||
41 | extern 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/gpio.h b/arch/arm/mach-exynos/include/mach/gpio.h new file mode 100644 index 000000000000..80523ca9bb49 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/gpio.h | |||
@@ -0,0 +1,149 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - GPIO lib 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 | #ifndef __ASM_ARCH_GPIO_H | ||
14 | #define __ASM_ARCH_GPIO_H __FILE__ | ||
15 | |||
16 | /* Practically, GPIO banks up to GPZ are the configurable gpio banks */ | ||
17 | |||
18 | /* GPIO bank sizes */ | ||
19 | #define EXYNOS4_GPIO_A0_NR (8) | ||
20 | #define EXYNOS4_GPIO_A1_NR (6) | ||
21 | #define EXYNOS4_GPIO_B_NR (8) | ||
22 | #define EXYNOS4_GPIO_C0_NR (5) | ||
23 | #define EXYNOS4_GPIO_C1_NR (5) | ||
24 | #define EXYNOS4_GPIO_D0_NR (4) | ||
25 | #define EXYNOS4_GPIO_D1_NR (4) | ||
26 | #define EXYNOS4_GPIO_E0_NR (5) | ||
27 | #define EXYNOS4_GPIO_E1_NR (8) | ||
28 | #define EXYNOS4_GPIO_E2_NR (6) | ||
29 | #define EXYNOS4_GPIO_E3_NR (8) | ||
30 | #define EXYNOS4_GPIO_E4_NR (8) | ||
31 | #define EXYNOS4_GPIO_F0_NR (8) | ||
32 | #define EXYNOS4_GPIO_F1_NR (8) | ||
33 | #define EXYNOS4_GPIO_F2_NR (8) | ||
34 | #define EXYNOS4_GPIO_F3_NR (6) | ||
35 | #define EXYNOS4_GPIO_J0_NR (8) | ||
36 | #define EXYNOS4_GPIO_J1_NR (5) | ||
37 | #define EXYNOS4_GPIO_K0_NR (7) | ||
38 | #define EXYNOS4_GPIO_K1_NR (7) | ||
39 | #define EXYNOS4_GPIO_K2_NR (7) | ||
40 | #define EXYNOS4_GPIO_K3_NR (7) | ||
41 | #define EXYNOS4_GPIO_L0_NR (8) | ||
42 | #define EXYNOS4_GPIO_L1_NR (3) | ||
43 | #define EXYNOS4_GPIO_L2_NR (8) | ||
44 | #define EXYNOS4_GPIO_X0_NR (8) | ||
45 | #define EXYNOS4_GPIO_X1_NR (8) | ||
46 | #define EXYNOS4_GPIO_X2_NR (8) | ||
47 | #define EXYNOS4_GPIO_X3_NR (8) | ||
48 | #define EXYNOS4_GPIO_Y0_NR (6) | ||
49 | #define EXYNOS4_GPIO_Y1_NR (4) | ||
50 | #define EXYNOS4_GPIO_Y2_NR (6) | ||
51 | #define EXYNOS4_GPIO_Y3_NR (8) | ||
52 | #define EXYNOS4_GPIO_Y4_NR (8) | ||
53 | #define EXYNOS4_GPIO_Y5_NR (8) | ||
54 | #define EXYNOS4_GPIO_Y6_NR (8) | ||
55 | #define EXYNOS4_GPIO_Z_NR (7) | ||
56 | |||
57 | /* GPIO bank numbers */ | ||
58 | |||
59 | #define EXYNOS4_GPIO_NEXT(__gpio) \ | ||
60 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) | ||
61 | |||
62 | enum s5p_gpio_number { | ||
63 | EXYNOS4_GPIO_A0_START = 0, | ||
64 | EXYNOS4_GPIO_A1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A0), | ||
65 | EXYNOS4_GPIO_B_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A1), | ||
66 | EXYNOS4_GPIO_C0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_B), | ||
67 | EXYNOS4_GPIO_C1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C0), | ||
68 | EXYNOS4_GPIO_D0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C1), | ||
69 | EXYNOS4_GPIO_D1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D0), | ||
70 | EXYNOS4_GPIO_E0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D1), | ||
71 | EXYNOS4_GPIO_E1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E0), | ||
72 | EXYNOS4_GPIO_E2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E1), | ||
73 | EXYNOS4_GPIO_E3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E2), | ||
74 | EXYNOS4_GPIO_E4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E3), | ||
75 | EXYNOS4_GPIO_F0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E4), | ||
76 | EXYNOS4_GPIO_F1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F0), | ||
77 | EXYNOS4_GPIO_F2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F1), | ||
78 | EXYNOS4_GPIO_F3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F2), | ||
79 | EXYNOS4_GPIO_J0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F3), | ||
80 | EXYNOS4_GPIO_J1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J0), | ||
81 | EXYNOS4_GPIO_K0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J1), | ||
82 | EXYNOS4_GPIO_K1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K0), | ||
83 | EXYNOS4_GPIO_K2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K1), | ||
84 | EXYNOS4_GPIO_K3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K2), | ||
85 | EXYNOS4_GPIO_L0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K3), | ||
86 | EXYNOS4_GPIO_L1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L0), | ||
87 | EXYNOS4_GPIO_L2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L1), | ||
88 | EXYNOS4_GPIO_X0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L2), | ||
89 | EXYNOS4_GPIO_X1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X0), | ||
90 | EXYNOS4_GPIO_X2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X1), | ||
91 | EXYNOS4_GPIO_X3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X2), | ||
92 | EXYNOS4_GPIO_Y0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X3), | ||
93 | EXYNOS4_GPIO_Y1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y0), | ||
94 | EXYNOS4_GPIO_Y2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y1), | ||
95 | EXYNOS4_GPIO_Y3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y2), | ||
96 | EXYNOS4_GPIO_Y4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y3), | ||
97 | EXYNOS4_GPIO_Y5_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y4), | ||
98 | EXYNOS4_GPIO_Y6_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y5), | ||
99 | EXYNOS4_GPIO_Z_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y6), | ||
100 | }; | ||
101 | |||
102 | /* EXYNOS4 GPIO number definitions */ | ||
103 | #define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr)) | ||
104 | #define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr)) | ||
105 | #define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr)) | ||
106 | #define EXYNOS4_GPC0(_nr) (EXYNOS4_GPIO_C0_START + (_nr)) | ||
107 | #define EXYNOS4_GPC1(_nr) (EXYNOS4_GPIO_C1_START + (_nr)) | ||
108 | #define EXYNOS4_GPD0(_nr) (EXYNOS4_GPIO_D0_START + (_nr)) | ||
109 | #define EXYNOS4_GPD1(_nr) (EXYNOS4_GPIO_D1_START + (_nr)) | ||
110 | #define EXYNOS4_GPE0(_nr) (EXYNOS4_GPIO_E0_START + (_nr)) | ||
111 | #define EXYNOS4_GPE1(_nr) (EXYNOS4_GPIO_E1_START + (_nr)) | ||
112 | #define EXYNOS4_GPE2(_nr) (EXYNOS4_GPIO_E2_START + (_nr)) | ||
113 | #define EXYNOS4_GPE3(_nr) (EXYNOS4_GPIO_E3_START + (_nr)) | ||
114 | #define EXYNOS4_GPE4(_nr) (EXYNOS4_GPIO_E4_START + (_nr)) | ||
115 | #define EXYNOS4_GPF0(_nr) (EXYNOS4_GPIO_F0_START + (_nr)) | ||
116 | #define EXYNOS4_GPF1(_nr) (EXYNOS4_GPIO_F1_START + (_nr)) | ||
117 | #define EXYNOS4_GPF2(_nr) (EXYNOS4_GPIO_F2_START + (_nr)) | ||
118 | #define EXYNOS4_GPF3(_nr) (EXYNOS4_GPIO_F3_START + (_nr)) | ||
119 | #define EXYNOS4_GPJ0(_nr) (EXYNOS4_GPIO_J0_START + (_nr)) | ||
120 | #define EXYNOS4_GPJ1(_nr) (EXYNOS4_GPIO_J1_START + (_nr)) | ||
121 | #define EXYNOS4_GPK0(_nr) (EXYNOS4_GPIO_K0_START + (_nr)) | ||
122 | #define EXYNOS4_GPK1(_nr) (EXYNOS4_GPIO_K1_START + (_nr)) | ||
123 | #define EXYNOS4_GPK2(_nr) (EXYNOS4_GPIO_K2_START + (_nr)) | ||
124 | #define EXYNOS4_GPK3(_nr) (EXYNOS4_GPIO_K3_START + (_nr)) | ||
125 | #define EXYNOS4_GPL0(_nr) (EXYNOS4_GPIO_L0_START + (_nr)) | ||
126 | #define EXYNOS4_GPL1(_nr) (EXYNOS4_GPIO_L1_START + (_nr)) | ||
127 | #define EXYNOS4_GPL2(_nr) (EXYNOS4_GPIO_L2_START + (_nr)) | ||
128 | #define EXYNOS4_GPX0(_nr) (EXYNOS4_GPIO_X0_START + (_nr)) | ||
129 | #define EXYNOS4_GPX1(_nr) (EXYNOS4_GPIO_X1_START + (_nr)) | ||
130 | #define EXYNOS4_GPX2(_nr) (EXYNOS4_GPIO_X2_START + (_nr)) | ||
131 | #define EXYNOS4_GPX3(_nr) (EXYNOS4_GPIO_X3_START + (_nr)) | ||
132 | #define EXYNOS4_GPY0(_nr) (EXYNOS4_GPIO_Y0_START + (_nr)) | ||
133 | #define EXYNOS4_GPY1(_nr) (EXYNOS4_GPIO_Y1_START + (_nr)) | ||
134 | #define EXYNOS4_GPY2(_nr) (EXYNOS4_GPIO_Y2_START + (_nr)) | ||
135 | #define EXYNOS4_GPY3(_nr) (EXYNOS4_GPIO_Y3_START + (_nr)) | ||
136 | #define EXYNOS4_GPY4(_nr) (EXYNOS4_GPIO_Y4_START + (_nr)) | ||
137 | #define EXYNOS4_GPY5(_nr) (EXYNOS4_GPIO_Y5_START + (_nr)) | ||
138 | #define EXYNOS4_GPY6(_nr) (EXYNOS4_GPIO_Y6_START + (_nr)) | ||
139 | #define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr)) | ||
140 | |||
141 | /* the end of the EXYNOS4 specific gpios */ | ||
142 | #define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1) | ||
143 | #define S3C_GPIO_END EXYNOS4_GPIO_END | ||
144 | |||
145 | /* define the number of gpios we need to the one after the GPZ() range */ | ||
146 | #define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ | ||
147 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) | ||
148 | |||
149 | #endif /* __ASM_ARCH_GPIO_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/hardware.h b/arch/arm/mach-exynos/include/mach/hardware.h new file mode 100644 index 000000000000..5109eb232f23 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/hardware.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/hardware.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Hardware 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 | #ifndef __ASM_ARCH_HARDWARE_H | ||
14 | #define __ASM_ARCH_HARDWARE_H __FILE__ | ||
15 | |||
16 | /* currently nothing here, placeholder */ | ||
17 | |||
18 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/io.h b/arch/arm/mach-exynos/include/mach/io.h new file mode 100644 index 000000000000..d5478d247535 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/io.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/io.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org> | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6442/include/mach/io.h | ||
9 | * | ||
10 | * Default IO routines for EXYNOS4 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARM_ARCH_IO_H | ||
18 | #define __ASM_ARM_ARCH_IO_H __FILE__ | ||
19 | |||
20 | /* No current ISA/PCI bus support. */ | ||
21 | #define __io(a) __typesafe_io(a) | ||
22 | #define __mem_pci(a) (a) | ||
23 | |||
24 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
25 | |||
26 | #endif /* __ASM_ARM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h new file mode 100644 index 000000000000..dfd4b7eecb90 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/irqs.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/irqs.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - IRQ definitions | ||
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 | #ifndef __ASM_ARCH_IRQS_H | ||
14 | #define __ASM_ARCH_IRQS_H __FILE__ | ||
15 | |||
16 | #include <plat/irqs.h> | ||
17 | |||
18 | /* PPI: Private Peripheral Interrupt */ | ||
19 | |||
20 | #define IRQ_PPI(x) S5P_IRQ(x+16) | ||
21 | |||
22 | #define IRQ_MCT_LOCALTIMER IRQ_PPI(12) | ||
23 | |||
24 | /* SPI: Shared Peripheral Interrupt */ | ||
25 | |||
26 | #define IRQ_SPI(x) S5P_IRQ(x+32) | ||
27 | |||
28 | #define IRQ_EINT0 IRQ_SPI(16) | ||
29 | #define IRQ_EINT1 IRQ_SPI(17) | ||
30 | #define IRQ_EINT2 IRQ_SPI(18) | ||
31 | #define IRQ_EINT3 IRQ_SPI(19) | ||
32 | #define IRQ_EINT4 IRQ_SPI(20) | ||
33 | #define IRQ_EINT5 IRQ_SPI(21) | ||
34 | #define IRQ_EINT6 IRQ_SPI(22) | ||
35 | #define IRQ_EINT7 IRQ_SPI(23) | ||
36 | #define IRQ_EINT8 IRQ_SPI(24) | ||
37 | #define IRQ_EINT9 IRQ_SPI(25) | ||
38 | #define IRQ_EINT10 IRQ_SPI(26) | ||
39 | #define IRQ_EINT11 IRQ_SPI(27) | ||
40 | #define IRQ_EINT12 IRQ_SPI(28) | ||
41 | #define IRQ_EINT13 IRQ_SPI(29) | ||
42 | #define IRQ_EINT14 IRQ_SPI(30) | ||
43 | #define IRQ_EINT15 IRQ_SPI(31) | ||
44 | #define IRQ_EINT16_31 IRQ_SPI(32) | ||
45 | |||
46 | #define IRQ_PDMA0 IRQ_SPI(35) | ||
47 | #define IRQ_PDMA1 IRQ_SPI(36) | ||
48 | #define IRQ_TIMER0_VIC IRQ_SPI(37) | ||
49 | #define IRQ_TIMER1_VIC IRQ_SPI(38) | ||
50 | #define IRQ_TIMER2_VIC IRQ_SPI(39) | ||
51 | #define IRQ_TIMER3_VIC IRQ_SPI(40) | ||
52 | #define IRQ_TIMER4_VIC IRQ_SPI(41) | ||
53 | #define IRQ_MCT_L0 IRQ_SPI(42) | ||
54 | #define IRQ_WDT IRQ_SPI(43) | ||
55 | #define IRQ_RTC_ALARM IRQ_SPI(44) | ||
56 | #define IRQ_RTC_TIC IRQ_SPI(45) | ||
57 | #define IRQ_GPIO_XB IRQ_SPI(46) | ||
58 | #define IRQ_GPIO_XA IRQ_SPI(47) | ||
59 | #define IRQ_MCT_L1 IRQ_SPI(48) | ||
60 | |||
61 | #define IRQ_UART0 IRQ_SPI(52) | ||
62 | #define IRQ_UART1 IRQ_SPI(53) | ||
63 | #define IRQ_UART2 IRQ_SPI(54) | ||
64 | #define IRQ_UART3 IRQ_SPI(55) | ||
65 | #define IRQ_UART4 IRQ_SPI(56) | ||
66 | #define IRQ_MCT_G0 IRQ_SPI(57) | ||
67 | #define IRQ_IIC IRQ_SPI(58) | ||
68 | #define IRQ_IIC1 IRQ_SPI(59) | ||
69 | #define IRQ_IIC2 IRQ_SPI(60) | ||
70 | #define IRQ_IIC3 IRQ_SPI(61) | ||
71 | #define IRQ_IIC4 IRQ_SPI(62) | ||
72 | #define IRQ_IIC5 IRQ_SPI(63) | ||
73 | #define IRQ_IIC6 IRQ_SPI(64) | ||
74 | #define IRQ_IIC7 IRQ_SPI(65) | ||
75 | |||
76 | #define IRQ_USB_HOST IRQ_SPI(70) | ||
77 | #define IRQ_USB_HSOTG IRQ_SPI(71) | ||
78 | #define IRQ_MODEM_IF IRQ_SPI(72) | ||
79 | #define IRQ_HSMMC0 IRQ_SPI(73) | ||
80 | #define IRQ_HSMMC1 IRQ_SPI(74) | ||
81 | #define IRQ_HSMMC2 IRQ_SPI(75) | ||
82 | #define IRQ_HSMMC3 IRQ_SPI(76) | ||
83 | #define IRQ_DWMCI IRQ_SPI(77) | ||
84 | |||
85 | #define IRQ_MIPI_CSIS0 IRQ_SPI(78) | ||
86 | #define IRQ_MIPI_CSIS1 IRQ_SPI(80) | ||
87 | |||
88 | #define IRQ_ONENAND_AUDI IRQ_SPI(82) | ||
89 | #define IRQ_ROTATOR IRQ_SPI(83) | ||
90 | #define IRQ_FIMC0 IRQ_SPI(84) | ||
91 | #define IRQ_FIMC1 IRQ_SPI(85) | ||
92 | #define IRQ_FIMC2 IRQ_SPI(86) | ||
93 | #define IRQ_FIMC3 IRQ_SPI(87) | ||
94 | #define IRQ_JPEG IRQ_SPI(88) | ||
95 | #define IRQ_2D IRQ_SPI(89) | ||
96 | #define IRQ_PCIE IRQ_SPI(90) | ||
97 | |||
98 | #define IRQ_MIXER IRQ_SPI(91) | ||
99 | #define IRQ_HDMI IRQ_SPI(92) | ||
100 | #define IRQ_IIC_HDMIPHY IRQ_SPI(93) | ||
101 | #define IRQ_MFC IRQ_SPI(94) | ||
102 | #define IRQ_SDO IRQ_SPI(95) | ||
103 | |||
104 | #define IRQ_AUDIO_SS IRQ_SPI(96) | ||
105 | #define IRQ_I2S0 IRQ_SPI(97) | ||
106 | #define IRQ_I2S1 IRQ_SPI(98) | ||
107 | #define IRQ_I2S2 IRQ_SPI(99) | ||
108 | #define IRQ_AC97 IRQ_SPI(100) | ||
109 | |||
110 | #define IRQ_SPDIF IRQ_SPI(104) | ||
111 | #define IRQ_ADC0 IRQ_SPI(105) | ||
112 | #define IRQ_PEN0 IRQ_SPI(106) | ||
113 | #define IRQ_ADC1 IRQ_SPI(107) | ||
114 | #define IRQ_PEN1 IRQ_SPI(108) | ||
115 | #define IRQ_KEYPAD IRQ_SPI(109) | ||
116 | #define IRQ_PMU IRQ_SPI(110) | ||
117 | #define IRQ_GPS IRQ_SPI(111) | ||
118 | #define IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) | ||
119 | #define IRQ_SLIMBUS IRQ_SPI(113) | ||
120 | |||
121 | #define IRQ_TSI IRQ_SPI(115) | ||
122 | #define IRQ_SATA IRQ_SPI(116) | ||
123 | |||
124 | #define MAX_IRQ_IN_COMBINER 8 | ||
125 | #define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128)) | ||
126 | #define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) | ||
127 | |||
128 | #define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) | ||
129 | #define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1) | ||
130 | #define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2) | ||
131 | #define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3) | ||
132 | #define IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4) | ||
133 | #define IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5) | ||
134 | #define IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6) | ||
135 | #define IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7) | ||
136 | |||
137 | #define IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0) | ||
138 | #define IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1) | ||
139 | #define IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2) | ||
140 | #define IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3) | ||
141 | #define IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4) | ||
142 | #define IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5) | ||
143 | #define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6) | ||
144 | #define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7) | ||
145 | |||
146 | #define IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0) | ||
147 | #define IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) | ||
148 | #define IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) | ||
149 | |||
150 | #define MAX_COMBINER_NR 16 | ||
151 | |||
152 | #define IRQ_ADC IRQ_ADC0 | ||
153 | #define IRQ_TC IRQ_PEN0 | ||
154 | |||
155 | #define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) | ||
156 | |||
157 | #define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE + 0) | ||
158 | #define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE + 16) | ||
159 | |||
160 | /* optional GPIO interrupts */ | ||
161 | #define S5P_GPIOINT_BASE (S5P_IRQ_EINT_BASE + 32) | ||
162 | #define IRQ_GPIO1_NR_GROUPS 16 | ||
163 | #define IRQ_GPIO2_NR_GROUPS 9 | ||
164 | #define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT) | ||
165 | |||
166 | /* Set the default NR_IRQS */ | ||
167 | #define NR_IRQS (IRQ_GPIO_END + 64) | ||
168 | |||
169 | #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 new file mode 100644 index 000000000000..058541d45af0 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* linux/arch/arm/mach-exynos/include/mach/map.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * EXYNOS4 - Memory map definitions | ||
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 | #ifndef __ASM_ARCH_MAP_H | ||
14 | #define __ASM_ARCH_MAP_H __FILE__ | ||
15 | |||
16 | #include <plat/map-base.h> | ||
17 | |||
18 | /* | ||
19 | * EXYNOS4 UART offset is 0x10000 but the older S5P SoCs are 0x400. | ||
20 | * So need to define it, and here is to avoid redefinition warning. | ||
21 | */ | ||
22 | #define S3C_UART_OFFSET (0x10000) | ||
23 | |||
24 | #include <plat/map-s5p.h> | ||
25 | |||
26 | #define EXYNOS4_PA_SYSRAM0 0x02025000 | ||
27 | #define EXYNOS4_PA_SYSRAM1 0x02020000 | ||
28 | |||
29 | #define EXYNOS4_PA_FIMC0 0x11800000 | ||
30 | #define EXYNOS4_PA_FIMC1 0x11810000 | ||
31 | #define EXYNOS4_PA_FIMC2 0x11820000 | ||
32 | #define EXYNOS4_PA_FIMC3 0x11830000 | ||
33 | |||
34 | #define EXYNOS4_PA_I2S0 0x03830000 | ||
35 | #define EXYNOS4_PA_I2S1 0xE3100000 | ||
36 | #define EXYNOS4_PA_I2S2 0xE2A00000 | ||
37 | |||
38 | #define EXYNOS4_PA_PCM0 0x03840000 | ||
39 | #define EXYNOS4_PA_PCM1 0x13980000 | ||
40 | #define EXYNOS4_PA_PCM2 0x13990000 | ||
41 | |||
42 | #define EXYNOS4_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000)) | ||
43 | |||
44 | #define EXYNOS4_PA_ONENAND 0x0C000000 | ||
45 | #define EXYNOS4_PA_ONENAND_DMA 0x0C600000 | ||
46 | |||
47 | #define EXYNOS4_PA_CHIPID 0x10000000 | ||
48 | |||
49 | #define EXYNOS4_PA_SYSCON 0x10010000 | ||
50 | #define EXYNOS4_PA_PMU 0x10020000 | ||
51 | #define EXYNOS4_PA_CMU 0x10030000 | ||
52 | |||
53 | #define EXYNOS4_PA_SYSTIMER 0x10050000 | ||
54 | #define EXYNOS4_PA_WATCHDOG 0x10060000 | ||
55 | #define EXYNOS4_PA_RTC 0x10070000 | ||
56 | |||
57 | #define EXYNOS4_PA_KEYPAD 0x100A0000 | ||
58 | |||
59 | #define EXYNOS4_PA_DMC0 0x10400000 | ||
60 | |||
61 | #define EXYNOS4_PA_COMBINER 0x10440000 | ||
62 | |||
63 | #define EXYNOS4_PA_GIC_CPU 0x10480000 | ||
64 | #define EXYNOS4_PA_GIC_DIST 0x10490000 | ||
65 | |||
66 | #define EXYNOS4_PA_COREPERI 0x10500000 | ||
67 | #define EXYNOS4_PA_TWD 0x10500600 | ||
68 | #define EXYNOS4_PA_L2CC 0x10502000 | ||
69 | |||
70 | #define EXYNOS4_PA_MDMA 0x10810000 | ||
71 | #define EXYNOS4_PA_PDMA0 0x12680000 | ||
72 | #define EXYNOS4_PA_PDMA1 0x12690000 | ||
73 | |||
74 | #define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000 | ||
75 | #define EXYNOS4_PA_SYSMMU_SSS 0x10A50000 | ||
76 | #define EXYNOS4_PA_SYSMMU_FIMC0 0x11A20000 | ||
77 | #define EXYNOS4_PA_SYSMMU_FIMC1 0x11A30000 | ||
78 | #define EXYNOS4_PA_SYSMMU_FIMC2 0x11A40000 | ||
79 | #define EXYNOS4_PA_SYSMMU_FIMC3 0x11A50000 | ||
80 | #define EXYNOS4_PA_SYSMMU_JPEG 0x11A60000 | ||
81 | #define EXYNOS4_PA_SYSMMU_FIMD0 0x11E20000 | ||
82 | #define EXYNOS4_PA_SYSMMU_FIMD1 0x12220000 | ||
83 | #define EXYNOS4_PA_SYSMMU_PCIe 0x12620000 | ||
84 | #define EXYNOS4_PA_SYSMMU_G2D 0x12A20000 | ||
85 | #define EXYNOS4_PA_SYSMMU_ROTATOR 0x12A30000 | ||
86 | #define EXYNOS4_PA_SYSMMU_MDMA2 0x12A40000 | ||
87 | #define EXYNOS4_PA_SYSMMU_TV 0x12E20000 | ||
88 | #define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000 | ||
89 | #define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000 | ||
90 | |||
91 | #define EXYNOS4_PA_GPIO1 0x11400000 | ||
92 | #define EXYNOS4_PA_GPIO2 0x11000000 | ||
93 | #define EXYNOS4_PA_GPIO3 0x03860000 | ||
94 | |||
95 | #define EXYNOS4_PA_MIPI_CSIS0 0x11880000 | ||
96 | #define EXYNOS4_PA_MIPI_CSIS1 0x11890000 | ||
97 | |||
98 | #define EXYNOS4_PA_FIMD0 0x11C00000 | ||
99 | |||
100 | #define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) | ||
101 | #define EXYNOS4_PA_DWMCI 0x12550000 | ||
102 | |||
103 | #define EXYNOS4_PA_SATA 0x12560000 | ||
104 | #define EXYNOS4_PA_SATAPHY 0x125D0000 | ||
105 | #define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000 | ||
106 | |||
107 | #define EXYNOS4_PA_SROMC 0x12570000 | ||
108 | |||
109 | #define EXYNOS4_PA_EHCI 0x12580000 | ||
110 | #define EXYNOS4_PA_HSPHY 0x125B0000 | ||
111 | #define EXYNOS4_PA_MFC 0x13400000 | ||
112 | |||
113 | #define EXYNOS4_PA_UART 0x13800000 | ||
114 | |||
115 | #define EXYNOS4_PA_VP 0x12C00000 | ||
116 | #define EXYNOS4_PA_MIXER 0x12C10000 | ||
117 | #define EXYNOS4_PA_SDO 0x12C20000 | ||
118 | #define EXYNOS4_PA_HDMI 0x12D00000 | ||
119 | #define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000 | ||
120 | |||
121 | #define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) | ||
122 | |||
123 | #define EXYNOS4_PA_ADC 0x13910000 | ||
124 | #define EXYNOS4_PA_ADC1 0x13911000 | ||
125 | |||
126 | #define EXYNOS4_PA_AC97 0x139A0000 | ||
127 | |||
128 | #define EXYNOS4_PA_SPDIF 0x139B0000 | ||
129 | |||
130 | #define EXYNOS4_PA_TIMER 0x139D0000 | ||
131 | |||
132 | #define EXYNOS4_PA_SDRAM 0x40000000 | ||
133 | |||
134 | /* Compatibiltiy Defines */ | ||
135 | |||
136 | #define S3C_PA_HSMMC0 EXYNOS4_PA_HSMMC(0) | ||
137 | #define S3C_PA_HSMMC1 EXYNOS4_PA_HSMMC(1) | ||
138 | #define S3C_PA_HSMMC2 EXYNOS4_PA_HSMMC(2) | ||
139 | #define S3C_PA_HSMMC3 EXYNOS4_PA_HSMMC(3) | ||
140 | #define S3C_PA_IIC EXYNOS4_PA_IIC(0) | ||
141 | #define S3C_PA_IIC1 EXYNOS4_PA_IIC(1) | ||
142 | #define S3C_PA_IIC2 EXYNOS4_PA_IIC(2) | ||
143 | #define S3C_PA_IIC3 EXYNOS4_PA_IIC(3) | ||
144 | #define S3C_PA_IIC4 EXYNOS4_PA_IIC(4) | ||
145 | #define S3C_PA_IIC5 EXYNOS4_PA_IIC(5) | ||
146 | #define S3C_PA_IIC6 EXYNOS4_PA_IIC(6) | ||
147 | #define S3C_PA_IIC7 EXYNOS4_PA_IIC(7) | ||
148 | #define S3C_PA_RTC EXYNOS4_PA_RTC | ||
149 | #define S3C_PA_WDT EXYNOS4_PA_WATCHDOG | ||
150 | #define S3C_PA_UART EXYNOS4_PA_UART | ||
151 | |||
152 | #define S5P_PA_CHIPID EXYNOS4_PA_CHIPID | ||
153 | #define S5P_PA_EHCI EXYNOS4_PA_EHCI | ||
154 | #define S5P_PA_FIMC0 EXYNOS4_PA_FIMC0 | ||
155 | #define S5P_PA_FIMC1 EXYNOS4_PA_FIMC1 | ||
156 | #define S5P_PA_FIMC2 EXYNOS4_PA_FIMC2 | ||
157 | #define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3 | ||
158 | #define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0 | ||
159 | #define S5P_PA_HDMI EXYNOS4_PA_HDMI | ||
160 | #define S5P_PA_IIC_HDMIPHY EXYNOS4_PA_IIC_HDMIPHY | ||
161 | #define S5P_PA_MFC EXYNOS4_PA_MFC | ||
162 | #define S5P_PA_MIPI_CSIS0 EXYNOS4_PA_MIPI_CSIS0 | ||
163 | #define S5P_PA_MIPI_CSIS1 EXYNOS4_PA_MIPI_CSIS1 | ||
164 | #define S5P_PA_MIXER EXYNOS4_PA_MIXER | ||
165 | #define S5P_PA_ONENAND EXYNOS4_PA_ONENAND | ||
166 | #define S5P_PA_ONENAND_DMA EXYNOS4_PA_ONENAND_DMA | ||
167 | #define S5P_PA_SDO EXYNOS4_PA_SDO | ||
168 | #define S5P_PA_SDRAM EXYNOS4_PA_SDRAM | ||
169 | #define S5P_PA_SROMC EXYNOS4_PA_SROMC | ||
170 | #define S5P_PA_SYSCON EXYNOS4_PA_SYSCON | ||
171 | #define S5P_PA_TIMER EXYNOS4_PA_TIMER | ||
172 | #define S5P_PA_VP EXYNOS4_PA_VP | ||
173 | |||
174 | #define SAMSUNG_PA_ADC EXYNOS4_PA_ADC | ||
175 | #define SAMSUNG_PA_ADC1 EXYNOS4_PA_ADC1 | ||
176 | #define SAMSUNG_PA_KEYPAD EXYNOS4_PA_KEYPAD | ||
177 | |||
178 | #define EXYNOS_PA_COMBINER EXYNOS4_PA_COMBINER | ||
179 | #define EXYNOS_PA_GIC_CPU EXYNOS4_PA_GIC_CPU | ||
180 | #define EXYNOS_PA_GIC_DIST EXYNOS4_PA_GIC_DIST | ||
181 | #define EXYNOS_PA_PMU EXYNOS4_PA_PMU | ||
182 | #define EXYNOS_PA_SYSTIMER EXYNOS4_PA_SYSTIMER | ||
183 | |||
184 | /* Compatibility UART */ | ||
185 | |||
186 | #define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) | ||
187 | |||
188 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) | ||
189 | #define S5P_PA_UART0 S5P_PA_UART(0) | ||
190 | #define S5P_PA_UART1 S5P_PA_UART(1) | ||
191 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
192 | #define S5P_PA_UART3 S5P_PA_UART(3) | ||
193 | #define S5P_PA_UART4 S5P_PA_UART(4) | ||
194 | |||
195 | #define S5P_SZ_UART SZ_256 | ||
196 | |||
197 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/memory.h b/arch/arm/mach-exynos/include/mach/memory.h new file mode 100644 index 000000000000..374ef2cf7152 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/memory.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/memory.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Memory definitions | ||
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 | #ifndef __ASM_ARCH_MEMORY_H | ||
14 | #define __ASM_ARCH_MEMORY_H __FILE__ | ||
15 | |||
16 | #define PLAT_PHYS_OFFSET UL(0x40000000) | ||
17 | |||
18 | /* Maximum of 256MiB in one bank */ | ||
19 | #define MAX_PHYSMEM_BITS 32 | ||
20 | #define SECTION_SIZE_BITS 28 | ||
21 | |||
22 | #endif /* __ASM_ARCH_MEMORY_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h new file mode 100644 index 000000000000..9d8da51e35ca --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/pm-core.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/pm-core.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Based on arch/arm/mach-s3c2410/include/mach/pm-core.h, | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * EXYNOS4210 - PM core support for arch/arm/plat-s5p/pm.c | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_PM_CORE_H | ||
19 | #define __ASM_ARCH_PM_CORE_H __FILE__ | ||
20 | |||
21 | #include <mach/regs-pmu.h> | ||
22 | |||
23 | static inline void s3c_pm_debug_init_uart(void) | ||
24 | { | ||
25 | /* nothing here yet */ | ||
26 | } | ||
27 | |||
28 | static inline void s3c_pm_arch_prepare_irqs(void) | ||
29 | { | ||
30 | unsigned int tmp; | ||
31 | tmp = __raw_readl(S5P_WAKEUP_MASK); | ||
32 | tmp &= ~(1 << 31); | ||
33 | __raw_writel(tmp, S5P_WAKEUP_MASK); | ||
34 | |||
35 | __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK); | ||
36 | __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK); | ||
37 | } | ||
38 | |||
39 | static inline void s3c_pm_arch_stop_clocks(void) | ||
40 | { | ||
41 | /* nothing here yet */ | ||
42 | } | ||
43 | |||
44 | static inline void s3c_pm_arch_show_resume_irqs(void) | ||
45 | { | ||
46 | /* nothing here yet */ | ||
47 | } | ||
48 | |||
49 | static inline void s3c_pm_arch_update_uart(void __iomem *regs, | ||
50 | struct pm_uart_save *save) | ||
51 | { | ||
52 | /* nothing here yet */ | ||
53 | } | ||
54 | |||
55 | static inline void s3c_pm_restored_gpios(void) | ||
56 | { | ||
57 | /* nothing here yet */ | ||
58 | } | ||
59 | |||
60 | static inline void samsung_pm_saved_gpios(void) | ||
61 | { | ||
62 | /* nothing here yet */ | ||
63 | } | ||
64 | |||
65 | #endif /* __ASM_ARCH_PM_CORE_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/pmu.h b/arch/arm/mach-exynos/include/mach/pmu.h new file mode 100644 index 000000000000..632dd5630138 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/pmu.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/pmu.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * EXYNOS4210 - PMU(Power Management Unit) 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 | #ifndef __ASM_ARCH_PMU_H | ||
14 | #define __ASM_ARCH_PMU_H __FILE__ | ||
15 | |||
16 | #define PMU_TABLE_END NULL | ||
17 | |||
18 | enum sys_powerdown { | ||
19 | SYS_AFTR, | ||
20 | SYS_LPA, | ||
21 | SYS_SLEEP, | ||
22 | NUM_SYS_POWERDOWN, | ||
23 | }; | ||
24 | |||
25 | struct exynos4_pmu_conf { | ||
26 | void __iomem *reg; | ||
27 | unsigned int val[NUM_SYS_POWERDOWN]; | ||
28 | }; | ||
29 | |||
30 | extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode); | ||
31 | |||
32 | #endif /* __ASM_ARCH_PMU_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-audss.h b/arch/arm/mach-exynos/include/mach/regs-audss.h new file mode 100644 index 000000000000..ca5a8b64218a --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-audss.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* arch/arm/mach-exynos4/include/mach/regs-audss.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Exynos4 Audio SubSystem clock register definitions | ||
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 | #ifndef __PLAT_REGS_AUDSS_H | ||
14 | #define __PLAT_REGS_AUDSS_H __FILE__ | ||
15 | |||
16 | #define EXYNOS4_AUDSS_INT_MEM (0x03000000) | ||
17 | |||
18 | #endif /* _PLAT_REGS_AUDSS_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h new file mode 100644 index 000000000000..6c37ebe94829 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-clock.h | |||
@@ -0,0 +1,210 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Clock register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_CLOCK_H | ||
14 | #define __ASM_ARCH_REGS_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <plat/cpu.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #define S5P_CLKREG(x) (S5P_VA_CMU + (x)) | ||
20 | |||
21 | #define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500) | ||
22 | #define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600) | ||
23 | #define S5P_CLKGATE_IP_LEFTBUS S5P_CLKREG(0x04800) | ||
24 | |||
25 | #define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500) | ||
26 | #define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) | ||
27 | #define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) | ||
28 | |||
29 | #define S5P_EPLL_LOCK S5P_CLKREG(0x0C010) | ||
30 | #define S5P_VPLL_LOCK S5P_CLKREG(0x0C020) | ||
31 | |||
32 | #define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) | ||
33 | #define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) | ||
34 | #define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) | ||
35 | #define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) | ||
36 | |||
37 | #define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) | ||
38 | #define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) | ||
39 | #define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) | ||
40 | #define S5P_CLKSRC_TV S5P_CLKREG(0x0C224) | ||
41 | #define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) | ||
42 | #define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C) | ||
43 | #define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) | ||
44 | #define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) | ||
45 | #define S5P_CLKSRC_MAUDIO S5P_CLKREG(0x0C23C) | ||
46 | #define S5P_CLKSRC_FSYS S5P_CLKREG(0x0C240) | ||
47 | #define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) | ||
48 | #define S5P_CLKSRC_PERIL1 S5P_CLKREG(0x0C254) | ||
49 | |||
50 | #define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) | ||
51 | #define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) | ||
52 | #define S5P_CLKSRC_MASK_TV S5P_CLKREG(0x0C324) | ||
53 | #define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334) | ||
54 | #define S5P_CLKSRC_MASK_MAUDIO S5P_CLKREG(0x0C33C) | ||
55 | #define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340) | ||
56 | #define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) | ||
57 | #define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) | ||
58 | |||
59 | #define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) | ||
60 | #define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520) | ||
61 | #define S5P_CLKDIV_TV S5P_CLKREG(0x0C524) | ||
62 | #define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528) | ||
63 | #define S5P_CLKDIV_G3D S5P_CLKREG(0x0C52C) | ||
64 | #define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530) | ||
65 | #define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534) | ||
66 | #define S5P_CLKDIV_MAUDIO S5P_CLKREG(0x0C53C) | ||
67 | #define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540) | ||
68 | #define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544) | ||
69 | #define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548) | ||
70 | #define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C) | ||
71 | #define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) | ||
72 | #define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) | ||
73 | #define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) | ||
74 | #define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) | ||
75 | #define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) | ||
76 | #define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) | ||
77 | #define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580) | ||
78 | |||
79 | #define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610) | ||
80 | |||
81 | #define S5P_CLKGATE_SCLKCAM S5P_CLKREG(0x0C820) | ||
82 | #define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) | ||
83 | #define S5P_CLKGATE_IP_TV S5P_CLKREG(0x0C924) | ||
84 | #define S5P_CLKGATE_IP_MFC S5P_CLKREG(0x0C928) | ||
85 | #define S5P_CLKGATE_IP_G3D S5P_CLKREG(0x0C92C) | ||
86 | #define S5P_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \ | ||
87 | S5P_CLKREG(0x0C930) : \ | ||
88 | S5P_CLKREG(0x04930)) | ||
89 | #define S5P_CLKGATE_IP_IMAGE_4210 S5P_CLKREG(0x0C930) | ||
90 | #define S5P_CLKGATE_IP_IMAGE_4212 S5P_CLKREG(0x04930) | ||
91 | #define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) | ||
92 | #define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940) | ||
93 | #define S5P_CLKGATE_IP_GPS S5P_CLKREG(0x0C94C) | ||
94 | #define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) | ||
95 | #define S5P_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \ | ||
96 | S5P_CLKREG(0x0C960) : \ | ||
97 | S5P_CLKREG(0x08960)) | ||
98 | #define S5P_CLKGATE_IP_PERIR_4210 S5P_CLKREG(0x0C960) | ||
99 | #define S5P_CLKGATE_IP_PERIR_4212 S5P_CLKREG(0x08960) | ||
100 | #define S5P_CLKGATE_BLOCK S5P_CLKREG(0x0C970) | ||
101 | |||
102 | #define S5P_CLKSRC_MASK_DMC S5P_CLKREG(0x10300) | ||
103 | #define S5P_CLKSRC_DMC S5P_CLKREG(0x10200) | ||
104 | #define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500) | ||
105 | #define S5P_CLKDIV_DMC1 S5P_CLKREG(0x10504) | ||
106 | #define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600) | ||
107 | #define S5P_CLKGATE_IP_DMC S5P_CLKREG(0x10900) | ||
108 | |||
109 | #define S5P_APLL_LOCK S5P_CLKREG(0x14000) | ||
110 | #define S5P_MPLL_LOCK (soc_is_exynos4210() ? \ | ||
111 | S5P_CLKREG(0x14004) : \ | ||
112 | S5P_CLKREG(0x10008)) | ||
113 | #define S5P_APLL_CON0 S5P_CLKREG(0x14100) | ||
114 | #define S5P_APLL_CON1 S5P_CLKREG(0x14104) | ||
115 | #define S5P_MPLL_CON0 (soc_is_exynos4210() ? \ | ||
116 | S5P_CLKREG(0x14108) : \ | ||
117 | S5P_CLKREG(0x10108)) | ||
118 | #define S5P_MPLL_CON1 (soc_is_exynos4210() ? \ | ||
119 | S5P_CLKREG(0x1410C) : \ | ||
120 | S5P_CLKREG(0x1010C)) | ||
121 | |||
122 | #define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) | ||
123 | #define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) | ||
124 | |||
125 | #define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) | ||
126 | #define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504) | ||
127 | #define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) | ||
128 | #define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604) | ||
129 | |||
130 | #define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) | ||
131 | #define S5P_CLKGATE_IP_CPU S5P_CLKREG(0x14900) | ||
132 | |||
133 | #define S5P_APLL_LOCKTIME (0x1C20) /* 300us */ | ||
134 | |||
135 | #define S5P_APLLCON0_ENABLE_SHIFT (31) | ||
136 | #define S5P_APLLCON0_LOCKED_SHIFT (29) | ||
137 | #define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) | ||
138 | #define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) | ||
139 | |||
140 | #define S5P_EPLLCON0_ENABLE_SHIFT (31) | ||
141 | #define S5P_EPLLCON0_LOCKED_SHIFT (29) | ||
142 | |||
143 | #define S5P_VPLLCON0_ENABLE_SHIFT (31) | ||
144 | #define S5P_VPLLCON0_LOCKED_SHIFT (29) | ||
145 | |||
146 | #define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) | ||
147 | #define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) | ||
148 | |||
149 | #define S5P_CLKDIV_CPU0_CORE_SHIFT (0) | ||
150 | #define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT) | ||
151 | #define S5P_CLKDIV_CPU0_COREM0_SHIFT (4) | ||
152 | #define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT) | ||
153 | #define S5P_CLKDIV_CPU0_COREM1_SHIFT (8) | ||
154 | #define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT) | ||
155 | #define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12) | ||
156 | #define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT) | ||
157 | #define S5P_CLKDIV_CPU0_ATB_SHIFT (16) | ||
158 | #define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT) | ||
159 | #define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20) | ||
160 | #define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) | ||
161 | #define S5P_CLKDIV_CPU0_APLL_SHIFT (24) | ||
162 | #define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT) | ||
163 | |||
164 | #define S5P_CLKDIV_DMC0_ACP_SHIFT (0) | ||
165 | #define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT) | ||
166 | #define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4) | ||
167 | #define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) | ||
168 | #define S5P_CLKDIV_DMC0_DPHY_SHIFT (8) | ||
169 | #define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT) | ||
170 | #define S5P_CLKDIV_DMC0_DMC_SHIFT (12) | ||
171 | #define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT) | ||
172 | #define S5P_CLKDIV_DMC0_DMCD_SHIFT (16) | ||
173 | #define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT) | ||
174 | #define S5P_CLKDIV_DMC0_DMCP_SHIFT (20) | ||
175 | #define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT) | ||
176 | #define S5P_CLKDIV_DMC0_COPY2_SHIFT (24) | ||
177 | #define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT) | ||
178 | #define S5P_CLKDIV_DMC0_CORETI_SHIFT (28) | ||
179 | #define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT) | ||
180 | |||
181 | #define S5P_CLKDIV_TOP_ACLK200_SHIFT (0) | ||
182 | #define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT) | ||
183 | #define S5P_CLKDIV_TOP_ACLK100_SHIFT (4) | ||
184 | #define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT) | ||
185 | #define S5P_CLKDIV_TOP_ACLK160_SHIFT (8) | ||
186 | #define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT) | ||
187 | #define S5P_CLKDIV_TOP_ACLK133_SHIFT (12) | ||
188 | #define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT) | ||
189 | #define S5P_CLKDIV_TOP_ONENAND_SHIFT (16) | ||
190 | #define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT) | ||
191 | |||
192 | #define S5P_CLKDIV_BUS_GDLR_SHIFT (0) | ||
193 | #define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT) | ||
194 | #define S5P_CLKDIV_BUS_GPLR_SHIFT (4) | ||
195 | #define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) | ||
196 | |||
197 | /* Only for EXYNOS4210 */ | ||
198 | |||
199 | #define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) | ||
200 | #define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338) | ||
201 | #define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538) | ||
202 | #define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938) | ||
203 | |||
204 | /* Compatibility defines and inclusion */ | ||
205 | |||
206 | #include <mach/regs-pmu.h> | ||
207 | |||
208 | #define S5P_EPLL_CON S5P_EPLL_CON0 | ||
209 | |||
210 | #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 new file mode 100644 index 000000000000..1401b21663a5 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-gpio.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - GPIO (including EINT) register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_GPIO_H | ||
14 | #define __ASM_ARCH_REGS_GPIO_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <mach/irqs.h> | ||
18 | |||
19 | #define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00) | ||
20 | #define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4)) | ||
21 | |||
22 | #define EXYNOS4_EINT40FLTCON0 (S5P_VA_GPIO2 + 0xE80) | ||
23 | #define S5P_EINT_FLTCON(x) (EXYNOS4_EINT40FLTCON0 + ((x) * 0x4)) | ||
24 | |||
25 | #define EXYNOS4_EINT40MASK (S5P_VA_GPIO2 + 0xF00) | ||
26 | #define S5P_EINT_MASK(x) (EXYNOS4_EINT40MASK + ((x) * 0x4)) | ||
27 | |||
28 | #define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40) | ||
29 | #define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4)) | ||
30 | |||
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 */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-irq.h b/arch/arm/mach-exynos/include/mach/regs-irq.h new file mode 100644 index 000000000000..9c7b4bfd546f --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-irq.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - IRQ register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_IRQ_H | ||
14 | #define __ASM_ARCH_REGS_IRQ_H __FILE__ | ||
15 | |||
16 | #include <asm/hardware/gic.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #endif /* __ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-mct.h b/arch/arm/mach-exynos/include/mach/regs-mct.h new file mode 100644 index 000000000000..80dd02ad6d61 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-mct.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* arch/arm/mach-exynos4/include/mach/regs-mct.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 MCT configutation | ||
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 | #ifndef __ASM_ARCH_REGS_MCT_H | ||
14 | #define __ASM_ARCH_REGS_MCT_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define EXYNOS4_MCTREG(x) (S5P_VA_SYSTIMER + (x)) | ||
19 | |||
20 | #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) | ||
21 | #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) | ||
22 | #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) | ||
23 | |||
24 | #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) | ||
25 | #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) | ||
26 | #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) | ||
27 | |||
28 | #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) | ||
29 | |||
30 | #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) | ||
31 | #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) | ||
32 | #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) | ||
33 | |||
34 | #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) | ||
35 | #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) | ||
36 | #define EXYNOS4_MCT_L_MASK (0xffffff00) | ||
37 | |||
38 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
39 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
40 | #define MCT_L_TCON_OFFSET (0x20) | ||
41 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
42 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
43 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
44 | |||
45 | #define MCT_G_TCON_START (1 << 8) | ||
46 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
47 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
48 | |||
49 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
50 | #define MCT_L_TCON_INT_START (1 << 1) | ||
51 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
52 | |||
53 | #endif /* __ASM_ARCH_REGS_MCT_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-mem.h b/arch/arm/mach-exynos/include/mach/regs-mem.h new file mode 100644 index 000000000000..0368b5a27252 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-mem.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-mem.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - SROMC and DMC register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_MEM_H | ||
14 | #define __ASM_ARCH_REGS_MEM_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define S5P_DMC0_MEMCON_OFFSET 0x04 | ||
19 | |||
20 | #define S5P_DMC0_MEMTYPE_SHIFT 8 | ||
21 | #define S5P_DMC0_MEMTYPE_MASK 0xF | ||
22 | |||
23 | #endif /* __ASM_ARCH_REGS_MEM_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h new file mode 100644 index 000000000000..4fff8e938fec --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h | |||
@@ -0,0 +1,220 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-pmu.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Power management unit definition | ||
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 | #ifndef __ASM_ARCH_REGS_PMU_H | ||
14 | #define __ASM_ARCH_REGS_PMU_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define S5P_PMUREG(x) (S5P_VA_PMU + (x)) | ||
19 | |||
20 | #define S5P_CENTRAL_SEQ_CONFIGURATION S5P_PMUREG(0x0200) | ||
21 | |||
22 | #define S5P_CENTRAL_LOWPWR_CFG (1 << 16) | ||
23 | |||
24 | #define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208) | ||
25 | |||
26 | #define S5P_USE_STANDBY_WFI0 (1 << 16) | ||
27 | #define S5P_USE_STANDBY_WFI1 (1 << 17) | ||
28 | #define S5P_USE_STANDBYWFI_ISP_ARM (1 << 18) | ||
29 | #define S5P_USE_STANDBY_WFE0 (1 << 24) | ||
30 | #define S5P_USE_STANDBY_WFE1 (1 << 25) | ||
31 | #define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26) | ||
32 | |||
33 | #define S5P_SWRESET S5P_PMUREG(0x0400) | ||
34 | |||
35 | #define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) | ||
36 | #define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) | ||
37 | #define S5P_WAKEUP_MASK S5P_PMUREG(0x0608) | ||
38 | |||
39 | #define S5P_HDMI_PHY_CONTROL S5P_PMUREG(0x0700) | ||
40 | #define S5P_HDMI_PHY_ENABLE (1 << 0) | ||
41 | |||
42 | #define S5P_DAC_PHY_CONTROL S5P_PMUREG(0x070C) | ||
43 | #define S5P_DAC_PHY_ENABLE (1 << 0) | ||
44 | |||
45 | #define S5P_MIPI_DPHY_CONTROL(n) S5P_PMUREG(0x0710 + (n) * 4) | ||
46 | #define S5P_MIPI_DPHY_ENABLE (1 << 0) | ||
47 | #define S5P_MIPI_DPHY_SRESETN (1 << 1) | ||
48 | #define S5P_MIPI_DPHY_MRESETN (1 << 2) | ||
49 | |||
50 | #define S5P_INFORM0 S5P_PMUREG(0x0800) | ||
51 | #define S5P_INFORM1 S5P_PMUREG(0x0804) | ||
52 | #define S5P_INFORM2 S5P_PMUREG(0x0808) | ||
53 | #define S5P_INFORM3 S5P_PMUREG(0x080C) | ||
54 | #define S5P_INFORM4 S5P_PMUREG(0x0810) | ||
55 | #define S5P_INFORM5 S5P_PMUREG(0x0814) | ||
56 | #define S5P_INFORM6 S5P_PMUREG(0x0818) | ||
57 | #define S5P_INFORM7 S5P_PMUREG(0x081C) | ||
58 | |||
59 | #define S5P_ARM_CORE0_LOWPWR S5P_PMUREG(0x1000) | ||
60 | #define S5P_DIS_IRQ_CORE0 S5P_PMUREG(0x1004) | ||
61 | #define S5P_DIS_IRQ_CENTRAL0 S5P_PMUREG(0x1008) | ||
62 | #define S5P_ARM_CORE1_LOWPWR S5P_PMUREG(0x1010) | ||
63 | #define S5P_DIS_IRQ_CORE1 S5P_PMUREG(0x1014) | ||
64 | #define S5P_DIS_IRQ_CENTRAL1 S5P_PMUREG(0x1018) | ||
65 | #define S5P_ARM_COMMON_LOWPWR S5P_PMUREG(0x1080) | ||
66 | #define S5P_L2_0_LOWPWR S5P_PMUREG(0x10C0) | ||
67 | #define S5P_L2_1_LOWPWR S5P_PMUREG(0x10C4) | ||
68 | #define S5P_CMU_ACLKSTOP_LOWPWR S5P_PMUREG(0x1100) | ||
69 | #define S5P_CMU_SCLKSTOP_LOWPWR S5P_PMUREG(0x1104) | ||
70 | #define S5P_CMU_RESET_LOWPWR S5P_PMUREG(0x110C) | ||
71 | #define S5P_APLL_SYSCLK_LOWPWR S5P_PMUREG(0x1120) | ||
72 | #define S5P_MPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1124) | ||
73 | #define S5P_VPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1128) | ||
74 | #define S5P_EPLL_SYSCLK_LOWPWR S5P_PMUREG(0x112C) | ||
75 | #define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR S5P_PMUREG(0x1138) | ||
76 | #define S5P_CMU_RESET_GPSALIVE_LOWPWR S5P_PMUREG(0x113C) | ||
77 | #define S5P_CMU_CLKSTOP_CAM_LOWPWR S5P_PMUREG(0x1140) | ||
78 | #define S5P_CMU_CLKSTOP_TV_LOWPWR S5P_PMUREG(0x1144) | ||
79 | #define S5P_CMU_CLKSTOP_MFC_LOWPWR S5P_PMUREG(0x1148) | ||
80 | #define S5P_CMU_CLKSTOP_G3D_LOWPWR S5P_PMUREG(0x114C) | ||
81 | #define S5P_CMU_CLKSTOP_LCD0_LOWPWR S5P_PMUREG(0x1150) | ||
82 | #define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR S5P_PMUREG(0x1158) | ||
83 | #define S5P_CMU_CLKSTOP_GPS_LOWPWR S5P_PMUREG(0x115C) | ||
84 | #define S5P_CMU_RESET_CAM_LOWPWR S5P_PMUREG(0x1160) | ||
85 | #define S5P_CMU_RESET_TV_LOWPWR S5P_PMUREG(0x1164) | ||
86 | #define S5P_CMU_RESET_MFC_LOWPWR S5P_PMUREG(0x1168) | ||
87 | #define S5P_CMU_RESET_G3D_LOWPWR S5P_PMUREG(0x116C) | ||
88 | #define S5P_CMU_RESET_LCD0_LOWPWR S5P_PMUREG(0x1170) | ||
89 | #define S5P_CMU_RESET_MAUDIO_LOWPWR S5P_PMUREG(0x1178) | ||
90 | #define S5P_CMU_RESET_GPS_LOWPWR S5P_PMUREG(0x117C) | ||
91 | #define S5P_TOP_BUS_LOWPWR S5P_PMUREG(0x1180) | ||
92 | #define S5P_TOP_RETENTION_LOWPWR S5P_PMUREG(0x1184) | ||
93 | #define S5P_TOP_PWR_LOWPWR S5P_PMUREG(0x1188) | ||
94 | #define S5P_LOGIC_RESET_LOWPWR S5P_PMUREG(0x11A0) | ||
95 | #define S5P_ONENAND_MEM_LOWPWR S5P_PMUREG(0x11C0) | ||
96 | #define S5P_G2D_ACP_MEM_LOWPWR S5P_PMUREG(0x11C8) | ||
97 | #define S5P_USBOTG_MEM_LOWPWR S5P_PMUREG(0x11CC) | ||
98 | #define S5P_HSMMC_MEM_LOWPWR S5P_PMUREG(0x11D0) | ||
99 | #define S5P_CSSYS_MEM_LOWPWR S5P_PMUREG(0x11D4) | ||
100 | #define S5P_SECSS_MEM_LOWPWR S5P_PMUREG(0x11D8) | ||
101 | #define S5P_PAD_RETENTION_DRAM_LOWPWR S5P_PMUREG(0x1200) | ||
102 | #define S5P_PAD_RETENTION_MAUDIO_LOWPWR S5P_PMUREG(0x1204) | ||
103 | #define S5P_PAD_RETENTION_GPIO_LOWPWR S5P_PMUREG(0x1220) | ||
104 | #define S5P_PAD_RETENTION_UART_LOWPWR S5P_PMUREG(0x1224) | ||
105 | #define S5P_PAD_RETENTION_MMCA_LOWPWR S5P_PMUREG(0x1228) | ||
106 | #define S5P_PAD_RETENTION_MMCB_LOWPWR S5P_PMUREG(0x122C) | ||
107 | #define S5P_PAD_RETENTION_EBIA_LOWPWR S5P_PMUREG(0x1230) | ||
108 | #define S5P_PAD_RETENTION_EBIB_LOWPWR S5P_PMUREG(0x1234) | ||
109 | #define S5P_PAD_RETENTION_ISOLATION_LOWPWR S5P_PMUREG(0x1240) | ||
110 | #define S5P_PAD_RETENTION_ALV_SEL_LOWPWR S5P_PMUREG(0x1260) | ||
111 | #define S5P_XUSBXTI_LOWPWR S5P_PMUREG(0x1280) | ||
112 | #define S5P_XXTI_LOWPWR S5P_PMUREG(0x1284) | ||
113 | #define S5P_EXT_REGULATOR_LOWPWR S5P_PMUREG(0x12C0) | ||
114 | #define S5P_GPIO_MODE_LOWPWR S5P_PMUREG(0x1300) | ||
115 | #define S5P_GPIO_MODE_MAUDIO_LOWPWR S5P_PMUREG(0x1340) | ||
116 | #define S5P_CAM_LOWPWR S5P_PMUREG(0x1380) | ||
117 | #define S5P_TV_LOWPWR S5P_PMUREG(0x1384) | ||
118 | #define S5P_MFC_LOWPWR S5P_PMUREG(0x1388) | ||
119 | #define S5P_G3D_LOWPWR S5P_PMUREG(0x138C) | ||
120 | #define S5P_LCD0_LOWPWR S5P_PMUREG(0x1390) | ||
121 | #define S5P_MAUDIO_LOWPWR S5P_PMUREG(0x1398) | ||
122 | #define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) | ||
123 | #define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) | ||
124 | |||
125 | #define S5P_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) | ||
126 | #define S5P_ARM_CORE0_OPTION S5P_PMUREG(0x2008) | ||
127 | #define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) | ||
128 | #define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) | ||
129 | #define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088) | ||
130 | |||
131 | #define S5P_ARM_COMMON_OPTION S5P_PMUREG(0x2408) | ||
132 | #define S5P_TOP_PWR_OPTION S5P_PMUREG(0x2C48) | ||
133 | #define S5P_CAM_OPTION S5P_PMUREG(0x3C08) | ||
134 | #define S5P_TV_OPTION S5P_PMUREG(0x3C28) | ||
135 | #define S5P_MFC_OPTION S5P_PMUREG(0x3C48) | ||
136 | #define S5P_G3D_OPTION S5P_PMUREG(0x3C68) | ||
137 | #define S5P_LCD0_OPTION S5P_PMUREG(0x3C88) | ||
138 | #define S5P_LCD1_OPTION S5P_PMUREG(0x3CA8) | ||
139 | #define S5P_MAUDIO_OPTION S5P_PMUREG(0x3CC8) | ||
140 | #define S5P_GPS_OPTION S5P_PMUREG(0x3CE8) | ||
141 | #define S5P_GPS_ALIVE_OPTION S5P_PMUREG(0x3D08) | ||
142 | |||
143 | #define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) | ||
144 | #define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) | ||
145 | #define S5P_PAD_RET_UART_OPTION S5P_PMUREG(0x3128) | ||
146 | #define S5P_PAD_RET_MMCA_OPTION S5P_PMUREG(0x3148) | ||
147 | #define S5P_PAD_RET_MMCB_OPTION S5P_PMUREG(0x3168) | ||
148 | #define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) | ||
149 | #define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) | ||
150 | |||
151 | #define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00) | ||
152 | #define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20) | ||
153 | #define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40) | ||
154 | #define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60) | ||
155 | #define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80) | ||
156 | #define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0) | ||
157 | |||
158 | #define S5P_PMU_SATA_PHY_CONTROL_EN 0x1 | ||
159 | #define S5P_CORE_LOCAL_PWR_EN 0x3 | ||
160 | #define S5P_INT_LOCAL_PWR_EN 0x7 | ||
161 | |||
162 | #define S5P_CHECK_SLEEP 0x00000BAD | ||
163 | |||
164 | /* Only for EXYNOS4210 */ | ||
165 | #define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708) | ||
166 | #define S5P_USBHOST_PHY_ENABLE (1 << 0) | ||
167 | |||
168 | #define S5P_PMU_SATA_PHY_CONTROL S5P_PMUREG(0x0720) | ||
169 | |||
170 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) | ||
171 | #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) | ||
172 | #define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) | ||
173 | #define S5P_PCIE_MEM_LOWPWR S5P_PMUREG(0x11E0) | ||
174 | #define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) | ||
175 | #define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) | ||
176 | |||
177 | #define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0) | ||
178 | |||
179 | /* Only for EXYNOS4212 */ | ||
180 | #define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050) | ||
181 | #define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054) | ||
182 | #define S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR S5P_PMUREG(0x1058) | ||
183 | #define S5P_CMU_ACLKSTOP_COREBLK_LOWPWR S5P_PMUREG(0x1110) | ||
184 | #define S5P_CMU_SCLKSTOP_COREBLK_LOWPWR S5P_PMUREG(0x1114) | ||
185 | #define S5P_CMU_RESET_COREBLK_LOWPWR S5P_PMUREG(0x111C) | ||
186 | #define S5P_MPLLUSER_SYSCLK_LOWPWR S5P_PMUREG(0x1130) | ||
187 | #define S5P_CMU_CLKSTOP_ISP_LOWPWR S5P_PMUREG(0x1154) | ||
188 | #define S5P_CMU_RESET_ISP_LOWPWR S5P_PMUREG(0x1174) | ||
189 | #define S5P_TOP_BUS_COREBLK_LOWPWR S5P_PMUREG(0x1190) | ||
190 | #define S5P_TOP_RETENTION_COREBLK_LOWPWR S5P_PMUREG(0x1194) | ||
191 | #define S5P_TOP_PWR_COREBLK_LOWPWR S5P_PMUREG(0x1198) | ||
192 | #define S5P_OSCCLK_GATE_LOWPWR S5P_PMUREG(0x11A4) | ||
193 | #define S5P_LOGIC_RESET_COREBLK_LOWPWR S5P_PMUREG(0x11B0) | ||
194 | #define S5P_OSCCLK_GATE_COREBLK_LOWPWR S5P_PMUREG(0x11B4) | ||
195 | #define S5P_HSI_MEM_LOWPWR S5P_PMUREG(0x11C4) | ||
196 | #define S5P_ROTATOR_MEM_LOWPWR S5P_PMUREG(0x11DC) | ||
197 | #define S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR S5P_PMUREG(0x123C) | ||
198 | #define S5P_PAD_ISOLATION_COREBLK_LOWPWR S5P_PMUREG(0x1250) | ||
199 | #define S5P_GPIO_MODE_COREBLK_LOWPWR S5P_PMUREG(0x1320) | ||
200 | #define S5P_TOP_ASB_RESET_LOWPWR S5P_PMUREG(0x1344) | ||
201 | #define S5P_TOP_ASB_ISOLATION_LOWPWR S5P_PMUREG(0x1348) | ||
202 | #define S5P_ISP_LOWPWR S5P_PMUREG(0x1394) | ||
203 | #define S5P_DRAM_FREQ_DOWN_LOWPWR S5P_PMUREG(0x13B0) | ||
204 | #define S5P_DDRPHY_DLLOFF_LOWPWR S5P_PMUREG(0x13B4) | ||
205 | #define S5P_CMU_SYSCLK_ISP_LOWPWR S5P_PMUREG(0x13B8) | ||
206 | #define S5P_CMU_SYSCLK_GPS_LOWPWR S5P_PMUREG(0x13BC) | ||
207 | #define S5P_LPDDR_PHY_DLL_LOCK_LOWPWR S5P_PMUREG(0x13C0) | ||
208 | |||
209 | #define S5P_ARM_L2_0_OPTION S5P_PMUREG(0x2608) | ||
210 | #define S5P_ARM_L2_1_OPTION S5P_PMUREG(0x2628) | ||
211 | #define S5P_ONENAND_MEM_OPTION S5P_PMUREG(0x2E08) | ||
212 | #define S5P_HSI_MEM_OPTION S5P_PMUREG(0x2E28) | ||
213 | #define S5P_G2D_ACP_MEM_OPTION S5P_PMUREG(0x2E48) | ||
214 | #define S5P_USBOTG_MEM_OPTION S5P_PMUREG(0x2E68) | ||
215 | #define S5P_HSMMC_MEM_OPTION S5P_PMUREG(0x2E88) | ||
216 | #define S5P_CSSYS_MEM_OPTION S5P_PMUREG(0x2EA8) | ||
217 | #define S5P_SECSS_MEM_OPTION S5P_PMUREG(0x2EC8) | ||
218 | #define S5P_ROTATOR_MEM_OPTION S5P_PMUREG(0x2F48) | ||
219 | |||
220 | #endif /* __ASM_ARCH_REGS_PMU_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-sysmmu.h b/arch/arm/mach-exynos/include/mach/regs-sysmmu.h new file mode 100644 index 000000000000..68ff6ad08a2b --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-sysmmu.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-sysmmu.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - System MMU register | ||
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 | #ifndef __ASM_ARCH_REGS_SYSMMU_H | ||
14 | #define __ASM_ARCH_REGS_SYSMMU_H __FILE__ | ||
15 | |||
16 | #define S5P_MMU_CTRL 0x000 | ||
17 | #define S5P_MMU_CFG 0x004 | ||
18 | #define S5P_MMU_STATUS 0x008 | ||
19 | #define S5P_MMU_FLUSH 0x00C | ||
20 | #define S5P_PT_BASE_ADDR 0x014 | ||
21 | #define S5P_INT_STATUS 0x018 | ||
22 | #define S5P_INT_CLEAR 0x01C | ||
23 | #define S5P_PAGE_FAULT_ADDR 0x024 | ||
24 | #define S5P_AW_FAULT_ADDR 0x028 | ||
25 | #define S5P_AR_FAULT_ADDR 0x02C | ||
26 | #define S5P_DEFAULT_SLAVE_ADDR 0x030 | ||
27 | |||
28 | #endif /* __ASM_ARCH_REGS_SYSMMU_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-usb-phy.h b/arch/arm/mach-exynos/include/mach/regs-usb-phy.h new file mode 100644 index 000000000000..c337cf3a71bf --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/regs-usb-phy.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd | ||
3 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_S5P_REGS_USB_PHY_H | ||
12 | #define __PLAT_S5P_REGS_USB_PHY_H | ||
13 | |||
14 | #define EXYNOS4_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY) | ||
15 | |||
16 | #define EXYNOS4_PHYPWR EXYNOS4_HSOTG_PHYREG(0x00) | ||
17 | #define PHY1_HSIC_NORMAL_MASK (0xf << 9) | ||
18 | #define PHY1_HSIC1_SLEEP (1 << 12) | ||
19 | #define PHY1_HSIC1_FORCE_SUSPEND (1 << 11) | ||
20 | #define PHY1_HSIC0_SLEEP (1 << 10) | ||
21 | #define PHY1_HSIC0_FORCE_SUSPEND (1 << 9) | ||
22 | |||
23 | #define PHY1_STD_NORMAL_MASK (0x7 << 6) | ||
24 | #define PHY1_STD_SLEEP (1 << 8) | ||
25 | #define PHY1_STD_ANALOG_POWERDOWN (1 << 7) | ||
26 | #define PHY1_STD_FORCE_SUSPEND (1 << 6) | ||
27 | |||
28 | #define PHY0_NORMAL_MASK (0x39 << 0) | ||
29 | #define PHY0_SLEEP (1 << 5) | ||
30 | #define PHY0_OTG_DISABLE (1 << 4) | ||
31 | #define PHY0_ANALOG_POWERDOWN (1 << 3) | ||
32 | #define PHY0_FORCE_SUSPEND (1 << 0) | ||
33 | |||
34 | #define EXYNOS4_PHYCLK EXYNOS4_HSOTG_PHYREG(0x04) | ||
35 | #define PHY1_COMMON_ON_N (1 << 7) | ||
36 | #define PHY0_COMMON_ON_N (1 << 4) | ||
37 | #define PHY0_ID_PULLUP (1 << 2) | ||
38 | #define CLKSEL_MASK (0x3 << 0) | ||
39 | #define CLKSEL_SHIFT (0) | ||
40 | #define CLKSEL_48M (0x0 << 0) | ||
41 | #define CLKSEL_12M (0x2 << 0) | ||
42 | #define CLKSEL_24M (0x3 << 0) | ||
43 | |||
44 | #define EXYNOS4_RSTCON EXYNOS4_HSOTG_PHYREG(0x08) | ||
45 | #define HOST_LINK_PORT_SWRST_MASK (0xf << 6) | ||
46 | #define HOST_LINK_PORT2_SWRST (1 << 9) | ||
47 | #define HOST_LINK_PORT1_SWRST (1 << 8) | ||
48 | #define HOST_LINK_PORT0_SWRST (1 << 7) | ||
49 | #define HOST_LINK_ALL_SWRST (1 << 6) | ||
50 | |||
51 | #define PHY1_SWRST_MASK (0x7 << 3) | ||
52 | #define PHY1_HSIC_SWRST (1 << 5) | ||
53 | #define PHY1_STD_SWRST (1 << 4) | ||
54 | #define PHY1_ALL_SWRST (1 << 3) | ||
55 | |||
56 | #define PHY0_SWRST_MASK (0x7 << 0) | ||
57 | #define PHY0_PHYLINK_SWRST (1 << 2) | ||
58 | #define PHY0_HLINK_SWRST (1 << 1) | ||
59 | #define PHY0_SWRST (1 << 0) | ||
60 | |||
61 | #define EXYNOS4_PHY1CON EXYNOS4_HSOTG_PHYREG(0x34) | ||
62 | #define FPENABLEN (1 << 0) | ||
63 | |||
64 | #endif /* __PLAT_S5P_REGS_USB_PHY_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/sysmmu.h b/arch/arm/mach-exynos/include/mach/sysmmu.h new file mode 100644 index 000000000000..6a5fbb534e82 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/sysmmu.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/sysmmu.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung sysmmu driver for EXYNOS4 | ||
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 | #ifndef __ASM_ARM_ARCH_SYSMMU_H | ||
14 | #define __ASM_ARM_ARCH_SYSMMU_H __FILE__ | ||
15 | |||
16 | enum exynos4_sysmmu_ips { | ||
17 | SYSMMU_MDMA, | ||
18 | SYSMMU_SSS, | ||
19 | SYSMMU_FIMC0, | ||
20 | SYSMMU_FIMC1, | ||
21 | SYSMMU_FIMC2, | ||
22 | SYSMMU_FIMC3, | ||
23 | SYSMMU_JPEG, | ||
24 | SYSMMU_FIMD0, | ||
25 | SYSMMU_FIMD1, | ||
26 | SYSMMU_PCIe, | ||
27 | SYSMMU_G2D, | ||
28 | SYSMMU_ROTATOR, | ||
29 | SYSMMU_MDMA2, | ||
30 | SYSMMU_TV, | ||
31 | SYSMMU_MFC_L, | ||
32 | SYSMMU_MFC_R, | ||
33 | EXYNOS4_SYSMMU_TOTAL_IPNUM, | ||
34 | }; | ||
35 | |||
36 | #define S5P_SYSMMU_TOTAL_IPNUM EXYNOS4_SYSMMU_TOTAL_IPNUM | ||
37 | |||
38 | extern const char *sysmmu_ips_name[EXYNOS4_SYSMMU_TOTAL_IPNUM]; | ||
39 | |||
40 | typedef enum exynos4_sysmmu_ips sysmmu_ips; | ||
41 | |||
42 | void sysmmu_clk_init(struct device *dev, sysmmu_ips ips); | ||
43 | void sysmmu_clk_enable(sysmmu_ips ips); | ||
44 | void sysmmu_clk_disable(sysmmu_ips ips); | ||
45 | |||
46 | #endif /* __ASM_ARM_ARCH_SYSMMU_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/system.h b/arch/arm/mach-exynos/include/mach/system.h new file mode 100644 index 000000000000..5e3220c18fc7 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/system.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/system.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - system support header | ||
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 | #ifndef __ASM_ARCH_SYSTEM_H | ||
14 | #define __ASM_ARCH_SYSTEM_H __FILE__ | ||
15 | |||
16 | #include <plat/system-reset.h> | ||
17 | |||
18 | static void arch_idle(void) | ||
19 | { | ||
20 | /* nothing here yet */ | ||
21 | } | ||
22 | #endif /* __ASM_ARCH_SYSTEM_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/timex.h b/arch/arm/mach-exynos/include/mach/timex.h new file mode 100644 index 000000000000..6d138750a708 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/timex.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/timex.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2003-2010 Simtec Electronics | ||
7 | * Ben Dooks <ben@simtec.co.uk> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s5p6442/include/mach/timex.h | ||
10 | * | ||
11 | * EXYNOS4 - time parameters | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_TIMEX_H | ||
19 | #define __ASM_ARCH_TIMEX_H __FILE__ | ||
20 | |||
21 | /* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it | ||
22 | * a variable is useless. It seems as long as we make our timers an | ||
23 | * exact multiple of HZ, any value that makes a 1->1 correspondence | ||
24 | * for the time conversion functions to/from jiffies is acceptable. | ||
25 | */ | ||
26 | |||
27 | #define CLOCK_TICK_RATE 12000000 | ||
28 | |||
29 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h new file mode 100644 index 000000000000..21d97bcd9acb --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/uncompress.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/uncompress.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - uncompress code | ||
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 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
14 | #define __ASM_ARCH_UNCOMPRESS_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | static void arch_detect_cpu(void) | ||
20 | { | ||
21 | /* we do not need to do any cpu detection here at the moment. */ | ||
22 | |||
23 | /* | ||
24 | * For preventing FIFO overrun or infinite loop of UART console, | ||
25 | * fifo_max should be the minimum fifo size of all of the UART channels | ||
26 | */ | ||
27 | fifo_mask = S5PV210_UFSTAT_TXMASK; | ||
28 | fifo_max = 15 << S5PV210_UFSTAT_TXSHIFT; | ||
29 | } | ||
30 | #endif /* __ASM_ARCH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/vmalloc.h b/arch/arm/mach-exynos/include/mach/vmalloc.h new file mode 100644 index 000000000000..284330e571d2 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/vmalloc.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/vmalloc.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2010 Ben Dooks <ben-linux@fluff.org> | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6440/include/mach/vmalloc.h | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * EXYNOS4 vmalloc definition | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARCH_VMALLOC_H | ||
18 | #define __ASM_ARCH_VMALLOC_H __FILE__ | ||
19 | |||
20 | #define VMALLOC_END 0xF6000000UL | ||
21 | |||
22 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-exynos/init.c b/arch/arm/mach-exynos/init.c new file mode 100644 index 000000000000..a8a83e3881a4 --- /dev/null +++ b/arch/arm/mach-exynos/init.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/init.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/serial_core.h> | ||
12 | |||
13 | #include <plat/cpu.h> | ||
14 | #include <plat/devs.h> | ||
15 | #include <plat/regs-serial.h> | ||
16 | |||
17 | static struct s3c24xx_uart_clksrc exynos4_serial_clocks[] = { | ||
18 | [0] = { | ||
19 | .name = "uclk1", | ||
20 | .divisor = 1, | ||
21 | .min_baud = 0, | ||
22 | .max_baud = 0, | ||
23 | }, | ||
24 | }; | ||
25 | |||
26 | /* uart registration process */ | ||
27 | void __init exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
28 | { | ||
29 | struct s3c2410_uartcfg *tcfg = cfg; | ||
30 | u32 ucnt; | ||
31 | |||
32 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
33 | if (!tcfg->clocks) { | ||
34 | tcfg->has_fracval = 1; | ||
35 | tcfg->clocks = exynos4_serial_clocks; | ||
36 | tcfg->clocks_size = ARRAY_SIZE(exynos4_serial_clocks); | ||
37 | } | ||
38 | tcfg->flags |= NO_NEED_CHECK_CLKSRC; | ||
39 | } | ||
40 | |||
41 | s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no); | ||
42 | } | ||
diff --git a/arch/arm/mach-exynos/irq-combiner.c b/arch/arm/mach-exynos/irq-combiner.c new file mode 100644 index 000000000000..5a2758ab055e --- /dev/null +++ b/arch/arm/mach-exynos/irq-combiner.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/irq-combiner.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Based on arch/arm/common/gic.c | ||
7 | * | ||
8 | * IRQ COMBINER support | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/io.h> | ||
16 | |||
17 | #include <asm/mach/irq.h> | ||
18 | |||
19 | #define COMBINER_ENABLE_SET 0x0 | ||
20 | #define COMBINER_ENABLE_CLEAR 0x4 | ||
21 | #define COMBINER_INT_STATUS 0xC | ||
22 | |||
23 | static DEFINE_SPINLOCK(irq_controller_lock); | ||
24 | |||
25 | struct combiner_chip_data { | ||
26 | unsigned int irq_offset; | ||
27 | unsigned int irq_mask; | ||
28 | void __iomem *base; | ||
29 | }; | ||
30 | |||
31 | static struct combiner_chip_data combiner_data[MAX_COMBINER_NR]; | ||
32 | |||
33 | static inline void __iomem *combiner_base(struct irq_data *data) | ||
34 | { | ||
35 | struct combiner_chip_data *combiner_data = | ||
36 | irq_data_get_irq_chip_data(data); | ||
37 | |||
38 | return combiner_data->base; | ||
39 | } | ||
40 | |||
41 | static void combiner_mask_irq(struct irq_data *data) | ||
42 | { | ||
43 | u32 mask = 1 << (data->irq % 32); | ||
44 | |||
45 | __raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_CLEAR); | ||
46 | } | ||
47 | |||
48 | static void combiner_unmask_irq(struct irq_data *data) | ||
49 | { | ||
50 | u32 mask = 1 << (data->irq % 32); | ||
51 | |||
52 | __raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_SET); | ||
53 | } | ||
54 | |||
55 | static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) | ||
56 | { | ||
57 | struct combiner_chip_data *chip_data = irq_get_handler_data(irq); | ||
58 | struct irq_chip *chip = irq_get_chip(irq); | ||
59 | unsigned int cascade_irq, combiner_irq; | ||
60 | unsigned long status; | ||
61 | |||
62 | chained_irq_enter(chip, desc); | ||
63 | |||
64 | spin_lock(&irq_controller_lock); | ||
65 | status = __raw_readl(chip_data->base + COMBINER_INT_STATUS); | ||
66 | spin_unlock(&irq_controller_lock); | ||
67 | status &= chip_data->irq_mask; | ||
68 | |||
69 | if (status == 0) | ||
70 | goto out; | ||
71 | |||
72 | combiner_irq = __ffs(status); | ||
73 | |||
74 | cascade_irq = combiner_irq + (chip_data->irq_offset & ~31); | ||
75 | if (unlikely(cascade_irq >= NR_IRQS)) | ||
76 | do_bad_IRQ(cascade_irq, desc); | ||
77 | else | ||
78 | generic_handle_irq(cascade_irq); | ||
79 | |||
80 | out: | ||
81 | chained_irq_exit(chip, desc); | ||
82 | } | ||
83 | |||
84 | static struct irq_chip combiner_chip = { | ||
85 | .name = "COMBINER", | ||
86 | .irq_mask = combiner_mask_irq, | ||
87 | .irq_unmask = combiner_unmask_irq, | ||
88 | }; | ||
89 | |||
90 | void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) | ||
91 | { | ||
92 | if (combiner_nr >= MAX_COMBINER_NR) | ||
93 | BUG(); | ||
94 | if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) | ||
95 | BUG(); | ||
96 | irq_set_chained_handler(irq, combiner_handle_cascade_irq); | ||
97 | } | ||
98 | |||
99 | void __init combiner_init(unsigned int combiner_nr, void __iomem *base, | ||
100 | unsigned int irq_start) | ||
101 | { | ||
102 | unsigned int i; | ||
103 | |||
104 | if (combiner_nr >= MAX_COMBINER_NR) | ||
105 | BUG(); | ||
106 | |||
107 | combiner_data[combiner_nr].base = base; | ||
108 | combiner_data[combiner_nr].irq_offset = irq_start; | ||
109 | combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3); | ||
110 | |||
111 | /* Disable all interrupts */ | ||
112 | |||
113 | __raw_writel(combiner_data[combiner_nr].irq_mask, | ||
114 | base + COMBINER_ENABLE_CLEAR); | ||
115 | |||
116 | /* Setup the Linux IRQ subsystem */ | ||
117 | |||
118 | for (i = irq_start; i < combiner_data[combiner_nr].irq_offset | ||
119 | + MAX_IRQ_IN_COMBINER; i++) { | ||
120 | irq_set_chip_and_handler(i, &combiner_chip, handle_level_irq); | ||
121 | irq_set_chip_data(i, &combiner_data[combiner_nr]); | ||
122 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | ||
123 | } | ||
124 | } | ||
diff --git a/arch/arm/mach-exynos/irq-eint.c b/arch/arm/mach-exynos/irq-eint.c new file mode 100644 index 000000000000..badb8c66fc9b --- /dev/null +++ b/arch/arm/mach-exynos/irq-eint.c | |||
@@ -0,0 +1,237 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/irq-eint.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - IRQ EINT 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/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/sysdev.h> | ||
18 | #include <linux/gpio.h> | ||
19 | |||
20 | #include <plat/pm.h> | ||
21 | #include <plat/cpu.h> | ||
22 | #include <plat/gpio-cfg.h> | ||
23 | |||
24 | #include <mach/regs-gpio.h> | ||
25 | |||
26 | #include <asm/mach/irq.h> | ||
27 | |||
28 | static DEFINE_SPINLOCK(eint_lock); | ||
29 | |||
30 | static unsigned int eint0_15_data[16]; | ||
31 | |||
32 | static unsigned int exynos4_get_irq_nr(unsigned int number) | ||
33 | { | ||
34 | u32 ret = 0; | ||
35 | |||
36 | switch (number) { | ||
37 | case 0 ... 3: | ||
38 | ret = (number + IRQ_EINT0); | ||
39 | break; | ||
40 | case 4 ... 7: | ||
41 | ret = (number + (IRQ_EINT4 - 4)); | ||
42 | break; | ||
43 | case 8 ... 15: | ||
44 | ret = (number + (IRQ_EINT8 - 8)); | ||
45 | break; | ||
46 | default: | ||
47 | printk(KERN_ERR "number available : %d\n", number); | ||
48 | } | ||
49 | |||
50 | return ret; | ||
51 | } | ||
52 | |||
53 | static inline void exynos4_irq_eint_mask(struct irq_data *data) | ||
54 | { | ||
55 | u32 mask; | ||
56 | |||
57 | spin_lock(&eint_lock); | ||
58 | mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); | ||
59 | mask |= eint_irq_to_bit(data->irq); | ||
60 | __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); | ||
61 | spin_unlock(&eint_lock); | ||
62 | } | ||
63 | |||
64 | static void exynos4_irq_eint_unmask(struct irq_data *data) | ||
65 | { | ||
66 | u32 mask; | ||
67 | |||
68 | spin_lock(&eint_lock); | ||
69 | mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); | ||
70 | mask &= ~(eint_irq_to_bit(data->irq)); | ||
71 | __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); | ||
72 | spin_unlock(&eint_lock); | ||
73 | } | ||
74 | |||
75 | static inline void exynos4_irq_eint_ack(struct irq_data *data) | ||
76 | { | ||
77 | __raw_writel(eint_irq_to_bit(data->irq), | ||
78 | S5P_EINT_PEND(EINT_REG_NR(data->irq))); | ||
79 | } | ||
80 | |||
81 | static void exynos4_irq_eint_maskack(struct irq_data *data) | ||
82 | { | ||
83 | exynos4_irq_eint_mask(data); | ||
84 | exynos4_irq_eint_ack(data); | ||
85 | } | ||
86 | |||
87 | static int exynos4_irq_eint_set_type(struct irq_data *data, unsigned int type) | ||
88 | { | ||
89 | int offs = EINT_OFFSET(data->irq); | ||
90 | int shift; | ||
91 | u32 ctrl, mask; | ||
92 | u32 newvalue = 0; | ||
93 | |||
94 | switch (type) { | ||
95 | case IRQ_TYPE_EDGE_RISING: | ||
96 | newvalue = S5P_IRQ_TYPE_EDGE_RISING; | ||
97 | break; | ||
98 | |||
99 | case IRQ_TYPE_EDGE_FALLING: | ||
100 | newvalue = S5P_IRQ_TYPE_EDGE_FALLING; | ||
101 | break; | ||
102 | |||
103 | case IRQ_TYPE_EDGE_BOTH: | ||
104 | newvalue = S5P_IRQ_TYPE_EDGE_BOTH; | ||
105 | break; | ||
106 | |||
107 | case IRQ_TYPE_LEVEL_LOW: | ||
108 | newvalue = S5P_IRQ_TYPE_LEVEL_LOW; | ||
109 | break; | ||
110 | |||
111 | case IRQ_TYPE_LEVEL_HIGH: | ||
112 | newvalue = S5P_IRQ_TYPE_LEVEL_HIGH; | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | printk(KERN_ERR "No such irq type %d", type); | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | |||
120 | shift = (offs & 0x7) * 4; | ||
121 | mask = 0x7 << shift; | ||
122 | |||
123 | spin_lock(&eint_lock); | ||
124 | ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq))); | ||
125 | ctrl &= ~mask; | ||
126 | ctrl |= newvalue << shift; | ||
127 | __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq))); | ||
128 | spin_unlock(&eint_lock); | ||
129 | |||
130 | switch (offs) { | ||
131 | case 0 ... 7: | ||
132 | s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE); | ||
133 | break; | ||
134 | case 8 ... 15: | ||
135 | s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE); | ||
136 | break; | ||
137 | case 16 ... 23: | ||
138 | s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE); | ||
139 | break; | ||
140 | case 24 ... 31: | ||
141 | s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE); | ||
142 | break; | ||
143 | default: | ||
144 | printk(KERN_ERR "No such irq number %d", offs); | ||
145 | } | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static struct irq_chip exynos4_irq_eint = { | ||
151 | .name = "exynos4-eint", | ||
152 | .irq_mask = exynos4_irq_eint_mask, | ||
153 | .irq_unmask = exynos4_irq_eint_unmask, | ||
154 | .irq_mask_ack = exynos4_irq_eint_maskack, | ||
155 | .irq_ack = exynos4_irq_eint_ack, | ||
156 | .irq_set_type = exynos4_irq_eint_set_type, | ||
157 | #ifdef CONFIG_PM | ||
158 | .irq_set_wake = s3c_irqext_wake, | ||
159 | #endif | ||
160 | }; | ||
161 | |||
162 | /* exynos4_irq_demux_eint | ||
163 | * | ||
164 | * This function demuxes the IRQ from from EINTs 16 to 31. | ||
165 | * It is designed to be inlined into the specific handler | ||
166 | * s5p_irq_demux_eintX_Y. | ||
167 | * | ||
168 | * Each EINT pend/mask registers handle eight of them. | ||
169 | */ | ||
170 | static inline void exynos4_irq_demux_eint(unsigned int start) | ||
171 | { | ||
172 | unsigned int irq; | ||
173 | |||
174 | u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start))); | ||
175 | u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start))); | ||
176 | |||
177 | status &= ~mask; | ||
178 | status &= 0xff; | ||
179 | |||
180 | while (status) { | ||
181 | irq = fls(status) - 1; | ||
182 | generic_handle_irq(irq + start); | ||
183 | status &= ~(1 << irq); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | static void exynos4_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) | ||
188 | { | ||
189 | struct irq_chip *chip = irq_get_chip(irq); | ||
190 | chained_irq_enter(chip, desc); | ||
191 | exynos4_irq_demux_eint(IRQ_EINT(16)); | ||
192 | exynos4_irq_demux_eint(IRQ_EINT(24)); | ||
193 | chained_irq_exit(chip, desc); | ||
194 | } | ||
195 | |||
196 | static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc) | ||
197 | { | ||
198 | u32 *irq_data = irq_get_handler_data(irq); | ||
199 | struct irq_chip *chip = irq_get_chip(irq); | ||
200 | |||
201 | chained_irq_enter(chip, desc); | ||
202 | chip->irq_mask(&desc->irq_data); | ||
203 | |||
204 | if (chip->irq_ack) | ||
205 | chip->irq_ack(&desc->irq_data); | ||
206 | |||
207 | generic_handle_irq(*irq_data); | ||
208 | |||
209 | chip->irq_unmask(&desc->irq_data); | ||
210 | chained_irq_exit(chip, desc); | ||
211 | } | ||
212 | |||
213 | int __init exynos4_init_irq_eint(void) | ||
214 | { | ||
215 | int irq; | ||
216 | |||
217 | for (irq = 0 ; irq <= 31 ; irq++) { | ||
218 | irq_set_chip_and_handler(IRQ_EINT(irq), &exynos4_irq_eint, | ||
219 | handle_level_irq); | ||
220 | set_irq_flags(IRQ_EINT(irq), IRQF_VALID); | ||
221 | } | ||
222 | |||
223 | irq_set_chained_handler(IRQ_EINT16_31, exynos4_irq_demux_eint16_31); | ||
224 | |||
225 | for (irq = 0 ; irq <= 15 ; irq++) { | ||
226 | eint0_15_data[irq] = IRQ_EINT(irq); | ||
227 | |||
228 | irq_set_handler_data(exynos4_get_irq_nr(irq), | ||
229 | &eint0_15_data[irq]); | ||
230 | irq_set_chained_handler(exynos4_get_irq_nr(irq), | ||
231 | exynos4_irq_eint0_15); | ||
232 | } | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | arch_initcall(exynos4_init_irq_eint); | ||
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c new file mode 100644 index 000000000000..f0ca6c157d29 --- /dev/null +++ b/arch/arm/mach-exynos/mach-armlex4210.c | |||
@@ -0,0 +1,215 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mach-armlex4210.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/gpio.h> | ||
12 | #include <linux/io.h> | ||
13 | #include <linux/mmc/host.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/serial_core.h> | ||
16 | #include <linux/smsc911x.h> | ||
17 | |||
18 | #include <asm/mach/arch.h> | ||
19 | #include <asm/mach-types.h> | ||
20 | |||
21 | #include <plat/cpu.h> | ||
22 | #include <plat/devs.h> | ||
23 | #include <plat/exynos4.h> | ||
24 | #include <plat/gpio-cfg.h> | ||
25 | #include <plat/regs-serial.h> | ||
26 | #include <plat/regs-srom.h> | ||
27 | #include <plat/sdhci.h> | ||
28 | |||
29 | #include <mach/map.h> | ||
30 | |||
31 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
32 | #define ARMLEX4210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
33 | S3C2410_UCON_RXILEVEL | \ | ||
34 | S3C2410_UCON_TXIRQMODE | \ | ||
35 | S3C2410_UCON_RXIRQMODE | \ | ||
36 | S3C2410_UCON_RXFIFO_TOI | \ | ||
37 | S3C2443_UCON_RXERR_IRQEN) | ||
38 | |||
39 | #define ARMLEX4210_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
40 | |||
41 | #define ARMLEX4210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
42 | S5PV210_UFCON_TXTRIG4 | \ | ||
43 | S5PV210_UFCON_RXTRIG4) | ||
44 | |||
45 | static struct s3c2410_uartcfg armlex4210_uartcfgs[] __initdata = { | ||
46 | [0] = { | ||
47 | .hwport = 0, | ||
48 | .flags = 0, | ||
49 | .ucon = ARMLEX4210_UCON_DEFAULT, | ||
50 | .ulcon = ARMLEX4210_ULCON_DEFAULT, | ||
51 | .ufcon = ARMLEX4210_UFCON_DEFAULT, | ||
52 | }, | ||
53 | [1] = { | ||
54 | .hwport = 1, | ||
55 | .flags = 0, | ||
56 | .ucon = ARMLEX4210_UCON_DEFAULT, | ||
57 | .ulcon = ARMLEX4210_ULCON_DEFAULT, | ||
58 | .ufcon = ARMLEX4210_UFCON_DEFAULT, | ||
59 | }, | ||
60 | [2] = { | ||
61 | .hwport = 2, | ||
62 | .flags = 0, | ||
63 | .ucon = ARMLEX4210_UCON_DEFAULT, | ||
64 | .ulcon = ARMLEX4210_ULCON_DEFAULT, | ||
65 | .ufcon = ARMLEX4210_UFCON_DEFAULT, | ||
66 | }, | ||
67 | [3] = { | ||
68 | .hwport = 3, | ||
69 | .flags = 0, | ||
70 | .ucon = ARMLEX4210_UCON_DEFAULT, | ||
71 | .ulcon = ARMLEX4210_ULCON_DEFAULT, | ||
72 | .ufcon = ARMLEX4210_UFCON_DEFAULT, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = { | ||
77 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
78 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
79 | #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT | ||
80 | .max_width = 8, | ||
81 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
82 | #endif | ||
83 | }; | ||
84 | |||
85 | static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = { | ||
86 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
87 | .ext_cd_gpio = EXYNOS4_GPX2(5), | ||
88 | .ext_cd_gpio_invert = 1, | ||
89 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
90 | .max_width = 4, | ||
91 | }; | ||
92 | |||
93 | static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = { | ||
94 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
95 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
96 | .max_width = 4, | ||
97 | }; | ||
98 | |||
99 | static void __init armlex4210_sdhci_init(void) | ||
100 | { | ||
101 | s3c_sdhci0_set_platdata(&armlex4210_hsmmc0_pdata); | ||
102 | s3c_sdhci2_set_platdata(&armlex4210_hsmmc2_pdata); | ||
103 | s3c_sdhci3_set_platdata(&armlex4210_hsmmc3_pdata); | ||
104 | } | ||
105 | |||
106 | static void __init armlex4210_wlan_init(void) | ||
107 | { | ||
108 | /* enable */ | ||
109 | s3c_gpio_cfgpin(EXYNOS4_GPX2(0), S3C_GPIO_SFN(0xf)); | ||
110 | s3c_gpio_setpull(EXYNOS4_GPX2(0), S3C_GPIO_PULL_UP); | ||
111 | |||
112 | /* reset */ | ||
113 | s3c_gpio_cfgpin(EXYNOS4_GPX1(6), S3C_GPIO_SFN(0xf)); | ||
114 | s3c_gpio_setpull(EXYNOS4_GPX1(6), S3C_GPIO_PULL_UP); | ||
115 | |||
116 | /* wakeup */ | ||
117 | s3c_gpio_cfgpin(EXYNOS4_GPX1(5), S3C_GPIO_SFN(0xf)); | ||
118 | s3c_gpio_setpull(EXYNOS4_GPX1(5), S3C_GPIO_PULL_UP); | ||
119 | } | ||
120 | |||
121 | static struct resource armlex4210_smsc911x_resources[] = { | ||
122 | [0] = { | ||
123 | .start = EXYNOS4_PA_SROM_BANK(3), | ||
124 | .end = EXYNOS4_PA_SROM_BANK(3) + SZ_64K - 1, | ||
125 | .flags = IORESOURCE_MEM, | ||
126 | }, | ||
127 | [1] = { | ||
128 | .start = IRQ_EINT(27), | ||
129 | .end = IRQ_EINT(27), | ||
130 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, | ||
131 | }, | ||
132 | }; | ||
133 | |||
134 | static struct smsc911x_platform_config smsc9215_config = { | ||
135 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, | ||
136 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
137 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | ||
138 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
139 | .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67}, | ||
140 | }; | ||
141 | |||
142 | static struct platform_device armlex4210_smsc911x = { | ||
143 | .name = "smsc911x", | ||
144 | .id = -1, | ||
145 | .num_resources = ARRAY_SIZE(armlex4210_smsc911x_resources), | ||
146 | .resource = armlex4210_smsc911x_resources, | ||
147 | .dev = { | ||
148 | .platform_data = &smsc9215_config, | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | static struct platform_device *armlex4210_devices[] __initdata = { | ||
153 | &s3c_device_hsmmc0, | ||
154 | &s3c_device_hsmmc2, | ||
155 | &s3c_device_hsmmc3, | ||
156 | &s3c_device_rtc, | ||
157 | &s3c_device_wdt, | ||
158 | &exynos4_device_sysmmu, | ||
159 | &samsung_asoc_dma, | ||
160 | &armlex4210_smsc911x, | ||
161 | &exynos4_device_ahci, | ||
162 | }; | ||
163 | |||
164 | static void __init armlex4210_smsc911x_init(void) | ||
165 | { | ||
166 | u32 cs1; | ||
167 | |||
168 | /* configure nCS1 width to 16 bits */ | ||
169 | cs1 = __raw_readl(S5P_SROM_BW) & | ||
170 | ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT); | ||
171 | cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) | | ||
172 | (0 << S5P_SROM_BW__WAITENABLE__SHIFT) | | ||
173 | (1 << S5P_SROM_BW__ADDRMODE__SHIFT) | | ||
174 | (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << | ||
175 | S5P_SROM_BW__NCS1__SHIFT; | ||
176 | __raw_writel(cs1, S5P_SROM_BW); | ||
177 | |||
178 | /* set timing for nCS1 suitable for ethernet chip */ | ||
179 | __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) | | ||
180 | (0x9 << S5P_SROM_BCX__TACP__SHIFT) | | ||
181 | (0xc << S5P_SROM_BCX__TCAH__SHIFT) | | ||
182 | (0x1 << S5P_SROM_BCX__TCOH__SHIFT) | | ||
183 | (0x6 << S5P_SROM_BCX__TACC__SHIFT) | | ||
184 | (0x1 << S5P_SROM_BCX__TCOS__SHIFT) | | ||
185 | (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); | ||
186 | } | ||
187 | |||
188 | static void __init armlex4210_map_io(void) | ||
189 | { | ||
190 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
191 | s3c24xx_init_clocks(24000000); | ||
192 | s3c24xx_init_uarts(armlex4210_uartcfgs, | ||
193 | ARRAY_SIZE(armlex4210_uartcfgs)); | ||
194 | } | ||
195 | |||
196 | static void __init armlex4210_machine_init(void) | ||
197 | { | ||
198 | armlex4210_smsc911x_init(); | ||
199 | |||
200 | armlex4210_sdhci_init(); | ||
201 | |||
202 | armlex4210_wlan_init(); | ||
203 | |||
204 | platform_add_devices(armlex4210_devices, | ||
205 | ARRAY_SIZE(armlex4210_devices)); | ||
206 | } | ||
207 | |||
208 | MACHINE_START(ARMLEX4210, "ARMLEX4210") | ||
209 | /* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */ | ||
210 | .atag_offset = 0x100, | ||
211 | .init_irq = exynos4_init_irq, | ||
212 | .map_io = armlex4210_map_io, | ||
213 | .init_machine = armlex4210_machine_init, | ||
214 | .timer = &exynos4_timer, | ||
215 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c new file mode 100644 index 000000000000..236bbe187163 --- /dev/null +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -0,0 +1,1339 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/mach-nuri.c | ||
3 | * | ||
4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/serial_core.h> | ||
13 | #include <linux/input.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/i2c/atmel_mxt_ts.h> | ||
16 | #include <linux/i2c-gpio.h> | ||
17 | #include <linux/gpio_keys.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/power/max8903_charger.h> | ||
20 | #include <linux/power/max17042_battery.h> | ||
21 | #include <linux/regulator/machine.h> | ||
22 | #include <linux/regulator/fixed.h> | ||
23 | #include <linux/mfd/max8997.h> | ||
24 | #include <linux/mfd/max8997-private.h> | ||
25 | #include <linux/mmc/host.h> | ||
26 | #include <linux/fb.h> | ||
27 | #include <linux/pwm_backlight.h> | ||
28 | |||
29 | #include <video/platform_lcd.h> | ||
30 | #include <media/m5mols.h> | ||
31 | #include <media/s5p_fimc.h> | ||
32 | #include <media/v4l2-mediabus.h> | ||
33 | |||
34 | #include <asm/mach/arch.h> | ||
35 | #include <asm/mach-types.h> | ||
36 | |||
37 | #include <plat/adc.h> | ||
38 | #include <plat/regs-fb-v4.h> | ||
39 | #include <plat/regs-serial.h> | ||
40 | #include <plat/exynos4.h> | ||
41 | #include <plat/cpu.h> | ||
42 | #include <plat/devs.h> | ||
43 | #include <plat/fb.h> | ||
44 | #include <plat/sdhci.h> | ||
45 | #include <plat/ehci.h> | ||
46 | #include <plat/clock.h> | ||
47 | #include <plat/gpio-cfg.h> | ||
48 | #include <plat/iic.h> | ||
49 | #include <plat/mfc.h> | ||
50 | #include <plat/pd.h> | ||
51 | #include <plat/fimc-core.h> | ||
52 | #include <plat/camport.h> | ||
53 | #include <plat/mipi_csis.h> | ||
54 | |||
55 | #include <mach/map.h> | ||
56 | |||
57 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
58 | #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
59 | S3C2410_UCON_RXILEVEL | \ | ||
60 | S3C2410_UCON_TXIRQMODE | \ | ||
61 | S3C2410_UCON_RXIRQMODE | \ | ||
62 | S3C2410_UCON_RXFIFO_TOI | \ | ||
63 | S3C2443_UCON_RXERR_IRQEN) | ||
64 | |||
65 | #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
66 | |||
67 | #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
68 | S5PV210_UFCON_TXTRIG256 | \ | ||
69 | S5PV210_UFCON_RXTRIG256) | ||
70 | |||
71 | enum fixed_regulator_id { | ||
72 | FIXED_REG_ID_MMC = 0, | ||
73 | FIXED_REG_ID_MAX8903, | ||
74 | FIXED_REG_ID_CAM_A28V, | ||
75 | FIXED_REG_ID_CAM_12V, | ||
76 | }; | ||
77 | |||
78 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { | ||
79 | { | ||
80 | .hwport = 0, | ||
81 | .ucon = NURI_UCON_DEFAULT, | ||
82 | .ulcon = NURI_ULCON_DEFAULT, | ||
83 | .ufcon = NURI_UFCON_DEFAULT, | ||
84 | }, | ||
85 | { | ||
86 | .hwport = 1, | ||
87 | .ucon = NURI_UCON_DEFAULT, | ||
88 | .ulcon = NURI_ULCON_DEFAULT, | ||
89 | .ufcon = NURI_UFCON_DEFAULT, | ||
90 | }, | ||
91 | { | ||
92 | .hwport = 2, | ||
93 | .ucon = NURI_UCON_DEFAULT, | ||
94 | .ulcon = NURI_ULCON_DEFAULT, | ||
95 | .ufcon = NURI_UFCON_DEFAULT, | ||
96 | }, | ||
97 | { | ||
98 | .hwport = 3, | ||
99 | .ucon = NURI_UCON_DEFAULT, | ||
100 | .ulcon = NURI_ULCON_DEFAULT, | ||
101 | .ufcon = NURI_UFCON_DEFAULT, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | /* eMMC */ | ||
106 | static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = { | ||
107 | .max_width = 8, | ||
108 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | ||
109 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
110 | MMC_CAP_DISABLE | MMC_CAP_ERASE), | ||
111 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
112 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
113 | }; | ||
114 | |||
115 | static struct regulator_consumer_supply emmc_supplies[] = { | ||
116 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | ||
117 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), | ||
118 | }; | ||
119 | |||
120 | static struct regulator_init_data emmc_fixed_voltage_init_data = { | ||
121 | .constraints = { | ||
122 | .name = "VMEM_VDD_2.8V", | ||
123 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
124 | }, | ||
125 | .num_consumer_supplies = ARRAY_SIZE(emmc_supplies), | ||
126 | .consumer_supplies = emmc_supplies, | ||
127 | }; | ||
128 | |||
129 | static struct fixed_voltage_config emmc_fixed_voltage_config = { | ||
130 | .supply_name = "MASSMEMORY_EN (inverted)", | ||
131 | .microvolts = 2800000, | ||
132 | .gpio = EXYNOS4_GPL1(1), | ||
133 | .enable_high = false, | ||
134 | .init_data = &emmc_fixed_voltage_init_data, | ||
135 | }; | ||
136 | |||
137 | static struct platform_device emmc_fixed_voltage = { | ||
138 | .name = "reg-fixed-voltage", | ||
139 | .id = FIXED_REG_ID_MMC, | ||
140 | .dev = { | ||
141 | .platform_data = &emmc_fixed_voltage_config, | ||
142 | }, | ||
143 | }; | ||
144 | |||
145 | /* SD */ | ||
146 | static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = { | ||
147 | .max_width = 4, | ||
148 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
149 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
150 | MMC_CAP_DISABLE, | ||
151 | .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */ | ||
152 | .ext_cd_gpio_invert = 1, | ||
153 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
154 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
155 | }; | ||
156 | |||
157 | /* WLAN */ | ||
158 | static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = { | ||
159 | .max_width = 4, | ||
160 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
161 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, | ||
162 | .cd_type = S3C_SDHCI_CD_EXTERNAL, | ||
163 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
164 | }; | ||
165 | |||
166 | static void __init nuri_sdhci_init(void) | ||
167 | { | ||
168 | s3c_sdhci0_set_platdata(&nuri_hsmmc0_data); | ||
169 | s3c_sdhci2_set_platdata(&nuri_hsmmc2_data); | ||
170 | s3c_sdhci3_set_platdata(&nuri_hsmmc3_data); | ||
171 | } | ||
172 | |||
173 | /* GPIO KEYS */ | ||
174 | static struct gpio_keys_button nuri_gpio_keys_tables[] = { | ||
175 | { | ||
176 | .code = KEY_VOLUMEUP, | ||
177 | .gpio = EXYNOS4_GPX2(0), /* XEINT16 */ | ||
178 | .desc = "gpio-keys: KEY_VOLUMEUP", | ||
179 | .type = EV_KEY, | ||
180 | .active_low = 1, | ||
181 | .debounce_interval = 1, | ||
182 | }, { | ||
183 | .code = KEY_VOLUMEDOWN, | ||
184 | .gpio = EXYNOS4_GPX2(1), /* XEINT17 */ | ||
185 | .desc = "gpio-keys: KEY_VOLUMEDOWN", | ||
186 | .type = EV_KEY, | ||
187 | .active_low = 1, | ||
188 | .debounce_interval = 1, | ||
189 | }, { | ||
190 | .code = KEY_POWER, | ||
191 | .gpio = EXYNOS4_GPX2(7), /* XEINT23 */ | ||
192 | .desc = "gpio-keys: KEY_POWER", | ||
193 | .type = EV_KEY, | ||
194 | .active_low = 1, | ||
195 | .wakeup = 1, | ||
196 | .debounce_interval = 1, | ||
197 | }, | ||
198 | }; | ||
199 | |||
200 | static struct gpio_keys_platform_data nuri_gpio_keys_data = { | ||
201 | .buttons = nuri_gpio_keys_tables, | ||
202 | .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables), | ||
203 | }; | ||
204 | |||
205 | static struct platform_device nuri_gpio_keys = { | ||
206 | .name = "gpio-keys", | ||
207 | .dev = { | ||
208 | .platform_data = &nuri_gpio_keys_data, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | /* Frame Buffer */ | ||
213 | static struct s3c_fb_pd_win nuri_fb_win0 = { | ||
214 | .win_mode = { | ||
215 | .left_margin = 64, | ||
216 | .right_margin = 16, | ||
217 | .upper_margin = 64, | ||
218 | .lower_margin = 1, | ||
219 | .hsync_len = 48, | ||
220 | .vsync_len = 3, | ||
221 | .xres = 1280, | ||
222 | .yres = 800, | ||
223 | .refresh = 60, | ||
224 | }, | ||
225 | .max_bpp = 24, | ||
226 | .default_bpp = 16, | ||
227 | .virtual_x = 1280, | ||
228 | .virtual_y = 800, | ||
229 | }; | ||
230 | |||
231 | static struct s3c_fb_platdata nuri_fb_pdata __initdata = { | ||
232 | .win[0] = &nuri_fb_win0, | ||
233 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB | | ||
234 | VIDCON0_CLKSEL_LCD, | ||
235 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
236 | .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, | ||
237 | }; | ||
238 | |||
239 | static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power) | ||
240 | { | ||
241 | int gpio = EXYNOS4_GPE1(5); | ||
242 | |||
243 | gpio_request(gpio, "LVDS_nSHDN"); | ||
244 | gpio_direction_output(gpio, power); | ||
245 | gpio_free(gpio); | ||
246 | } | ||
247 | |||
248 | static int nuri_bl_init(struct device *dev) | ||
249 | { | ||
250 | int ret, gpio = EXYNOS4_GPE2(3); | ||
251 | |||
252 | ret = gpio_request(gpio, "LCD_LDO_EN"); | ||
253 | if (!ret) | ||
254 | gpio_direction_output(gpio, 0); | ||
255 | |||
256 | return ret; | ||
257 | } | ||
258 | |||
259 | static int nuri_bl_notify(struct device *dev, int brightness) | ||
260 | { | ||
261 | if (brightness < 1) | ||
262 | brightness = 0; | ||
263 | |||
264 | gpio_set_value(EXYNOS4_GPE2(3), 1); | ||
265 | |||
266 | return brightness; | ||
267 | } | ||
268 | |||
269 | static void nuri_bl_exit(struct device *dev) | ||
270 | { | ||
271 | gpio_free(EXYNOS4_GPE2(3)); | ||
272 | } | ||
273 | |||
274 | /* nuri pwm backlight */ | ||
275 | static struct platform_pwm_backlight_data nuri_backlight_data = { | ||
276 | .pwm_id = 0, | ||
277 | .pwm_period_ns = 30000, | ||
278 | .max_brightness = 100, | ||
279 | .dft_brightness = 50, | ||
280 | .init = nuri_bl_init, | ||
281 | .notify = nuri_bl_notify, | ||
282 | .exit = nuri_bl_exit, | ||
283 | }; | ||
284 | |||
285 | static struct platform_device nuri_backlight_device = { | ||
286 | .name = "pwm-backlight", | ||
287 | .id = -1, | ||
288 | .dev = { | ||
289 | .parent = &s3c_device_timer[0].dev, | ||
290 | .platform_data = &nuri_backlight_data, | ||
291 | }, | ||
292 | }; | ||
293 | |||
294 | static struct plat_lcd_data nuri_lcd_platform_data = { | ||
295 | .set_power = nuri_lcd_power_on, | ||
296 | }; | ||
297 | |||
298 | static struct platform_device nuri_lcd_device = { | ||
299 | .name = "platform-lcd", | ||
300 | .id = -1, | ||
301 | .dev = { | ||
302 | .platform_data = &nuri_lcd_platform_data, | ||
303 | }, | ||
304 | }; | ||
305 | |||
306 | /* I2C1 */ | ||
307 | static struct i2c_board_info i2c1_devs[] __initdata = { | ||
308 | /* Gyro, To be updated */ | ||
309 | }; | ||
310 | |||
311 | /* TSP */ | ||
312 | static u8 mxt_init_vals[] = { | ||
313 | /* MXT_GEN_COMMAND(6) */ | ||
314 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
315 | /* MXT_GEN_POWER(7) */ | ||
316 | 0x20, 0xff, 0x32, | ||
317 | /* MXT_GEN_ACQUIRE(8) */ | ||
318 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, | ||
319 | /* MXT_TOUCH_MULTI(9) */ | ||
320 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
321 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | ||
322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
323 | 0x00, | ||
324 | /* MXT_TOUCH_KEYARRAY(15) */ | ||
325 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
326 | 0x00, | ||
327 | /* MXT_SPT_GPIOPWM(19) */ | ||
328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
330 | /* MXT_PROCI_GRIPFACE(20) */ | ||
331 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, | ||
332 | 0x0f, 0x0a, | ||
333 | /* MXT_PROCG_NOISE(22) */ | ||
334 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, | ||
335 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, | ||
336 | /* MXT_TOUCH_PROXIMITY(23) */ | ||
337 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
338 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
339 | /* MXT_PROCI_ONETOUCH(24) */ | ||
340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
341 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
342 | /* MXT_SPT_SELFTEST(25) */ | ||
343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
344 | 0x00, 0x00, 0x00, 0x00, | ||
345 | /* MXT_PROCI_TWOTOUCH(27) */ | ||
346 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
347 | /* MXT_SPT_CTECONFIG(28) */ | ||
348 | 0x00, 0x00, 0x02, 0x08, 0x10, 0x00, | ||
349 | }; | ||
350 | |||
351 | static struct mxt_platform_data mxt_platform_data = { | ||
352 | .config = mxt_init_vals, | ||
353 | .config_length = ARRAY_SIZE(mxt_init_vals), | ||
354 | |||
355 | .x_line = 18, | ||
356 | .y_line = 11, | ||
357 | .x_size = 1024, | ||
358 | .y_size = 600, | ||
359 | .blen = 0x1, | ||
360 | .threshold = 0x28, | ||
361 | .voltage = 2800000, /* 2.8V */ | ||
362 | .orient = MXT_DIAGONAL_COUNTER, | ||
363 | .irqflags = IRQF_TRIGGER_FALLING, | ||
364 | }; | ||
365 | |||
366 | static struct s3c2410_platform_i2c i2c3_data __initdata = { | ||
367 | .flags = 0, | ||
368 | .bus_num = 3, | ||
369 | .slave_addr = 0x10, | ||
370 | .frequency = 400 * 1000, | ||
371 | .sda_delay = 100, | ||
372 | }; | ||
373 | |||
374 | static struct i2c_board_info i2c3_devs[] __initdata = { | ||
375 | { | ||
376 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), | ||
377 | .platform_data = &mxt_platform_data, | ||
378 | .irq = IRQ_EINT(4), | ||
379 | }, | ||
380 | }; | ||
381 | |||
382 | static void __init nuri_tsp_init(void) | ||
383 | { | ||
384 | int gpio; | ||
385 | |||
386 | /* TOUCH_INT: XEINT_4 */ | ||
387 | gpio = EXYNOS4_GPX0(4); | ||
388 | gpio_request(gpio, "TOUCH_INT"); | ||
389 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
390 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
391 | } | ||
392 | |||
393 | static struct regulator_consumer_supply __initdata max8997_ldo1_[] = { | ||
394 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */ | ||
395 | }; | ||
396 | static struct regulator_consumer_supply __initdata max8997_ldo3_[] = { | ||
397 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ | ||
398 | }; | ||
399 | static struct regulator_consumer_supply __initdata max8997_ldo4_[] = { | ||
400 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ | ||
401 | }; | ||
402 | static struct regulator_consumer_supply __initdata max8997_ldo5_[] = { | ||
403 | REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */ | ||
404 | }; | ||
405 | static struct regulator_consumer_supply __initdata max8997_ldo7_[] = { | ||
406 | REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */ | ||
407 | }; | ||
408 | static struct regulator_consumer_supply __initdata max8997_ldo8_[] = { | ||
409 | REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */ | ||
410 | REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */ | ||
411 | }; | ||
412 | static struct regulator_consumer_supply __initdata max8997_ldo11_[] = { | ||
413 | REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */ | ||
414 | }; | ||
415 | static struct regulator_consumer_supply __initdata max8997_ldo12_[] = { | ||
416 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ | ||
417 | }; | ||
418 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { | ||
419 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ | ||
420 | }; | ||
421 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { | ||
422 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), | ||
423 | }; | ||
424 | static struct regulator_consumer_supply __initdata max8997_ldo15_[] = { | ||
425 | REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */ | ||
426 | }; | ||
427 | static struct regulator_consumer_supply __initdata max8997_ldo16_[] = { | ||
428 | REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */ | ||
429 | }; | ||
430 | static struct regulator_consumer_supply __initdata max8997_ldo18_[] = { | ||
431 | REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */ | ||
432 | }; | ||
433 | static struct regulator_consumer_supply __initdata max8997_buck1_[] = { | ||
434 | REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ | ||
435 | }; | ||
436 | static struct regulator_consumer_supply __initdata max8997_buck2_[] = { | ||
437 | REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */ | ||
438 | }; | ||
439 | static struct regulator_consumer_supply __initdata max8997_buck3_[] = { | ||
440 | REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */ | ||
441 | }; | ||
442 | static struct regulator_consumer_supply __initdata max8997_buck4_[] = { | ||
443 | REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */ | ||
444 | }; | ||
445 | static struct regulator_consumer_supply __initdata max8997_buck6_[] = { | ||
446 | REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */ | ||
447 | }; | ||
448 | static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = { | ||
449 | REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */ | ||
450 | }; | ||
451 | static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = { | ||
452 | REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */ | ||
453 | }; | ||
454 | |||
455 | static struct regulator_consumer_supply __initdata max8997_charger_[] = { | ||
456 | REGULATOR_SUPPLY("vinchg1", "charger-manager.0"), | ||
457 | }; | ||
458 | static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = { | ||
459 | REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */ | ||
460 | }; | ||
461 | |||
462 | static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = { | ||
463 | REGULATOR_SUPPLY("gps_clk", "bcm4751"), | ||
464 | REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"), | ||
465 | REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"), | ||
466 | }; | ||
467 | |||
468 | static struct regulator_init_data __initdata max8997_ldo1_data = { | ||
469 | .constraints = { | ||
470 | .name = "VADC_3.3V_C210", | ||
471 | .min_uV = 3300000, | ||
472 | .max_uV = 3300000, | ||
473 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
474 | .apply_uV = 1, | ||
475 | .state_mem = { | ||
476 | .disabled = 1, | ||
477 | }, | ||
478 | }, | ||
479 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_), | ||
480 | .consumer_supplies = max8997_ldo1_, | ||
481 | }; | ||
482 | |||
483 | static struct regulator_init_data __initdata max8997_ldo2_data = { | ||
484 | .constraints = { | ||
485 | .name = "VALIVE_1.1V_C210", | ||
486 | .min_uV = 1100000, | ||
487 | .max_uV = 1100000, | ||
488 | .apply_uV = 1, | ||
489 | .always_on = 1, | ||
490 | .state_mem = { | ||
491 | .enabled = 1, | ||
492 | }, | ||
493 | }, | ||
494 | }; | ||
495 | |||
496 | static struct regulator_init_data __initdata max8997_ldo3_data = { | ||
497 | .constraints = { | ||
498 | .name = "VUSB_1.1V_C210", | ||
499 | .min_uV = 1100000, | ||
500 | .max_uV = 1100000, | ||
501 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
502 | .apply_uV = 1, | ||
503 | .state_mem = { | ||
504 | .disabled = 1, | ||
505 | }, | ||
506 | }, | ||
507 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_), | ||
508 | .consumer_supplies = max8997_ldo3_, | ||
509 | }; | ||
510 | |||
511 | static struct regulator_init_data __initdata max8997_ldo4_data = { | ||
512 | .constraints = { | ||
513 | .name = "VMIPI_1.8V", | ||
514 | .min_uV = 1800000, | ||
515 | .max_uV = 1800000, | ||
516 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
517 | .apply_uV = 1, | ||
518 | .state_mem = { | ||
519 | .disabled = 1, | ||
520 | }, | ||
521 | }, | ||
522 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_), | ||
523 | .consumer_supplies = max8997_ldo4_, | ||
524 | }; | ||
525 | |||
526 | static struct regulator_init_data __initdata max8997_ldo5_data = { | ||
527 | .constraints = { | ||
528 | .name = "VHSIC_1.2V_C210", | ||
529 | .min_uV = 1200000, | ||
530 | .max_uV = 1200000, | ||
531 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
532 | .apply_uV = 1, | ||
533 | .state_mem = { | ||
534 | .disabled = 1, | ||
535 | }, | ||
536 | }, | ||
537 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_), | ||
538 | .consumer_supplies = max8997_ldo5_, | ||
539 | }; | ||
540 | |||
541 | static struct regulator_init_data __initdata max8997_ldo6_data = { | ||
542 | .constraints = { | ||
543 | .name = "VCC_1.8V_PDA", | ||
544 | .min_uV = 1800000, | ||
545 | .max_uV = 1800000, | ||
546 | .apply_uV = 1, | ||
547 | .always_on = 1, | ||
548 | .state_mem = { | ||
549 | .enabled = 1, | ||
550 | }, | ||
551 | }, | ||
552 | }; | ||
553 | |||
554 | static struct regulator_init_data __initdata max8997_ldo7_data = { | ||
555 | .constraints = { | ||
556 | .name = "CAM_ISP_1.8V", | ||
557 | .min_uV = 1800000, | ||
558 | .max_uV = 1800000, | ||
559 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
560 | .apply_uV = 1, | ||
561 | .state_mem = { | ||
562 | .disabled = 1, | ||
563 | }, | ||
564 | }, | ||
565 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_), | ||
566 | .consumer_supplies = max8997_ldo7_, | ||
567 | }; | ||
568 | |||
569 | static struct regulator_init_data __initdata max8997_ldo8_data = { | ||
570 | .constraints = { | ||
571 | .name = "VUSB/VDAC_3.3V_C210", | ||
572 | .min_uV = 3300000, | ||
573 | .max_uV = 3300000, | ||
574 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
575 | .apply_uV = 1, | ||
576 | .state_mem = { | ||
577 | .disabled = 1, | ||
578 | }, | ||
579 | }, | ||
580 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_), | ||
581 | .consumer_supplies = max8997_ldo8_, | ||
582 | }; | ||
583 | |||
584 | static struct regulator_init_data __initdata max8997_ldo9_data = { | ||
585 | .constraints = { | ||
586 | .name = "VCC_2.8V_PDA", | ||
587 | .min_uV = 2800000, | ||
588 | .max_uV = 2800000, | ||
589 | .apply_uV = 1, | ||
590 | .always_on = 1, | ||
591 | .state_mem = { | ||
592 | .enabled = 1, | ||
593 | }, | ||
594 | }, | ||
595 | }; | ||
596 | |||
597 | static struct regulator_init_data __initdata max8997_ldo10_data = { | ||
598 | .constraints = { | ||
599 | .name = "VPLL_1.1V_C210", | ||
600 | .min_uV = 1100000, | ||
601 | .max_uV = 1100000, | ||
602 | .apply_uV = 1, | ||
603 | .always_on = 1, | ||
604 | .state_mem = { | ||
605 | .disabled = 1, | ||
606 | }, | ||
607 | }, | ||
608 | }; | ||
609 | |||
610 | static struct regulator_init_data __initdata max8997_ldo11_data = { | ||
611 | .constraints = { | ||
612 | .name = "LVDS_VDD3.3V", | ||
613 | .min_uV = 3300000, | ||
614 | .max_uV = 3300000, | ||
615 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
616 | .apply_uV = 1, | ||
617 | .boot_on = 1, | ||
618 | .state_mem = { | ||
619 | .disabled = 1, | ||
620 | }, | ||
621 | }, | ||
622 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_), | ||
623 | .consumer_supplies = max8997_ldo11_, | ||
624 | }; | ||
625 | |||
626 | static struct regulator_init_data __initdata max8997_ldo12_data = { | ||
627 | .constraints = { | ||
628 | .name = "VT_CAM_1.8V", | ||
629 | .min_uV = 1800000, | ||
630 | .max_uV = 1800000, | ||
631 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
632 | .apply_uV = 1, | ||
633 | .state_mem = { | ||
634 | .disabled = 1, | ||
635 | }, | ||
636 | }, | ||
637 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_), | ||
638 | .consumer_supplies = max8997_ldo12_, | ||
639 | }; | ||
640 | |||
641 | static struct regulator_init_data __initdata max8997_ldo13_data = { | ||
642 | .constraints = { | ||
643 | .name = "VTF_2.8V", | ||
644 | .min_uV = 2800000, | ||
645 | .max_uV = 2800000, | ||
646 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
647 | .apply_uV = 1, | ||
648 | .state_mem = { | ||
649 | .disabled = 1, | ||
650 | }, | ||
651 | }, | ||
652 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_), | ||
653 | .consumer_supplies = max8997_ldo13_, | ||
654 | }; | ||
655 | |||
656 | static struct regulator_init_data __initdata max8997_ldo14_data = { | ||
657 | .constraints = { | ||
658 | .name = "VCC_3.0V_MOTOR", | ||
659 | .min_uV = 3000000, | ||
660 | .max_uV = 3000000, | ||
661 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
662 | .apply_uV = 1, | ||
663 | .state_mem = { | ||
664 | .disabled = 1, | ||
665 | }, | ||
666 | }, | ||
667 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_), | ||
668 | .consumer_supplies = max8997_ldo14_, | ||
669 | }; | ||
670 | |||
671 | static struct regulator_init_data __initdata max8997_ldo15_data = { | ||
672 | .constraints = { | ||
673 | .name = "VTOUCH_ADVV2.8V", | ||
674 | .min_uV = 2800000, | ||
675 | .max_uV = 2800000, | ||
676 | .apply_uV = 1, | ||
677 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
678 | .state_mem = { | ||
679 | .disabled = 1, | ||
680 | }, | ||
681 | }, | ||
682 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_), | ||
683 | .consumer_supplies = max8997_ldo15_, | ||
684 | }; | ||
685 | |||
686 | static struct regulator_init_data __initdata max8997_ldo16_data = { | ||
687 | .constraints = { | ||
688 | .name = "CAM_SENSOR_IO_1.8V", | ||
689 | .min_uV = 1800000, | ||
690 | .max_uV = 1800000, | ||
691 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
692 | .apply_uV = 1, | ||
693 | .state_mem = { | ||
694 | .disabled = 1, | ||
695 | }, | ||
696 | }, | ||
697 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_), | ||
698 | .consumer_supplies = max8997_ldo16_, | ||
699 | }; | ||
700 | |||
701 | static struct regulator_init_data __initdata max8997_ldo18_data = { | ||
702 | .constraints = { | ||
703 | .name = "VTOUCH_VDD2.8V", | ||
704 | .min_uV = 2800000, | ||
705 | .max_uV = 2800000, | ||
706 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
707 | .apply_uV = 1, | ||
708 | .state_mem = { | ||
709 | .disabled = 1, | ||
710 | }, | ||
711 | }, | ||
712 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_), | ||
713 | .consumer_supplies = max8997_ldo18_, | ||
714 | }; | ||
715 | |||
716 | static struct regulator_init_data __initdata max8997_ldo21_data = { | ||
717 | .constraints = { | ||
718 | .name = "VDDQ_M1M2_1.2V", | ||
719 | .min_uV = 1200000, | ||
720 | .max_uV = 1200000, | ||
721 | .apply_uV = 1, | ||
722 | .always_on = 1, | ||
723 | .state_mem = { | ||
724 | .disabled = 1, | ||
725 | }, | ||
726 | }, | ||
727 | }; | ||
728 | |||
729 | static struct regulator_init_data __initdata max8997_buck1_data = { | ||
730 | .constraints = { | ||
731 | .name = "VARM_1.2V_C210", | ||
732 | .min_uV = 900000, | ||
733 | .max_uV = 1350000, | ||
734 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
735 | .always_on = 1, | ||
736 | .state_mem = { | ||
737 | .disabled = 1, | ||
738 | }, | ||
739 | }, | ||
740 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_), | ||
741 | .consumer_supplies = max8997_buck1_, | ||
742 | }; | ||
743 | |||
744 | static struct regulator_init_data __initdata max8997_buck2_data = { | ||
745 | .constraints = { | ||
746 | .name = "VINT_1.1V_C210", | ||
747 | .min_uV = 900000, | ||
748 | .max_uV = 1100000, | ||
749 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
750 | .always_on = 1, | ||
751 | .state_mem = { | ||
752 | .disabled = 1, | ||
753 | }, | ||
754 | }, | ||
755 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_), | ||
756 | .consumer_supplies = max8997_buck2_, | ||
757 | }; | ||
758 | |||
759 | static struct regulator_init_data __initdata max8997_buck3_data = { | ||
760 | .constraints = { | ||
761 | .name = "VG3D_1.1V_C210", | ||
762 | .min_uV = 900000, | ||
763 | .max_uV = 1100000, | ||
764 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
765 | REGULATOR_CHANGE_STATUS, | ||
766 | .state_mem = { | ||
767 | .disabled = 1, | ||
768 | }, | ||
769 | }, | ||
770 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_), | ||
771 | .consumer_supplies = max8997_buck3_, | ||
772 | }; | ||
773 | |||
774 | static struct regulator_init_data __initdata max8997_buck4_data = { | ||
775 | .constraints = { | ||
776 | .name = "CAM_ISP_CORE_1.2V", | ||
777 | .min_uV = 1200000, | ||
778 | .max_uV = 1200000, | ||
779 | .apply_uV = 1, | ||
780 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
781 | .state_mem = { | ||
782 | .disabled = 1, | ||
783 | }, | ||
784 | }, | ||
785 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_), | ||
786 | .consumer_supplies = max8997_buck4_, | ||
787 | }; | ||
788 | |||
789 | static struct regulator_init_data __initdata max8997_buck5_data = { | ||
790 | .constraints = { | ||
791 | .name = "VMEM_1.2V_C210", | ||
792 | .min_uV = 1200000, | ||
793 | .max_uV = 1200000, | ||
794 | .apply_uV = 1, | ||
795 | .always_on = 1, | ||
796 | .state_mem = { | ||
797 | .enabled = 1, | ||
798 | }, | ||
799 | }, | ||
800 | }; | ||
801 | |||
802 | static struct regulator_init_data __initdata max8997_buck6_data = { | ||
803 | .constraints = { | ||
804 | .name = "CAM_AF_2.8V", | ||
805 | .min_uV = 2800000, | ||
806 | .max_uV = 2800000, | ||
807 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
808 | .state_mem = { | ||
809 | .disabled = 1, | ||
810 | }, | ||
811 | }, | ||
812 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_), | ||
813 | .consumer_supplies = max8997_buck6_, | ||
814 | }; | ||
815 | |||
816 | static struct regulator_init_data __initdata max8997_buck7_data = { | ||
817 | .constraints = { | ||
818 | .name = "VCC_SUB_2.0V", | ||
819 | .min_uV = 2000000, | ||
820 | .max_uV = 2000000, | ||
821 | .apply_uV = 1, | ||
822 | .always_on = 1, | ||
823 | .state_mem = { | ||
824 | .enabled = 1, | ||
825 | }, | ||
826 | }, | ||
827 | }; | ||
828 | |||
829 | static struct regulator_init_data __initdata max8997_32khz_ap_data = { | ||
830 | .constraints = { | ||
831 | .name = "32KHz AP", | ||
832 | .always_on = 1, | ||
833 | .state_mem = { | ||
834 | .enabled = 1, | ||
835 | }, | ||
836 | }, | ||
837 | .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_), | ||
838 | .consumer_supplies = max8997_32khz_ap_, | ||
839 | }; | ||
840 | |||
841 | static struct regulator_init_data __initdata max8997_32khz_cp_data = { | ||
842 | .constraints = { | ||
843 | .name = "32KHz CP", | ||
844 | .state_mem = { | ||
845 | .disabled = 1, | ||
846 | }, | ||
847 | }, | ||
848 | }; | ||
849 | |||
850 | static struct regulator_init_data __initdata max8997_vichg_data = { | ||
851 | .constraints = { | ||
852 | .name = "VICHG", | ||
853 | .state_mem = { | ||
854 | .disabled = 1, | ||
855 | }, | ||
856 | }, | ||
857 | }; | ||
858 | |||
859 | static struct regulator_init_data __initdata max8997_esafeout1_data = { | ||
860 | .constraints = { | ||
861 | .name = "SAFEOUT1", | ||
862 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
863 | .state_mem = { | ||
864 | .disabled = 1, | ||
865 | }, | ||
866 | }, | ||
867 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_), | ||
868 | .consumer_supplies = max8997_esafeout1_, | ||
869 | }; | ||
870 | |||
871 | static struct regulator_init_data __initdata max8997_esafeout2_data = { | ||
872 | .constraints = { | ||
873 | .name = "SAFEOUT2", | ||
874 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
875 | .state_mem = { | ||
876 | .disabled = 1, | ||
877 | }, | ||
878 | }, | ||
879 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_), | ||
880 | .consumer_supplies = max8997_esafeout2_, | ||
881 | }; | ||
882 | |||
883 | static struct regulator_init_data __initdata max8997_charger_cv_data = { | ||
884 | .constraints = { | ||
885 | .name = "CHARGER_CV", | ||
886 | .min_uV = 4200000, | ||
887 | .max_uV = 4200000, | ||
888 | .apply_uV = 1, | ||
889 | }, | ||
890 | }; | ||
891 | |||
892 | static struct regulator_init_data __initdata max8997_charger_data = { | ||
893 | .constraints = { | ||
894 | .name = "CHARGER", | ||
895 | .min_uA = 200000, | ||
896 | .max_uA = 950000, | ||
897 | .boot_on = 1, | ||
898 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | ||
899 | REGULATOR_CHANGE_CURRENT, | ||
900 | }, | ||
901 | .num_consumer_supplies = ARRAY_SIZE(max8997_charger_), | ||
902 | .consumer_supplies = max8997_charger_, | ||
903 | }; | ||
904 | |||
905 | static struct regulator_init_data __initdata max8997_charger_topoff_data = { | ||
906 | .constraints = { | ||
907 | .name = "CHARGER TOPOFF", | ||
908 | .min_uA = 50000, | ||
909 | .max_uA = 200000, | ||
910 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | ||
911 | }, | ||
912 | .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_), | ||
913 | .consumer_supplies = max8997_chg_toff_, | ||
914 | }; | ||
915 | |||
916 | static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = { | ||
917 | { MAX8997_LDO1, &max8997_ldo1_data }, | ||
918 | { MAX8997_LDO2, &max8997_ldo2_data }, | ||
919 | { MAX8997_LDO3, &max8997_ldo3_data }, | ||
920 | { MAX8997_LDO4, &max8997_ldo4_data }, | ||
921 | { MAX8997_LDO5, &max8997_ldo5_data }, | ||
922 | { MAX8997_LDO6, &max8997_ldo6_data }, | ||
923 | { MAX8997_LDO7, &max8997_ldo7_data }, | ||
924 | { MAX8997_LDO8, &max8997_ldo8_data }, | ||
925 | { MAX8997_LDO9, &max8997_ldo9_data }, | ||
926 | { MAX8997_LDO10, &max8997_ldo10_data }, | ||
927 | { MAX8997_LDO11, &max8997_ldo11_data }, | ||
928 | { MAX8997_LDO12, &max8997_ldo12_data }, | ||
929 | { MAX8997_LDO13, &max8997_ldo13_data }, | ||
930 | { MAX8997_LDO14, &max8997_ldo14_data }, | ||
931 | { MAX8997_LDO15, &max8997_ldo15_data }, | ||
932 | { MAX8997_LDO16, &max8997_ldo16_data }, | ||
933 | |||
934 | { MAX8997_LDO18, &max8997_ldo18_data }, | ||
935 | { MAX8997_LDO21, &max8997_ldo21_data }, | ||
936 | |||
937 | { MAX8997_BUCK1, &max8997_buck1_data }, | ||
938 | { MAX8997_BUCK2, &max8997_buck2_data }, | ||
939 | { MAX8997_BUCK3, &max8997_buck3_data }, | ||
940 | { MAX8997_BUCK4, &max8997_buck4_data }, | ||
941 | { MAX8997_BUCK5, &max8997_buck5_data }, | ||
942 | { MAX8997_BUCK6, &max8997_buck6_data }, | ||
943 | { MAX8997_BUCK7, &max8997_buck7_data }, | ||
944 | |||
945 | { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data }, | ||
946 | { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data }, | ||
947 | |||
948 | { MAX8997_ENVICHG, &max8997_vichg_data }, | ||
949 | { MAX8997_ESAFEOUT1, &max8997_esafeout1_data }, | ||
950 | { MAX8997_ESAFEOUT2, &max8997_esafeout2_data }, | ||
951 | { MAX8997_CHARGER_CV, &max8997_charger_cv_data }, | ||
952 | { MAX8997_CHARGER, &max8997_charger_data }, | ||
953 | { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data }, | ||
954 | }; | ||
955 | |||
956 | static struct max8997_platform_data __initdata nuri_max8997_pdata = { | ||
957 | .wakeup = 1, | ||
958 | |||
959 | .num_regulators = ARRAY_SIZE(nuri_max8997_regulators), | ||
960 | .regulators = nuri_max8997_regulators, | ||
961 | |||
962 | .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) }, | ||
963 | .buck2_gpiodvs = true, | ||
964 | |||
965 | .buck1_voltage[0] = 1350000, /* 1.35V */ | ||
966 | .buck1_voltage[1] = 1300000, /* 1.3V */ | ||
967 | .buck1_voltage[2] = 1250000, /* 1.25V */ | ||
968 | .buck1_voltage[3] = 1200000, /* 1.2V */ | ||
969 | .buck1_voltage[4] = 1150000, /* 1.15V */ | ||
970 | .buck1_voltage[5] = 1100000, /* 1.1V */ | ||
971 | .buck1_voltage[6] = 1000000, /* 1.0V */ | ||
972 | .buck1_voltage[7] = 950000, /* 0.95V */ | ||
973 | |||
974 | .buck2_voltage[0] = 1100000, /* 1.1V */ | ||
975 | .buck2_voltage[1] = 1000000, /* 1.0V */ | ||
976 | .buck2_voltage[2] = 950000, /* 0.95V */ | ||
977 | .buck2_voltage[3] = 900000, /* 0.9V */ | ||
978 | .buck2_voltage[4] = 1100000, /* 1.1V */ | ||
979 | .buck2_voltage[5] = 1000000, /* 1.0V */ | ||
980 | .buck2_voltage[6] = 950000, /* 0.95V */ | ||
981 | .buck2_voltage[7] = 900000, /* 0.9V */ | ||
982 | |||
983 | .buck5_voltage[0] = 1200000, /* 1.2V */ | ||
984 | .buck5_voltage[1] = 1200000, /* 1.2V */ | ||
985 | .buck5_voltage[2] = 1200000, /* 1.2V */ | ||
986 | .buck5_voltage[3] = 1200000, /* 1.2V */ | ||
987 | .buck5_voltage[4] = 1200000, /* 1.2V */ | ||
988 | .buck5_voltage[5] = 1200000, /* 1.2V */ | ||
989 | .buck5_voltage[6] = 1200000, /* 1.2V */ | ||
990 | .buck5_voltage[7] = 1200000, /* 1.2V */ | ||
991 | }; | ||
992 | |||
993 | /* GPIO I2C 5 (PMIC) */ | ||
994 | enum { I2C5_MAX8997 }; | ||
995 | static struct i2c_board_info i2c5_devs[] __initdata = { | ||
996 | [I2C5_MAX8997] = { | ||
997 | I2C_BOARD_INFO("max8997", 0xCC >> 1), | ||
998 | .platform_data = &nuri_max8997_pdata, | ||
999 | }, | ||
1000 | }; | ||
1001 | |||
1002 | static struct max17042_platform_data nuri_battery_platform_data = { | ||
1003 | }; | ||
1004 | |||
1005 | /* GPIO I2C 9 (Fuel Gauge) */ | ||
1006 | static struct i2c_gpio_platform_data i2c9_gpio_data = { | ||
1007 | .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */ | ||
1008 | .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */ | ||
1009 | }; | ||
1010 | static struct platform_device i2c9_gpio = { | ||
1011 | .name = "i2c-gpio", | ||
1012 | .id = 9, | ||
1013 | .dev = { | ||
1014 | .platform_data = &i2c9_gpio_data, | ||
1015 | }, | ||
1016 | }; | ||
1017 | enum { I2C9_MAX17042}; | ||
1018 | static struct i2c_board_info i2c9_devs[] __initdata = { | ||
1019 | [I2C9_MAX17042] = { | ||
1020 | I2C_BOARD_INFO("max17042", 0x36), | ||
1021 | .platform_data = &nuri_battery_platform_data, | ||
1022 | }, | ||
1023 | }; | ||
1024 | |||
1025 | /* MAX8903 Secondary Charger */ | ||
1026 | static struct regulator_consumer_supply supplies_max8903[] = { | ||
1027 | REGULATOR_SUPPLY("vinchg2", "charger-manager.0"), | ||
1028 | }; | ||
1029 | |||
1030 | static struct regulator_init_data max8903_charger_en_data = { | ||
1031 | .constraints = { | ||
1032 | .name = "VOUT_CHARGER", | ||
1033 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1034 | .boot_on = 1, | ||
1035 | }, | ||
1036 | .num_consumer_supplies = ARRAY_SIZE(supplies_max8903), | ||
1037 | .consumer_supplies = supplies_max8903, | ||
1038 | }; | ||
1039 | |||
1040 | static struct fixed_voltage_config max8903_charger_en = { | ||
1041 | .supply_name = "VOUT_CHARGER", | ||
1042 | .microvolts = 5000000, /* Assume 5VDC */ | ||
1043 | .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */ | ||
1044 | .enable_high = 0, /* Enable = Low */ | ||
1045 | .enabled_at_boot = 1, | ||
1046 | .init_data = &max8903_charger_en_data, | ||
1047 | }; | ||
1048 | |||
1049 | static struct platform_device max8903_fixed_reg_dev = { | ||
1050 | .name = "reg-fixed-voltage", | ||
1051 | .id = FIXED_REG_ID_MAX8903, | ||
1052 | .dev = { .platform_data = &max8903_charger_en }, | ||
1053 | }; | ||
1054 | |||
1055 | static struct max8903_pdata nuri_max8903 = { | ||
1056 | /* | ||
1057 | * cen: don't control with the driver, let it be | ||
1058 | * controlled by regulator above | ||
1059 | */ | ||
1060 | .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */ | ||
1061 | /* uok, usus: not connected */ | ||
1062 | .chg = EXYNOS4_GPE2(0), /* TA_nCHG */ | ||
1063 | /* flt: vcc_1.8V_pda */ | ||
1064 | .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */ | ||
1065 | |||
1066 | .dc_valid = true, | ||
1067 | .usb_valid = false, /* USB is not wired to MAX8903 */ | ||
1068 | }; | ||
1069 | |||
1070 | static struct platform_device nuri_max8903_device = { | ||
1071 | .name = "max8903-charger", | ||
1072 | .dev = { | ||
1073 | .platform_data = &nuri_max8903, | ||
1074 | }, | ||
1075 | }; | ||
1076 | |||
1077 | static void __init nuri_power_init(void) | ||
1078 | { | ||
1079 | int gpio; | ||
1080 | int irq_base = IRQ_GPIO_END + 1; | ||
1081 | int ta_en = 0; | ||
1082 | |||
1083 | nuri_max8997_pdata.irq_base = irq_base; | ||
1084 | irq_base += MAX8997_IRQ_NR; | ||
1085 | |||
1086 | gpio = EXYNOS4_GPX0(7); | ||
1087 | gpio_request(gpio, "AP_PMIC_IRQ"); | ||
1088 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1089 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1090 | |||
1091 | gpio = EXYNOS4_GPX2(3); | ||
1092 | gpio_request(gpio, "FUEL_ALERT"); | ||
1093 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1094 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1095 | |||
1096 | gpio = nuri_max8903.dok; | ||
1097 | gpio_request(gpio, "TA_nCONNECTED"); | ||
1098 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1099 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1100 | ta_en = gpio_get_value(gpio) ? 0 : 1; | ||
1101 | |||
1102 | gpio = nuri_max8903.chg; | ||
1103 | gpio_request(gpio, "TA_nCHG"); | ||
1104 | gpio_direction_input(gpio); | ||
1105 | |||
1106 | gpio = nuri_max8903.dcm; | ||
1107 | gpio_request(gpio, "CURR_ADJ"); | ||
1108 | gpio_direction_output(gpio, ta_en); | ||
1109 | } | ||
1110 | |||
1111 | /* USB EHCI */ | ||
1112 | static struct s5p_ehci_platdata nuri_ehci_pdata; | ||
1113 | |||
1114 | static void __init nuri_ehci_init(void) | ||
1115 | { | ||
1116 | struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata; | ||
1117 | |||
1118 | s5p_ehci_set_platdata(pdata); | ||
1119 | } | ||
1120 | |||
1121 | /* CAMERA */ | ||
1122 | static struct regulator_consumer_supply cam_vdda_supply[] = { | ||
1123 | REGULATOR_SUPPLY("a_sensor", "0-001f"), | ||
1124 | }; | ||
1125 | |||
1126 | static struct regulator_init_data cam_vdda_reg_init_data = { | ||
1127 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | ||
1128 | .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply), | ||
1129 | .consumer_supplies = cam_vdda_supply, | ||
1130 | }; | ||
1131 | |||
1132 | static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = { | ||
1133 | .supply_name = "CAM_IO_EN", | ||
1134 | .microvolts = 2800000, | ||
1135 | .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */ | ||
1136 | .enable_high = 1, | ||
1137 | .init_data = &cam_vdda_reg_init_data, | ||
1138 | }; | ||
1139 | |||
1140 | static struct platform_device cam_vdda_fixed_rdev = { | ||
1141 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V, | ||
1142 | .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg }, | ||
1143 | }; | ||
1144 | |||
1145 | static struct regulator_consumer_supply camera_8m_12v_supply = | ||
1146 | REGULATOR_SUPPLY("dig_12", "0-001f"); | ||
1147 | |||
1148 | static struct regulator_init_data cam_8m_12v_reg_init_data = { | ||
1149 | .num_consumer_supplies = 1, | ||
1150 | .consumer_supplies = &camera_8m_12v_supply, | ||
1151 | .constraints = { | ||
1152 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | ||
1153 | }, | ||
1154 | }; | ||
1155 | |||
1156 | static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = { | ||
1157 | .supply_name = "8M_1.2V", | ||
1158 | .microvolts = 1200000, | ||
1159 | .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */ | ||
1160 | .enable_high = 1, | ||
1161 | .init_data = &cam_8m_12v_reg_init_data, | ||
1162 | }; | ||
1163 | |||
1164 | static struct platform_device cam_8m_12v_fixed_rdev = { | ||
1165 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V, | ||
1166 | .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg }, | ||
1167 | }; | ||
1168 | |||
1169 | static struct s5p_platform_mipi_csis mipi_csis_platdata = { | ||
1170 | .clk_rate = 166000000UL, | ||
1171 | .lanes = 2, | ||
1172 | .alignment = 32, | ||
1173 | .hs_settle = 12, | ||
1174 | .phy_enable = s5p_csis_phy_enable, | ||
1175 | }; | ||
1176 | |||
1177 | #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */ | ||
1178 | #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5) | ||
1179 | |||
1180 | static struct m5mols_platform_data m5mols_platdata = { | ||
1181 | .gpio_reset = GPIO_CAM_MEGA_RST, | ||
1182 | }; | ||
1183 | |||
1184 | static struct i2c_board_info m5mols_board_info = { | ||
1185 | I2C_BOARD_INFO("M5MOLS", 0x1F), | ||
1186 | .platform_data = &m5mols_platdata, | ||
1187 | }; | ||
1188 | |||
1189 | static struct s5p_fimc_isp_info nuri_camera_sensors[] = { | ||
1190 | { | ||
1191 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | ||
1192 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | ||
1193 | .bus_type = FIMC_MIPI_CSI2, | ||
1194 | .board_info = &m5mols_board_info, | ||
1195 | .clk_frequency = 24000000UL, | ||
1196 | .csi_data_align = 32, | ||
1197 | }, | ||
1198 | }; | ||
1199 | |||
1200 | static struct s5p_platform_fimc fimc_md_platdata = { | ||
1201 | .isp_info = nuri_camera_sensors, | ||
1202 | .num_clients = ARRAY_SIZE(nuri_camera_sensors), | ||
1203 | }; | ||
1204 | |||
1205 | static struct gpio nuri_camera_gpios[] = { | ||
1206 | { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, | ||
1207 | { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, | ||
1208 | }; | ||
1209 | |||
1210 | static void nuri_camera_init(void) | ||
1211 | { | ||
1212 | s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), | ||
1213 | &s5p_device_mipi_csis0); | ||
1214 | s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata), | ||
1215 | &s5p_device_fimc_md); | ||
1216 | |||
1217 | if (gpio_request_array(nuri_camera_gpios, | ||
1218 | ARRAY_SIZE(nuri_camera_gpios))) { | ||
1219 | pr_err("%s: GPIO request failed\n", __func__); | ||
1220 | return; | ||
1221 | } | ||
1222 | |||
1223 | m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT); | ||
1224 | if (!IS_ERR_VALUE(m5mols_board_info.irq)) | ||
1225 | s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF)); | ||
1226 | else | ||
1227 | pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); | ||
1228 | |||
1229 | /* Free GPIOs controlled directly by the sensor drivers. */ | ||
1230 | gpio_free(GPIO_CAM_MEGA_RST); | ||
1231 | |||
1232 | if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) { | ||
1233 | pr_err("%s: Camera port A setup failed\n", __func__); | ||
1234 | return; | ||
1235 | } | ||
1236 | /* Increase drive strength of the sensor clock output */ | ||
1237 | s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4); | ||
1238 | } | ||
1239 | |||
1240 | static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = { | ||
1241 | .frequency = 400000U, | ||
1242 | .sda_delay = 200, | ||
1243 | }; | ||
1244 | |||
1245 | static struct platform_device *nuri_devices[] __initdata = { | ||
1246 | /* Samsung Platform Devices */ | ||
1247 | &s3c_device_i2c5, /* PMIC should initialize first */ | ||
1248 | &s3c_device_i2c0, | ||
1249 | &emmc_fixed_voltage, | ||
1250 | &s5p_device_mipi_csis0, | ||
1251 | &s5p_device_fimc0, | ||
1252 | &s5p_device_fimc1, | ||
1253 | &s5p_device_fimc2, | ||
1254 | &s5p_device_fimc3, | ||
1255 | &s5p_device_fimd0, | ||
1256 | &s3c_device_hsmmc0, | ||
1257 | &s3c_device_hsmmc2, | ||
1258 | &s3c_device_hsmmc3, | ||
1259 | &s3c_device_wdt, | ||
1260 | &s3c_device_timer[0], | ||
1261 | &s5p_device_ehci, | ||
1262 | &s3c_device_i2c3, | ||
1263 | &i2c9_gpio, | ||
1264 | &s3c_device_adc, | ||
1265 | &s3c_device_rtc, | ||
1266 | &s5p_device_mfc, | ||
1267 | &s5p_device_mfc_l, | ||
1268 | &s5p_device_mfc_r, | ||
1269 | &exynos4_device_pd[PD_MFC], | ||
1270 | &exynos4_device_pd[PD_LCD0], | ||
1271 | &exynos4_device_pd[PD_CAM], | ||
1272 | &s5p_device_fimc_md, | ||
1273 | |||
1274 | /* NURI Devices */ | ||
1275 | &nuri_gpio_keys, | ||
1276 | &nuri_lcd_device, | ||
1277 | &nuri_backlight_device, | ||
1278 | &max8903_fixed_reg_dev, | ||
1279 | &nuri_max8903_device, | ||
1280 | &cam_vdda_fixed_rdev, | ||
1281 | &cam_8m_12v_fixed_rdev, | ||
1282 | }; | ||
1283 | |||
1284 | static void __init nuri_map_io(void) | ||
1285 | { | ||
1286 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
1287 | s3c24xx_init_clocks(24000000); | ||
1288 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); | ||
1289 | } | ||
1290 | |||
1291 | static void __init nuri_reserve(void) | ||
1292 | { | ||
1293 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
1294 | } | ||
1295 | |||
1296 | static void __init nuri_machine_init(void) | ||
1297 | { | ||
1298 | nuri_sdhci_init(); | ||
1299 | nuri_tsp_init(); | ||
1300 | nuri_power_init(); | ||
1301 | |||
1302 | s3c_i2c0_set_platdata(&nuri_i2c0_platdata); | ||
1303 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | ||
1304 | s3c_i2c3_set_platdata(&i2c3_data); | ||
1305 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | ||
1306 | s3c_i2c5_set_platdata(NULL); | ||
1307 | i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7)); | ||
1308 | i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); | ||
1309 | i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3)); | ||
1310 | i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs)); | ||
1311 | |||
1312 | s5p_fimd0_set_platdata(&nuri_fb_pdata); | ||
1313 | |||
1314 | nuri_camera_init(); | ||
1315 | |||
1316 | nuri_ehci_init(); | ||
1317 | clk_xusbxti.rate = 24000000; | ||
1318 | |||
1319 | /* Last */ | ||
1320 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); | ||
1321 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
1322 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; | ||
1323 | |||
1324 | s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1325 | s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1326 | s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1327 | s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1328 | s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1329 | } | ||
1330 | |||
1331 | MACHINE_START(NURI, "NURI") | ||
1332 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | ||
1333 | .atag_offset = 0x100, | ||
1334 | .init_irq = exynos4_init_irq, | ||
1335 | .map_io = nuri_map_io, | ||
1336 | .init_machine = nuri_machine_init, | ||
1337 | .timer = &exynos4_timer, | ||
1338 | .reserve = &nuri_reserve, | ||
1339 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c new file mode 100644 index 000000000000..f80b563f2be7 --- /dev/null +++ b/arch/arm/mach-exynos/mach-origen.c | |||
@@ -0,0 +1,700 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mach-origen.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Insignal Co., Ltd. | ||
4 | * http://www.insignal.co.kr/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/serial_core.h> | ||
12 | #include <linux/gpio.h> | ||
13 | #include <linux/mmc/host.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/input.h> | ||
17 | #include <linux/pwm_backlight.h> | ||
18 | #include <linux/gpio_keys.h> | ||
19 | #include <linux/i2c.h> | ||
20 | #include <linux/regulator/machine.h> | ||
21 | #include <linux/mfd/max8997.h> | ||
22 | #include <linux/lcd.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach-types.h> | ||
26 | |||
27 | #include <video/platform_lcd.h> | ||
28 | |||
29 | #include <plat/regs-serial.h> | ||
30 | #include <plat/regs-fb-v4.h> | ||
31 | #include <plat/exynos4.h> | ||
32 | #include <plat/cpu.h> | ||
33 | #include <plat/devs.h> | ||
34 | #include <plat/sdhci.h> | ||
35 | #include <plat/iic.h> | ||
36 | #include <plat/ehci.h> | ||
37 | #include <plat/clock.h> | ||
38 | #include <plat/gpio-cfg.h> | ||
39 | #include <plat/backlight.h> | ||
40 | #include <plat/pd.h> | ||
41 | #include <plat/fb.h> | ||
42 | #include <plat/mfc.h> | ||
43 | |||
44 | #include <mach/map.h> | ||
45 | |||
46 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
47 | #define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
48 | S3C2410_UCON_RXILEVEL | \ | ||
49 | S3C2410_UCON_TXIRQMODE | \ | ||
50 | S3C2410_UCON_RXIRQMODE | \ | ||
51 | S3C2410_UCON_RXFIFO_TOI | \ | ||
52 | S3C2443_UCON_RXERR_IRQEN) | ||
53 | |||
54 | #define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
55 | |||
56 | #define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
57 | S5PV210_UFCON_TXTRIG4 | \ | ||
58 | S5PV210_UFCON_RXTRIG4) | ||
59 | |||
60 | static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = { | ||
61 | [0] = { | ||
62 | .hwport = 0, | ||
63 | .flags = 0, | ||
64 | .ucon = ORIGEN_UCON_DEFAULT, | ||
65 | .ulcon = ORIGEN_ULCON_DEFAULT, | ||
66 | .ufcon = ORIGEN_UFCON_DEFAULT, | ||
67 | }, | ||
68 | [1] = { | ||
69 | .hwport = 1, | ||
70 | .flags = 0, | ||
71 | .ucon = ORIGEN_UCON_DEFAULT, | ||
72 | .ulcon = ORIGEN_ULCON_DEFAULT, | ||
73 | .ufcon = ORIGEN_UFCON_DEFAULT, | ||
74 | }, | ||
75 | [2] = { | ||
76 | .hwport = 2, | ||
77 | .flags = 0, | ||
78 | .ucon = ORIGEN_UCON_DEFAULT, | ||
79 | .ulcon = ORIGEN_ULCON_DEFAULT, | ||
80 | .ufcon = ORIGEN_UFCON_DEFAULT, | ||
81 | }, | ||
82 | [3] = { | ||
83 | .hwport = 3, | ||
84 | .flags = 0, | ||
85 | .ucon = ORIGEN_UCON_DEFAULT, | ||
86 | .ulcon = ORIGEN_ULCON_DEFAULT, | ||
87 | .ufcon = ORIGEN_UFCON_DEFAULT, | ||
88 | }, | ||
89 | }; | ||
90 | |||
91 | static struct regulator_consumer_supply __initdata ldo3_consumer[] = { | ||
92 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ | ||
93 | REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */ | ||
94 | REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */ | ||
95 | }; | ||
96 | static struct regulator_consumer_supply __initdata ldo6_consumer[] = { | ||
97 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ | ||
98 | }; | ||
99 | static struct regulator_consumer_supply __initdata ldo7_consumer[] = { | ||
100 | REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */ | ||
101 | }; | ||
102 | static struct regulator_consumer_supply __initdata ldo8_consumer[] = { | ||
103 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ | ||
104 | REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */ | ||
105 | }; | ||
106 | static struct regulator_consumer_supply __initdata ldo9_consumer[] = { | ||
107 | REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ | ||
108 | }; | ||
109 | static struct regulator_consumer_supply __initdata ldo11_consumer[] = { | ||
110 | REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */ | ||
111 | }; | ||
112 | static struct regulator_consumer_supply __initdata ldo14_consumer[] = { | ||
113 | REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ | ||
114 | }; | ||
115 | static struct regulator_consumer_supply __initdata ldo17_consumer[] = { | ||
116 | REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ | ||
117 | }; | ||
118 | static struct regulator_consumer_supply __initdata buck1_consumer[] = { | ||
119 | REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ | ||
120 | }; | ||
121 | static struct regulator_consumer_supply __initdata buck2_consumer[] = { | ||
122 | REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */ | ||
123 | }; | ||
124 | static struct regulator_consumer_supply __initdata buck3_consumer[] = { | ||
125 | REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */ | ||
126 | }; | ||
127 | static struct regulator_consumer_supply __initdata buck7_consumer[] = { | ||
128 | REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */ | ||
129 | }; | ||
130 | |||
131 | static struct regulator_init_data __initdata max8997_ldo1_data = { | ||
132 | .constraints = { | ||
133 | .name = "VDD_ABB_3.3V", | ||
134 | .min_uV = 3300000, | ||
135 | .max_uV = 3300000, | ||
136 | .apply_uV = 1, | ||
137 | .state_mem = { | ||
138 | .disabled = 1, | ||
139 | }, | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | static struct regulator_init_data __initdata max8997_ldo2_data = { | ||
144 | .constraints = { | ||
145 | .name = "VDD_ALIVE_1.1V", | ||
146 | .min_uV = 1100000, | ||
147 | .max_uV = 1100000, | ||
148 | .apply_uV = 1, | ||
149 | .always_on = 1, | ||
150 | .state_mem = { | ||
151 | .enabled = 1, | ||
152 | }, | ||
153 | }, | ||
154 | }; | ||
155 | |||
156 | static struct regulator_init_data __initdata max8997_ldo3_data = { | ||
157 | .constraints = { | ||
158 | .name = "VMIPI_1.1V", | ||
159 | .min_uV = 1100000, | ||
160 | .max_uV = 1100000, | ||
161 | .apply_uV = 1, | ||
162 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
163 | .state_mem = { | ||
164 | .disabled = 1, | ||
165 | }, | ||
166 | }, | ||
167 | .num_consumer_supplies = ARRAY_SIZE(ldo3_consumer), | ||
168 | .consumer_supplies = ldo3_consumer, | ||
169 | }; | ||
170 | |||
171 | static struct regulator_init_data __initdata max8997_ldo4_data = { | ||
172 | .constraints = { | ||
173 | .name = "VDD_RTC_1.8V", | ||
174 | .min_uV = 1800000, | ||
175 | .max_uV = 1800000, | ||
176 | .apply_uV = 1, | ||
177 | .always_on = 1, | ||
178 | .state_mem = { | ||
179 | .disabled = 1, | ||
180 | }, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static struct regulator_init_data __initdata max8997_ldo6_data = { | ||
185 | .constraints = { | ||
186 | .name = "VMIPI_1.8V", | ||
187 | .min_uV = 1800000, | ||
188 | .max_uV = 1800000, | ||
189 | .apply_uV = 1, | ||
190 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
191 | .state_mem = { | ||
192 | .disabled = 1, | ||
193 | }, | ||
194 | }, | ||
195 | .num_consumer_supplies = ARRAY_SIZE(ldo6_consumer), | ||
196 | .consumer_supplies = ldo6_consumer, | ||
197 | }; | ||
198 | |||
199 | static struct regulator_init_data __initdata max8997_ldo7_data = { | ||
200 | .constraints = { | ||
201 | .name = "VDD_AUD_1.8V", | ||
202 | .min_uV = 1800000, | ||
203 | .max_uV = 1800000, | ||
204 | .apply_uV = 1, | ||
205 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
206 | .state_mem = { | ||
207 | .disabled = 1, | ||
208 | }, | ||
209 | }, | ||
210 | .num_consumer_supplies = ARRAY_SIZE(ldo7_consumer), | ||
211 | .consumer_supplies = ldo7_consumer, | ||
212 | }; | ||
213 | |||
214 | static struct regulator_init_data __initdata max8997_ldo8_data = { | ||
215 | .constraints = { | ||
216 | .name = "VADC_3.3V", | ||
217 | .min_uV = 3300000, | ||
218 | .max_uV = 3300000, | ||
219 | .apply_uV = 1, | ||
220 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
221 | .state_mem = { | ||
222 | .disabled = 1, | ||
223 | }, | ||
224 | }, | ||
225 | .num_consumer_supplies = ARRAY_SIZE(ldo8_consumer), | ||
226 | .consumer_supplies = ldo8_consumer, | ||
227 | }; | ||
228 | |||
229 | static struct regulator_init_data __initdata max8997_ldo9_data = { | ||
230 | .constraints = { | ||
231 | .name = "DVDD_SWB_2.8V", | ||
232 | .min_uV = 2800000, | ||
233 | .max_uV = 2800000, | ||
234 | .apply_uV = 1, | ||
235 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
236 | .state_mem = { | ||
237 | .disabled = 1, | ||
238 | }, | ||
239 | }, | ||
240 | .num_consumer_supplies = ARRAY_SIZE(ldo9_consumer), | ||
241 | .consumer_supplies = ldo9_consumer, | ||
242 | }; | ||
243 | |||
244 | static struct regulator_init_data __initdata max8997_ldo10_data = { | ||
245 | .constraints = { | ||
246 | .name = "VDD_PLL_1.1V", | ||
247 | .min_uV = 1100000, | ||
248 | .max_uV = 1100000, | ||
249 | .apply_uV = 1, | ||
250 | .always_on = 1, | ||
251 | .state_mem = { | ||
252 | .disabled = 1, | ||
253 | }, | ||
254 | }, | ||
255 | }; | ||
256 | |||
257 | static struct regulator_init_data __initdata max8997_ldo11_data = { | ||
258 | .constraints = { | ||
259 | .name = "VDD_AUD_3V", | ||
260 | .min_uV = 3000000, | ||
261 | .max_uV = 3000000, | ||
262 | .apply_uV = 1, | ||
263 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
264 | .state_mem = { | ||
265 | .disabled = 1, | ||
266 | }, | ||
267 | }, | ||
268 | .num_consumer_supplies = ARRAY_SIZE(ldo11_consumer), | ||
269 | .consumer_supplies = ldo11_consumer, | ||
270 | }; | ||
271 | |||
272 | static struct regulator_init_data __initdata max8997_ldo14_data = { | ||
273 | .constraints = { | ||
274 | .name = "AVDD18_SWB_1.8V", | ||
275 | .min_uV = 1800000, | ||
276 | .max_uV = 1800000, | ||
277 | .apply_uV = 1, | ||
278 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
279 | .state_mem = { | ||
280 | .disabled = 1, | ||
281 | }, | ||
282 | }, | ||
283 | .num_consumer_supplies = ARRAY_SIZE(ldo14_consumer), | ||
284 | .consumer_supplies = ldo14_consumer, | ||
285 | }; | ||
286 | |||
287 | static struct regulator_init_data __initdata max8997_ldo17_data = { | ||
288 | .constraints = { | ||
289 | .name = "VDD_SWB_3.3V", | ||
290 | .min_uV = 3300000, | ||
291 | .max_uV = 3300000, | ||
292 | .apply_uV = 1, | ||
293 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
294 | .state_mem = { | ||
295 | .disabled = 1, | ||
296 | }, | ||
297 | }, | ||
298 | .num_consumer_supplies = ARRAY_SIZE(ldo17_consumer), | ||
299 | .consumer_supplies = ldo17_consumer, | ||
300 | }; | ||
301 | |||
302 | static struct regulator_init_data __initdata max8997_ldo21_data = { | ||
303 | .constraints = { | ||
304 | .name = "VDD_MIF_1.2V", | ||
305 | .min_uV = 1200000, | ||
306 | .max_uV = 1200000, | ||
307 | .apply_uV = 1, | ||
308 | .always_on = 1, | ||
309 | .state_mem = { | ||
310 | .disabled = 1, | ||
311 | }, | ||
312 | }, | ||
313 | }; | ||
314 | |||
315 | static struct regulator_init_data __initdata max8997_buck1_data = { | ||
316 | .constraints = { | ||
317 | .name = "VDD_ARM_1.2V", | ||
318 | .min_uV = 950000, | ||
319 | .max_uV = 1350000, | ||
320 | .always_on = 1, | ||
321 | .boot_on = 1, | ||
322 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
323 | .state_mem = { | ||
324 | .disabled = 1, | ||
325 | }, | ||
326 | }, | ||
327 | .num_consumer_supplies = ARRAY_SIZE(buck1_consumer), | ||
328 | .consumer_supplies = buck1_consumer, | ||
329 | }; | ||
330 | |||
331 | static struct regulator_init_data __initdata max8997_buck2_data = { | ||
332 | .constraints = { | ||
333 | .name = "VDD_INT_1.1V", | ||
334 | .min_uV = 900000, | ||
335 | .max_uV = 1100000, | ||
336 | .always_on = 1, | ||
337 | .boot_on = 1, | ||
338 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
339 | .state_mem = { | ||
340 | .disabled = 1, | ||
341 | }, | ||
342 | }, | ||
343 | .num_consumer_supplies = ARRAY_SIZE(buck2_consumer), | ||
344 | .consumer_supplies = buck2_consumer, | ||
345 | }; | ||
346 | |||
347 | static struct regulator_init_data __initdata max8997_buck3_data = { | ||
348 | .constraints = { | ||
349 | .name = "VDD_G3D_1.1V", | ||
350 | .min_uV = 900000, | ||
351 | .max_uV = 1100000, | ||
352 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
353 | REGULATOR_CHANGE_STATUS, | ||
354 | .state_mem = { | ||
355 | .disabled = 1, | ||
356 | }, | ||
357 | }, | ||
358 | .num_consumer_supplies = ARRAY_SIZE(buck3_consumer), | ||
359 | .consumer_supplies = buck3_consumer, | ||
360 | }; | ||
361 | |||
362 | static struct regulator_init_data __initdata max8997_buck5_data = { | ||
363 | .constraints = { | ||
364 | .name = "VDDQ_M1M2_1.2V", | ||
365 | .min_uV = 1200000, | ||
366 | .max_uV = 1200000, | ||
367 | .apply_uV = 1, | ||
368 | .always_on = 1, | ||
369 | .state_mem = { | ||
370 | .disabled = 1, | ||
371 | }, | ||
372 | }, | ||
373 | }; | ||
374 | |||
375 | static struct regulator_init_data __initdata max8997_buck7_data = { | ||
376 | .constraints = { | ||
377 | .name = "VDD_LCD_3.3V", | ||
378 | .min_uV = 3300000, | ||
379 | .max_uV = 3300000, | ||
380 | .boot_on = 1, | ||
381 | .apply_uV = 1, | ||
382 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
383 | .state_mem = { | ||
384 | .disabled = 1 | ||
385 | }, | ||
386 | }, | ||
387 | .num_consumer_supplies = ARRAY_SIZE(buck7_consumer), | ||
388 | .consumer_supplies = buck7_consumer, | ||
389 | }; | ||
390 | |||
391 | static struct max8997_regulator_data __initdata origen_max8997_regulators[] = { | ||
392 | { MAX8997_LDO1, &max8997_ldo1_data }, | ||
393 | { MAX8997_LDO2, &max8997_ldo2_data }, | ||
394 | { MAX8997_LDO3, &max8997_ldo3_data }, | ||
395 | { MAX8997_LDO4, &max8997_ldo4_data }, | ||
396 | { MAX8997_LDO6, &max8997_ldo6_data }, | ||
397 | { MAX8997_LDO7, &max8997_ldo7_data }, | ||
398 | { MAX8997_LDO8, &max8997_ldo8_data }, | ||
399 | { MAX8997_LDO9, &max8997_ldo9_data }, | ||
400 | { MAX8997_LDO10, &max8997_ldo10_data }, | ||
401 | { MAX8997_LDO11, &max8997_ldo11_data }, | ||
402 | { MAX8997_LDO14, &max8997_ldo14_data }, | ||
403 | { MAX8997_LDO17, &max8997_ldo17_data }, | ||
404 | { MAX8997_LDO21, &max8997_ldo21_data }, | ||
405 | { MAX8997_BUCK1, &max8997_buck1_data }, | ||
406 | { MAX8997_BUCK2, &max8997_buck2_data }, | ||
407 | { MAX8997_BUCK3, &max8997_buck3_data }, | ||
408 | { MAX8997_BUCK5, &max8997_buck5_data }, | ||
409 | { MAX8997_BUCK7, &max8997_buck7_data }, | ||
410 | }; | ||
411 | |||
412 | struct max8997_platform_data __initdata origen_max8997_pdata = { | ||
413 | .num_regulators = ARRAY_SIZE(origen_max8997_regulators), | ||
414 | .regulators = origen_max8997_regulators, | ||
415 | |||
416 | .wakeup = true, | ||
417 | .buck1_gpiodvs = false, | ||
418 | .buck2_gpiodvs = false, | ||
419 | .buck5_gpiodvs = false, | ||
420 | .irq_base = IRQ_GPIO_END + 1, | ||
421 | |||
422 | .ignore_gpiodvs_side_effect = true, | ||
423 | .buck125_default_idx = 0x0, | ||
424 | |||
425 | .buck125_gpios[0] = EXYNOS4_GPX0(0), | ||
426 | .buck125_gpios[1] = EXYNOS4_GPX0(1), | ||
427 | .buck125_gpios[2] = EXYNOS4_GPX0(2), | ||
428 | |||
429 | .buck1_voltage[0] = 1350000, | ||
430 | .buck1_voltage[1] = 1300000, | ||
431 | .buck1_voltage[2] = 1250000, | ||
432 | .buck1_voltage[3] = 1200000, | ||
433 | .buck1_voltage[4] = 1150000, | ||
434 | .buck1_voltage[5] = 1100000, | ||
435 | .buck1_voltage[6] = 1000000, | ||
436 | .buck1_voltage[7] = 950000, | ||
437 | |||
438 | .buck2_voltage[0] = 1100000, | ||
439 | .buck2_voltage[1] = 1100000, | ||
440 | .buck2_voltage[2] = 1100000, | ||
441 | .buck2_voltage[3] = 1100000, | ||
442 | .buck2_voltage[4] = 1000000, | ||
443 | .buck2_voltage[5] = 1000000, | ||
444 | .buck2_voltage[6] = 1000000, | ||
445 | .buck2_voltage[7] = 1000000, | ||
446 | |||
447 | .buck5_voltage[0] = 1200000, | ||
448 | .buck5_voltage[1] = 1200000, | ||
449 | .buck5_voltage[2] = 1200000, | ||
450 | .buck5_voltage[3] = 1200000, | ||
451 | .buck5_voltage[4] = 1200000, | ||
452 | .buck5_voltage[5] = 1200000, | ||
453 | .buck5_voltage[6] = 1200000, | ||
454 | .buck5_voltage[7] = 1200000, | ||
455 | }; | ||
456 | |||
457 | /* I2C0 */ | ||
458 | static struct i2c_board_info i2c0_devs[] __initdata = { | ||
459 | { | ||
460 | I2C_BOARD_INFO("max8997", (0xCC >> 1)), | ||
461 | .platform_data = &origen_max8997_pdata, | ||
462 | .irq = IRQ_EINT(4), | ||
463 | }, | ||
464 | }; | ||
465 | |||
466 | static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = { | ||
467 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
468 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
469 | }; | ||
470 | |||
471 | static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = { | ||
472 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
473 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
474 | }; | ||
475 | |||
476 | /* USB EHCI */ | ||
477 | static struct s5p_ehci_platdata origen_ehci_pdata; | ||
478 | |||
479 | static void __init origen_ehci_init(void) | ||
480 | { | ||
481 | struct s5p_ehci_platdata *pdata = &origen_ehci_pdata; | ||
482 | |||
483 | s5p_ehci_set_platdata(pdata); | ||
484 | } | ||
485 | |||
486 | static struct gpio_keys_button origen_gpio_keys_table[] = { | ||
487 | { | ||
488 | .code = KEY_MENU, | ||
489 | .gpio = EXYNOS4_GPX1(5), | ||
490 | .desc = "gpio-keys: KEY_MENU", | ||
491 | .type = EV_KEY, | ||
492 | .active_low = 1, | ||
493 | .wakeup = 1, | ||
494 | .debounce_interval = 1, | ||
495 | }, { | ||
496 | .code = KEY_HOME, | ||
497 | .gpio = EXYNOS4_GPX1(6), | ||
498 | .desc = "gpio-keys: KEY_HOME", | ||
499 | .type = EV_KEY, | ||
500 | .active_low = 1, | ||
501 | .wakeup = 1, | ||
502 | .debounce_interval = 1, | ||
503 | }, { | ||
504 | .code = KEY_BACK, | ||
505 | .gpio = EXYNOS4_GPX1(7), | ||
506 | .desc = "gpio-keys: KEY_BACK", | ||
507 | .type = EV_KEY, | ||
508 | .active_low = 1, | ||
509 | .wakeup = 1, | ||
510 | .debounce_interval = 1, | ||
511 | }, { | ||
512 | .code = KEY_UP, | ||
513 | .gpio = EXYNOS4_GPX2(0), | ||
514 | .desc = "gpio-keys: KEY_UP", | ||
515 | .type = EV_KEY, | ||
516 | .active_low = 1, | ||
517 | .wakeup = 1, | ||
518 | .debounce_interval = 1, | ||
519 | }, { | ||
520 | .code = KEY_DOWN, | ||
521 | .gpio = EXYNOS4_GPX2(1), | ||
522 | .desc = "gpio-keys: KEY_DOWN", | ||
523 | .type = EV_KEY, | ||
524 | .active_low = 1, | ||
525 | .wakeup = 1, | ||
526 | .debounce_interval = 1, | ||
527 | }, | ||
528 | }; | ||
529 | |||
530 | static struct gpio_keys_platform_data origen_gpio_keys_data = { | ||
531 | .buttons = origen_gpio_keys_table, | ||
532 | .nbuttons = ARRAY_SIZE(origen_gpio_keys_table), | ||
533 | }; | ||
534 | |||
535 | static struct platform_device origen_device_gpiokeys = { | ||
536 | .name = "gpio-keys", | ||
537 | .dev = { | ||
538 | .platform_data = &origen_gpio_keys_data, | ||
539 | }, | ||
540 | }; | ||
541 | |||
542 | static void lcd_hv070wsa_set_power(struct plat_lcd_data *pd, unsigned int power) | ||
543 | { | ||
544 | int ret; | ||
545 | |||
546 | if (power) | ||
547 | ret = gpio_request_one(EXYNOS4_GPE3(4), | ||
548 | GPIOF_OUT_INIT_HIGH, "GPE3_4"); | ||
549 | else | ||
550 | ret = gpio_request_one(EXYNOS4_GPE3(4), | ||
551 | GPIOF_OUT_INIT_LOW, "GPE3_4"); | ||
552 | |||
553 | gpio_free(EXYNOS4_GPE3(4)); | ||
554 | |||
555 | if (ret) | ||
556 | pr_err("failed to request gpio for LCD power: %d\n", ret); | ||
557 | } | ||
558 | |||
559 | static struct plat_lcd_data origen_lcd_hv070wsa_data = { | ||
560 | .set_power = lcd_hv070wsa_set_power, | ||
561 | }; | ||
562 | |||
563 | static struct platform_device origen_lcd_hv070wsa = { | ||
564 | .name = "platform-lcd", | ||
565 | .dev.parent = &s5p_device_fimd0.dev, | ||
566 | .dev.platform_data = &origen_lcd_hv070wsa_data, | ||
567 | }; | ||
568 | |||
569 | static struct s3c_fb_pd_win origen_fb_win0 = { | ||
570 | .win_mode = { | ||
571 | .left_margin = 64, | ||
572 | .right_margin = 16, | ||
573 | .upper_margin = 64, | ||
574 | .lower_margin = 16, | ||
575 | .hsync_len = 48, | ||
576 | .vsync_len = 3, | ||
577 | .xres = 1024, | ||
578 | .yres = 600, | ||
579 | }, | ||
580 | .max_bpp = 32, | ||
581 | .default_bpp = 24, | ||
582 | }; | ||
583 | |||
584 | static struct s3c_fb_platdata origen_lcd_pdata __initdata = { | ||
585 | .win[0] = &origen_fb_win0, | ||
586 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | ||
587 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
588 | .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, | ||
589 | }; | ||
590 | |||
591 | static struct platform_device *origen_devices[] __initdata = { | ||
592 | &s3c_device_hsmmc2, | ||
593 | &s3c_device_hsmmc0, | ||
594 | &s3c_device_i2c0, | ||
595 | &s3c_device_rtc, | ||
596 | &s3c_device_wdt, | ||
597 | &s5p_device_ehci, | ||
598 | &s5p_device_fimc0, | ||
599 | &s5p_device_fimc1, | ||
600 | &s5p_device_fimc2, | ||
601 | &s5p_device_fimc3, | ||
602 | &s5p_device_fimd0, | ||
603 | &s5p_device_hdmi, | ||
604 | &s5p_device_i2c_hdmiphy, | ||
605 | &s5p_device_mfc, | ||
606 | &s5p_device_mfc_l, | ||
607 | &s5p_device_mfc_r, | ||
608 | &s5p_device_mixer, | ||
609 | &exynos4_device_pd[PD_LCD0], | ||
610 | &exynos4_device_pd[PD_TV], | ||
611 | &exynos4_device_pd[PD_G3D], | ||
612 | &exynos4_device_pd[PD_LCD1], | ||
613 | &exynos4_device_pd[PD_CAM], | ||
614 | &exynos4_device_pd[PD_GPS], | ||
615 | &exynos4_device_pd[PD_MFC], | ||
616 | &origen_device_gpiokeys, | ||
617 | &origen_lcd_hv070wsa, | ||
618 | }; | ||
619 | |||
620 | /* LCD Backlight data */ | ||
621 | static struct samsung_bl_gpio_info origen_bl_gpio_info = { | ||
622 | .no = EXYNOS4_GPD0(0), | ||
623 | .func = S3C_GPIO_SFN(2), | ||
624 | }; | ||
625 | |||
626 | static struct platform_pwm_backlight_data origen_bl_data = { | ||
627 | .pwm_id = 0, | ||
628 | .pwm_period_ns = 1000, | ||
629 | }; | ||
630 | |||
631 | static void s5p_tv_setup(void) | ||
632 | { | ||
633 | /* Direct HPD to HDMI chip */ | ||
634 | gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug"); | ||
635 | s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3)); | ||
636 | s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE); | ||
637 | } | ||
638 | |||
639 | static void __init origen_map_io(void) | ||
640 | { | ||
641 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
642 | s3c24xx_init_clocks(24000000); | ||
643 | s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs)); | ||
644 | } | ||
645 | |||
646 | static void __init origen_power_init(void) | ||
647 | { | ||
648 | gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ"); | ||
649 | s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf)); | ||
650 | s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); | ||
651 | } | ||
652 | |||
653 | static void __init origen_reserve(void) | ||
654 | { | ||
655 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
656 | } | ||
657 | |||
658 | static void __init origen_machine_init(void) | ||
659 | { | ||
660 | origen_power_init(); | ||
661 | |||
662 | s3c_i2c0_set_platdata(NULL); | ||
663 | i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); | ||
664 | |||
665 | /* | ||
666 | * Since sdhci instance 2 can contain a bootable media, | ||
667 | * sdhci instance 0 is registered after instance 2. | ||
668 | */ | ||
669 | s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata); | ||
670 | s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata); | ||
671 | |||
672 | origen_ehci_init(); | ||
673 | clk_xusbxti.rate = 24000000; | ||
674 | |||
675 | s5p_tv_setup(); | ||
676 | s5p_i2c_hdmiphy_set_platdata(NULL); | ||
677 | |||
678 | s5p_fimd0_set_platdata(&origen_lcd_pdata); | ||
679 | |||
680 | platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); | ||
681 | |||
682 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; | ||
683 | |||
684 | s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
685 | s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
686 | |||
687 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
688 | |||
689 | samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); | ||
690 | } | ||
691 | |||
692 | MACHINE_START(ORIGEN, "ORIGEN") | ||
693 | /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */ | ||
694 | .atag_offset = 0x100, | ||
695 | .init_irq = exynos4_init_irq, | ||
696 | .map_io = origen_map_io, | ||
697 | .init_machine = origen_machine_init, | ||
698 | .timer = &exynos4_timer, | ||
699 | .reserve = &origen_reserve, | ||
700 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c new file mode 100644 index 000000000000..fcf2e0e23d53 --- /dev/null +++ b/arch/arm/mach-exynos/mach-smdk4x12.c | |||
@@ -0,0 +1,302 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/mach-smdk4x12.c | ||
3 | * | ||
4 | * Copyright (c) 2011 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/gpio.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/input.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/mfd/max8997.h> | ||
17 | #include <linux/mmc/host.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/pwm_backlight.h> | ||
20 | #include <linux/regulator/machine.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | #include <plat/backlight.h> | ||
27 | #include <plat/clock.h> | ||
28 | #include <plat/cpu.h> | ||
29 | #include <plat/devs.h> | ||
30 | #include <plat/exynos4.h> | ||
31 | #include <plat/gpio-cfg.h> | ||
32 | #include <plat/iic.h> | ||
33 | #include <plat/keypad.h> | ||
34 | #include <plat/regs-serial.h> | ||
35 | #include <plat/sdhci.h> | ||
36 | |||
37 | #include <mach/map.h> | ||
38 | |||
39 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
40 | #define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
41 | S3C2410_UCON_RXILEVEL | \ | ||
42 | S3C2410_UCON_TXIRQMODE | \ | ||
43 | S3C2410_UCON_RXIRQMODE | \ | ||
44 | S3C2410_UCON_RXFIFO_TOI | \ | ||
45 | S3C2443_UCON_RXERR_IRQEN) | ||
46 | |||
47 | #define SMDK4X12_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
48 | |||
49 | #define SMDK4X12_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
50 | S5PV210_UFCON_TXTRIG4 | \ | ||
51 | S5PV210_UFCON_RXTRIG4) | ||
52 | |||
53 | static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = { | ||
54 | [0] = { | ||
55 | .hwport = 0, | ||
56 | .flags = 0, | ||
57 | .ucon = SMDK4X12_UCON_DEFAULT, | ||
58 | .ulcon = SMDK4X12_ULCON_DEFAULT, | ||
59 | .ufcon = SMDK4X12_UFCON_DEFAULT, | ||
60 | }, | ||
61 | [1] = { | ||
62 | .hwport = 1, | ||
63 | .flags = 0, | ||
64 | .ucon = SMDK4X12_UCON_DEFAULT, | ||
65 | .ulcon = SMDK4X12_ULCON_DEFAULT, | ||
66 | .ufcon = SMDK4X12_UFCON_DEFAULT, | ||
67 | }, | ||
68 | [2] = { | ||
69 | .hwport = 2, | ||
70 | .flags = 0, | ||
71 | .ucon = SMDK4X12_UCON_DEFAULT, | ||
72 | .ulcon = SMDK4X12_ULCON_DEFAULT, | ||
73 | .ufcon = SMDK4X12_UFCON_DEFAULT, | ||
74 | }, | ||
75 | [3] = { | ||
76 | .hwport = 3, | ||
77 | .flags = 0, | ||
78 | .ucon = SMDK4X12_UCON_DEFAULT, | ||
79 | .ulcon = SMDK4X12_ULCON_DEFAULT, | ||
80 | .ufcon = SMDK4X12_UFCON_DEFAULT, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = { | ||
85 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
86 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
87 | #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT | ||
88 | .max_width = 8, | ||
89 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
90 | #endif | ||
91 | }; | ||
92 | |||
93 | static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = { | ||
94 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
95 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
96 | }; | ||
97 | |||
98 | static struct regulator_consumer_supply max8997_buck1 = | ||
99 | REGULATOR_SUPPLY("vdd_arm", NULL); | ||
100 | |||
101 | static struct regulator_consumer_supply max8997_buck2 = | ||
102 | REGULATOR_SUPPLY("vdd_int", NULL); | ||
103 | |||
104 | static struct regulator_consumer_supply max8997_buck3 = | ||
105 | REGULATOR_SUPPLY("vdd_g3d", NULL); | ||
106 | |||
107 | static struct regulator_init_data max8997_buck1_data = { | ||
108 | .constraints = { | ||
109 | .name = "VDD_ARM_SMDK4X12", | ||
110 | .min_uV = 925000, | ||
111 | .max_uV = 1350000, | ||
112 | .always_on = 1, | ||
113 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
114 | .state_mem = { | ||
115 | .disabled = 1, | ||
116 | }, | ||
117 | }, | ||
118 | .num_consumer_supplies = 1, | ||
119 | .consumer_supplies = &max8997_buck1, | ||
120 | }; | ||
121 | |||
122 | static struct regulator_init_data max8997_buck2_data = { | ||
123 | .constraints = { | ||
124 | .name = "VDD_INT_SMDK4X12", | ||
125 | .min_uV = 950000, | ||
126 | .max_uV = 1150000, | ||
127 | .always_on = 1, | ||
128 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
129 | .state_mem = { | ||
130 | .disabled = 1, | ||
131 | }, | ||
132 | }, | ||
133 | .num_consumer_supplies = 1, | ||
134 | .consumer_supplies = &max8997_buck2, | ||
135 | }; | ||
136 | |||
137 | static struct regulator_init_data max8997_buck3_data = { | ||
138 | .constraints = { | ||
139 | .name = "VDD_G3D_SMDK4X12", | ||
140 | .min_uV = 950000, | ||
141 | .max_uV = 1150000, | ||
142 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
143 | REGULATOR_CHANGE_STATUS, | ||
144 | .state_mem = { | ||
145 | .disabled = 1, | ||
146 | }, | ||
147 | }, | ||
148 | .num_consumer_supplies = 1, | ||
149 | .consumer_supplies = &max8997_buck3, | ||
150 | }; | ||
151 | |||
152 | static struct max8997_regulator_data smdk4x12_max8997_regulators[] = { | ||
153 | { MAX8997_BUCK1, &max8997_buck1_data }, | ||
154 | { MAX8997_BUCK2, &max8997_buck2_data }, | ||
155 | { MAX8997_BUCK3, &max8997_buck3_data }, | ||
156 | }; | ||
157 | |||
158 | static struct max8997_platform_data smdk4x12_max8997_pdata = { | ||
159 | .num_regulators = ARRAY_SIZE(smdk4x12_max8997_regulators), | ||
160 | .regulators = smdk4x12_max8997_regulators, | ||
161 | |||
162 | .buck1_voltage[0] = 1100000, /* 1.1V */ | ||
163 | .buck1_voltage[1] = 1100000, /* 1.1V */ | ||
164 | .buck1_voltage[2] = 1100000, /* 1.1V */ | ||
165 | .buck1_voltage[3] = 1100000, /* 1.1V */ | ||
166 | .buck1_voltage[4] = 1100000, /* 1.1V */ | ||
167 | .buck1_voltage[5] = 1100000, /* 1.1V */ | ||
168 | .buck1_voltage[6] = 1000000, /* 1.0V */ | ||
169 | .buck1_voltage[7] = 950000, /* 0.95V */ | ||
170 | |||
171 | .buck2_voltage[0] = 1100000, /* 1.1V */ | ||
172 | .buck2_voltage[1] = 1000000, /* 1.0V */ | ||
173 | .buck2_voltage[2] = 950000, /* 0.95V */ | ||
174 | .buck2_voltage[3] = 900000, /* 0.9V */ | ||
175 | .buck2_voltage[4] = 1100000, /* 1.1V */ | ||
176 | .buck2_voltage[5] = 1000000, /* 1.0V */ | ||
177 | .buck2_voltage[6] = 950000, /* 0.95V */ | ||
178 | .buck2_voltage[7] = 900000, /* 0.9V */ | ||
179 | |||
180 | .buck5_voltage[0] = 1100000, /* 1.1V */ | ||
181 | .buck5_voltage[1] = 1100000, /* 1.1V */ | ||
182 | .buck5_voltage[2] = 1100000, /* 1.1V */ | ||
183 | .buck5_voltage[3] = 1100000, /* 1.1V */ | ||
184 | .buck5_voltage[4] = 1100000, /* 1.1V */ | ||
185 | .buck5_voltage[5] = 1100000, /* 1.1V */ | ||
186 | .buck5_voltage[6] = 1100000, /* 1.1V */ | ||
187 | .buck5_voltage[7] = 1100000, /* 1.1V */ | ||
188 | }; | ||
189 | |||
190 | static struct i2c_board_info smdk4x12_i2c_devs0[] __initdata = { | ||
191 | { | ||
192 | I2C_BOARD_INFO("max8997", 0x66), | ||
193 | .platform_data = &smdk4x12_max8997_pdata, | ||
194 | } | ||
195 | }; | ||
196 | |||
197 | static struct i2c_board_info smdk4x12_i2c_devs1[] __initdata = { | ||
198 | { I2C_BOARD_INFO("wm8994", 0x1a), } | ||
199 | }; | ||
200 | |||
201 | static struct i2c_board_info smdk4x12_i2c_devs3[] __initdata = { | ||
202 | /* nothing here yet */ | ||
203 | }; | ||
204 | |||
205 | static struct i2c_board_info smdk4x12_i2c_devs7[] __initdata = { | ||
206 | /* nothing here yet */ | ||
207 | }; | ||
208 | |||
209 | static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = { | ||
210 | .no = EXYNOS4_GPD0(1), | ||
211 | .func = S3C_GPIO_SFN(2), | ||
212 | }; | ||
213 | |||
214 | static struct platform_pwm_backlight_data smdk4x12_bl_data = { | ||
215 | .pwm_id = 1, | ||
216 | .pwm_period_ns = 1000, | ||
217 | }; | ||
218 | |||
219 | static uint32_t smdk4x12_keymap[] __initdata = { | ||
220 | /* KEY(row, col, keycode) */ | ||
221 | KEY(1, 0, KEY_D), KEY(1, 1, KEY_A), KEY(1, 2, KEY_B), | ||
222 | KEY(1, 3, KEY_E), KEY(1, 4, KEY_C) | ||
223 | }; | ||
224 | |||
225 | static struct matrix_keymap_data smdk4x12_keymap_data __initdata = { | ||
226 | .keymap = smdk4x12_keymap, | ||
227 | .keymap_size = ARRAY_SIZE(smdk4x12_keymap), | ||
228 | }; | ||
229 | |||
230 | static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = { | ||
231 | .keymap_data = &smdk4x12_keymap_data, | ||
232 | .rows = 2, | ||
233 | .cols = 5, | ||
234 | }; | ||
235 | |||
236 | static struct platform_device *smdk4x12_devices[] __initdata = { | ||
237 | &s3c_device_hsmmc2, | ||
238 | &s3c_device_hsmmc3, | ||
239 | &s3c_device_i2c0, | ||
240 | &s3c_device_i2c1, | ||
241 | &s3c_device_i2c3, | ||
242 | &s3c_device_i2c7, | ||
243 | &s3c_device_rtc, | ||
244 | &s3c_device_wdt, | ||
245 | &samsung_device_keypad, | ||
246 | }; | ||
247 | |||
248 | static void __init smdk4x12_map_io(void) | ||
249 | { | ||
250 | clk_xusbxti.rate = 24000000; | ||
251 | |||
252 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
253 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
254 | s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); | ||
255 | } | ||
256 | |||
257 | static void __init smdk4x12_machine_init(void) | ||
258 | { | ||
259 | s3c_i2c0_set_platdata(NULL); | ||
260 | i2c_register_board_info(0, smdk4x12_i2c_devs0, | ||
261 | ARRAY_SIZE(smdk4x12_i2c_devs0)); | ||
262 | |||
263 | s3c_i2c1_set_platdata(NULL); | ||
264 | i2c_register_board_info(1, smdk4x12_i2c_devs1, | ||
265 | ARRAY_SIZE(smdk4x12_i2c_devs1)); | ||
266 | |||
267 | s3c_i2c3_set_platdata(NULL); | ||
268 | i2c_register_board_info(3, smdk4x12_i2c_devs3, | ||
269 | ARRAY_SIZE(smdk4x12_i2c_devs3)); | ||
270 | |||
271 | s3c_i2c7_set_platdata(NULL); | ||
272 | i2c_register_board_info(7, smdk4x12_i2c_devs7, | ||
273 | ARRAY_SIZE(smdk4x12_i2c_devs7)); | ||
274 | |||
275 | samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data); | ||
276 | |||
277 | samsung_keypad_set_platdata(&smdk4x12_keypad_data); | ||
278 | |||
279 | s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata); | ||
280 | s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata); | ||
281 | |||
282 | platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices)); | ||
283 | } | ||
284 | |||
285 | MACHINE_START(SMDK4212, "SMDK4212") | ||
286 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
287 | .atag_offset = 0x100, | ||
288 | .init_irq = exynos4_init_irq, | ||
289 | .map_io = smdk4x12_map_io, | ||
290 | .init_machine = smdk4x12_machine_init, | ||
291 | .timer = &exynos4_timer, | ||
292 | MACHINE_END | ||
293 | |||
294 | MACHINE_START(SMDK4412, "SMDK4412") | ||
295 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
296 | /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ | ||
297 | .atag_offset = 0x100, | ||
298 | .init_irq = exynos4_init_irq, | ||
299 | .map_io = smdk4x12_map_io, | ||
300 | .init_machine = smdk4x12_machine_init, | ||
301 | .timer = &exynos4_timer, | ||
302 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c new file mode 100644 index 000000000000..cec2afabe7b4 --- /dev/null +++ b/arch/arm/mach-exynos/mach-smdkv310.c | |||
@@ -0,0 +1,390 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mach-smdkv310.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/serial_core.h> | ||
12 | #include <linux/delay.h> | ||
13 | #include <linux/gpio.h> | ||
14 | #include <linux/lcd.h> | ||
15 | #include <linux/mmc/host.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/smsc911x.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/i2c.h> | ||
20 | #include <linux/input.h> | ||
21 | #include <linux/pwm_backlight.h> | ||
22 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | #include <video/platform_lcd.h> | ||
27 | #include <plat/regs-serial.h> | ||
28 | #include <plat/regs-srom.h> | ||
29 | #include <plat/regs-fb-v4.h> | ||
30 | #include <plat/exynos4.h> | ||
31 | #include <plat/cpu.h> | ||
32 | #include <plat/devs.h> | ||
33 | #include <plat/fb.h> | ||
34 | #include <plat/keypad.h> | ||
35 | #include <plat/sdhci.h> | ||
36 | #include <plat/iic.h> | ||
37 | #include <plat/pd.h> | ||
38 | #include <plat/gpio-cfg.h> | ||
39 | #include <plat/backlight.h> | ||
40 | #include <plat/mfc.h> | ||
41 | #include <plat/ehci.h> | ||
42 | #include <plat/clock.h> | ||
43 | |||
44 | #include <mach/map.h> | ||
45 | |||
46 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
47 | #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
48 | S3C2410_UCON_RXILEVEL | \ | ||
49 | S3C2410_UCON_TXIRQMODE | \ | ||
50 | S3C2410_UCON_RXIRQMODE | \ | ||
51 | S3C2410_UCON_RXFIFO_TOI | \ | ||
52 | S3C2443_UCON_RXERR_IRQEN) | ||
53 | |||
54 | #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
55 | |||
56 | #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
57 | S5PV210_UFCON_TXTRIG4 | \ | ||
58 | S5PV210_UFCON_RXTRIG4) | ||
59 | |||
60 | static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = { | ||
61 | [0] = { | ||
62 | .hwport = 0, | ||
63 | .flags = 0, | ||
64 | .ucon = SMDKV310_UCON_DEFAULT, | ||
65 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
66 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
67 | }, | ||
68 | [1] = { | ||
69 | .hwport = 1, | ||
70 | .flags = 0, | ||
71 | .ucon = SMDKV310_UCON_DEFAULT, | ||
72 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
73 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
74 | }, | ||
75 | [2] = { | ||
76 | .hwport = 2, | ||
77 | .flags = 0, | ||
78 | .ucon = SMDKV310_UCON_DEFAULT, | ||
79 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
80 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
81 | }, | ||
82 | [3] = { | ||
83 | .hwport = 3, | ||
84 | .flags = 0, | ||
85 | .ucon = SMDKV310_UCON_DEFAULT, | ||
86 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
87 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
88 | }, | ||
89 | }; | ||
90 | |||
91 | static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = { | ||
92 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
93 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
94 | #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT | ||
95 | .max_width = 8, | ||
96 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
97 | #endif | ||
98 | }; | ||
99 | |||
100 | static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = { | ||
101 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
102 | .ext_cd_gpio = EXYNOS4_GPK0(2), | ||
103 | .ext_cd_gpio_invert = 1, | ||
104 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
105 | }; | ||
106 | |||
107 | static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = { | ||
108 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
109 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
110 | #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT | ||
111 | .max_width = 8, | ||
112 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
113 | #endif | ||
114 | }; | ||
115 | |||
116 | static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = { | ||
117 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
118 | .ext_cd_gpio = EXYNOS4_GPK2(2), | ||
119 | .ext_cd_gpio_invert = 1, | ||
120 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
121 | }; | ||
122 | |||
123 | static void lcd_lte480wv_set_power(struct plat_lcd_data *pd, | ||
124 | unsigned int power) | ||
125 | { | ||
126 | if (power) { | ||
127 | #if !defined(CONFIG_BACKLIGHT_PWM) | ||
128 | gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0"); | ||
129 | gpio_free(EXYNOS4_GPD0(1)); | ||
130 | #endif | ||
131 | /* fire nRESET on power up */ | ||
132 | gpio_request(EXYNOS4_GPX0(6), "GPX0"); | ||
133 | |||
134 | gpio_direction_output(EXYNOS4_GPX0(6), 1); | ||
135 | mdelay(100); | ||
136 | |||
137 | gpio_set_value(EXYNOS4_GPX0(6), 0); | ||
138 | mdelay(10); | ||
139 | |||
140 | gpio_set_value(EXYNOS4_GPX0(6), 1); | ||
141 | mdelay(10); | ||
142 | |||
143 | gpio_free(EXYNOS4_GPX0(6)); | ||
144 | } else { | ||
145 | #if !defined(CONFIG_BACKLIGHT_PWM) | ||
146 | gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0"); | ||
147 | gpio_free(EXYNOS4_GPD0(1)); | ||
148 | #endif | ||
149 | } | ||
150 | } | ||
151 | |||
152 | static struct plat_lcd_data smdkv310_lcd_lte480wv_data = { | ||
153 | .set_power = lcd_lte480wv_set_power, | ||
154 | }; | ||
155 | |||
156 | static struct platform_device smdkv310_lcd_lte480wv = { | ||
157 | .name = "platform-lcd", | ||
158 | .dev.parent = &s5p_device_fimd0.dev, | ||
159 | .dev.platform_data = &smdkv310_lcd_lte480wv_data, | ||
160 | }; | ||
161 | |||
162 | static struct s3c_fb_pd_win smdkv310_fb_win0 = { | ||
163 | .win_mode = { | ||
164 | .left_margin = 13, | ||
165 | .right_margin = 8, | ||
166 | .upper_margin = 7, | ||
167 | .lower_margin = 5, | ||
168 | .hsync_len = 3, | ||
169 | .vsync_len = 1, | ||
170 | .xres = 800, | ||
171 | .yres = 480, | ||
172 | }, | ||
173 | .max_bpp = 32, | ||
174 | .default_bpp = 24, | ||
175 | }; | ||
176 | |||
177 | static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata = { | ||
178 | .win[0] = &smdkv310_fb_win0, | ||
179 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | ||
180 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
181 | .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, | ||
182 | }; | ||
183 | |||
184 | static struct resource smdkv310_smsc911x_resources[] = { | ||
185 | [0] = { | ||
186 | .start = EXYNOS4_PA_SROM_BANK(1), | ||
187 | .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1, | ||
188 | .flags = IORESOURCE_MEM, | ||
189 | }, | ||
190 | [1] = { | ||
191 | .start = IRQ_EINT(5), | ||
192 | .end = IRQ_EINT(5), | ||
193 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
194 | }, | ||
195 | }; | ||
196 | |||
197 | static struct smsc911x_platform_config smsc9215_config = { | ||
198 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
199 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
200 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | ||
201 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
202 | .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67}, | ||
203 | }; | ||
204 | |||
205 | static struct platform_device smdkv310_smsc911x = { | ||
206 | .name = "smsc911x", | ||
207 | .id = -1, | ||
208 | .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources), | ||
209 | .resource = smdkv310_smsc911x_resources, | ||
210 | .dev = { | ||
211 | .platform_data = &smsc9215_config, | ||
212 | }, | ||
213 | }; | ||
214 | |||
215 | static uint32_t smdkv310_keymap[] __initdata = { | ||
216 | /* KEY(row, col, keycode) */ | ||
217 | KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3), | ||
218 | KEY(0, 6, KEY_4), KEY(0, 7, KEY_5), | ||
219 | KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C), | ||
220 | KEY(1, 6, KEY_D), KEY(1, 7, KEY_E) | ||
221 | }; | ||
222 | |||
223 | static struct matrix_keymap_data smdkv310_keymap_data __initdata = { | ||
224 | .keymap = smdkv310_keymap, | ||
225 | .keymap_size = ARRAY_SIZE(smdkv310_keymap), | ||
226 | }; | ||
227 | |||
228 | static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = { | ||
229 | .keymap_data = &smdkv310_keymap_data, | ||
230 | .rows = 2, | ||
231 | .cols = 8, | ||
232 | }; | ||
233 | |||
234 | static struct i2c_board_info i2c_devs1[] __initdata = { | ||
235 | {I2C_BOARD_INFO("wm8994", 0x1a),}, | ||
236 | }; | ||
237 | |||
238 | /* USB EHCI */ | ||
239 | static struct s5p_ehci_platdata smdkv310_ehci_pdata; | ||
240 | |||
241 | static void __init smdkv310_ehci_init(void) | ||
242 | { | ||
243 | struct s5p_ehci_platdata *pdata = &smdkv310_ehci_pdata; | ||
244 | |||
245 | s5p_ehci_set_platdata(pdata); | ||
246 | } | ||
247 | |||
248 | static struct platform_device *smdkv310_devices[] __initdata = { | ||
249 | &s3c_device_hsmmc0, | ||
250 | &s3c_device_hsmmc1, | ||
251 | &s3c_device_hsmmc2, | ||
252 | &s3c_device_hsmmc3, | ||
253 | &s3c_device_i2c1, | ||
254 | &s5p_device_i2c_hdmiphy, | ||
255 | &s3c_device_rtc, | ||
256 | &s3c_device_wdt, | ||
257 | &s5p_device_ehci, | ||
258 | &s5p_device_fimc0, | ||
259 | &s5p_device_fimc1, | ||
260 | &s5p_device_fimc2, | ||
261 | &s5p_device_fimc3, | ||
262 | &exynos4_device_ac97, | ||
263 | &exynos4_device_i2s0, | ||
264 | &samsung_device_keypad, | ||
265 | &s5p_device_mfc, | ||
266 | &s5p_device_mfc_l, | ||
267 | &s5p_device_mfc_r, | ||
268 | &exynos4_device_pd[PD_MFC], | ||
269 | &exynos4_device_pd[PD_G3D], | ||
270 | &exynos4_device_pd[PD_LCD0], | ||
271 | &exynos4_device_pd[PD_LCD1], | ||
272 | &exynos4_device_pd[PD_CAM], | ||
273 | &exynos4_device_pd[PD_TV], | ||
274 | &exynos4_device_pd[PD_GPS], | ||
275 | &exynos4_device_spdif, | ||
276 | &exynos4_device_sysmmu, | ||
277 | &samsung_asoc_dma, | ||
278 | &samsung_asoc_idma, | ||
279 | &s5p_device_fimd0, | ||
280 | &smdkv310_lcd_lte480wv, | ||
281 | &smdkv310_smsc911x, | ||
282 | &exynos4_device_ahci, | ||
283 | &s5p_device_hdmi, | ||
284 | &s5p_device_mixer, | ||
285 | }; | ||
286 | |||
287 | static void __init smdkv310_smsc911x_init(void) | ||
288 | { | ||
289 | u32 cs1; | ||
290 | |||
291 | /* configure nCS1 width to 16 bits */ | ||
292 | cs1 = __raw_readl(S5P_SROM_BW) & | ||
293 | ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT); | ||
294 | cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) | | ||
295 | (1 << S5P_SROM_BW__WAITENABLE__SHIFT) | | ||
296 | (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << | ||
297 | S5P_SROM_BW__NCS1__SHIFT; | ||
298 | __raw_writel(cs1, S5P_SROM_BW); | ||
299 | |||
300 | /* set timing for nCS1 suitable for ethernet chip */ | ||
301 | __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) | | ||
302 | (0x9 << S5P_SROM_BCX__TACP__SHIFT) | | ||
303 | (0xc << S5P_SROM_BCX__TCAH__SHIFT) | | ||
304 | (0x1 << S5P_SROM_BCX__TCOH__SHIFT) | | ||
305 | (0x6 << S5P_SROM_BCX__TACC__SHIFT) | | ||
306 | (0x1 << S5P_SROM_BCX__TCOS__SHIFT) | | ||
307 | (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); | ||
308 | } | ||
309 | |||
310 | /* LCD Backlight data */ | ||
311 | static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = { | ||
312 | .no = EXYNOS4_GPD0(1), | ||
313 | .func = S3C_GPIO_SFN(2), | ||
314 | }; | ||
315 | |||
316 | static struct platform_pwm_backlight_data smdkv310_bl_data = { | ||
317 | .pwm_id = 1, | ||
318 | .pwm_period_ns = 1000, | ||
319 | }; | ||
320 | |||
321 | static void s5p_tv_setup(void) | ||
322 | { | ||
323 | /* direct HPD to HDMI chip */ | ||
324 | WARN_ON(gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug")); | ||
325 | s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3)); | ||
326 | s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE); | ||
327 | |||
328 | /* setup dependencies between TV devices */ | ||
329 | s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
330 | s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
331 | } | ||
332 | |||
333 | static void __init smdkv310_map_io(void) | ||
334 | { | ||
335 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
336 | s3c24xx_init_clocks(24000000); | ||
337 | s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); | ||
338 | } | ||
339 | |||
340 | static void __init smdkv310_reserve(void) | ||
341 | { | ||
342 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
343 | } | ||
344 | |||
345 | static void __init smdkv310_machine_init(void) | ||
346 | { | ||
347 | s3c_i2c1_set_platdata(NULL); | ||
348 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | ||
349 | |||
350 | smdkv310_smsc911x_init(); | ||
351 | |||
352 | s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata); | ||
353 | s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata); | ||
354 | s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata); | ||
355 | s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata); | ||
356 | |||
357 | s5p_tv_setup(); | ||
358 | s5p_i2c_hdmiphy_set_platdata(NULL); | ||
359 | |||
360 | samsung_keypad_set_platdata(&smdkv310_keypad_data); | ||
361 | |||
362 | samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data); | ||
363 | s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata); | ||
364 | |||
365 | smdkv310_ehci_init(); | ||
366 | clk_xusbxti.rate = 24000000; | ||
367 | |||
368 | platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices)); | ||
369 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
370 | } | ||
371 | |||
372 | MACHINE_START(SMDKV310, "SMDKV310") | ||
373 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
374 | /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ | ||
375 | .atag_offset = 0x100, | ||
376 | .init_irq = exynos4_init_irq, | ||
377 | .map_io = smdkv310_map_io, | ||
378 | .init_machine = smdkv310_machine_init, | ||
379 | .timer = &exynos4_timer, | ||
380 | .reserve = &smdkv310_reserve, | ||
381 | MACHINE_END | ||
382 | |||
383 | MACHINE_START(SMDKC210, "SMDKC210") | ||
384 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
385 | .atag_offset = 0x100, | ||
386 | .init_irq = exynos4_init_irq, | ||
387 | .map_io = smdkv310_map_io, | ||
388 | .init_machine = smdkv310_machine_init, | ||
389 | .timer = &exynos4_timer, | ||
390 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c new file mode 100644 index 000000000000..a2a177ff4b44 --- /dev/null +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -0,0 +1,1064 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mach-universal_c210.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <linux/platform_device.h> | ||
11 | #include <linux/serial_core.h> | ||
12 | #include <linux/input.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/gpio_keys.h> | ||
15 | #include <linux/gpio.h> | ||
16 | #include <linux/fb.h> | ||
17 | #include <linux/mfd/max8998.h> | ||
18 | #include <linux/regulator/machine.h> | ||
19 | #include <linux/regulator/fixed.h> | ||
20 | #include <linux/regulator/max8952.h> | ||
21 | #include <linux/mmc/host.h> | ||
22 | #include <linux/i2c-gpio.h> | ||
23 | #include <linux/i2c/mcs.h> | ||
24 | #include <linux/i2c/atmel_mxt_ts.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | |||
29 | #include <plat/regs-serial.h> | ||
30 | #include <plat/exynos4.h> | ||
31 | #include <plat/cpu.h> | ||
32 | #include <plat/devs.h> | ||
33 | #include <plat/iic.h> | ||
34 | #include <plat/gpio-cfg.h> | ||
35 | #include <plat/fb.h> | ||
36 | #include <plat/mfc.h> | ||
37 | #include <plat/sdhci.h> | ||
38 | #include <plat/pd.h> | ||
39 | #include <plat/regs-fb-v4.h> | ||
40 | #include <plat/fimc-core.h> | ||
41 | #include <plat/camport.h> | ||
42 | #include <plat/mipi_csis.h> | ||
43 | |||
44 | #include <mach/map.h> | ||
45 | |||
46 | #include <media/v4l2-mediabus.h> | ||
47 | #include <media/s5p_fimc.h> | ||
48 | #include <media/m5mols.h> | ||
49 | |||
50 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
51 | #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
52 | S3C2410_UCON_RXILEVEL | \ | ||
53 | S3C2410_UCON_TXIRQMODE | \ | ||
54 | S3C2410_UCON_RXIRQMODE | \ | ||
55 | S3C2410_UCON_RXFIFO_TOI | \ | ||
56 | S3C2443_UCON_RXERR_IRQEN) | ||
57 | |||
58 | #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
59 | |||
60 | #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
61 | S5PV210_UFCON_TXTRIG256 | \ | ||
62 | S5PV210_UFCON_RXTRIG256) | ||
63 | |||
64 | static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = { | ||
65 | [0] = { | ||
66 | .hwport = 0, | ||
67 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
68 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
69 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
70 | }, | ||
71 | [1] = { | ||
72 | .hwport = 1, | ||
73 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
74 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
75 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
76 | }, | ||
77 | [2] = { | ||
78 | .hwport = 2, | ||
79 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
80 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
81 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
82 | }, | ||
83 | [3] = { | ||
84 | .hwport = 3, | ||
85 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
86 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
87 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
88 | }, | ||
89 | }; | ||
90 | |||
91 | static struct regulator_consumer_supply max8952_consumer = | ||
92 | REGULATOR_SUPPLY("vdd_arm", NULL); | ||
93 | |||
94 | static struct max8952_platform_data universal_max8952_pdata __initdata = { | ||
95 | .gpio_vid0 = EXYNOS4_GPX0(3), | ||
96 | .gpio_vid1 = EXYNOS4_GPX0(4), | ||
97 | .gpio_en = -1, /* Not controllable, set "Always High" */ | ||
98 | .default_mode = 0, /* vid0 = 0, vid1 = 0 */ | ||
99 | .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */ | ||
100 | .sync_freq = 0, /* default: fastest */ | ||
101 | .ramp_speed = 0, /* default: fastest */ | ||
102 | |||
103 | .reg_data = { | ||
104 | .constraints = { | ||
105 | .name = "VARM_1.2V", | ||
106 | .min_uV = 770000, | ||
107 | .max_uV = 1400000, | ||
108 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
109 | .always_on = 1, | ||
110 | .boot_on = 1, | ||
111 | }, | ||
112 | .num_consumer_supplies = 1, | ||
113 | .consumer_supplies = &max8952_consumer, | ||
114 | }, | ||
115 | }; | ||
116 | |||
117 | static struct regulator_consumer_supply lp3974_buck1_consumer = | ||
118 | REGULATOR_SUPPLY("vdd_int", NULL); | ||
119 | |||
120 | static struct regulator_consumer_supply lp3974_buck2_consumer = | ||
121 | REGULATOR_SUPPLY("vddg3d", NULL); | ||
122 | |||
123 | static struct regulator_consumer_supply lp3974_buck3_consumer = | ||
124 | REGULATOR_SUPPLY("vdet", "s5p-sdo"); | ||
125 | |||
126 | static struct regulator_init_data lp3974_buck1_data = { | ||
127 | .constraints = { | ||
128 | .name = "VINT_1.1V", | ||
129 | .min_uV = 750000, | ||
130 | .max_uV = 1500000, | ||
131 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
132 | REGULATOR_CHANGE_STATUS, | ||
133 | .boot_on = 1, | ||
134 | .state_mem = { | ||
135 | .disabled = 1, | ||
136 | }, | ||
137 | }, | ||
138 | .num_consumer_supplies = 1, | ||
139 | .consumer_supplies = &lp3974_buck1_consumer, | ||
140 | }; | ||
141 | |||
142 | static struct regulator_init_data lp3974_buck2_data = { | ||
143 | .constraints = { | ||
144 | .name = "VG3D_1.1V", | ||
145 | .min_uV = 750000, | ||
146 | .max_uV = 1500000, | ||
147 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
148 | REGULATOR_CHANGE_STATUS, | ||
149 | .boot_on = 1, | ||
150 | .state_mem = { | ||
151 | .disabled = 1, | ||
152 | }, | ||
153 | }, | ||
154 | .num_consumer_supplies = 1, | ||
155 | .consumer_supplies = &lp3974_buck2_consumer, | ||
156 | }; | ||
157 | |||
158 | static struct regulator_init_data lp3974_buck3_data = { | ||
159 | .constraints = { | ||
160 | .name = "VCC_1.8V", | ||
161 | .min_uV = 1800000, | ||
162 | .max_uV = 1800000, | ||
163 | .apply_uV = 1, | ||
164 | .always_on = 1, | ||
165 | .state_mem = { | ||
166 | .enabled = 1, | ||
167 | }, | ||
168 | }, | ||
169 | .num_consumer_supplies = 1, | ||
170 | .consumer_supplies = &lp3974_buck3_consumer, | ||
171 | }; | ||
172 | |||
173 | static struct regulator_init_data lp3974_buck4_data = { | ||
174 | .constraints = { | ||
175 | .name = "VMEM_1.2V", | ||
176 | .min_uV = 1200000, | ||
177 | .max_uV = 1200000, | ||
178 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
179 | .apply_uV = 1, | ||
180 | .state_mem = { | ||
181 | .disabled = 1, | ||
182 | }, | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | static struct regulator_init_data lp3974_ldo2_data = { | ||
187 | .constraints = { | ||
188 | .name = "VALIVE_1.2V", | ||
189 | .min_uV = 1200000, | ||
190 | .max_uV = 1200000, | ||
191 | .apply_uV = 1, | ||
192 | .always_on = 1, | ||
193 | .state_mem = { | ||
194 | .enabled = 1, | ||
195 | }, | ||
196 | }, | ||
197 | }; | ||
198 | |||
199 | static struct regulator_consumer_supply lp3974_ldo3_consumer[] = { | ||
200 | REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), | ||
201 | REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), | ||
202 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), | ||
203 | }; | ||
204 | |||
205 | static struct regulator_init_data lp3974_ldo3_data = { | ||
206 | .constraints = { | ||
207 | .name = "VUSB+MIPI_1.1V", | ||
208 | .min_uV = 1100000, | ||
209 | .max_uV = 1100000, | ||
210 | .apply_uV = 1, | ||
211 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
212 | .state_mem = { | ||
213 | .disabled = 1, | ||
214 | }, | ||
215 | }, | ||
216 | .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer), | ||
217 | .consumer_supplies = lp3974_ldo3_consumer, | ||
218 | }; | ||
219 | |||
220 | static struct regulator_consumer_supply lp3974_ldo4_consumer[] = { | ||
221 | REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), | ||
222 | }; | ||
223 | |||
224 | static struct regulator_init_data lp3974_ldo4_data = { | ||
225 | .constraints = { | ||
226 | .name = "VADC_3.3V", | ||
227 | .min_uV = 3300000, | ||
228 | .max_uV = 3300000, | ||
229 | .apply_uV = 1, | ||
230 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
231 | .state_mem = { | ||
232 | .disabled = 1, | ||
233 | }, | ||
234 | }, | ||
235 | .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer), | ||
236 | .consumer_supplies = lp3974_ldo4_consumer, | ||
237 | }; | ||
238 | |||
239 | static struct regulator_init_data lp3974_ldo5_data = { | ||
240 | .constraints = { | ||
241 | .name = "VTF_2.8V", | ||
242 | .min_uV = 2800000, | ||
243 | .max_uV = 2800000, | ||
244 | .apply_uV = 1, | ||
245 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
246 | .state_mem = { | ||
247 | .disabled = 1, | ||
248 | }, | ||
249 | }, | ||
250 | }; | ||
251 | |||
252 | static struct regulator_init_data lp3974_ldo6_data = { | ||
253 | .constraints = { | ||
254 | .name = "LDO6", | ||
255 | .min_uV = 2000000, | ||
256 | .max_uV = 2000000, | ||
257 | .apply_uV = 1, | ||
258 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
259 | .state_mem = { | ||
260 | .disabled = 1, | ||
261 | }, | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static struct regulator_consumer_supply lp3974_ldo7_consumer[] = { | ||
266 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), | ||
267 | }; | ||
268 | |||
269 | static struct regulator_init_data lp3974_ldo7_data = { | ||
270 | .constraints = { | ||
271 | .name = "VLCD+VMIPI_1.8V", | ||
272 | .min_uV = 1800000, | ||
273 | .max_uV = 1800000, | ||
274 | .apply_uV = 1, | ||
275 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
276 | .state_mem = { | ||
277 | .disabled = 1, | ||
278 | }, | ||
279 | }, | ||
280 | .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer), | ||
281 | .consumer_supplies = lp3974_ldo7_consumer, | ||
282 | }; | ||
283 | |||
284 | static struct regulator_consumer_supply lp3974_ldo8_consumer[] = { | ||
285 | REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"), | ||
286 | }; | ||
287 | |||
288 | static struct regulator_init_data lp3974_ldo8_data = { | ||
289 | .constraints = { | ||
290 | .name = "VUSB+VDAC_3.3V", | ||
291 | .min_uV = 3300000, | ||
292 | .max_uV = 3300000, | ||
293 | .apply_uV = 1, | ||
294 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
295 | .state_mem = { | ||
296 | .disabled = 1, | ||
297 | }, | ||
298 | }, | ||
299 | .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer), | ||
300 | .consumer_supplies = lp3974_ldo8_consumer, | ||
301 | }; | ||
302 | |||
303 | static struct regulator_init_data lp3974_ldo9_data = { | ||
304 | .constraints = { | ||
305 | .name = "VCC_2.8V", | ||
306 | .min_uV = 2800000, | ||
307 | .max_uV = 2800000, | ||
308 | .apply_uV = 1, | ||
309 | .always_on = 1, | ||
310 | .state_mem = { | ||
311 | .enabled = 1, | ||
312 | }, | ||
313 | }, | ||
314 | }; | ||
315 | |||
316 | static struct regulator_init_data lp3974_ldo10_data = { | ||
317 | .constraints = { | ||
318 | .name = "VPLL_1.1V", | ||
319 | .min_uV = 1100000, | ||
320 | .max_uV = 1100000, | ||
321 | .boot_on = 1, | ||
322 | .apply_uV = 1, | ||
323 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
324 | .state_mem = { | ||
325 | .disabled = 1, | ||
326 | }, | ||
327 | }, | ||
328 | }; | ||
329 | |||
330 | static struct regulator_consumer_supply lp3974_ldo11_consumer = | ||
331 | REGULATOR_SUPPLY("dig_28", "0-001f"); | ||
332 | |||
333 | static struct regulator_init_data lp3974_ldo11_data = { | ||
334 | .constraints = { | ||
335 | .name = "CAM_AF_3.3V", | ||
336 | .min_uV = 3300000, | ||
337 | .max_uV = 3300000, | ||
338 | .apply_uV = 1, | ||
339 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
340 | .state_mem = { | ||
341 | .disabled = 1, | ||
342 | }, | ||
343 | }, | ||
344 | .num_consumer_supplies = 1, | ||
345 | .consumer_supplies = &lp3974_ldo11_consumer, | ||
346 | }; | ||
347 | |||
348 | static struct regulator_init_data lp3974_ldo12_data = { | ||
349 | .constraints = { | ||
350 | .name = "PS_2.8V", | ||
351 | .min_uV = 2800000, | ||
352 | .max_uV = 2800000, | ||
353 | .apply_uV = 1, | ||
354 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
355 | .state_mem = { | ||
356 | .disabled = 1, | ||
357 | }, | ||
358 | }, | ||
359 | }; | ||
360 | |||
361 | static struct regulator_init_data lp3974_ldo13_data = { | ||
362 | .constraints = { | ||
363 | .name = "VHIC_1.2V", | ||
364 | .min_uV = 1200000, | ||
365 | .max_uV = 1200000, | ||
366 | .apply_uV = 1, | ||
367 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
368 | .state_mem = { | ||
369 | .disabled = 1, | ||
370 | }, | ||
371 | }, | ||
372 | }; | ||
373 | |||
374 | static struct regulator_consumer_supply lp3974_ldo14_consumer = | ||
375 | REGULATOR_SUPPLY("dig_18", "0-001f"); | ||
376 | |||
377 | static struct regulator_init_data lp3974_ldo14_data = { | ||
378 | .constraints = { | ||
379 | .name = "CAM_I_HOST_1.8V", | ||
380 | .min_uV = 1800000, | ||
381 | .max_uV = 1800000, | ||
382 | .apply_uV = 1, | ||
383 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
384 | .state_mem = { | ||
385 | .disabled = 1, | ||
386 | }, | ||
387 | }, | ||
388 | .num_consumer_supplies = 1, | ||
389 | .consumer_supplies = &lp3974_ldo14_consumer, | ||
390 | }; | ||
391 | |||
392 | |||
393 | static struct regulator_consumer_supply lp3974_ldo15_consumer = | ||
394 | REGULATOR_SUPPLY("dig_12", "0-001f"); | ||
395 | |||
396 | static struct regulator_init_data lp3974_ldo15_data = { | ||
397 | .constraints = { | ||
398 | .name = "CAM_S_DIG+FM33_CORE_1.2V", | ||
399 | .min_uV = 1200000, | ||
400 | .max_uV = 1200000, | ||
401 | .apply_uV = 1, | ||
402 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
403 | .state_mem = { | ||
404 | .disabled = 1, | ||
405 | }, | ||
406 | }, | ||
407 | .num_consumer_supplies = 1, | ||
408 | .consumer_supplies = &lp3974_ldo15_consumer, | ||
409 | }; | ||
410 | |||
411 | static struct regulator_consumer_supply lp3974_ldo16_consumer[] = { | ||
412 | REGULATOR_SUPPLY("a_sensor", "0-001f"), | ||
413 | }; | ||
414 | |||
415 | static struct regulator_init_data lp3974_ldo16_data = { | ||
416 | .constraints = { | ||
417 | .name = "CAM_S_ANA_2.8V", | ||
418 | .min_uV = 2800000, | ||
419 | .max_uV = 2800000, | ||
420 | .apply_uV = 1, | ||
421 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
422 | .state_mem = { | ||
423 | .disabled = 1, | ||
424 | }, | ||
425 | }, | ||
426 | .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer), | ||
427 | .consumer_supplies = lp3974_ldo16_consumer, | ||
428 | }; | ||
429 | |||
430 | static struct regulator_init_data lp3974_ldo17_data = { | ||
431 | .constraints = { | ||
432 | .name = "VCC_3.0V_LCD", | ||
433 | .min_uV = 3000000, | ||
434 | .max_uV = 3000000, | ||
435 | .apply_uV = 1, | ||
436 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
437 | .boot_on = 1, | ||
438 | .state_mem = { | ||
439 | .disabled = 1, | ||
440 | }, | ||
441 | }, | ||
442 | }; | ||
443 | |||
444 | static struct regulator_init_data lp3974_32khz_ap_data = { | ||
445 | .constraints = { | ||
446 | .name = "32KHz AP", | ||
447 | .always_on = 1, | ||
448 | .state_mem = { | ||
449 | .enabled = 1, | ||
450 | }, | ||
451 | }, | ||
452 | }; | ||
453 | |||
454 | static struct regulator_init_data lp3974_32khz_cp_data = { | ||
455 | .constraints = { | ||
456 | .name = "32KHz CP", | ||
457 | .state_mem = { | ||
458 | .disabled = 1, | ||
459 | }, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | static struct regulator_init_data lp3974_vichg_data = { | ||
464 | .constraints = { | ||
465 | .name = "VICHG", | ||
466 | .state_mem = { | ||
467 | .disabled = 1, | ||
468 | }, | ||
469 | }, | ||
470 | }; | ||
471 | |||
472 | static struct regulator_init_data lp3974_esafeout1_data = { | ||
473 | .constraints = { | ||
474 | .name = "SAFEOUT1", | ||
475 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
476 | .state_mem = { | ||
477 | .enabled = 1, | ||
478 | }, | ||
479 | }, | ||
480 | }; | ||
481 | |||
482 | static struct regulator_init_data lp3974_esafeout2_data = { | ||
483 | .constraints = { | ||
484 | .name = "SAFEOUT2", | ||
485 | .boot_on = 1, | ||
486 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
487 | .state_mem = { | ||
488 | .enabled = 1, | ||
489 | }, | ||
490 | }, | ||
491 | }; | ||
492 | |||
493 | static struct max8998_regulator_data lp3974_regulators[] = { | ||
494 | { MAX8998_LDO2, &lp3974_ldo2_data }, | ||
495 | { MAX8998_LDO3, &lp3974_ldo3_data }, | ||
496 | { MAX8998_LDO4, &lp3974_ldo4_data }, | ||
497 | { MAX8998_LDO5, &lp3974_ldo5_data }, | ||
498 | { MAX8998_LDO6, &lp3974_ldo6_data }, | ||
499 | { MAX8998_LDO7, &lp3974_ldo7_data }, | ||
500 | { MAX8998_LDO8, &lp3974_ldo8_data }, | ||
501 | { MAX8998_LDO9, &lp3974_ldo9_data }, | ||
502 | { MAX8998_LDO10, &lp3974_ldo10_data }, | ||
503 | { MAX8998_LDO11, &lp3974_ldo11_data }, | ||
504 | { MAX8998_LDO12, &lp3974_ldo12_data }, | ||
505 | { MAX8998_LDO13, &lp3974_ldo13_data }, | ||
506 | { MAX8998_LDO14, &lp3974_ldo14_data }, | ||
507 | { MAX8998_LDO15, &lp3974_ldo15_data }, | ||
508 | { MAX8998_LDO16, &lp3974_ldo16_data }, | ||
509 | { MAX8998_LDO17, &lp3974_ldo17_data }, | ||
510 | { MAX8998_BUCK1, &lp3974_buck1_data }, | ||
511 | { MAX8998_BUCK2, &lp3974_buck2_data }, | ||
512 | { MAX8998_BUCK3, &lp3974_buck3_data }, | ||
513 | { MAX8998_BUCK4, &lp3974_buck4_data }, | ||
514 | { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data }, | ||
515 | { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data }, | ||
516 | { MAX8998_ENVICHG, &lp3974_vichg_data }, | ||
517 | { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data }, | ||
518 | { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data }, | ||
519 | }; | ||
520 | |||
521 | static struct max8998_platform_data universal_lp3974_pdata = { | ||
522 | .num_regulators = ARRAY_SIZE(lp3974_regulators), | ||
523 | .regulators = lp3974_regulators, | ||
524 | .buck1_voltage1 = 1100000, /* INT */ | ||
525 | .buck1_voltage2 = 1000000, | ||
526 | .buck1_voltage3 = 1100000, | ||
527 | .buck1_voltage4 = 1000000, | ||
528 | .buck1_set1 = EXYNOS4_GPX0(5), | ||
529 | .buck1_set2 = EXYNOS4_GPX0(6), | ||
530 | .buck2_voltage1 = 1200000, /* G3D */ | ||
531 | .buck2_voltage2 = 1100000, | ||
532 | .buck1_default_idx = 0, | ||
533 | .buck2_set3 = EXYNOS4_GPE2(0), | ||
534 | .buck2_default_idx = 0, | ||
535 | .wakeup = true, | ||
536 | }; | ||
537 | |||
538 | |||
539 | enum fixed_regulator_id { | ||
540 | FIXED_REG_ID_MMC0, | ||
541 | FIXED_REG_ID_HDMI_5V, | ||
542 | FIXED_REG_ID_CAM_S_IF, | ||
543 | FIXED_REG_ID_CAM_I_CORE, | ||
544 | FIXED_REG_ID_CAM_VT_DIO, | ||
545 | }; | ||
546 | |||
547 | static struct regulator_consumer_supply hdmi_fixed_consumer = | ||
548 | REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi"); | ||
549 | |||
550 | static struct regulator_init_data hdmi_fixed_voltage_init_data = { | ||
551 | .constraints = { | ||
552 | .name = "HDMI_5V", | ||
553 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
554 | }, | ||
555 | .num_consumer_supplies = 1, | ||
556 | .consumer_supplies = &hdmi_fixed_consumer, | ||
557 | }; | ||
558 | |||
559 | static struct fixed_voltage_config hdmi_fixed_voltage_config = { | ||
560 | .supply_name = "HDMI_EN1", | ||
561 | .microvolts = 5000000, | ||
562 | .gpio = EXYNOS4_GPE0(1), | ||
563 | .enable_high = true, | ||
564 | .init_data = &hdmi_fixed_voltage_init_data, | ||
565 | }; | ||
566 | |||
567 | static struct platform_device hdmi_fixed_voltage = { | ||
568 | .name = "reg-fixed-voltage", | ||
569 | .id = FIXED_REG_ID_HDMI_5V, | ||
570 | .dev = { | ||
571 | .platform_data = &hdmi_fixed_voltage_config, | ||
572 | }, | ||
573 | }; | ||
574 | |||
575 | /* GPIO I2C 5 (PMIC) */ | ||
576 | static struct i2c_board_info i2c5_devs[] __initdata = { | ||
577 | { | ||
578 | I2C_BOARD_INFO("max8952", 0xC0 >> 1), | ||
579 | .platform_data = &universal_max8952_pdata, | ||
580 | }, { | ||
581 | I2C_BOARD_INFO("lp3974", 0xCC >> 1), | ||
582 | .platform_data = &universal_lp3974_pdata, | ||
583 | }, | ||
584 | }; | ||
585 | |||
586 | /* I2C3 (TSP) */ | ||
587 | static struct mxt_platform_data qt602240_platform_data = { | ||
588 | .x_line = 19, | ||
589 | .y_line = 11, | ||
590 | .x_size = 800, | ||
591 | .y_size = 480, | ||
592 | .blen = 0x11, | ||
593 | .threshold = 0x28, | ||
594 | .voltage = 2800000, /* 2.8V */ | ||
595 | .orient = MXT_DIAGONAL, | ||
596 | }; | ||
597 | |||
598 | static struct i2c_board_info i2c3_devs[] __initdata = { | ||
599 | { | ||
600 | I2C_BOARD_INFO("qt602240_ts", 0x4a), | ||
601 | .platform_data = &qt602240_platform_data, | ||
602 | }, | ||
603 | }; | ||
604 | |||
605 | static void __init universal_tsp_init(void) | ||
606 | { | ||
607 | int gpio; | ||
608 | |||
609 | /* TSP_LDO_ON: XMDMADDR_11 */ | ||
610 | gpio = EXYNOS4_GPE2(3); | ||
611 | gpio_request(gpio, "TSP_LDO_ON"); | ||
612 | gpio_direction_output(gpio, 1); | ||
613 | gpio_export(gpio, 0); | ||
614 | |||
615 | /* TSP_INT: XMDMADDR_7 */ | ||
616 | gpio = EXYNOS4_GPE1(7); | ||
617 | gpio_request(gpio, "TSP_INT"); | ||
618 | |||
619 | s5p_register_gpio_interrupt(gpio); | ||
620 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
621 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
622 | i2c3_devs[0].irq = gpio_to_irq(gpio); | ||
623 | } | ||
624 | |||
625 | |||
626 | /* GPIO I2C 12 (3 Touchkey) */ | ||
627 | static uint32_t touchkey_keymap[] = { | ||
628 | /* MCS_KEY_MAP(value, keycode) */ | ||
629 | MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */ | ||
630 | MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */ | ||
631 | }; | ||
632 | |||
633 | static struct mcs_platform_data touchkey_data = { | ||
634 | .keymap = touchkey_keymap, | ||
635 | .keymap_size = ARRAY_SIZE(touchkey_keymap), | ||
636 | .key_maxval = 2, | ||
637 | }; | ||
638 | |||
639 | /* GPIO I2C 3_TOUCH 2.8V */ | ||
640 | #define I2C_GPIO_BUS_12 12 | ||
641 | static struct i2c_gpio_platform_data i2c_gpio12_data = { | ||
642 | .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */ | ||
643 | .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */ | ||
644 | }; | ||
645 | |||
646 | static struct platform_device i2c_gpio12 = { | ||
647 | .name = "i2c-gpio", | ||
648 | .id = I2C_GPIO_BUS_12, | ||
649 | .dev = { | ||
650 | .platform_data = &i2c_gpio12_data, | ||
651 | }, | ||
652 | }; | ||
653 | |||
654 | static struct i2c_board_info i2c_gpio12_devs[] __initdata = { | ||
655 | { | ||
656 | I2C_BOARD_INFO("mcs5080_touchkey", 0x20), | ||
657 | .platform_data = &touchkey_data, | ||
658 | }, | ||
659 | }; | ||
660 | |||
661 | static void __init universal_touchkey_init(void) | ||
662 | { | ||
663 | int gpio; | ||
664 | |||
665 | gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */ | ||
666 | gpio_request(gpio, "3_TOUCH_INT"); | ||
667 | s5p_register_gpio_interrupt(gpio); | ||
668 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
669 | i2c_gpio12_devs[0].irq = gpio_to_irq(gpio); | ||
670 | |||
671 | gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */ | ||
672 | gpio_request(gpio, "3_TOUCH_EN"); | ||
673 | gpio_direction_output(gpio, 1); | ||
674 | } | ||
675 | |||
676 | static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = { | ||
677 | .frequency = 300 * 1000, | ||
678 | .sda_delay = 200, | ||
679 | }; | ||
680 | |||
681 | /* GPIO KEYS */ | ||
682 | static struct gpio_keys_button universal_gpio_keys_tables[] = { | ||
683 | { | ||
684 | .code = KEY_VOLUMEUP, | ||
685 | .gpio = EXYNOS4_GPX2(0), /* XEINT16 */ | ||
686 | .desc = "gpio-keys: KEY_VOLUMEUP", | ||
687 | .type = EV_KEY, | ||
688 | .active_low = 1, | ||
689 | .debounce_interval = 1, | ||
690 | }, { | ||
691 | .code = KEY_VOLUMEDOWN, | ||
692 | .gpio = EXYNOS4_GPX2(1), /* XEINT17 */ | ||
693 | .desc = "gpio-keys: KEY_VOLUMEDOWN", | ||
694 | .type = EV_KEY, | ||
695 | .active_low = 1, | ||
696 | .debounce_interval = 1, | ||
697 | }, { | ||
698 | .code = KEY_CONFIG, | ||
699 | .gpio = EXYNOS4_GPX2(2), /* XEINT18 */ | ||
700 | .desc = "gpio-keys: KEY_CONFIG", | ||
701 | .type = EV_KEY, | ||
702 | .active_low = 1, | ||
703 | .debounce_interval = 1, | ||
704 | }, { | ||
705 | .code = KEY_CAMERA, | ||
706 | .gpio = EXYNOS4_GPX2(3), /* XEINT19 */ | ||
707 | .desc = "gpio-keys: KEY_CAMERA", | ||
708 | .type = EV_KEY, | ||
709 | .active_low = 1, | ||
710 | .debounce_interval = 1, | ||
711 | }, { | ||
712 | .code = KEY_OK, | ||
713 | .gpio = EXYNOS4_GPX3(5), /* XEINT29 */ | ||
714 | .desc = "gpio-keys: KEY_OK", | ||
715 | .type = EV_KEY, | ||
716 | .active_low = 1, | ||
717 | .debounce_interval = 1, | ||
718 | }, | ||
719 | }; | ||
720 | |||
721 | static struct gpio_keys_platform_data universal_gpio_keys_data = { | ||
722 | .buttons = universal_gpio_keys_tables, | ||
723 | .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables), | ||
724 | }; | ||
725 | |||
726 | static struct platform_device universal_gpio_keys = { | ||
727 | .name = "gpio-keys", | ||
728 | .dev = { | ||
729 | .platform_data = &universal_gpio_keys_data, | ||
730 | }, | ||
731 | }; | ||
732 | |||
733 | /* eMMC */ | ||
734 | static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { | ||
735 | .max_width = 8, | ||
736 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | ||
737 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
738 | MMC_CAP_DISABLE), | ||
739 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
740 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
741 | }; | ||
742 | |||
743 | static struct regulator_consumer_supply mmc0_supplies[] = { | ||
744 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | ||
745 | }; | ||
746 | |||
747 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { | ||
748 | .constraints = { | ||
749 | .name = "VMEM_VDD_2.8V", | ||
750 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
751 | }, | ||
752 | .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies), | ||
753 | .consumer_supplies = mmc0_supplies, | ||
754 | }; | ||
755 | |||
756 | static struct fixed_voltage_config mmc0_fixed_voltage_config = { | ||
757 | .supply_name = "MASSMEMORY_EN", | ||
758 | .microvolts = 2800000, | ||
759 | .gpio = EXYNOS4_GPE1(3), | ||
760 | .enable_high = true, | ||
761 | .init_data = &mmc0_fixed_voltage_init_data, | ||
762 | }; | ||
763 | |||
764 | static struct platform_device mmc0_fixed_voltage = { | ||
765 | .name = "reg-fixed-voltage", | ||
766 | .id = FIXED_REG_ID_MMC0, | ||
767 | .dev = { | ||
768 | .platform_data = &mmc0_fixed_voltage_config, | ||
769 | }, | ||
770 | }; | ||
771 | |||
772 | /* SD */ | ||
773 | static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = { | ||
774 | .max_width = 4, | ||
775 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
776 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
777 | MMC_CAP_DISABLE, | ||
778 | .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */ | ||
779 | .ext_cd_gpio_invert = 1, | ||
780 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
781 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
782 | }; | ||
783 | |||
784 | /* WiFi */ | ||
785 | static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = { | ||
786 | .max_width = 4, | ||
787 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
788 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
789 | MMC_CAP_DISABLE, | ||
790 | .cd_type = S3C_SDHCI_CD_EXTERNAL, | ||
791 | }; | ||
792 | |||
793 | static void __init universal_sdhci_init(void) | ||
794 | { | ||
795 | s3c_sdhci0_set_platdata(&universal_hsmmc0_data); | ||
796 | s3c_sdhci2_set_platdata(&universal_hsmmc2_data); | ||
797 | s3c_sdhci3_set_platdata(&universal_hsmmc3_data); | ||
798 | } | ||
799 | |||
800 | /* I2C1 */ | ||
801 | static struct i2c_board_info i2c1_devs[] __initdata = { | ||
802 | /* Gyro, To be updated */ | ||
803 | }; | ||
804 | |||
805 | /* Frame Buffer */ | ||
806 | static struct s3c_fb_pd_win universal_fb_win0 = { | ||
807 | .win_mode = { | ||
808 | .left_margin = 16, | ||
809 | .right_margin = 16, | ||
810 | .upper_margin = 2, | ||
811 | .lower_margin = 28, | ||
812 | .hsync_len = 2, | ||
813 | .vsync_len = 1, | ||
814 | .xres = 480, | ||
815 | .yres = 800, | ||
816 | .refresh = 55, | ||
817 | }, | ||
818 | .max_bpp = 32, | ||
819 | .default_bpp = 16, | ||
820 | }; | ||
821 | |||
822 | static struct s3c_fb_platdata universal_lcd_pdata __initdata = { | ||
823 | .win[0] = &universal_fb_win0, | ||
824 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB | | ||
825 | VIDCON0_CLKSEL_LCD, | ||
826 | .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN | ||
827 | | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
828 | .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, | ||
829 | }; | ||
830 | |||
831 | static struct regulator_consumer_supply cam_i_core_supply = | ||
832 | REGULATOR_SUPPLY("core", "0-001f"); | ||
833 | |||
834 | static struct regulator_init_data cam_i_core_reg_init_data = { | ||
835 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | ||
836 | .num_consumer_supplies = 1, | ||
837 | .consumer_supplies = &cam_i_core_supply, | ||
838 | }; | ||
839 | |||
840 | static struct fixed_voltage_config cam_i_core_fixed_voltage_cfg = { | ||
841 | .supply_name = "CAM_I_CORE_1.2V", | ||
842 | .microvolts = 1200000, | ||
843 | .gpio = EXYNOS4_GPE2(2), /* CAM_8M_CORE_EN */ | ||
844 | .enable_high = 1, | ||
845 | .init_data = &cam_i_core_reg_init_data, | ||
846 | }; | ||
847 | |||
848 | static struct platform_device cam_i_core_fixed_reg_dev = { | ||
849 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_I_CORE, | ||
850 | .dev = { .platform_data = &cam_i_core_fixed_voltage_cfg }, | ||
851 | }; | ||
852 | |||
853 | static struct regulator_consumer_supply cam_s_if_supply = | ||
854 | REGULATOR_SUPPLY("d_sensor", "0-001f"); | ||
855 | |||
856 | static struct regulator_init_data cam_s_if_reg_init_data = { | ||
857 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | ||
858 | .num_consumer_supplies = 1, | ||
859 | .consumer_supplies = &cam_s_if_supply, | ||
860 | }; | ||
861 | |||
862 | static struct fixed_voltage_config cam_s_if_fixed_voltage_cfg = { | ||
863 | .supply_name = "CAM_S_IF_1.8V", | ||
864 | .microvolts = 1800000, | ||
865 | .gpio = EXYNOS4_GPE3(0), /* CAM_PWR_EN1 */ | ||
866 | .enable_high = 1, | ||
867 | .init_data = &cam_s_if_reg_init_data, | ||
868 | }; | ||
869 | |||
870 | static struct platform_device cam_s_if_fixed_reg_dev = { | ||
871 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_S_IF, | ||
872 | .dev = { .platform_data = &cam_s_if_fixed_voltage_cfg }, | ||
873 | }; | ||
874 | |||
875 | static struct s5p_platform_mipi_csis mipi_csis_platdata = { | ||
876 | .clk_rate = 166000000UL, | ||
877 | .lanes = 2, | ||
878 | .alignment = 32, | ||
879 | .hs_settle = 12, | ||
880 | .phy_enable = s5p_csis_phy_enable, | ||
881 | }; | ||
882 | |||
883 | #define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3) | ||
884 | #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */ | ||
885 | #define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5) | ||
886 | |||
887 | static int m5mols_set_power(struct device *dev, int on) | ||
888 | { | ||
889 | gpio_set_value(GPIO_CAM_LEVEL_EN(1), !on); | ||
890 | gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on); | ||
891 | return 0; | ||
892 | } | ||
893 | |||
894 | static struct m5mols_platform_data m5mols_platdata = { | ||
895 | .gpio_reset = GPIO_CAM_MEGA_nRST, | ||
896 | .reset_polarity = 0, | ||
897 | .set_power = m5mols_set_power, | ||
898 | }; | ||
899 | |||
900 | static struct i2c_board_info m5mols_board_info = { | ||
901 | I2C_BOARD_INFO("M5MOLS", 0x1F), | ||
902 | .platform_data = &m5mols_platdata, | ||
903 | }; | ||
904 | |||
905 | static struct s5p_fimc_isp_info universal_camera_sensors[] = { | ||
906 | { | ||
907 | .mux_id = 0, | ||
908 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | ||
909 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | ||
910 | .bus_type = FIMC_MIPI_CSI2, | ||
911 | .board_info = &m5mols_board_info, | ||
912 | .i2c_bus_num = 0, | ||
913 | .clk_frequency = 21600000UL, | ||
914 | .csi_data_align = 32, | ||
915 | }, | ||
916 | }; | ||
917 | |||
918 | static struct s5p_platform_fimc fimc_md_platdata = { | ||
919 | .isp_info = universal_camera_sensors, | ||
920 | .num_clients = ARRAY_SIZE(universal_camera_sensors), | ||
921 | }; | ||
922 | |||
923 | static struct gpio universal_camera_gpios[] = { | ||
924 | { GPIO_CAM_LEVEL_EN(1), GPIOF_OUT_INIT_HIGH, "CAM_LVL_EN1" }, | ||
925 | { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" }, | ||
926 | { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, | ||
927 | { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, | ||
928 | }; | ||
929 | |||
930 | static void universal_camera_init(void) | ||
931 | { | ||
932 | s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), | ||
933 | &s5p_device_mipi_csis0); | ||
934 | s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata), | ||
935 | &s5p_device_fimc_md); | ||
936 | |||
937 | if (gpio_request_array(universal_camera_gpios, | ||
938 | ARRAY_SIZE(universal_camera_gpios))) { | ||
939 | pr_err("%s: GPIO request failed\n", __func__); | ||
940 | return; | ||
941 | } | ||
942 | |||
943 | if (!s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xf))) | ||
944 | m5mols_board_info.irq = gpio_to_irq(GPIO_CAM_8M_ISP_INT); | ||
945 | else | ||
946 | pr_err("Failed to configure 8M_ISP_INT GPIO\n"); | ||
947 | |||
948 | /* Free GPIOs controlled directly by the sensor drivers. */ | ||
949 | gpio_free(GPIO_CAM_MEGA_nRST); | ||
950 | gpio_free(GPIO_CAM_8M_ISP_INT); | ||
951 | |||
952 | if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) | ||
953 | pr_err("Camera port A setup failed\n"); | ||
954 | } | ||
955 | |||
956 | static struct platform_device *universal_devices[] __initdata = { | ||
957 | /* Samsung Platform Devices */ | ||
958 | &s5p_device_mipi_csis0, | ||
959 | &s5p_device_fimc0, | ||
960 | &s5p_device_fimc1, | ||
961 | &s5p_device_fimc2, | ||
962 | &s5p_device_fimc3, | ||
963 | &mmc0_fixed_voltage, | ||
964 | &s3c_device_hsmmc0, | ||
965 | &s3c_device_hsmmc2, | ||
966 | &s3c_device_hsmmc3, | ||
967 | &s3c_device_i2c0, | ||
968 | &s3c_device_i2c3, | ||
969 | &s3c_device_i2c5, | ||
970 | &s5p_device_i2c_hdmiphy, | ||
971 | &hdmi_fixed_voltage, | ||
972 | &exynos4_device_pd[PD_TV], | ||
973 | &s5p_device_hdmi, | ||
974 | &s5p_device_sdo, | ||
975 | &s5p_device_mixer, | ||
976 | |||
977 | /* Universal Devices */ | ||
978 | &i2c_gpio12, | ||
979 | &universal_gpio_keys, | ||
980 | &s5p_device_onenand, | ||
981 | &s5p_device_fimd0, | ||
982 | &s5p_device_mfc, | ||
983 | &s5p_device_mfc_l, | ||
984 | &s5p_device_mfc_r, | ||
985 | &exynos4_device_pd[PD_MFC], | ||
986 | &exynos4_device_pd[PD_LCD0], | ||
987 | &exynos4_device_pd[PD_CAM], | ||
988 | &cam_i_core_fixed_reg_dev, | ||
989 | &cam_s_if_fixed_reg_dev, | ||
990 | &s5p_device_fimc_md, | ||
991 | }; | ||
992 | |||
993 | static void __init universal_map_io(void) | ||
994 | { | ||
995 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
996 | s3c24xx_init_clocks(24000000); | ||
997 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | ||
998 | } | ||
999 | |||
1000 | void s5p_tv_setup(void) | ||
1001 | { | ||
1002 | /* direct HPD to HDMI chip */ | ||
1003 | gpio_request(EXYNOS4_GPX3(7), "hpd-plug"); | ||
1004 | |||
1005 | gpio_direction_input(EXYNOS4_GPX3(7)); | ||
1006 | s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3)); | ||
1007 | s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE); | ||
1008 | |||
1009 | /* setup dependencies between TV devices */ | ||
1010 | s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
1011 | s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; | ||
1012 | } | ||
1013 | |||
1014 | static void __init universal_reserve(void) | ||
1015 | { | ||
1016 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
1017 | } | ||
1018 | |||
1019 | static void __init universal_machine_init(void) | ||
1020 | { | ||
1021 | universal_sdhci_init(); | ||
1022 | s5p_tv_setup(); | ||
1023 | |||
1024 | s3c_i2c0_set_platdata(&universal_i2c0_platdata); | ||
1025 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | ||
1026 | |||
1027 | universal_tsp_init(); | ||
1028 | s3c_i2c3_set_platdata(NULL); | ||
1029 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | ||
1030 | |||
1031 | s3c_i2c5_set_platdata(NULL); | ||
1032 | s5p_i2c_hdmiphy_set_platdata(NULL); | ||
1033 | i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); | ||
1034 | |||
1035 | s5p_fimd0_set_platdata(&universal_lcd_pdata); | ||
1036 | |||
1037 | universal_touchkey_init(); | ||
1038 | i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs, | ||
1039 | ARRAY_SIZE(i2c_gpio12_devs)); | ||
1040 | |||
1041 | universal_camera_init(); | ||
1042 | |||
1043 | /* Last */ | ||
1044 | platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); | ||
1045 | |||
1046 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
1047 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; | ||
1048 | |||
1049 | s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1050 | s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1051 | s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1052 | s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1053 | s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
1054 | } | ||
1055 | |||
1056 | MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") | ||
1057 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | ||
1058 | .atag_offset = 0x100, | ||
1059 | .init_irq = exynos4_init_irq, | ||
1060 | .map_io = universal_map_io, | ||
1061 | .init_machine = universal_machine_init, | ||
1062 | .timer = &exynos4_timer, | ||
1063 | .reserve = &universal_reserve, | ||
1064 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c new file mode 100644 index 000000000000..97343df8f132 --- /dev/null +++ b/arch/arm/mach-exynos/mct.c | |||
@@ -0,0 +1,471 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mct.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 MCT(Multi-Core Timer) 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/sched.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/clockchips.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/percpu.h> | ||
22 | |||
23 | #include <asm/hardware/gic.h> | ||
24 | |||
25 | #include <plat/cpu.h> | ||
26 | |||
27 | #include <mach/map.h> | ||
28 | #include <mach/irqs.h> | ||
29 | #include <mach/regs-mct.h> | ||
30 | #include <asm/mach/time.h> | ||
31 | |||
32 | enum { | ||
33 | MCT_INT_SPI, | ||
34 | MCT_INT_PPI | ||
35 | }; | ||
36 | |||
37 | static unsigned long clk_cnt_per_tick; | ||
38 | static unsigned long clk_rate; | ||
39 | static unsigned int mct_int_type; | ||
40 | |||
41 | struct mct_clock_event_device { | ||
42 | struct clock_event_device *evt; | ||
43 | void __iomem *base; | ||
44 | char name[10]; | ||
45 | }; | ||
46 | |||
47 | static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick); | ||
48 | |||
49 | static void exynos4_mct_write(unsigned int value, void *addr) | ||
50 | { | ||
51 | void __iomem *stat_addr; | ||
52 | u32 mask; | ||
53 | u32 i; | ||
54 | |||
55 | __raw_writel(value, addr); | ||
56 | |||
57 | if (likely(addr >= EXYNOS4_MCT_L_BASE(0))) { | ||
58 | u32 base = (u32) addr & EXYNOS4_MCT_L_MASK; | ||
59 | switch ((u32) addr & ~EXYNOS4_MCT_L_MASK) { | ||
60 | case (u32) MCT_L_TCON_OFFSET: | ||
61 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
62 | mask = 1 << 3; /* L_TCON write status */ | ||
63 | break; | ||
64 | case (u32) MCT_L_ICNTB_OFFSET: | ||
65 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
66 | mask = 1 << 1; /* L_ICNTB write status */ | ||
67 | break; | ||
68 | case (u32) MCT_L_TCNTB_OFFSET: | ||
69 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
70 | mask = 1 << 0; /* L_TCNTB write status */ | ||
71 | break; | ||
72 | default: | ||
73 | return; | ||
74 | } | ||
75 | } else { | ||
76 | switch ((u32) addr) { | ||
77 | case (u32) EXYNOS4_MCT_G_TCON: | ||
78 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
79 | mask = 1 << 16; /* G_TCON write status */ | ||
80 | break; | ||
81 | case (u32) EXYNOS4_MCT_G_COMP0_L: | ||
82 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
83 | mask = 1 << 0; /* G_COMP0_L write status */ | ||
84 | break; | ||
85 | case (u32) EXYNOS4_MCT_G_COMP0_U: | ||
86 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
87 | mask = 1 << 1; /* G_COMP0_U write status */ | ||
88 | break; | ||
89 | case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR: | ||
90 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
91 | mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ | ||
92 | break; | ||
93 | case (u32) EXYNOS4_MCT_G_CNT_L: | ||
94 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | ||
95 | mask = 1 << 0; /* G_CNT_L write status */ | ||
96 | break; | ||
97 | case (u32) EXYNOS4_MCT_G_CNT_U: | ||
98 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | ||
99 | mask = 1 << 1; /* G_CNT_U write status */ | ||
100 | break; | ||
101 | default: | ||
102 | return; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | /* Wait maximum 1 ms until written values are applied */ | ||
107 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) | ||
108 | if (__raw_readl(stat_addr) & mask) { | ||
109 | __raw_writel(mask, stat_addr); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr); | ||
114 | } | ||
115 | |||
116 | /* Clocksource handling */ | ||
117 | static void exynos4_mct_frc_start(u32 hi, u32 lo) | ||
118 | { | ||
119 | u32 reg; | ||
120 | |||
121 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | ||
122 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | ||
123 | |||
124 | reg = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
125 | reg |= MCT_G_TCON_START; | ||
126 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | ||
127 | } | ||
128 | |||
129 | static cycle_t exynos4_frc_read(struct clocksource *cs) | ||
130 | { | ||
131 | unsigned int lo, hi; | ||
132 | u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | ||
133 | |||
134 | do { | ||
135 | hi = hi2; | ||
136 | lo = __raw_readl(EXYNOS4_MCT_G_CNT_L); | ||
137 | hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | ||
138 | } while (hi != hi2); | ||
139 | |||
140 | return ((cycle_t)hi << 32) | lo; | ||
141 | } | ||
142 | |||
143 | static void exynos4_frc_resume(struct clocksource *cs) | ||
144 | { | ||
145 | exynos4_mct_frc_start(0, 0); | ||
146 | } | ||
147 | |||
148 | struct clocksource mct_frc = { | ||
149 | .name = "mct-frc", | ||
150 | .rating = 400, | ||
151 | .read = exynos4_frc_read, | ||
152 | .mask = CLOCKSOURCE_MASK(64), | ||
153 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
154 | .resume = exynos4_frc_resume, | ||
155 | }; | ||
156 | |||
157 | static void __init exynos4_clocksource_init(void) | ||
158 | { | ||
159 | exynos4_mct_frc_start(0, 0); | ||
160 | |||
161 | if (clocksource_register_hz(&mct_frc, clk_rate)) | ||
162 | panic("%s: can't register clocksource\n", mct_frc.name); | ||
163 | } | ||
164 | |||
165 | static void exynos4_mct_comp0_stop(void) | ||
166 | { | ||
167 | unsigned int tcon; | ||
168 | |||
169 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
170 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); | ||
171 | |||
172 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); | ||
173 | exynos4_mct_write(0, EXYNOS4_MCT_G_INT_ENB); | ||
174 | } | ||
175 | |||
176 | static void exynos4_mct_comp0_start(enum clock_event_mode mode, | ||
177 | unsigned long cycles) | ||
178 | { | ||
179 | unsigned int tcon; | ||
180 | cycle_t comp_cycle; | ||
181 | |||
182 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
183 | |||
184 | if (mode == CLOCK_EVT_MODE_PERIODIC) { | ||
185 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; | ||
186 | exynos4_mct_write(cycles, EXYNOS4_MCT_G_COMP0_ADD_INCR); | ||
187 | } | ||
188 | |||
189 | comp_cycle = exynos4_frc_read(&mct_frc) + cycles; | ||
190 | exynos4_mct_write((u32)comp_cycle, EXYNOS4_MCT_G_COMP0_L); | ||
191 | exynos4_mct_write((u32)(comp_cycle >> 32), EXYNOS4_MCT_G_COMP0_U); | ||
192 | |||
193 | exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_ENB); | ||
194 | |||
195 | tcon |= MCT_G_TCON_COMP0_ENABLE; | ||
196 | exynos4_mct_write(tcon , EXYNOS4_MCT_G_TCON); | ||
197 | } | ||
198 | |||
199 | static int exynos4_comp_set_next_event(unsigned long cycles, | ||
200 | struct clock_event_device *evt) | ||
201 | { | ||
202 | exynos4_mct_comp0_start(evt->mode, cycles); | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static void exynos4_comp_set_mode(enum clock_event_mode mode, | ||
208 | struct clock_event_device *evt) | ||
209 | { | ||
210 | exynos4_mct_comp0_stop(); | ||
211 | |||
212 | switch (mode) { | ||
213 | case CLOCK_EVT_MODE_PERIODIC: | ||
214 | exynos4_mct_comp0_start(mode, clk_cnt_per_tick); | ||
215 | break; | ||
216 | |||
217 | case CLOCK_EVT_MODE_ONESHOT: | ||
218 | case CLOCK_EVT_MODE_UNUSED: | ||
219 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
220 | case CLOCK_EVT_MODE_RESUME: | ||
221 | break; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static struct clock_event_device mct_comp_device = { | ||
226 | .name = "mct-comp", | ||
227 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
228 | .rating = 250, | ||
229 | .set_next_event = exynos4_comp_set_next_event, | ||
230 | .set_mode = exynos4_comp_set_mode, | ||
231 | }; | ||
232 | |||
233 | static irqreturn_t exynos4_mct_comp_isr(int irq, void *dev_id) | ||
234 | { | ||
235 | struct clock_event_device *evt = dev_id; | ||
236 | |||
237 | exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_CSTAT); | ||
238 | |||
239 | evt->event_handler(evt); | ||
240 | |||
241 | return IRQ_HANDLED; | ||
242 | } | ||
243 | |||
244 | static struct irqaction mct_comp_event_irq = { | ||
245 | .name = "mct_comp_irq", | ||
246 | .flags = IRQF_TIMER | IRQF_IRQPOLL, | ||
247 | .handler = exynos4_mct_comp_isr, | ||
248 | .dev_id = &mct_comp_device, | ||
249 | }; | ||
250 | |||
251 | static void exynos4_clockevent_init(void) | ||
252 | { | ||
253 | clk_cnt_per_tick = clk_rate / 2 / HZ; | ||
254 | |||
255 | clockevents_calc_mult_shift(&mct_comp_device, clk_rate / 2, 5); | ||
256 | mct_comp_device.max_delta_ns = | ||
257 | clockevent_delta2ns(0xffffffff, &mct_comp_device); | ||
258 | mct_comp_device.min_delta_ns = | ||
259 | clockevent_delta2ns(0xf, &mct_comp_device); | ||
260 | mct_comp_device.cpumask = cpumask_of(0); | ||
261 | clockevents_register_device(&mct_comp_device); | ||
262 | |||
263 | setup_irq(IRQ_MCT_G0, &mct_comp_event_irq); | ||
264 | } | ||
265 | |||
266 | #ifdef CONFIG_LOCAL_TIMERS | ||
267 | /* Clock event handling */ | ||
268 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | ||
269 | { | ||
270 | unsigned long tmp; | ||
271 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; | ||
272 | void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET; | ||
273 | |||
274 | tmp = __raw_readl(addr); | ||
275 | if (tmp & mask) { | ||
276 | tmp &= ~mask; | ||
277 | exynos4_mct_write(tmp, addr); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | static void exynos4_mct_tick_start(unsigned long cycles, | ||
282 | struct mct_clock_event_device *mevt) | ||
283 | { | ||
284 | unsigned long tmp; | ||
285 | |||
286 | exynos4_mct_tick_stop(mevt); | ||
287 | |||
288 | tmp = (1 << 31) | cycles; /* MCT_L_UPDATE_ICNTB */ | ||
289 | |||
290 | /* update interrupt count buffer */ | ||
291 | exynos4_mct_write(tmp, mevt->base + MCT_L_ICNTB_OFFSET); | ||
292 | |||
293 | /* enable MCT tick interrupt */ | ||
294 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); | ||
295 | |||
296 | tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); | ||
297 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | | ||
298 | MCT_L_TCON_INTERVAL_MODE; | ||
299 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); | ||
300 | } | ||
301 | |||
302 | static int exynos4_tick_set_next_event(unsigned long cycles, | ||
303 | struct clock_event_device *evt) | ||
304 | { | ||
305 | struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick); | ||
306 | |||
307 | exynos4_mct_tick_start(cycles, mevt); | ||
308 | |||
309 | return 0; | ||
310 | } | ||
311 | |||
312 | static inline void exynos4_tick_set_mode(enum clock_event_mode mode, | ||
313 | struct clock_event_device *evt) | ||
314 | { | ||
315 | struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick); | ||
316 | |||
317 | exynos4_mct_tick_stop(mevt); | ||
318 | |||
319 | switch (mode) { | ||
320 | case CLOCK_EVT_MODE_PERIODIC: | ||
321 | exynos4_mct_tick_start(clk_cnt_per_tick, mevt); | ||
322 | break; | ||
323 | |||
324 | case CLOCK_EVT_MODE_ONESHOT: | ||
325 | case CLOCK_EVT_MODE_UNUSED: | ||
326 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
327 | case CLOCK_EVT_MODE_RESUME: | ||
328 | break; | ||
329 | } | ||
330 | } | ||
331 | |||
332 | static int exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) | ||
333 | { | ||
334 | struct clock_event_device *evt = mevt->evt; | ||
335 | |||
336 | /* | ||
337 | * This is for supporting oneshot mode. | ||
338 | * Mct would generate interrupt periodically | ||
339 | * without explicit stopping. | ||
340 | */ | ||
341 | if (evt->mode != CLOCK_EVT_MODE_PERIODIC) | ||
342 | exynos4_mct_tick_stop(mevt); | ||
343 | |||
344 | /* Clear the MCT tick interrupt */ | ||
345 | if (__raw_readl(mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { | ||
346 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); | ||
347 | return 1; | ||
348 | } else { | ||
349 | return 0; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id) | ||
354 | { | ||
355 | struct mct_clock_event_device *mevt = dev_id; | ||
356 | struct clock_event_device *evt = mevt->evt; | ||
357 | |||
358 | exynos4_mct_tick_clear(mevt); | ||
359 | |||
360 | evt->event_handler(evt); | ||
361 | |||
362 | return IRQ_HANDLED; | ||
363 | } | ||
364 | |||
365 | static struct irqaction mct_tick0_event_irq = { | ||
366 | .name = "mct_tick0_irq", | ||
367 | .flags = IRQF_TIMER | IRQF_NOBALANCING, | ||
368 | .handler = exynos4_mct_tick_isr, | ||
369 | }; | ||
370 | |||
371 | static struct irqaction mct_tick1_event_irq = { | ||
372 | .name = "mct_tick1_irq", | ||
373 | .flags = IRQF_TIMER | IRQF_NOBALANCING, | ||
374 | .handler = exynos4_mct_tick_isr, | ||
375 | }; | ||
376 | |||
377 | static void exynos4_mct_tick_init(struct clock_event_device *evt) | ||
378 | { | ||
379 | struct mct_clock_event_device *mevt; | ||
380 | unsigned int cpu = smp_processor_id(); | ||
381 | |||
382 | mevt = this_cpu_ptr(&percpu_mct_tick); | ||
383 | mevt->evt = evt; | ||
384 | |||
385 | mevt->base = EXYNOS4_MCT_L_BASE(cpu); | ||
386 | sprintf(mevt->name, "mct_tick%d", cpu); | ||
387 | |||
388 | evt->name = mevt->name; | ||
389 | evt->cpumask = cpumask_of(cpu); | ||
390 | evt->set_next_event = exynos4_tick_set_next_event; | ||
391 | evt->set_mode = exynos4_tick_set_mode; | ||
392 | evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
393 | evt->rating = 450; | ||
394 | |||
395 | clockevents_calc_mult_shift(evt, clk_rate / 2, 5); | ||
396 | evt->max_delta_ns = | ||
397 | clockevent_delta2ns(0x7fffffff, evt); | ||
398 | evt->min_delta_ns = | ||
399 | clockevent_delta2ns(0xf, evt); | ||
400 | |||
401 | clockevents_register_device(evt); | ||
402 | |||
403 | exynos4_mct_write(0x1, mevt->base + MCT_L_TCNTB_OFFSET); | ||
404 | |||
405 | if (mct_int_type == MCT_INT_SPI) { | ||
406 | if (cpu == 0) { | ||
407 | mct_tick0_event_irq.dev_id = mevt; | ||
408 | evt->irq = IRQ_MCT_L0; | ||
409 | setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq); | ||
410 | } else { | ||
411 | mct_tick1_event_irq.dev_id = mevt; | ||
412 | evt->irq = IRQ_MCT_L1; | ||
413 | setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq); | ||
414 | irq_set_affinity(IRQ_MCT_L1, cpumask_of(1)); | ||
415 | } | ||
416 | } else { | ||
417 | enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /* Setup the local clock events for a CPU */ | ||
422 | int __cpuinit local_timer_setup(struct clock_event_device *evt) | ||
423 | { | ||
424 | exynos4_mct_tick_init(evt); | ||
425 | |||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | void local_timer_stop(struct clock_event_device *evt) | ||
430 | { | ||
431 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); | ||
432 | if (mct_int_type == MCT_INT_SPI) | ||
433 | disable_irq(evt->irq); | ||
434 | else | ||
435 | disable_percpu_irq(IRQ_MCT_LOCALTIMER); | ||
436 | } | ||
437 | #endif /* CONFIG_LOCAL_TIMERS */ | ||
438 | |||
439 | static void __init exynos4_timer_resources(void) | ||
440 | { | ||
441 | struct clk *mct_clk; | ||
442 | mct_clk = clk_get(NULL, "xtal"); | ||
443 | |||
444 | clk_rate = clk_get_rate(mct_clk); | ||
445 | |||
446 | if (mct_int_type == MCT_INT_PPI) { | ||
447 | int err; | ||
448 | |||
449 | err = request_percpu_irq(IRQ_MCT_LOCALTIMER, | ||
450 | exynos4_mct_tick_isr, "MCT", | ||
451 | &percpu_mct_tick); | ||
452 | WARN(err, "MCT: can't request IRQ %d (%d)\n", | ||
453 | IRQ_MCT_LOCALTIMER, err); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | static void __init exynos4_timer_init(void) | ||
458 | { | ||
459 | if (soc_is_exynos4210()) | ||
460 | mct_int_type = MCT_INT_SPI; | ||
461 | else | ||
462 | mct_int_type = MCT_INT_PPI; | ||
463 | |||
464 | exynos4_timer_resources(); | ||
465 | exynos4_clocksource_init(); | ||
466 | exynos4_clockevent_init(); | ||
467 | } | ||
468 | |||
469 | struct sys_timer exynos4_timer = { | ||
470 | .init = exynos4_timer_init, | ||
471 | }; | ||
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c new file mode 100644 index 000000000000..05595407e9ff --- /dev/null +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -0,0 +1,225 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/platsmp.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Cloned from linux/arch/arm/mach-vexpress/platsmp.c | ||
7 | * | ||
8 | * Copyright (C) 2002 ARM Ltd. | ||
9 | * All Rights Reserved | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/delay.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/jiffies.h> | ||
21 | #include <linux/smp.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <asm/cacheflush.h> | ||
25 | #include <asm/hardware/gic.h> | ||
26 | #include <asm/smp_scu.h> | ||
27 | #include <asm/unified.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/regs-clock.h> | ||
31 | #include <mach/regs-pmu.h> | ||
32 | |||
33 | #include <plat/cpu.h> | ||
34 | |||
35 | extern unsigned int gic_bank_offset; | ||
36 | extern void exynos4_secondary_startup(void); | ||
37 | |||
38 | #define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \ | ||
39 | S5P_INFORM5 : S5P_VA_SYSRAM) | ||
40 | |||
41 | /* | ||
42 | * control for which core is the next to come out of the secondary | ||
43 | * boot "holding pen" | ||
44 | */ | ||
45 | |||
46 | volatile int __cpuinitdata pen_release = -1; | ||
47 | |||
48 | /* | ||
49 | * Write pen_release in a way that is guaranteed to be visible to all | ||
50 | * observers, irrespective of whether they're taking part in coherency | ||
51 | * or not. This is necessary for the hotplug code to work reliably. | ||
52 | */ | ||
53 | static void write_pen_release(int val) | ||
54 | { | ||
55 | pen_release = val; | ||
56 | smp_wmb(); | ||
57 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | ||
58 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
59 | } | ||
60 | |||
61 | static void __iomem *scu_base_addr(void) | ||
62 | { | ||
63 | return (void __iomem *)(S5P_VA_SCU); | ||
64 | } | ||
65 | |||
66 | static DEFINE_SPINLOCK(boot_lock); | ||
67 | |||
68 | static void __cpuinit exynos4_gic_secondary_init(void) | ||
69 | { | ||
70 | void __iomem *dist_base = S5P_VA_GIC_DIST + | ||
71 | (gic_bank_offset * smp_processor_id()); | ||
72 | void __iomem *cpu_base = S5P_VA_GIC_CPU + | ||
73 | (gic_bank_offset * smp_processor_id()); | ||
74 | int i; | ||
75 | |||
76 | /* | ||
77 | * Deal with the banked PPI and SGI interrupts - disable all | ||
78 | * PPI interrupts, ensure all SGI interrupts are enabled. | ||
79 | */ | ||
80 | __raw_writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR); | ||
81 | __raw_writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET); | ||
82 | |||
83 | /* | ||
84 | * Set priority on PPI and SGI interrupts | ||
85 | */ | ||
86 | for (i = 0; i < 32; i += 4) | ||
87 | __raw_writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4); | ||
88 | |||
89 | __raw_writel(0xf0, cpu_base + GIC_CPU_PRIMASK); | ||
90 | __raw_writel(1, cpu_base + GIC_CPU_CTRL); | ||
91 | } | ||
92 | |||
93 | void __cpuinit platform_secondary_init(unsigned int cpu) | ||
94 | { | ||
95 | /* | ||
96 | * if any interrupts are already enabled for the primary | ||
97 | * core (e.g. timer irq), then they will not have been enabled | ||
98 | * for us: do so | ||
99 | */ | ||
100 | exynos4_gic_secondary_init(); | ||
101 | |||
102 | /* | ||
103 | * let the primary processor know we're out of the | ||
104 | * pen, then head off into the C entry point | ||
105 | */ | ||
106 | write_pen_release(-1); | ||
107 | |||
108 | /* | ||
109 | * Synchronise with the boot thread. | ||
110 | */ | ||
111 | spin_lock(&boot_lock); | ||
112 | spin_unlock(&boot_lock); | ||
113 | |||
114 | set_cpu_online(cpu, true); | ||
115 | } | ||
116 | |||
117 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
118 | { | ||
119 | unsigned long timeout; | ||
120 | |||
121 | /* | ||
122 | * Set synchronisation state between this boot processor | ||
123 | * and the secondary one | ||
124 | */ | ||
125 | spin_lock(&boot_lock); | ||
126 | |||
127 | /* | ||
128 | * The secondary processor is waiting to be released from | ||
129 | * the holding pen - release it, then wait for it to flag | ||
130 | * that it has been released by resetting pen_release. | ||
131 | * | ||
132 | * Note that "pen_release" is the hardware CPU ID, whereas | ||
133 | * "cpu" is Linux's internal ID. | ||
134 | */ | ||
135 | write_pen_release(cpu_logical_map(cpu)); | ||
136 | |||
137 | if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) { | ||
138 | __raw_writel(S5P_CORE_LOCAL_PWR_EN, | ||
139 | S5P_ARM_CORE1_CONFIGURATION); | ||
140 | |||
141 | timeout = 10; | ||
142 | |||
143 | /* wait max 10 ms until cpu1 is on */ | ||
144 | while ((__raw_readl(S5P_ARM_CORE1_STATUS) | ||
145 | & S5P_CORE_LOCAL_PWR_EN) != S5P_CORE_LOCAL_PWR_EN) { | ||
146 | if (timeout-- == 0) | ||
147 | break; | ||
148 | |||
149 | mdelay(1); | ||
150 | } | ||
151 | |||
152 | if (timeout == 0) { | ||
153 | printk(KERN_ERR "cpu1 power enable failed"); | ||
154 | spin_unlock(&boot_lock); | ||
155 | return -ETIMEDOUT; | ||
156 | } | ||
157 | } | ||
158 | /* | ||
159 | * Send the secondary CPU a soft interrupt, thereby causing | ||
160 | * the boot monitor to read the system wide flags register, | ||
161 | * and branch to the address found there. | ||
162 | */ | ||
163 | |||
164 | timeout = jiffies + (1 * HZ); | ||
165 | while (time_before(jiffies, timeout)) { | ||
166 | smp_rmb(); | ||
167 | |||
168 | __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)), | ||
169 | CPU1_BOOT_REG); | ||
170 | gic_raise_softirq(cpumask_of(cpu), 1); | ||
171 | |||
172 | if (pen_release == -1) | ||
173 | break; | ||
174 | |||
175 | udelay(10); | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * now the secondary core is starting up let it run its | ||
180 | * calibrations, then wait for it to finish | ||
181 | */ | ||
182 | spin_unlock(&boot_lock); | ||
183 | |||
184 | return pen_release != -1 ? -ENOSYS : 0; | ||
185 | } | ||
186 | |||
187 | /* | ||
188 | * Initialise the CPU possible map early - this describes the CPUs | ||
189 | * which may be present or become present in the system. | ||
190 | */ | ||
191 | |||
192 | void __init smp_init_cpus(void) | ||
193 | { | ||
194 | void __iomem *scu_base = scu_base_addr(); | ||
195 | unsigned int i, ncores; | ||
196 | |||
197 | ncores = scu_base ? scu_get_core_count(scu_base) : 1; | ||
198 | |||
199 | /* sanity check */ | ||
200 | if (ncores > nr_cpu_ids) { | ||
201 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", | ||
202 | ncores, nr_cpu_ids); | ||
203 | ncores = nr_cpu_ids; | ||
204 | } | ||
205 | |||
206 | for (i = 0; i < ncores; i++) | ||
207 | set_cpu_possible(i, true); | ||
208 | |||
209 | set_smp_cross_call(gic_raise_softirq); | ||
210 | } | ||
211 | |||
212 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | ||
213 | { | ||
214 | |||
215 | scu_enable(scu_base_addr()); | ||
216 | |||
217 | /* | ||
218 | * Write the address of secondary startup into the | ||
219 | * system-wide flags register. The boot monitor waits | ||
220 | * until it receives a soft interrupt, and then the | ||
221 | * secondary CPU branches to this address. | ||
222 | */ | ||
223 | __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)), | ||
224 | CPU1_BOOT_REG); | ||
225 | } | ||
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c new file mode 100644 index 000000000000..509a435afd4b --- /dev/null +++ b/arch/arm/mach-exynos/pm.c | |||
@@ -0,0 +1,428 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/pm.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4210 - Power Management support | ||
7 | * | ||
8 | * Based on arch/arm/mach-s3c2410/pm.c | ||
9 | * Copyright (c) 2006 Simtec Electronics | ||
10 | * Ben Dooks <ben@simtec.co.uk> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | #include <linux/suspend.h> | ||
19 | #include <linux/syscore_ops.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/clk.h> | ||
23 | |||
24 | #include <asm/cacheflush.h> | ||
25 | #include <asm/hardware/cache-l2x0.h> | ||
26 | |||
27 | #include <plat/cpu.h> | ||
28 | #include <plat/pm.h> | ||
29 | #include <plat/pll.h> | ||
30 | #include <plat/regs-srom.h> | ||
31 | |||
32 | #include <mach/regs-irq.h> | ||
33 | #include <mach/regs-gpio.h> | ||
34 | #include <mach/regs-clock.h> | ||
35 | #include <mach/regs-pmu.h> | ||
36 | #include <mach/pm-core.h> | ||
37 | #include <mach/pmu.h> | ||
38 | |||
39 | static struct sleep_save exynos4_set_clksrc[] = { | ||
40 | { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, }, | ||
41 | { .reg = S5P_CLKSRC_MASK_CAM , .val = 0x11111111, }, | ||
42 | { .reg = S5P_CLKSRC_MASK_TV , .val = 0x00000111, }, | ||
43 | { .reg = S5P_CLKSRC_MASK_LCD0 , .val = 0x00001111, }, | ||
44 | { .reg = S5P_CLKSRC_MASK_MAUDIO , .val = 0x00000001, }, | ||
45 | { .reg = S5P_CLKSRC_MASK_FSYS , .val = 0x01011111, }, | ||
46 | { .reg = S5P_CLKSRC_MASK_PERIL0 , .val = 0x01111111, }, | ||
47 | { .reg = S5P_CLKSRC_MASK_PERIL1 , .val = 0x01110111, }, | ||
48 | { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, | ||
49 | }; | ||
50 | |||
51 | static struct sleep_save exynos4210_set_clksrc[] = { | ||
52 | { .reg = S5P_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, | ||
53 | }; | ||
54 | |||
55 | static struct sleep_save exynos4_epll_save[] = { | ||
56 | SAVE_ITEM(S5P_EPLL_CON0), | ||
57 | SAVE_ITEM(S5P_EPLL_CON1), | ||
58 | }; | ||
59 | |||
60 | static struct sleep_save exynos4_vpll_save[] = { | ||
61 | SAVE_ITEM(S5P_VPLL_CON0), | ||
62 | SAVE_ITEM(S5P_VPLL_CON1), | ||
63 | }; | ||
64 | |||
65 | static struct sleep_save exynos4_core_save[] = { | ||
66 | /* GIC side */ | ||
67 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x000), | ||
68 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x004), | ||
69 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x008), | ||
70 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x00C), | ||
71 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x014), | ||
72 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x018), | ||
73 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x000), | ||
74 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x004), | ||
75 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x100), | ||
76 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x104), | ||
77 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x108), | ||
78 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x300), | ||
79 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x304), | ||
80 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x308), | ||
81 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x400), | ||
82 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x404), | ||
83 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x408), | ||
84 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x40C), | ||
85 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x410), | ||
86 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x414), | ||
87 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x418), | ||
88 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x41C), | ||
89 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x420), | ||
90 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x424), | ||
91 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x428), | ||
92 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x42C), | ||
93 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x430), | ||
94 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x434), | ||
95 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x438), | ||
96 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x43C), | ||
97 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x440), | ||
98 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x444), | ||
99 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x448), | ||
100 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x44C), | ||
101 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x450), | ||
102 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x454), | ||
103 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x458), | ||
104 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x45C), | ||
105 | |||
106 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x800), | ||
107 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x804), | ||
108 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x808), | ||
109 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x80C), | ||
110 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x810), | ||
111 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x814), | ||
112 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x818), | ||
113 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x81C), | ||
114 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x820), | ||
115 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x824), | ||
116 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x828), | ||
117 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x82C), | ||
118 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x830), | ||
119 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x834), | ||
120 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x838), | ||
121 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x83C), | ||
122 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x840), | ||
123 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x844), | ||
124 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x848), | ||
125 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x84C), | ||
126 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x850), | ||
127 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x854), | ||
128 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x858), | ||
129 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x85C), | ||
130 | |||
131 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC00), | ||
132 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC04), | ||
133 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC08), | ||
134 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC0C), | ||
135 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC10), | ||
136 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC14), | ||
137 | |||
138 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x000), | ||
139 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x010), | ||
140 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x020), | ||
141 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x030), | ||
142 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x040), | ||
143 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x050), | ||
144 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x060), | ||
145 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x070), | ||
146 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x080), | ||
147 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x090), | ||
148 | |||
149 | /* SROM side */ | ||
150 | SAVE_ITEM(S5P_SROM_BW), | ||
151 | SAVE_ITEM(S5P_SROM_BC0), | ||
152 | SAVE_ITEM(S5P_SROM_BC1), | ||
153 | SAVE_ITEM(S5P_SROM_BC2), | ||
154 | SAVE_ITEM(S5P_SROM_BC3), | ||
155 | }; | ||
156 | |||
157 | static struct sleep_save exynos4_l2cc_save[] = { | ||
158 | SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL), | ||
159 | SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL), | ||
160 | SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL), | ||
161 | SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL), | ||
162 | SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL), | ||
163 | }; | ||
164 | |||
165 | /* For Cortex-A9 Diagnostic and Power control register */ | ||
166 | static unsigned int save_arm_register[2]; | ||
167 | |||
168 | static int exynos4_cpu_suspend(unsigned long arg) | ||
169 | { | ||
170 | outer_flush_all(); | ||
171 | |||
172 | /* issue the standby signal into the pm unit. */ | ||
173 | cpu_do_idle(); | ||
174 | |||
175 | /* we should never get past here */ | ||
176 | panic("sleep resumed to originator?"); | ||
177 | } | ||
178 | |||
179 | static void exynos4_pm_prepare(void) | ||
180 | { | ||
181 | u32 tmp; | ||
182 | |||
183 | s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); | ||
184 | s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); | ||
185 | s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save)); | ||
186 | s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save)); | ||
187 | |||
188 | tmp = __raw_readl(S5P_INFORM1); | ||
189 | |||
190 | /* Set value of power down register for sleep mode */ | ||
191 | |||
192 | exynos4_sys_powerdown_conf(SYS_SLEEP); | ||
193 | __raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1); | ||
194 | |||
195 | /* ensure at least INFORM0 has the resume address */ | ||
196 | |||
197 | __raw_writel(virt_to_phys(s3c_cpu_resume), S5P_INFORM0); | ||
198 | |||
199 | /* Before enter central sequence mode, clock src register have to set */ | ||
200 | |||
201 | s3c_pm_do_restore_core(exynos4_set_clksrc, ARRAY_SIZE(exynos4_set_clksrc)); | ||
202 | |||
203 | if (soc_is_exynos4210()) | ||
204 | s3c_pm_do_restore_core(exynos4210_set_clksrc, ARRAY_SIZE(exynos4210_set_clksrc)); | ||
205 | |||
206 | } | ||
207 | |||
208 | static int exynos4_pm_add(struct sys_device *sysdev) | ||
209 | { | ||
210 | pm_cpu_prep = exynos4_pm_prepare; | ||
211 | pm_cpu_sleep = exynos4_cpu_suspend; | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | /* This function copy from linux/arch/arm/kernel/smp_scu.c */ | ||
217 | |||
218 | void exynos4_scu_enable(void __iomem *scu_base) | ||
219 | { | ||
220 | u32 scu_ctrl; | ||
221 | |||
222 | scu_ctrl = __raw_readl(scu_base); | ||
223 | /* already enabled? */ | ||
224 | if (scu_ctrl & 1) | ||
225 | return; | ||
226 | |||
227 | scu_ctrl |= 1; | ||
228 | __raw_writel(scu_ctrl, scu_base); | ||
229 | |||
230 | /* | ||
231 | * Ensure that the data accessed by CPU0 before the SCU was | ||
232 | * initialised is visible to the other CPUs. | ||
233 | */ | ||
234 | flush_cache_all(); | ||
235 | } | ||
236 | |||
237 | static unsigned long pll_base_rate; | ||
238 | |||
239 | static void exynos4_restore_pll(void) | ||
240 | { | ||
241 | unsigned long pll_con, locktime, lockcnt; | ||
242 | unsigned long pll_in_rate; | ||
243 | unsigned int p_div, epll_wait = 0, vpll_wait = 0; | ||
244 | |||
245 | if (pll_base_rate == 0) | ||
246 | return; | ||
247 | |||
248 | pll_in_rate = pll_base_rate; | ||
249 | |||
250 | /* EPLL */ | ||
251 | pll_con = exynos4_epll_save[0].val; | ||
252 | |||
253 | if (pll_con & (1 << 31)) { | ||
254 | pll_con &= (PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT); | ||
255 | p_div = (pll_con >> PLL46XX_PDIV_SHIFT); | ||
256 | |||
257 | pll_in_rate /= 1000000; | ||
258 | |||
259 | locktime = (3000 / pll_in_rate) * p_div; | ||
260 | lockcnt = locktime * 10000 / (10000 / pll_in_rate); | ||
261 | |||
262 | __raw_writel(lockcnt, S5P_EPLL_LOCK); | ||
263 | |||
264 | s3c_pm_do_restore_core(exynos4_epll_save, | ||
265 | ARRAY_SIZE(exynos4_epll_save)); | ||
266 | epll_wait = 1; | ||
267 | } | ||
268 | |||
269 | pll_in_rate = pll_base_rate; | ||
270 | |||
271 | /* VPLL */ | ||
272 | pll_con = exynos4_vpll_save[0].val; | ||
273 | |||
274 | if (pll_con & (1 << 31)) { | ||
275 | pll_in_rate /= 1000000; | ||
276 | /* 750us */ | ||
277 | locktime = 750; | ||
278 | lockcnt = locktime * 10000 / (10000 / pll_in_rate); | ||
279 | |||
280 | __raw_writel(lockcnt, S5P_VPLL_LOCK); | ||
281 | |||
282 | s3c_pm_do_restore_core(exynos4_vpll_save, | ||
283 | ARRAY_SIZE(exynos4_vpll_save)); | ||
284 | vpll_wait = 1; | ||
285 | } | ||
286 | |||
287 | /* Wait PLL locking */ | ||
288 | |||
289 | do { | ||
290 | if (epll_wait) { | ||
291 | pll_con = __raw_readl(S5P_EPLL_CON0); | ||
292 | if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT)) | ||
293 | epll_wait = 0; | ||
294 | } | ||
295 | |||
296 | if (vpll_wait) { | ||
297 | pll_con = __raw_readl(S5P_VPLL_CON0); | ||
298 | if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT)) | ||
299 | vpll_wait = 0; | ||
300 | } | ||
301 | } while (epll_wait || vpll_wait); | ||
302 | } | ||
303 | |||
304 | static struct sysdev_driver exynos4_pm_driver = { | ||
305 | .add = exynos4_pm_add, | ||
306 | }; | ||
307 | |||
308 | static __init int exynos4_pm_drvinit(void) | ||
309 | { | ||
310 | struct clk *pll_base; | ||
311 | unsigned int tmp; | ||
312 | |||
313 | s3c_pm_init(); | ||
314 | |||
315 | /* All wakeup disable */ | ||
316 | |||
317 | tmp = __raw_readl(S5P_WAKEUP_MASK); | ||
318 | tmp |= ((0xFF << 8) | (0x1F << 1)); | ||
319 | __raw_writel(tmp, S5P_WAKEUP_MASK); | ||
320 | |||
321 | pll_base = clk_get(NULL, "xtal"); | ||
322 | |||
323 | if (!IS_ERR(pll_base)) { | ||
324 | pll_base_rate = clk_get_rate(pll_base); | ||
325 | clk_put(pll_base); | ||
326 | } | ||
327 | |||
328 | return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver); | ||
329 | } | ||
330 | arch_initcall(exynos4_pm_drvinit); | ||
331 | |||
332 | static int exynos4_pm_suspend(void) | ||
333 | { | ||
334 | unsigned long tmp; | ||
335 | |||
336 | /* Setting Central Sequence Register for power down mode */ | ||
337 | |||
338 | tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); | ||
339 | tmp &= ~S5P_CENTRAL_LOWPWR_CFG; | ||
340 | __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); | ||
341 | |||
342 | if (soc_is_exynos4212()) { | ||
343 | tmp = __raw_readl(S5P_CENTRAL_SEQ_OPTION); | ||
344 | tmp &= ~(S5P_USE_STANDBYWFI_ISP_ARM | | ||
345 | S5P_USE_STANDBYWFE_ISP_ARM); | ||
346 | __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); | ||
347 | } | ||
348 | |||
349 | /* Save Power control register */ | ||
350 | asm ("mrc p15, 0, %0, c15, c0, 0" | ||
351 | : "=r" (tmp) : : "cc"); | ||
352 | save_arm_register[0] = tmp; | ||
353 | |||
354 | /* Save Diagnostic register */ | ||
355 | asm ("mrc p15, 0, %0, c15, c0, 1" | ||
356 | : "=r" (tmp) : : "cc"); | ||
357 | save_arm_register[1] = tmp; | ||
358 | |||
359 | return 0; | ||
360 | } | ||
361 | |||
362 | static void exynos4_pm_resume(void) | ||
363 | { | ||
364 | unsigned long tmp; | ||
365 | |||
366 | /* | ||
367 | * If PMU failed while entering sleep mode, WFI will be | ||
368 | * ignored by PMU and then exiting cpu_do_idle(). | ||
369 | * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically | ||
370 | * in this situation. | ||
371 | */ | ||
372 | tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); | ||
373 | if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) { | ||
374 | tmp |= S5P_CENTRAL_LOWPWR_CFG; | ||
375 | __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); | ||
376 | /* No need to perform below restore code */ | ||
377 | goto early_wakeup; | ||
378 | } | ||
379 | /* Restore Power control register */ | ||
380 | tmp = save_arm_register[0]; | ||
381 | asm volatile ("mcr p15, 0, %0, c15, c0, 0" | ||
382 | : : "r" (tmp) | ||
383 | : "cc"); | ||
384 | |||
385 | /* Restore Diagnostic register */ | ||
386 | tmp = save_arm_register[1]; | ||
387 | asm volatile ("mcr p15, 0, %0, c15, c0, 1" | ||
388 | : : "r" (tmp) | ||
389 | : "cc"); | ||
390 | |||
391 | /* For release retention */ | ||
392 | |||
393 | __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION); | ||
394 | __raw_writel((1 << 28), S5P_PAD_RET_GPIO_OPTION); | ||
395 | __raw_writel((1 << 28), S5P_PAD_RET_UART_OPTION); | ||
396 | __raw_writel((1 << 28), S5P_PAD_RET_MMCA_OPTION); | ||
397 | __raw_writel((1 << 28), S5P_PAD_RET_MMCB_OPTION); | ||
398 | __raw_writel((1 << 28), S5P_PAD_RET_EBIA_OPTION); | ||
399 | __raw_writel((1 << 28), S5P_PAD_RET_EBIB_OPTION); | ||
400 | |||
401 | s3c_pm_do_restore_core(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); | ||
402 | |||
403 | exynos4_restore_pll(); | ||
404 | |||
405 | exynos4_scu_enable(S5P_VA_SCU); | ||
406 | |||
407 | #ifdef CONFIG_CACHE_L2X0 | ||
408 | s3c_pm_do_restore_core(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); | ||
409 | outer_inv_all(); | ||
410 | /* enable L2X0*/ | ||
411 | writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL); | ||
412 | #endif | ||
413 | |||
414 | early_wakeup: | ||
415 | return; | ||
416 | } | ||
417 | |||
418 | static struct syscore_ops exynos4_pm_syscore_ops = { | ||
419 | .suspend = exynos4_pm_suspend, | ||
420 | .resume = exynos4_pm_resume, | ||
421 | }; | ||
422 | |||
423 | static __init int exynos4_pm_syscore_init(void) | ||
424 | { | ||
425 | register_syscore_ops(&exynos4_pm_syscore_ops); | ||
426 | return 0; | ||
427 | } | ||
428 | arch_initcall(exynos4_pm_syscore_init); | ||
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c new file mode 100644 index 000000000000..bba48f5c3e8f --- /dev/null +++ b/arch/arm/mach-exynos/pmu.c | |||
@@ -0,0 +1,230 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/pmu.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * EXYNOS4210 - CPU PMU(Power Management Unit) 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/io.h> | ||
14 | #include <linux/kernel.h> | ||
15 | |||
16 | #include <mach/regs-clock.h> | ||
17 | #include <mach/pmu.h> | ||
18 | |||
19 | static struct exynos4_pmu_conf *exynos4_pmu_config; | ||
20 | |||
21 | static struct exynos4_pmu_conf exynos4210_pmu_config[] = { | ||
22 | /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ | ||
23 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
24 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, | ||
25 | { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, | ||
26 | { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
27 | { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } }, | ||
28 | { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } }, | ||
29 | { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
30 | { S5P_L2_0_LOWPWR, { 0x2, 0x2, 0x3 } }, | ||
31 | { S5P_L2_1_LOWPWR, { 0x2, 0x2, 0x3 } }, | ||
32 | { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
33 | { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
34 | { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
35 | { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
36 | { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
37 | { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
38 | { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
39 | { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
40 | { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
41 | { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
42 | { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
43 | { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
44 | { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
45 | { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
46 | { S5P_CMU_CLKSTOP_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
47 | { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
48 | { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
49 | { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
50 | { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
51 | { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
52 | { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
53 | { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
54 | { S5P_CMU_RESET_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
55 | { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
56 | { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
57 | { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
58 | { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
59 | { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } }, | ||
60 | { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
61 | { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
62 | { S5P_MODIMIF_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
63 | { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
64 | { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
65 | { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
66 | { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
67 | { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
68 | { S5P_PCIE_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
69 | { S5P_SATA_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
70 | { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
71 | { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
72 | { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
73 | { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
74 | { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
75 | { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
76 | { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
77 | { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
78 | { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
79 | { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
80 | { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
81 | { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
82 | { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
83 | { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
84 | { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
85 | { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
86 | { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
87 | { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
88 | { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
89 | { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
90 | { S5P_LCD1_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
91 | { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } }, | ||
92 | { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
93 | { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
94 | { PMU_TABLE_END,}, | ||
95 | }; | ||
96 | |||
97 | static struct exynos4_pmu_conf exynos4212_pmu_config[] = { | ||
98 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
99 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, | ||
100 | { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, | ||
101 | { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
102 | { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } }, | ||
103 | { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } }, | ||
104 | { S5P_ISP_ARM_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
105 | { S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR, { 0x0, 0x0, 0x0 } }, | ||
106 | { S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR, { 0x0, 0x0, 0x0 } }, | ||
107 | { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } }, | ||
108 | { S5P_L2_0_LOWPWR, { 0x0, 0x0, 0x3 } }, | ||
109 | /* XXX_OPTION register should be set other field */ | ||
110 | { S5P_ARM_L2_0_OPTION, { 0x10, 0x10, 0x0 } }, | ||
111 | { S5P_L2_1_LOWPWR, { 0x0, 0x0, 0x3 } }, | ||
112 | { S5P_ARM_L2_1_OPTION, { 0x10, 0x10, 0x0 } }, | ||
113 | { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
114 | { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
115 | { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
116 | { S5P_DRAM_FREQ_DOWN_LOWPWR, { 0x1, 0x1, 0x1 } }, | ||
117 | { S5P_DDRPHY_DLLOFF_LOWPWR, { 0x1, 0x1, 0x1 } }, | ||
118 | { S5P_LPDDR_PHY_DLL_LOCK_LOWPWR, { 0x1, 0x1, 0x1 } }, | ||
119 | { S5P_CMU_ACLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
120 | { S5P_CMU_SCLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
121 | { S5P_CMU_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
122 | { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
123 | { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
124 | { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
125 | { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
126 | { S5P_MPLLUSER_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
127 | { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
128 | { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
129 | { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
130 | { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
131 | { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
132 | { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
133 | { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
134 | { S5P_CMU_CLKSTOP_ISP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
135 | { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
136 | { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
137 | { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
138 | { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
139 | { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
140 | { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
141 | { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
142 | { S5P_CMU_RESET_ISP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
143 | { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
144 | { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
145 | { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
146 | { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
147 | { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } }, | ||
148 | { S5P_TOP_BUS_COREBLK_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
149 | { S5P_TOP_RETENTION_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
150 | { S5P_TOP_PWR_COREBLK_LOWPWR, { 0x3, 0x0, 0x3 } }, | ||
151 | { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
152 | { S5P_OSCCLK_GATE_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
153 | { S5P_LOGIC_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
154 | { S5P_OSCCLK_GATE_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
155 | { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
156 | { S5P_ONENAND_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
157 | { S5P_HSI_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
158 | { S5P_HSI_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
159 | { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
160 | { S5P_G2D_ACP_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
161 | { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
162 | { S5P_USBOTG_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
163 | { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
164 | { S5P_HSMMC_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
165 | { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
166 | { S5P_CSSYS_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
167 | { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
168 | { S5P_SECSS_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
169 | { S5P_ROTATOR_MEM_LOWPWR, { 0x3, 0x0, 0x0 } }, | ||
170 | { S5P_ROTATOR_MEM_OPTION, { 0x10, 0x10, 0x0 } }, | ||
171 | { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
172 | { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
173 | { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
174 | { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
175 | { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
176 | { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
177 | { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
178 | { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
179 | { S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR,{ 0x1, 0x0, 0x0 } }, | ||
180 | { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
181 | { S5P_PAD_ISOLATION_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
182 | { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
183 | { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
184 | { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
185 | { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
186 | { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
187 | { S5P_GPIO_MODE_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
188 | { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } }, | ||
189 | { S5P_TOP_ASB_RESET_LOWPWR, { 0x1, 0x1, 0x1 } }, | ||
190 | { S5P_TOP_ASB_ISOLATION_LOWPWR, { 0x1, 0x0, 0x1 } }, | ||
191 | { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
192 | { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
193 | { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
194 | { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
195 | { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
196 | { S5P_ISP_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
197 | { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } }, | ||
198 | { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
199 | { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } }, | ||
200 | { S5P_CMU_SYSCLK_ISP_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
201 | { S5P_CMU_SYSCLK_GPS_LOWPWR, { 0x1, 0x0, 0x0 } }, | ||
202 | { PMU_TABLE_END,}, | ||
203 | }; | ||
204 | |||
205 | void exynos4_sys_powerdown_conf(enum sys_powerdown mode) | ||
206 | { | ||
207 | unsigned int i; | ||
208 | |||
209 | for (i = 0; (exynos4_pmu_config[i].reg != PMU_TABLE_END) ; i++) | ||
210 | __raw_writel(exynos4_pmu_config[i].val[mode], | ||
211 | exynos4_pmu_config[i].reg); | ||
212 | } | ||
213 | |||
214 | static int __init exynos4_pmu_init(void) | ||
215 | { | ||
216 | exynos4_pmu_config = exynos4210_pmu_config; | ||
217 | |||
218 | if (soc_is_exynos4210()) { | ||
219 | exynos4_pmu_config = exynos4210_pmu_config; | ||
220 | pr_info("EXYNOS4210 PMU Initialize\n"); | ||
221 | } else if (soc_is_exynos4212()) { | ||
222 | exynos4_pmu_config = exynos4212_pmu_config; | ||
223 | pr_info("EXYNOS4212 PMU Initialize\n"); | ||
224 | } else { | ||
225 | pr_info("EXYNOS4: PMU not supported\n"); | ||
226 | } | ||
227 | |||
228 | return 0; | ||
229 | } | ||
230 | arch_initcall(exynos4_pmu_init); | ||
diff --git a/arch/arm/mach-exynos/setup-fimc.c b/arch/arm/mach-exynos/setup-fimc.c new file mode 100644 index 000000000000..6a45078d9d12 --- /dev/null +++ b/arch/arm/mach-exynos/setup-fimc.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * Exynos4 camera interface GPIO configuration. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/gpio.h> | ||
12 | #include <plat/gpio-cfg.h> | ||
13 | #include <plat/camport.h> | ||
14 | |||
15 | int exynos4_fimc_setup_gpio(enum s5p_camport_id id) | ||
16 | { | ||
17 | u32 gpio8, gpio5; | ||
18 | u32 sfn; | ||
19 | int ret; | ||
20 | |||
21 | switch (id) { | ||
22 | case S5P_CAMPORT_A: | ||
23 | gpio8 = EXYNOS4_GPJ0(0); /* PCLK, VSYNC, HREF, DATA[0:4] */ | ||
24 | gpio5 = EXYNOS4_GPJ1(0); /* DATA[5:7], CLKOUT, FIELD */ | ||
25 | sfn = S3C_GPIO_SFN(2); | ||
26 | break; | ||
27 | |||
28 | case S5P_CAMPORT_B: | ||
29 | gpio8 = EXYNOS4_GPE0(0); /* DATA[0:7] */ | ||
30 | gpio5 = EXYNOS4_GPE1(0); /* PCLK, VSYNC, HREF, CLKOUT, FIELD */ | ||
31 | sfn = S3C_GPIO_SFN(3); | ||
32 | break; | ||
33 | |||
34 | default: | ||
35 | WARN(1, "Wrong camport id: %d\n", id); | ||
36 | return -EINVAL; | ||
37 | } | ||
38 | |||
39 | ret = s3c_gpio_cfgall_range(gpio8, 8, sfn, S3C_GPIO_PULL_UP); | ||
40 | if (ret) | ||
41 | return ret; | ||
42 | |||
43 | return s3c_gpio_cfgall_range(gpio5, 5, sfn, S3C_GPIO_PULL_UP); | ||
44 | } | ||
diff --git a/arch/arm/mach-exynos/setup-fimd0.c b/arch/arm/mach-exynos/setup-fimd0.c new file mode 100644 index 000000000000..07a6dbeecdd0 --- /dev/null +++ b/arch/arm/mach-exynos/setup-fimd0.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/setup-fimd0.c | ||
2 | * | ||
3 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Base Exynos4 FIMD 0 configuration | ||
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/fb.h> | ||
14 | #include <linux/gpio.h> | ||
15 | |||
16 | #include <plat/gpio-cfg.h> | ||
17 | #include <plat/regs-fb-v4.h> | ||
18 | |||
19 | #include <mach/map.h> | ||
20 | |||
21 | void exynos4_fimd0_gpio_setup_24bpp(void) | ||
22 | { | ||
23 | unsigned int reg; | ||
24 | |||
25 | s3c_gpio_cfgrange_nopull(EXYNOS4_GPF0(0), 8, S3C_GPIO_SFN(2)); | ||
26 | s3c_gpio_cfgrange_nopull(EXYNOS4_GPF1(0), 8, S3C_GPIO_SFN(2)); | ||
27 | s3c_gpio_cfgrange_nopull(EXYNOS4_GPF2(0), 8, S3C_GPIO_SFN(2)); | ||
28 | s3c_gpio_cfgrange_nopull(EXYNOS4_GPF3(0), 4, S3C_GPIO_SFN(2)); | ||
29 | |||
30 | /* | ||
31 | * Set DISPLAY_CONTROL register for Display path selection. | ||
32 | * | ||
33 | * DISPLAY_CONTROL[1:0] | ||
34 | * --------------------- | ||
35 | * 00 | MIE | ||
36 | * 01 | MDINE | ||
37 | * 10 | FIMD : selected | ||
38 | * 11 | FIMD | ||
39 | */ | ||
40 | reg = __raw_readl(S3C_VA_SYS + 0x0210); | ||
41 | reg |= (1 << 1); | ||
42 | __raw_writel(reg, S3C_VA_SYS + 0x0210); | ||
43 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c new file mode 100644 index 000000000000..d395bd17c38b --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c0.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c0.c | ||
3 | * | ||
4 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com/ | ||
6 | * | ||
7 | * I2C0 GPIO configuration. | ||
8 | * | ||
9 | * Based on plat-s3c64xx/setup-i2c0.c | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | struct platform_device; /* don't need the contents */ | ||
17 | |||
18 | #include <linux/gpio.h> | ||
19 | #include <plat/iic.h> | ||
20 | #include <plat/gpio-cfg.h> | ||
21 | |||
22 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) | ||
23 | { | ||
24 | s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2, | ||
25 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
26 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c1.c b/arch/arm/mach-exynos/setup-i2c1.c new file mode 100644 index 000000000000..fd7235a43f6e --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c1.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c1.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C1 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c1_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPD1(2), 2, | ||
22 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c2.c b/arch/arm/mach-exynos/setup-i2c2.c new file mode 100644 index 000000000000..2694b19e8b37 --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c2.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c2.c | ||
3 | * | ||
4 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C2 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c2_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPA0(6), 2, | ||
22 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c3.c b/arch/arm/mach-exynos/setup-i2c3.c new file mode 100644 index 000000000000..379bd306993f --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c3.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c3.c | ||
3 | * | ||
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C3 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c3_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPA1(2), 2, | ||
22 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c4.c b/arch/arm/mach-exynos/setup-i2c4.c new file mode 100644 index 000000000000..9f3c04855b76 --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c4.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c4.c | ||
3 | * | ||
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C4 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c4_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPB(2), 2, | ||
22 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c5.c b/arch/arm/mach-exynos/setup-i2c5.c new file mode 100644 index 000000000000..77e1a1e57c76 --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c5.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c5.c | ||
3 | * | ||
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C5 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c5_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPB(6), 2, | ||
22 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c6.c b/arch/arm/mach-exynos/setup-i2c6.c new file mode 100644 index 000000000000..284d12b7af0e --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c6.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c6.c | ||
3 | * | ||
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C6 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c6_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPC1(3), 2, | ||
22 | S3C_GPIO_SFN(4), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-i2c7.c b/arch/arm/mach-exynos/setup-i2c7.c new file mode 100644 index 000000000000..b7611ee359a2 --- /dev/null +++ b/arch/arm/mach-exynos/setup-i2c7.c | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-exynos4/setup-i2c7.c | ||
3 | * | ||
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
5 | * | ||
6 | * I2C7 GPIO configuration. | ||
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 | struct platform_device; /* don't need the contents */ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <plat/iic.h> | ||
17 | #include <plat/gpio-cfg.h> | ||
18 | |||
19 | void s3c_i2c7_cfg_gpio(struct platform_device *dev) | ||
20 | { | ||
21 | s3c_gpio_cfgall_range(EXYNOS4_GPD0(2), 2, | ||
22 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
23 | } | ||
diff --git a/arch/arm/mach-exynos/setup-keypad.c b/arch/arm/mach-exynos/setup-keypad.c new file mode 100644 index 000000000000..7862bfb5933d --- /dev/null +++ b/arch/arm/mach-exynos/setup-keypad.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/setup-keypad.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * GPIO configuration for Exynos4 KeyPad device | ||
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/gpio.h> | ||
14 | #include <plat/gpio-cfg.h> | ||
15 | |||
16 | void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) | ||
17 | { | ||
18 | /* Keypads can be of various combinations, Just making sure */ | ||
19 | |||
20 | if (rows > 8) { | ||
21 | /* Set all the necessary GPX2 pins: KP_ROW[0~7] */ | ||
22 | s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3), | ||
23 | S3C_GPIO_PULL_UP); | ||
24 | |||
25 | /* Set all the necessary GPX3 pins: KP_ROW[8~] */ | ||
26 | s3c_gpio_cfgall_range(EXYNOS4_GPX3(0), (rows - 8), | ||
27 | S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); | ||
28 | } else { | ||
29 | /* Set all the necessary GPX2 pins: KP_ROW[x] */ | ||
30 | s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), rows, S3C_GPIO_SFN(3), | ||
31 | S3C_GPIO_PULL_UP); | ||
32 | } | ||
33 | |||
34 | /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */ | ||
35 | s3c_gpio_cfgrange_nopull(EXYNOS4_GPX1(0), cols, S3C_GPIO_SFN(3)); | ||
36 | } | ||
diff --git a/arch/arm/mach-exynos/setup-sdhci-gpio.c b/arch/arm/mach-exynos/setup-sdhci-gpio.c new file mode 100644 index 000000000000..e8d08bf8965a --- /dev/null +++ b/arch/arm/mach-exynos/setup-sdhci-gpio.c | |||
@@ -0,0 +1,152 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/setup-sdhci-gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC) | ||
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/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/mmc/host.h> | ||
20 | #include <linux/mmc/card.h> | ||
21 | |||
22 | #include <plat/gpio-cfg.h> | ||
23 | #include <plat/regs-sdhci.h> | ||
24 | #include <plat/sdhci.h> | ||
25 | |||
26 | void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | ||
27 | { | ||
28 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
29 | unsigned int gpio; | ||
30 | |||
31 | /* Set all the necessary GPK0[0:1] pins to special-function 2 */ | ||
32 | for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) { | ||
33 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
34 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
35 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
36 | } | ||
37 | |||
38 | switch (width) { | ||
39 | case 8: | ||
40 | for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { | ||
41 | /* Data pin GPK1[3:6] to special-function 3 */ | ||
42 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); | ||
43 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
44 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
45 | } | ||
46 | case 4: | ||
47 | for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) { | ||
48 | /* Data pin GPK0[3:6] to special-function 2 */ | ||
49 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
50 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
51 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
52 | } | ||
53 | default: | ||
54 | break; | ||
55 | } | ||
56 | |||
57 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { | ||
58 | s3c_gpio_cfgpin(EXYNOS4_GPK0(2), S3C_GPIO_SFN(2)); | ||
59 | s3c_gpio_setpull(EXYNOS4_GPK0(2), S3C_GPIO_PULL_UP); | ||
60 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | ||
65 | { | ||
66 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
67 | unsigned int gpio; | ||
68 | |||
69 | /* Set all the necessary GPK1[0:1] pins to special-function 2 */ | ||
70 | for (gpio = EXYNOS4_GPK1(0); gpio < EXYNOS4_GPK1(2); gpio++) { | ||
71 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
72 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
73 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
74 | } | ||
75 | |||
76 | for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { | ||
77 | /* Data pin GPK1[3:6] to special-function 2 */ | ||
78 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
79 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
80 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
81 | } | ||
82 | |||
83 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { | ||
84 | s3c_gpio_cfgpin(EXYNOS4_GPK1(2), S3C_GPIO_SFN(2)); | ||
85 | s3c_gpio_setpull(EXYNOS4_GPK1(2), S3C_GPIO_PULL_UP); | ||
86 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | ||
91 | { | ||
92 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
93 | unsigned int gpio; | ||
94 | |||
95 | /* Set all the necessary GPK2[0:1] pins to special-function 2 */ | ||
96 | for (gpio = EXYNOS4_GPK2(0); gpio < EXYNOS4_GPK2(2); gpio++) { | ||
97 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
98 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
99 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
100 | } | ||
101 | |||
102 | switch (width) { | ||
103 | case 8: | ||
104 | for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { | ||
105 | /* Data pin GPK3[3:6] to special-function 3 */ | ||
106 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); | ||
107 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
108 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
109 | } | ||
110 | case 4: | ||
111 | for (gpio = EXYNOS4_GPK2(3); gpio <= EXYNOS4_GPK2(6); gpio++) { | ||
112 | /* Data pin GPK2[3:6] to special-function 2 */ | ||
113 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
114 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
115 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
116 | } | ||
117 | default: | ||
118 | break; | ||
119 | } | ||
120 | |||
121 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { | ||
122 | s3c_gpio_cfgpin(EXYNOS4_GPK2(2), S3C_GPIO_SFN(2)); | ||
123 | s3c_gpio_setpull(EXYNOS4_GPK2(2), S3C_GPIO_PULL_UP); | ||
124 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width) | ||
129 | { | ||
130 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
131 | unsigned int gpio; | ||
132 | |||
133 | /* Set all the necessary GPK3[0:1] pins to special-function 2 */ | ||
134 | for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { | ||
135 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
136 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
137 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
138 | } | ||
139 | |||
140 | for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { | ||
141 | /* Data pin GPK3[3:6] to special-function 2 */ | ||
142 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
143 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
144 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
145 | } | ||
146 | |||
147 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { | ||
148 | s3c_gpio_cfgpin(EXYNOS4_GPK3(2), S3C_GPIO_SFN(2)); | ||
149 | s3c_gpio_setpull(EXYNOS4_GPK3(2), S3C_GPIO_PULL_UP); | ||
150 | s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); | ||
151 | } | ||
152 | } | ||
diff --git a/arch/arm/mach-exynos/setup-sdhci.c b/arch/arm/mach-exynos/setup-sdhci.c new file mode 100644 index 000000000000..92937b410906 --- /dev/null +++ b/arch/arm/mach-exynos/setup-sdhci.c | |||
@@ -0,0 +1,22 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/setup-sdhci.c | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Helper functions for settign up SDHCI device(s) (HSMMC) | ||
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/types.h> | ||
14 | |||
15 | /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ | ||
16 | |||
17 | char *exynos4_hsmmc_clksrcs[4] = { | ||
18 | [0] = NULL, | ||
19 | [1] = NULL, | ||
20 | [2] = "sclk_mmc", /* mmc_bus */ | ||
21 | [3] = NULL, | ||
22 | }; | ||
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c new file mode 100644 index 000000000000..39aca045f660 --- /dev/null +++ b/arch/arm/mach-exynos/setup-usb-phy.c | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd | ||
3 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <mach/regs-pmu.h> | ||
18 | #include <mach/regs-usb-phy.h> | ||
19 | #include <plat/cpu.h> | ||
20 | #include <plat/usb-phy.h> | ||
21 | |||
22 | static int exynos4_usb_phy1_init(struct platform_device *pdev) | ||
23 | { | ||
24 | struct clk *otg_clk; | ||
25 | struct clk *xusbxti_clk; | ||
26 | u32 phyclk; | ||
27 | u32 rstcon; | ||
28 | int err; | ||
29 | |||
30 | otg_clk = clk_get(&pdev->dev, "otg"); | ||
31 | if (IS_ERR(otg_clk)) { | ||
32 | dev_err(&pdev->dev, "Failed to get otg clock\n"); | ||
33 | return PTR_ERR(otg_clk); | ||
34 | } | ||
35 | |||
36 | err = clk_enable(otg_clk); | ||
37 | if (err) { | ||
38 | clk_put(otg_clk); | ||
39 | return err; | ||
40 | } | ||
41 | |||
42 | writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE, | ||
43 | S5P_USBHOST_PHY_CONTROL); | ||
44 | |||
45 | /* set clock frequency for PLL */ | ||
46 | phyclk = readl(EXYNOS4_PHYCLK) & ~CLKSEL_MASK; | ||
47 | |||
48 | xusbxti_clk = clk_get(&pdev->dev, "xusbxti"); | ||
49 | if (xusbxti_clk && !IS_ERR(xusbxti_clk)) { | ||
50 | switch (clk_get_rate(xusbxti_clk)) { | ||
51 | case 12 * MHZ: | ||
52 | phyclk |= CLKSEL_12M; | ||
53 | break; | ||
54 | case 24 * MHZ: | ||
55 | phyclk |= CLKSEL_24M; | ||
56 | break; | ||
57 | default: | ||
58 | case 48 * MHZ: | ||
59 | /* default reference clock */ | ||
60 | break; | ||
61 | } | ||
62 | clk_put(xusbxti_clk); | ||
63 | } | ||
64 | |||
65 | writel(phyclk, EXYNOS4_PHYCLK); | ||
66 | |||
67 | /* floating prevention logic: disable */ | ||
68 | writel((readl(EXYNOS4_PHY1CON) | FPENABLEN), EXYNOS4_PHY1CON); | ||
69 | |||
70 | /* set to normal HSIC 0 and 1 of PHY1 */ | ||
71 | writel((readl(EXYNOS4_PHYPWR) & ~PHY1_HSIC_NORMAL_MASK), | ||
72 | EXYNOS4_PHYPWR); | ||
73 | |||
74 | /* set to normal standard USB of PHY1 */ | ||
75 | writel((readl(EXYNOS4_PHYPWR) & ~PHY1_STD_NORMAL_MASK), EXYNOS4_PHYPWR); | ||
76 | |||
77 | /* reset all ports of both PHY and Link */ | ||
78 | rstcon = readl(EXYNOS4_RSTCON) | HOST_LINK_PORT_SWRST_MASK | | ||
79 | PHY1_SWRST_MASK; | ||
80 | writel(rstcon, EXYNOS4_RSTCON); | ||
81 | udelay(10); | ||
82 | |||
83 | rstcon &= ~(HOST_LINK_PORT_SWRST_MASK | PHY1_SWRST_MASK); | ||
84 | writel(rstcon, EXYNOS4_RSTCON); | ||
85 | udelay(80); | ||
86 | |||
87 | clk_disable(otg_clk); | ||
88 | clk_put(otg_clk); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static int exynos4_usb_phy1_exit(struct platform_device *pdev) | ||
94 | { | ||
95 | struct clk *otg_clk; | ||
96 | int err; | ||
97 | |||
98 | otg_clk = clk_get(&pdev->dev, "otg"); | ||
99 | if (IS_ERR(otg_clk)) { | ||
100 | dev_err(&pdev->dev, "Failed to get otg clock\n"); | ||
101 | return PTR_ERR(otg_clk); | ||
102 | } | ||
103 | |||
104 | err = clk_enable(otg_clk); | ||
105 | if (err) { | ||
106 | clk_put(otg_clk); | ||
107 | return err; | ||
108 | } | ||
109 | |||
110 | writel((readl(EXYNOS4_PHYPWR) | PHY1_STD_ANALOG_POWERDOWN), | ||
111 | EXYNOS4_PHYPWR); | ||
112 | |||
113 | writel(readl(S5P_USBHOST_PHY_CONTROL) & ~S5P_USBHOST_PHY_ENABLE, | ||
114 | S5P_USBHOST_PHY_CONTROL); | ||
115 | |||
116 | clk_disable(otg_clk); | ||
117 | clk_put(otg_clk); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | int s5p_usb_phy_init(struct platform_device *pdev, int type) | ||
123 | { | ||
124 | if (type == S5P_USB_PHY_HOST) | ||
125 | return exynos4_usb_phy1_init(pdev); | ||
126 | |||
127 | return -EINVAL; | ||
128 | } | ||
129 | |||
130 | int s5p_usb_phy_exit(struct platform_device *pdev, int type) | ||
131 | { | ||
132 | if (type == S5P_USB_PHY_HOST) | ||
133 | return exynos4_usb_phy1_exit(pdev); | ||
134 | |||
135 | return -EINVAL; | ||
136 | } | ||