diff options
Diffstat (limited to 'arch/arm/mach-exynos4')
69 files changed, 10078 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig new file mode 100644 index 00000000000..0c77ab99fa1 --- /dev/null +++ b/arch/arm/mach-exynos4/Kconfig | |||
@@ -0,0 +1,241 @@ | |||
1 | # arch/arm/mach-exynos4/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_EXYNOS4 | ||
11 | |||
12 | config CPU_EXYNOS4210 | ||
13 | bool | ||
14 | select S3C_PL330_DMA | ||
15 | help | ||
16 | Enable EXYNOS4210 CPU support | ||
17 | |||
18 | config EXYNOS4_MCT | ||
19 | bool | ||
20 | default y | ||
21 | help | ||
22 | Use MCT (Multi Core Timer) as kernel timers | ||
23 | |||
24 | config EXYNOS4_DEV_AHCI | ||
25 | bool | ||
26 | help | ||
27 | Compile in platform device definitions for AHCI | ||
28 | |||
29 | config EXYNOS4_SETUP_FIMD0 | ||
30 | bool | ||
31 | help | ||
32 | Common setup code for FIMD0. | ||
33 | |||
34 | config EXYNOS4_DEV_PD | ||
35 | bool | ||
36 | help | ||
37 | Compile in platform device definitions for Power Domain | ||
38 | |||
39 | config EXYNOS4_DEV_SYSMMU | ||
40 | bool | ||
41 | help | ||
42 | Common setup code for SYSTEM MMU in EXYNOS4 | ||
43 | |||
44 | config EXYNOS4_DEV_DWMCI | ||
45 | bool | ||
46 | help | ||
47 | Compile in platform device definitions for DWMCI | ||
48 | |||
49 | config EXYNOS4_SETUP_I2C1 | ||
50 | bool | ||
51 | help | ||
52 | Common setup code for i2c bus 1. | ||
53 | |||
54 | config EXYNOS4_SETUP_I2C2 | ||
55 | bool | ||
56 | help | ||
57 | Common setup code for i2c bus 2. | ||
58 | |||
59 | config EXYNOS4_SETUP_I2C3 | ||
60 | bool | ||
61 | help | ||
62 | Common setup code for i2c bus 3. | ||
63 | |||
64 | config EXYNOS4_SETUP_I2C4 | ||
65 | bool | ||
66 | help | ||
67 | Common setup code for i2c bus 4. | ||
68 | |||
69 | config EXYNOS4_SETUP_I2C5 | ||
70 | bool | ||
71 | help | ||
72 | Common setup code for i2c bus 5. | ||
73 | |||
74 | config EXYNOS4_SETUP_I2C6 | ||
75 | bool | ||
76 | help | ||
77 | Common setup code for i2c bus 6. | ||
78 | |||
79 | config EXYNOS4_SETUP_I2C7 | ||
80 | bool | ||
81 | help | ||
82 | Common setup code for i2c bus 7. | ||
83 | |||
84 | config EXYNOS4_SETUP_KEYPAD | ||
85 | bool | ||
86 | help | ||
87 | Common setup code for keypad. | ||
88 | |||
89 | config EXYNOS4_SETUP_SDHCI | ||
90 | bool | ||
91 | select EXYNOS4_SETUP_SDHCI_GPIO | ||
92 | help | ||
93 | Internal helper functions for EXYNOS4 based SDHCI systems. | ||
94 | |||
95 | config EXYNOS4_SETUP_SDHCI_GPIO | ||
96 | bool | ||
97 | help | ||
98 | Common setup code for SDHCI gpio. | ||
99 | |||
100 | config EXYNOS4_SETUP_FIMC | ||
101 | bool | ||
102 | help | ||
103 | Common setup code for the camera interfaces. | ||
104 | |||
105 | config EXYNOS4_SETUP_USB_PHY | ||
106 | bool | ||
107 | help | ||
108 | Common setup code for USB PHY controller | ||
109 | |||
110 | # machine support | ||
111 | |||
112 | menu "EXYNOS4 Machines" | ||
113 | |||
114 | config MACH_SMDKC210 | ||
115 | bool "SMDKC210" | ||
116 | select CPU_EXYNOS4210 | ||
117 | select S5P_DEV_FIMD0 | ||
118 | select S3C_DEV_RTC | ||
119 | select S3C_DEV_WDT | ||
120 | select S3C_DEV_I2C1 | ||
121 | select S3C_DEV_HSMMC | ||
122 | select S3C_DEV_HSMMC1 | ||
123 | select S3C_DEV_HSMMC2 | ||
124 | select S3C_DEV_HSMMC3 | ||
125 | select SAMSUNG_DEV_PWM | ||
126 | select SAMSUNG_DEV_BACKLIGHT | ||
127 | select EXYNOS4_DEV_PD | ||
128 | select EXYNOS4_DEV_SYSMMU | ||
129 | select EXYNOS4_SETUP_FIMD0 | ||
130 | select EXYNOS4_SETUP_I2C1 | ||
131 | select EXYNOS4_SETUP_SDHCI | ||
132 | help | ||
133 | Machine support for Samsung SMDKC210 | ||
134 | |||
135 | config MACH_SMDKV310 | ||
136 | bool "SMDKV310" | ||
137 | select CPU_EXYNOS4210 | ||
138 | select S5P_DEV_FIMD0 | ||
139 | select S3C_DEV_RTC | ||
140 | select S3C_DEV_WDT | ||
141 | select S3C_DEV_I2C1 | ||
142 | select S3C_DEV_HSMMC | ||
143 | select S3C_DEV_HSMMC1 | ||
144 | select S3C_DEV_HSMMC2 | ||
145 | select S3C_DEV_HSMMC3 | ||
146 | select SAMSUNG_DEV_BACKLIGHT | ||
147 | select EXYNOS4_DEV_AHCI | ||
148 | select SAMSUNG_DEV_KEYPAD | ||
149 | select EXYNOS4_DEV_PD | ||
150 | select SAMSUNG_DEV_PWM | ||
151 | select EXYNOS4_DEV_SYSMMU | ||
152 | select EXYNOS4_SETUP_FIMD0 | ||
153 | select EXYNOS4_SETUP_I2C1 | ||
154 | select EXYNOS4_SETUP_KEYPAD | ||
155 | select EXYNOS4_SETUP_SDHCI | ||
156 | help | ||
157 | Machine support for Samsung SMDKV310 | ||
158 | |||
159 | config MACH_ARMLEX4210 | ||
160 | bool "ARMLEX4210" | ||
161 | select CPU_EXYNOS4210 | ||
162 | select S3C_DEV_RTC | ||
163 | select S3C_DEV_WDT | ||
164 | select S3C_DEV_HSMMC | ||
165 | select S3C_DEV_HSMMC2 | ||
166 | select S3C_DEV_HSMMC3 | ||
167 | select EXYNOS4_DEV_AHCI | ||
168 | select EXYNOS4_DEV_SYSMMU | ||
169 | select EXYNOS4_SETUP_SDHCI | ||
170 | help | ||
171 | Machine support for Samsung ARMLEX4210 based on EXYNOS4210 | ||
172 | |||
173 | config MACH_UNIVERSAL_C210 | ||
174 | bool "Mobile UNIVERSAL_C210 Board" | ||
175 | select CPU_EXYNOS4210 | ||
176 | select S5P_GPIO_INT | ||
177 | select S5P_DEV_FIMC0 | ||
178 | select S5P_DEV_FIMC1 | ||
179 | select S5P_DEV_FIMC2 | ||
180 | select S5P_DEV_FIMC3 | ||
181 | select S3C_DEV_HSMMC | ||
182 | select S3C_DEV_HSMMC2 | ||
183 | select S3C_DEV_HSMMC3 | ||
184 | select S3C_DEV_I2C1 | ||
185 | select S3C_DEV_I2C3 | ||
186 | select S3C_DEV_I2C5 | ||
187 | select S5P_DEV_MFC | ||
188 | select S5P_DEV_ONENAND | ||
189 | select EXYNOS4_DEV_PD | ||
190 | select EXYNOS4_SETUP_I2C1 | ||
191 | select EXYNOS4_SETUP_I2C3 | ||
192 | select EXYNOS4_SETUP_I2C5 | ||
193 | select EXYNOS4_SETUP_SDHCI | ||
194 | help | ||
195 | Machine support for Samsung Mobile Universal S5PC210 Reference | ||
196 | Board. | ||
197 | |||
198 | config MACH_NURI | ||
199 | bool "Mobile NURI Board" | ||
200 | select CPU_EXYNOS4210 | ||
201 | select S3C_DEV_WDT | ||
202 | select S3C_DEV_HSMMC | ||
203 | select S3C_DEV_HSMMC2 | ||
204 | select S3C_DEV_HSMMC3 | ||
205 | select S3C_DEV_I2C1 | ||
206 | select S3C_DEV_I2C3 | ||
207 | select S3C_DEV_I2C5 | ||
208 | select S5P_DEV_MFC | ||
209 | select S5P_DEV_USB_EHCI | ||
210 | select EXYNOS4_DEV_PD | ||
211 | select EXYNOS4_SETUP_I2C1 | ||
212 | select EXYNOS4_SETUP_I2C3 | ||
213 | select EXYNOS4_SETUP_I2C5 | ||
214 | select EXYNOS4_SETUP_SDHCI | ||
215 | select EXYNOS4_SETUP_USB_PHY | ||
216 | select SAMSUNG_DEV_PWM | ||
217 | select SAMSUNG_DEV_ADC | ||
218 | help | ||
219 | Machine support for Samsung Mobile NURI Board. | ||
220 | |||
221 | endmenu | ||
222 | |||
223 | comment "Configuration for HSMMC bus width" | ||
224 | |||
225 | menu "Use 8-bit bus width" | ||
226 | |||
227 | config EXYNOS4_SDHCI_CH0_8BIT | ||
228 | bool "Channel 0 with 8-bit bus" | ||
229 | help | ||
230 | Support HSMMC Channel 0 8-bit bus. | ||
231 | If selected, Channel 1 is disabled. | ||
232 | |||
233 | config EXYNOS4_SDHCI_CH2_8BIT | ||
234 | bool "Channel 2 with 8-bit bus" | ||
235 | help | ||
236 | Support HSMMC Channel 2 8-bit bus. | ||
237 | If selected, Channel 3 is disabled. | ||
238 | |||
239 | endmenu | ||
240 | |||
241 | endif | ||
diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile new file mode 100644 index 00000000000..b7fe1d7b0b1 --- /dev/null +++ b/arch/arm/mach-exynos4/Makefile | |||
@@ -0,0 +1,55 @@ | |||
1 | # arch/arm/mach-exynos4/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_CPU_EXYNOS4210) += cpu.o init.o clock.o irq-combiner.o | ||
16 | obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o pmu.o | ||
17 | obj-$(CONFIG_PM) += pm.o sleep.o | ||
18 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
19 | |||
20 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | ||
21 | |||
22 | obj-$(CONFIG_EXYNOS4_MCT) += mct.o | ||
23 | |||
24 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | ||
25 | |||
26 | # machine support | ||
27 | |||
28 | obj-$(CONFIG_MACH_SMDKC210) += mach-smdkc210.o | ||
29 | obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o | ||
30 | obj-$(CONFIG_MACH_ARMLEX4210) += mach-armlex4210.o | ||
31 | obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o | ||
32 | obj-$(CONFIG_MACH_NURI) += mach-nuri.o | ||
33 | |||
34 | # device support | ||
35 | |||
36 | obj-y += dev-audio.o | ||
37 | obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o | ||
38 | obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o | ||
39 | obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o | ||
40 | obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o | ||
41 | |||
42 | obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o | ||
43 | obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o | ||
44 | obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o | ||
45 | obj-$(CONFIG_EXYNOS4_SETUP_I2C2) += setup-i2c2.o | ||
46 | obj-$(CONFIG_EXYNOS4_SETUP_I2C3) += setup-i2c3.o | ||
47 | obj-$(CONFIG_EXYNOS4_SETUP_I2C4) += setup-i2c4.o | ||
48 | obj-$(CONFIG_EXYNOS4_SETUP_I2C5) += setup-i2c5.o | ||
49 | obj-$(CONFIG_EXYNOS4_SETUP_I2C6) += setup-i2c6.o | ||
50 | obj-$(CONFIG_EXYNOS4_SETUP_I2C7) += setup-i2c7.o | ||
51 | obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o | ||
52 | obj-$(CONFIG_EXYNOS4_SETUP_SDHCI) += setup-sdhci.o | ||
53 | obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | ||
54 | |||
55 | obj-$(CONFIG_EXYNOS4_SETUP_USB_PHY) += setup-usb-phy.o | ||
diff --git a/arch/arm/mach-exynos4/Makefile.boot b/arch/arm/mach-exynos4/Makefile.boot new file mode 100644 index 00000000000..d65956ffb43 --- /dev/null +++ b/arch/arm/mach-exynos4/Makefile.boot | |||
@@ -0,0 +1,2 @@ | |||
1 | zreladdr-y := 0x40008000 | ||
2 | params_phys-y := 0x40000100 | ||
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c new file mode 100644 index 00000000000..86964d2e9e1 --- /dev/null +++ b/arch/arm/mach-exynos4/clock.c | |||
@@ -0,0 +1,1212 @@ | |||
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 | |||
17 | #include <plat/cpu-freq.h> | ||
18 | #include <plat/clock.h> | ||
19 | #include <plat/cpu.h> | ||
20 | #include <plat/pll.h> | ||
21 | #include <plat/s5p-clock.h> | ||
22 | #include <plat/clock-clksrc.h> | ||
23 | |||
24 | #include <mach/map.h> | ||
25 | #include <mach/regs-clock.h> | ||
26 | #include <mach/sysmmu.h> | ||
27 | |||
28 | static struct clk clk_sclk_hdmi27m = { | ||
29 | .name = "sclk_hdmi27m", | ||
30 | .rate = 27000000, | ||
31 | }; | ||
32 | |||
33 | static struct clk clk_sclk_hdmiphy = { | ||
34 | .name = "sclk_hdmiphy", | ||
35 | }; | ||
36 | |||
37 | static struct clk clk_sclk_usbphy0 = { | ||
38 | .name = "sclk_usbphy0", | ||
39 | .rate = 27000000, | ||
40 | }; | ||
41 | |||
42 | static struct clk clk_sclk_usbphy1 = { | ||
43 | .name = "sclk_usbphy1", | ||
44 | }; | ||
45 | |||
46 | static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable) | ||
47 | { | ||
48 | return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable); | ||
49 | } | ||
50 | |||
51 | static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable) | ||
52 | { | ||
53 | return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable); | ||
54 | } | ||
55 | |||
56 | static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable) | ||
57 | { | ||
58 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable); | ||
59 | } | ||
60 | |||
61 | static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) | ||
62 | { | ||
63 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); | ||
64 | } | ||
65 | |||
66 | static int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) | ||
67 | { | ||
68 | return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable); | ||
69 | } | ||
70 | |||
71 | static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) | ||
72 | { | ||
73 | return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable); | ||
74 | } | ||
75 | |||
76 | static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable) | ||
77 | { | ||
78 | return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable); | ||
79 | } | ||
80 | |||
81 | static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable) | ||
82 | { | ||
83 | return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable); | ||
84 | } | ||
85 | |||
86 | static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable) | ||
87 | { | ||
88 | return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable); | ||
89 | } | ||
90 | |||
91 | static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable) | ||
92 | { | ||
93 | return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable); | ||
94 | } | ||
95 | |||
96 | static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable) | ||
97 | { | ||
98 | return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable); | ||
99 | } | ||
100 | |||
101 | static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable) | ||
102 | { | ||
103 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable); | ||
104 | } | ||
105 | |||
106 | static int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) | ||
107 | { | ||
108 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable); | ||
109 | } | ||
110 | |||
111 | static int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) | ||
112 | { | ||
113 | return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable); | ||
114 | } | ||
115 | |||
116 | static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable) | ||
117 | { | ||
118 | return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable); | ||
119 | } | ||
120 | |||
121 | static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable) | ||
122 | { | ||
123 | return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable); | ||
124 | } | ||
125 | |||
126 | /* Core list of CMU_CPU side */ | ||
127 | |||
128 | static struct clksrc_clk clk_mout_apll = { | ||
129 | .clk = { | ||
130 | .name = "mout_apll", | ||
131 | }, | ||
132 | .sources = &clk_src_apll, | ||
133 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, | ||
134 | }; | ||
135 | |||
136 | static struct clksrc_clk clk_sclk_apll = { | ||
137 | .clk = { | ||
138 | .name = "sclk_apll", | ||
139 | .parent = &clk_mout_apll.clk, | ||
140 | }, | ||
141 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, | ||
142 | }; | ||
143 | |||
144 | static struct clksrc_clk clk_mout_epll = { | ||
145 | .clk = { | ||
146 | .name = "mout_epll", | ||
147 | }, | ||
148 | .sources = &clk_src_epll, | ||
149 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, | ||
150 | }; | ||
151 | |||
152 | static struct clksrc_clk clk_mout_mpll = { | ||
153 | .clk = { | ||
154 | .name = "mout_mpll", | ||
155 | }, | ||
156 | .sources = &clk_src_mpll, | ||
157 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 }, | ||
158 | }; | ||
159 | |||
160 | static struct clk *clkset_moutcore_list[] = { | ||
161 | [0] = &clk_mout_apll.clk, | ||
162 | [1] = &clk_mout_mpll.clk, | ||
163 | }; | ||
164 | |||
165 | static struct clksrc_sources clkset_moutcore = { | ||
166 | .sources = clkset_moutcore_list, | ||
167 | .nr_sources = ARRAY_SIZE(clkset_moutcore_list), | ||
168 | }; | ||
169 | |||
170 | static struct clksrc_clk clk_moutcore = { | ||
171 | .clk = { | ||
172 | .name = "moutcore", | ||
173 | }, | ||
174 | .sources = &clkset_moutcore, | ||
175 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 }, | ||
176 | }; | ||
177 | |||
178 | static struct clksrc_clk clk_coreclk = { | ||
179 | .clk = { | ||
180 | .name = "core_clk", | ||
181 | .parent = &clk_moutcore.clk, | ||
182 | }, | ||
183 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 }, | ||
184 | }; | ||
185 | |||
186 | static struct clksrc_clk clk_armclk = { | ||
187 | .clk = { | ||
188 | .name = "armclk", | ||
189 | .parent = &clk_coreclk.clk, | ||
190 | }, | ||
191 | }; | ||
192 | |||
193 | static struct clksrc_clk clk_aclk_corem0 = { | ||
194 | .clk = { | ||
195 | .name = "aclk_corem0", | ||
196 | .parent = &clk_coreclk.clk, | ||
197 | }, | ||
198 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
199 | }; | ||
200 | |||
201 | static struct clksrc_clk clk_aclk_cores = { | ||
202 | .clk = { | ||
203 | .name = "aclk_cores", | ||
204 | .parent = &clk_coreclk.clk, | ||
205 | }, | ||
206 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
207 | }; | ||
208 | |||
209 | static struct clksrc_clk clk_aclk_corem1 = { | ||
210 | .clk = { | ||
211 | .name = "aclk_corem1", | ||
212 | .parent = &clk_coreclk.clk, | ||
213 | }, | ||
214 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 }, | ||
215 | }; | ||
216 | |||
217 | static struct clksrc_clk clk_periphclk = { | ||
218 | .clk = { | ||
219 | .name = "periphclk", | ||
220 | .parent = &clk_coreclk.clk, | ||
221 | }, | ||
222 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 }, | ||
223 | }; | ||
224 | |||
225 | /* Core list of CMU_CORE side */ | ||
226 | |||
227 | static struct clk *clkset_corebus_list[] = { | ||
228 | [0] = &clk_mout_mpll.clk, | ||
229 | [1] = &clk_sclk_apll.clk, | ||
230 | }; | ||
231 | |||
232 | static struct clksrc_sources clkset_mout_corebus = { | ||
233 | .sources = clkset_corebus_list, | ||
234 | .nr_sources = ARRAY_SIZE(clkset_corebus_list), | ||
235 | }; | ||
236 | |||
237 | static struct clksrc_clk clk_mout_corebus = { | ||
238 | .clk = { | ||
239 | .name = "mout_corebus", | ||
240 | }, | ||
241 | .sources = &clkset_mout_corebus, | ||
242 | .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 }, | ||
243 | }; | ||
244 | |||
245 | static struct clksrc_clk clk_sclk_dmc = { | ||
246 | .clk = { | ||
247 | .name = "sclk_dmc", | ||
248 | .parent = &clk_mout_corebus.clk, | ||
249 | }, | ||
250 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 }, | ||
251 | }; | ||
252 | |||
253 | static struct clksrc_clk clk_aclk_cored = { | ||
254 | .clk = { | ||
255 | .name = "aclk_cored", | ||
256 | .parent = &clk_sclk_dmc.clk, | ||
257 | }, | ||
258 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 }, | ||
259 | }; | ||
260 | |||
261 | static struct clksrc_clk clk_aclk_corep = { | ||
262 | .clk = { | ||
263 | .name = "aclk_corep", | ||
264 | .parent = &clk_aclk_cored.clk, | ||
265 | }, | ||
266 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 }, | ||
267 | }; | ||
268 | |||
269 | static struct clksrc_clk clk_aclk_acp = { | ||
270 | .clk = { | ||
271 | .name = "aclk_acp", | ||
272 | .parent = &clk_mout_corebus.clk, | ||
273 | }, | ||
274 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 }, | ||
275 | }; | ||
276 | |||
277 | static struct clksrc_clk clk_pclk_acp = { | ||
278 | .clk = { | ||
279 | .name = "pclk_acp", | ||
280 | .parent = &clk_aclk_acp.clk, | ||
281 | }, | ||
282 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 }, | ||
283 | }; | ||
284 | |||
285 | /* Core list of CMU_TOP side */ | ||
286 | |||
287 | static struct clk *clkset_aclk_top_list[] = { | ||
288 | [0] = &clk_mout_mpll.clk, | ||
289 | [1] = &clk_sclk_apll.clk, | ||
290 | }; | ||
291 | |||
292 | static struct clksrc_sources clkset_aclk = { | ||
293 | .sources = clkset_aclk_top_list, | ||
294 | .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), | ||
295 | }; | ||
296 | |||
297 | static struct clksrc_clk clk_aclk_200 = { | ||
298 | .clk = { | ||
299 | .name = "aclk_200", | ||
300 | }, | ||
301 | .sources = &clkset_aclk, | ||
302 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 }, | ||
303 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 }, | ||
304 | }; | ||
305 | |||
306 | static struct clksrc_clk clk_aclk_100 = { | ||
307 | .clk = { | ||
308 | .name = "aclk_100", | ||
309 | }, | ||
310 | .sources = &clkset_aclk, | ||
311 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 }, | ||
312 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 }, | ||
313 | }; | ||
314 | |||
315 | static struct clksrc_clk clk_aclk_160 = { | ||
316 | .clk = { | ||
317 | .name = "aclk_160", | ||
318 | }, | ||
319 | .sources = &clkset_aclk, | ||
320 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 }, | ||
321 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, | ||
322 | }; | ||
323 | |||
324 | static struct clksrc_clk clk_aclk_133 = { | ||
325 | .clk = { | ||
326 | .name = "aclk_133", | ||
327 | }, | ||
328 | .sources = &clkset_aclk, | ||
329 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 }, | ||
330 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 }, | ||
331 | }; | ||
332 | |||
333 | static struct clk *clkset_vpllsrc_list[] = { | ||
334 | [0] = &clk_fin_vpll, | ||
335 | [1] = &clk_sclk_hdmi27m, | ||
336 | }; | ||
337 | |||
338 | static struct clksrc_sources clkset_vpllsrc = { | ||
339 | .sources = clkset_vpllsrc_list, | ||
340 | .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list), | ||
341 | }; | ||
342 | |||
343 | static struct clksrc_clk clk_vpllsrc = { | ||
344 | .clk = { | ||
345 | .name = "vpll_src", | ||
346 | .enable = exynos4_clksrc_mask_top_ctrl, | ||
347 | .ctrlbit = (1 << 0), | ||
348 | }, | ||
349 | .sources = &clkset_vpllsrc, | ||
350 | .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 }, | ||
351 | }; | ||
352 | |||
353 | static struct clk *clkset_sclk_vpll_list[] = { | ||
354 | [0] = &clk_vpllsrc.clk, | ||
355 | [1] = &clk_fout_vpll, | ||
356 | }; | ||
357 | |||
358 | static struct clksrc_sources clkset_sclk_vpll = { | ||
359 | .sources = clkset_sclk_vpll_list, | ||
360 | .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), | ||
361 | }; | ||
362 | |||
363 | static struct clksrc_clk clk_sclk_vpll = { | ||
364 | .clk = { | ||
365 | .name = "sclk_vpll", | ||
366 | }, | ||
367 | .sources = &clkset_sclk_vpll, | ||
368 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, | ||
369 | }; | ||
370 | |||
371 | static struct clk init_clocks_off[] = { | ||
372 | { | ||
373 | .name = "timers", | ||
374 | .parent = &clk_aclk_100.clk, | ||
375 | .enable = exynos4_clk_ip_peril_ctrl, | ||
376 | .ctrlbit = (1<<24), | ||
377 | }, { | ||
378 | .name = "csis", | ||
379 | .devname = "s5p-mipi-csis.0", | ||
380 | .enable = exynos4_clk_ip_cam_ctrl, | ||
381 | .ctrlbit = (1 << 4), | ||
382 | }, { | ||
383 | .name = "csis", | ||
384 | .devname = "s5p-mipi-csis.1", | ||
385 | .enable = exynos4_clk_ip_cam_ctrl, | ||
386 | .ctrlbit = (1 << 5), | ||
387 | }, { | ||
388 | .name = "fimc", | ||
389 | .devname = "exynos4-fimc.0", | ||
390 | .enable = exynos4_clk_ip_cam_ctrl, | ||
391 | .ctrlbit = (1 << 0), | ||
392 | }, { | ||
393 | .name = "fimc", | ||
394 | .devname = "exynos4-fimc.1", | ||
395 | .enable = exynos4_clk_ip_cam_ctrl, | ||
396 | .ctrlbit = (1 << 1), | ||
397 | }, { | ||
398 | .name = "fimc", | ||
399 | .devname = "exynos4-fimc.2", | ||
400 | .enable = exynos4_clk_ip_cam_ctrl, | ||
401 | .ctrlbit = (1 << 2), | ||
402 | }, { | ||
403 | .name = "fimc", | ||
404 | .devname = "exynos4-fimc.3", | ||
405 | .enable = exynos4_clk_ip_cam_ctrl, | ||
406 | .ctrlbit = (1 << 3), | ||
407 | }, { | ||
408 | .name = "fimd", | ||
409 | .devname = "exynos4-fb.0", | ||
410 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
411 | .ctrlbit = (1 << 0), | ||
412 | }, { | ||
413 | .name = "fimd", | ||
414 | .devname = "exynos4-fb.1", | ||
415 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
416 | .ctrlbit = (1 << 0), | ||
417 | }, { | ||
418 | .name = "sataphy", | ||
419 | .parent = &clk_aclk_133.clk, | ||
420 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
421 | .ctrlbit = (1 << 3), | ||
422 | }, { | ||
423 | .name = "hsmmc", | ||
424 | .devname = "s3c-sdhci.0", | ||
425 | .parent = &clk_aclk_133.clk, | ||
426 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
427 | .ctrlbit = (1 << 5), | ||
428 | }, { | ||
429 | .name = "hsmmc", | ||
430 | .devname = "s3c-sdhci.1", | ||
431 | .parent = &clk_aclk_133.clk, | ||
432 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
433 | .ctrlbit = (1 << 6), | ||
434 | }, { | ||
435 | .name = "hsmmc", | ||
436 | .devname = "s3c-sdhci.2", | ||
437 | .parent = &clk_aclk_133.clk, | ||
438 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
439 | .ctrlbit = (1 << 7), | ||
440 | }, { | ||
441 | .name = "hsmmc", | ||
442 | .devname = "s3c-sdhci.3", | ||
443 | .parent = &clk_aclk_133.clk, | ||
444 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
445 | .ctrlbit = (1 << 8), | ||
446 | }, { | ||
447 | .name = "dwmmc", | ||
448 | .parent = &clk_aclk_133.clk, | ||
449 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
450 | .ctrlbit = (1 << 9), | ||
451 | }, { | ||
452 | .name = "sata", | ||
453 | .parent = &clk_aclk_133.clk, | ||
454 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
455 | .ctrlbit = (1 << 10), | ||
456 | }, { | ||
457 | .name = "pdma", | ||
458 | .devname = "s3c-pl330.0", | ||
459 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
460 | .ctrlbit = (1 << 0), | ||
461 | }, { | ||
462 | .name = "pdma", | ||
463 | .devname = "s3c-pl330.1", | ||
464 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
465 | .ctrlbit = (1 << 1), | ||
466 | }, { | ||
467 | .name = "adc", | ||
468 | .enable = exynos4_clk_ip_peril_ctrl, | ||
469 | .ctrlbit = (1 << 15), | ||
470 | }, { | ||
471 | .name = "keypad", | ||
472 | .enable = exynos4_clk_ip_perir_ctrl, | ||
473 | .ctrlbit = (1 << 16), | ||
474 | }, { | ||
475 | .name = "rtc", | ||
476 | .enable = exynos4_clk_ip_perir_ctrl, | ||
477 | .ctrlbit = (1 << 15), | ||
478 | }, { | ||
479 | .name = "watchdog", | ||
480 | .parent = &clk_aclk_100.clk, | ||
481 | .enable = exynos4_clk_ip_perir_ctrl, | ||
482 | .ctrlbit = (1 << 14), | ||
483 | }, { | ||
484 | .name = "usbhost", | ||
485 | .enable = exynos4_clk_ip_fsys_ctrl , | ||
486 | .ctrlbit = (1 << 12), | ||
487 | }, { | ||
488 | .name = "otg", | ||
489 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
490 | .ctrlbit = (1 << 13), | ||
491 | }, { | ||
492 | .name = "spi", | ||
493 | .devname = "s3c64xx-spi.0", | ||
494 | .enable = exynos4_clk_ip_peril_ctrl, | ||
495 | .ctrlbit = (1 << 16), | ||
496 | }, { | ||
497 | .name = "spi", | ||
498 | .devname = "s3c64xx-spi.1", | ||
499 | .enable = exynos4_clk_ip_peril_ctrl, | ||
500 | .ctrlbit = (1 << 17), | ||
501 | }, { | ||
502 | .name = "spi", | ||
503 | .devname = "s3c64xx-spi.2", | ||
504 | .enable = exynos4_clk_ip_peril_ctrl, | ||
505 | .ctrlbit = (1 << 18), | ||
506 | }, { | ||
507 | .name = "iis", | ||
508 | .devname = "samsung-i2s.0", | ||
509 | .enable = exynos4_clk_ip_peril_ctrl, | ||
510 | .ctrlbit = (1 << 19), | ||
511 | }, { | ||
512 | .name = "iis", | ||
513 | .devname = "samsung-i2s.1", | ||
514 | .enable = exynos4_clk_ip_peril_ctrl, | ||
515 | .ctrlbit = (1 << 20), | ||
516 | }, { | ||
517 | .name = "iis", | ||
518 | .devname = "samsung-i2s.2", | ||
519 | .enable = exynos4_clk_ip_peril_ctrl, | ||
520 | .ctrlbit = (1 << 21), | ||
521 | }, { | ||
522 | .name = "ac97", | ||
523 | .devname = "samsung-ac97", | ||
524 | .enable = exynos4_clk_ip_peril_ctrl, | ||
525 | .ctrlbit = (1 << 27), | ||
526 | }, { | ||
527 | .name = "fimg2d", | ||
528 | .enable = exynos4_clk_ip_image_ctrl, | ||
529 | .ctrlbit = (1 << 0), | ||
530 | }, { | ||
531 | .name = "mfc", | ||
532 | .devname = "s5p-mfc", | ||
533 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
534 | .ctrlbit = (1 << 0), | ||
535 | }, { | ||
536 | .name = "i2c", | ||
537 | .devname = "s3c2440-i2c.0", | ||
538 | .parent = &clk_aclk_100.clk, | ||
539 | .enable = exynos4_clk_ip_peril_ctrl, | ||
540 | .ctrlbit = (1 << 6), | ||
541 | }, { | ||
542 | .name = "i2c", | ||
543 | .devname = "s3c2440-i2c.1", | ||
544 | .parent = &clk_aclk_100.clk, | ||
545 | .enable = exynos4_clk_ip_peril_ctrl, | ||
546 | .ctrlbit = (1 << 7), | ||
547 | }, { | ||
548 | .name = "i2c", | ||
549 | .devname = "s3c2440-i2c.2", | ||
550 | .parent = &clk_aclk_100.clk, | ||
551 | .enable = exynos4_clk_ip_peril_ctrl, | ||
552 | .ctrlbit = (1 << 8), | ||
553 | }, { | ||
554 | .name = "i2c", | ||
555 | .devname = "s3c2440-i2c.3", | ||
556 | .parent = &clk_aclk_100.clk, | ||
557 | .enable = exynos4_clk_ip_peril_ctrl, | ||
558 | .ctrlbit = (1 << 9), | ||
559 | }, { | ||
560 | .name = "i2c", | ||
561 | .devname = "s3c2440-i2c.4", | ||
562 | .parent = &clk_aclk_100.clk, | ||
563 | .enable = exynos4_clk_ip_peril_ctrl, | ||
564 | .ctrlbit = (1 << 10), | ||
565 | }, { | ||
566 | .name = "i2c", | ||
567 | .devname = "s3c2440-i2c.5", | ||
568 | .parent = &clk_aclk_100.clk, | ||
569 | .enable = exynos4_clk_ip_peril_ctrl, | ||
570 | .ctrlbit = (1 << 11), | ||
571 | }, { | ||
572 | .name = "i2c", | ||
573 | .devname = "s3c2440-i2c.6", | ||
574 | .parent = &clk_aclk_100.clk, | ||
575 | .enable = exynos4_clk_ip_peril_ctrl, | ||
576 | .ctrlbit = (1 << 12), | ||
577 | }, { | ||
578 | .name = "i2c", | ||
579 | .devname = "s3c2440-i2c.7", | ||
580 | .parent = &clk_aclk_100.clk, | ||
581 | .enable = exynos4_clk_ip_peril_ctrl, | ||
582 | .ctrlbit = (1 << 13), | ||
583 | }, { | ||
584 | .name = "SYSMMU_MDMA", | ||
585 | .enable = exynos4_clk_ip_image_ctrl, | ||
586 | .ctrlbit = (1 << 5), | ||
587 | }, { | ||
588 | .name = "SYSMMU_FIMC0", | ||
589 | .enable = exynos4_clk_ip_cam_ctrl, | ||
590 | .ctrlbit = (1 << 7), | ||
591 | }, { | ||
592 | .name = "SYSMMU_FIMC1", | ||
593 | .enable = exynos4_clk_ip_cam_ctrl, | ||
594 | .ctrlbit = (1 << 8), | ||
595 | }, { | ||
596 | .name = "SYSMMU_FIMC2", | ||
597 | .enable = exynos4_clk_ip_cam_ctrl, | ||
598 | .ctrlbit = (1 << 9), | ||
599 | }, { | ||
600 | .name = "SYSMMU_FIMC3", | ||
601 | .enable = exynos4_clk_ip_cam_ctrl, | ||
602 | .ctrlbit = (1 << 10), | ||
603 | }, { | ||
604 | .name = "SYSMMU_JPEG", | ||
605 | .enable = exynos4_clk_ip_cam_ctrl, | ||
606 | .ctrlbit = (1 << 11), | ||
607 | }, { | ||
608 | .name = "SYSMMU_FIMD0", | ||
609 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
610 | .ctrlbit = (1 << 4), | ||
611 | }, { | ||
612 | .name = "SYSMMU_FIMD1", | ||
613 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
614 | .ctrlbit = (1 << 4), | ||
615 | }, { | ||
616 | .name = "SYSMMU_PCIe", | ||
617 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
618 | .ctrlbit = (1 << 18), | ||
619 | }, { | ||
620 | .name = "SYSMMU_G2D", | ||
621 | .enable = exynos4_clk_ip_image_ctrl, | ||
622 | .ctrlbit = (1 << 3), | ||
623 | }, { | ||
624 | .name = "SYSMMU_ROTATOR", | ||
625 | .enable = exynos4_clk_ip_image_ctrl, | ||
626 | .ctrlbit = (1 << 4), | ||
627 | }, { | ||
628 | .name = "SYSMMU_TV", | ||
629 | .enable = exynos4_clk_ip_tv_ctrl, | ||
630 | .ctrlbit = (1 << 4), | ||
631 | }, { | ||
632 | .name = "SYSMMU_MFC_L", | ||
633 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
634 | .ctrlbit = (1 << 1), | ||
635 | }, { | ||
636 | .name = "SYSMMU_MFC_R", | ||
637 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
638 | .ctrlbit = (1 << 2), | ||
639 | } | ||
640 | }; | ||
641 | |||
642 | static struct clk init_clocks[] = { | ||
643 | { | ||
644 | .name = "uart", | ||
645 | .devname = "s5pv210-uart.0", | ||
646 | .enable = exynos4_clk_ip_peril_ctrl, | ||
647 | .ctrlbit = (1 << 0), | ||
648 | }, { | ||
649 | .name = "uart", | ||
650 | .devname = "s5pv210-uart.1", | ||
651 | .enable = exynos4_clk_ip_peril_ctrl, | ||
652 | .ctrlbit = (1 << 1), | ||
653 | }, { | ||
654 | .name = "uart", | ||
655 | .devname = "s5pv210-uart.2", | ||
656 | .enable = exynos4_clk_ip_peril_ctrl, | ||
657 | .ctrlbit = (1 << 2), | ||
658 | }, { | ||
659 | .name = "uart", | ||
660 | .devname = "s5pv210-uart.3", | ||
661 | .enable = exynos4_clk_ip_peril_ctrl, | ||
662 | .ctrlbit = (1 << 3), | ||
663 | }, { | ||
664 | .name = "uart", | ||
665 | .devname = "s5pv210-uart.4", | ||
666 | .enable = exynos4_clk_ip_peril_ctrl, | ||
667 | .ctrlbit = (1 << 4), | ||
668 | }, { | ||
669 | .name = "uart", | ||
670 | .devname = "s5pv210-uart.5", | ||
671 | .enable = exynos4_clk_ip_peril_ctrl, | ||
672 | .ctrlbit = (1 << 5), | ||
673 | } | ||
674 | }; | ||
675 | |||
676 | static struct clk *clkset_group_list[] = { | ||
677 | [0] = &clk_ext_xtal_mux, | ||
678 | [1] = &clk_xusbxti, | ||
679 | [2] = &clk_sclk_hdmi27m, | ||
680 | [3] = &clk_sclk_usbphy0, | ||
681 | [4] = &clk_sclk_usbphy1, | ||
682 | [5] = &clk_sclk_hdmiphy, | ||
683 | [6] = &clk_mout_mpll.clk, | ||
684 | [7] = &clk_mout_epll.clk, | ||
685 | [8] = &clk_sclk_vpll.clk, | ||
686 | }; | ||
687 | |||
688 | static struct clksrc_sources clkset_group = { | ||
689 | .sources = clkset_group_list, | ||
690 | .nr_sources = ARRAY_SIZE(clkset_group_list), | ||
691 | }; | ||
692 | |||
693 | static struct clk *clkset_mout_g2d0_list[] = { | ||
694 | [0] = &clk_mout_mpll.clk, | ||
695 | [1] = &clk_sclk_apll.clk, | ||
696 | }; | ||
697 | |||
698 | static struct clksrc_sources clkset_mout_g2d0 = { | ||
699 | .sources = clkset_mout_g2d0_list, | ||
700 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list), | ||
701 | }; | ||
702 | |||
703 | static struct clksrc_clk clk_mout_g2d0 = { | ||
704 | .clk = { | ||
705 | .name = "mout_g2d0", | ||
706 | }, | ||
707 | .sources = &clkset_mout_g2d0, | ||
708 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 }, | ||
709 | }; | ||
710 | |||
711 | static struct clk *clkset_mout_g2d1_list[] = { | ||
712 | [0] = &clk_mout_epll.clk, | ||
713 | [1] = &clk_sclk_vpll.clk, | ||
714 | }; | ||
715 | |||
716 | static struct clksrc_sources clkset_mout_g2d1 = { | ||
717 | .sources = clkset_mout_g2d1_list, | ||
718 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list), | ||
719 | }; | ||
720 | |||
721 | static struct clksrc_clk clk_mout_g2d1 = { | ||
722 | .clk = { | ||
723 | .name = "mout_g2d1", | ||
724 | }, | ||
725 | .sources = &clkset_mout_g2d1, | ||
726 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 }, | ||
727 | }; | ||
728 | |||
729 | static struct clk *clkset_mout_g2d_list[] = { | ||
730 | [0] = &clk_mout_g2d0.clk, | ||
731 | [1] = &clk_mout_g2d1.clk, | ||
732 | }; | ||
733 | |||
734 | static struct clksrc_sources clkset_mout_g2d = { | ||
735 | .sources = clkset_mout_g2d_list, | ||
736 | .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list), | ||
737 | }; | ||
738 | |||
739 | static struct clk *clkset_mout_mfc0_list[] = { | ||
740 | [0] = &clk_mout_mpll.clk, | ||
741 | [1] = &clk_sclk_apll.clk, | ||
742 | }; | ||
743 | |||
744 | static struct clksrc_sources clkset_mout_mfc0 = { | ||
745 | .sources = clkset_mout_mfc0_list, | ||
746 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list), | ||
747 | }; | ||
748 | |||
749 | static struct clksrc_clk clk_mout_mfc0 = { | ||
750 | .clk = { | ||
751 | .name = "mout_mfc0", | ||
752 | }, | ||
753 | .sources = &clkset_mout_mfc0, | ||
754 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 }, | ||
755 | }; | ||
756 | |||
757 | static struct clk *clkset_mout_mfc1_list[] = { | ||
758 | [0] = &clk_mout_epll.clk, | ||
759 | [1] = &clk_sclk_vpll.clk, | ||
760 | }; | ||
761 | |||
762 | static struct clksrc_sources clkset_mout_mfc1 = { | ||
763 | .sources = clkset_mout_mfc1_list, | ||
764 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list), | ||
765 | }; | ||
766 | |||
767 | static struct clksrc_clk clk_mout_mfc1 = { | ||
768 | .clk = { | ||
769 | .name = "mout_mfc1", | ||
770 | }, | ||
771 | .sources = &clkset_mout_mfc1, | ||
772 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 }, | ||
773 | }; | ||
774 | |||
775 | static struct clk *clkset_mout_mfc_list[] = { | ||
776 | [0] = &clk_mout_mfc0.clk, | ||
777 | [1] = &clk_mout_mfc1.clk, | ||
778 | }; | ||
779 | |||
780 | static struct clksrc_sources clkset_mout_mfc = { | ||
781 | .sources = clkset_mout_mfc_list, | ||
782 | .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list), | ||
783 | }; | ||
784 | |||
785 | static struct clksrc_clk clk_dout_mmc0 = { | ||
786 | .clk = { | ||
787 | .name = "dout_mmc0", | ||
788 | }, | ||
789 | .sources = &clkset_group, | ||
790 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 }, | ||
791 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 }, | ||
792 | }; | ||
793 | |||
794 | static struct clksrc_clk clk_dout_mmc1 = { | ||
795 | .clk = { | ||
796 | .name = "dout_mmc1", | ||
797 | }, | ||
798 | .sources = &clkset_group, | ||
799 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 }, | ||
800 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 }, | ||
801 | }; | ||
802 | |||
803 | static struct clksrc_clk clk_dout_mmc2 = { | ||
804 | .clk = { | ||
805 | .name = "dout_mmc2", | ||
806 | }, | ||
807 | .sources = &clkset_group, | ||
808 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 }, | ||
809 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 }, | ||
810 | }; | ||
811 | |||
812 | static struct clksrc_clk clk_dout_mmc3 = { | ||
813 | .clk = { | ||
814 | .name = "dout_mmc3", | ||
815 | }, | ||
816 | .sources = &clkset_group, | ||
817 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 }, | ||
818 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 }, | ||
819 | }; | ||
820 | |||
821 | static struct clksrc_clk clk_dout_mmc4 = { | ||
822 | .clk = { | ||
823 | .name = "dout_mmc4", | ||
824 | }, | ||
825 | .sources = &clkset_group, | ||
826 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 }, | ||
827 | .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 }, | ||
828 | }; | ||
829 | |||
830 | static struct clksrc_clk clksrcs[] = { | ||
831 | { | ||
832 | .clk = { | ||
833 | .name = "uclk1", | ||
834 | .devname = "s5pv210-uart.0", | ||
835 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
836 | .ctrlbit = (1 << 0), | ||
837 | }, | ||
838 | .sources = &clkset_group, | ||
839 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 }, | ||
840 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 }, | ||
841 | }, { | ||
842 | .clk = { | ||
843 | .name = "uclk1", | ||
844 | .devname = "s5pv210-uart.1", | ||
845 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
846 | .ctrlbit = (1 << 4), | ||
847 | }, | ||
848 | .sources = &clkset_group, | ||
849 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 }, | ||
850 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 }, | ||
851 | }, { | ||
852 | .clk = { | ||
853 | .name = "uclk1", | ||
854 | .devname = "s5pv210-uart.2", | ||
855 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
856 | .ctrlbit = (1 << 8), | ||
857 | }, | ||
858 | .sources = &clkset_group, | ||
859 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 }, | ||
860 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 }, | ||
861 | }, { | ||
862 | .clk = { | ||
863 | .name = "uclk1", | ||
864 | .devname = "s5pv210-uart.3", | ||
865 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
866 | .ctrlbit = (1 << 12), | ||
867 | }, | ||
868 | .sources = &clkset_group, | ||
869 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 }, | ||
870 | .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 }, | ||
871 | }, { | ||
872 | .clk = { | ||
873 | .name = "sclk_pwm", | ||
874 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
875 | .ctrlbit = (1 << 24), | ||
876 | }, | ||
877 | .sources = &clkset_group, | ||
878 | .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 }, | ||
879 | .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 }, | ||
880 | }, { | ||
881 | .clk = { | ||
882 | .name = "sclk_csis", | ||
883 | .devname = "s5p-mipi-csis.0", | ||
884 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
885 | .ctrlbit = (1 << 24), | ||
886 | }, | ||
887 | .sources = &clkset_group, | ||
888 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 }, | ||
889 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 }, | ||
890 | }, { | ||
891 | .clk = { | ||
892 | .name = "sclk_csis", | ||
893 | .devname = "s5p-mipi-csis.1", | ||
894 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
895 | .ctrlbit = (1 << 28), | ||
896 | }, | ||
897 | .sources = &clkset_group, | ||
898 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 }, | ||
899 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 }, | ||
900 | }, { | ||
901 | .clk = { | ||
902 | .name = "sclk_cam0", | ||
903 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
904 | .ctrlbit = (1 << 16), | ||
905 | }, | ||
906 | .sources = &clkset_group, | ||
907 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 }, | ||
908 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 }, | ||
909 | }, { | ||
910 | .clk = { | ||
911 | .name = "sclk_cam1", | ||
912 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
913 | .ctrlbit = (1 << 20), | ||
914 | }, | ||
915 | .sources = &clkset_group, | ||
916 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 }, | ||
917 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 }, | ||
918 | }, { | ||
919 | .clk = { | ||
920 | .name = "sclk_fimc", | ||
921 | .devname = "exynos4-fimc.0", | ||
922 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
923 | .ctrlbit = (1 << 0), | ||
924 | }, | ||
925 | .sources = &clkset_group, | ||
926 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 }, | ||
927 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 }, | ||
928 | }, { | ||
929 | .clk = { | ||
930 | .name = "sclk_fimc", | ||
931 | .devname = "exynos4-fimc.1", | ||
932 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
933 | .ctrlbit = (1 << 4), | ||
934 | }, | ||
935 | .sources = &clkset_group, | ||
936 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 }, | ||
937 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 }, | ||
938 | }, { | ||
939 | .clk = { | ||
940 | .name = "sclk_fimc", | ||
941 | .devname = "exynos4-fimc.2", | ||
942 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
943 | .ctrlbit = (1 << 8), | ||
944 | }, | ||
945 | .sources = &clkset_group, | ||
946 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 }, | ||
947 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 }, | ||
948 | }, { | ||
949 | .clk = { | ||
950 | .name = "sclk_fimc", | ||
951 | .devname = "exynos4-fimc.3", | ||
952 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
953 | .ctrlbit = (1 << 12), | ||
954 | }, | ||
955 | .sources = &clkset_group, | ||
956 | .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 }, | ||
957 | .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 }, | ||
958 | }, { | ||
959 | .clk = { | ||
960 | .name = "sclk_fimd", | ||
961 | .devname = "exynos4-fb.0", | ||
962 | .enable = exynos4_clksrc_mask_lcd0_ctrl, | ||
963 | .ctrlbit = (1 << 0), | ||
964 | }, | ||
965 | .sources = &clkset_group, | ||
966 | .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 }, | ||
967 | .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 }, | ||
968 | }, { | ||
969 | .clk = { | ||
970 | .name = "sclk_fimd", | ||
971 | .devname = "exynos4-fb.1", | ||
972 | .enable = exynos4_clksrc_mask_lcd1_ctrl, | ||
973 | .ctrlbit = (1 << 0), | ||
974 | }, | ||
975 | .sources = &clkset_group, | ||
976 | .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, | ||
977 | .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, | ||
978 | }, { | ||
979 | .clk = { | ||
980 | .name = "sclk_sata", | ||
981 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
982 | .ctrlbit = (1 << 24), | ||
983 | }, | ||
984 | .sources = &clkset_mout_corebus, | ||
985 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, | ||
986 | .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, | ||
987 | }, { | ||
988 | .clk = { | ||
989 | .name = "sclk_spi", | ||
990 | .devname = "s3c64xx-spi.0", | ||
991 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
992 | .ctrlbit = (1 << 16), | ||
993 | }, | ||
994 | .sources = &clkset_group, | ||
995 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 }, | ||
996 | .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 }, | ||
997 | }, { | ||
998 | .clk = { | ||
999 | .name = "sclk_spi", | ||
1000 | .devname = "s3c64xx-spi.1", | ||
1001 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1002 | .ctrlbit = (1 << 20), | ||
1003 | }, | ||
1004 | .sources = &clkset_group, | ||
1005 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 }, | ||
1006 | .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 }, | ||
1007 | }, { | ||
1008 | .clk = { | ||
1009 | .name = "sclk_spi", | ||
1010 | .devname = "s3c64xx-spi.2", | ||
1011 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1012 | .ctrlbit = (1 << 24), | ||
1013 | }, | ||
1014 | .sources = &clkset_group, | ||
1015 | .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 }, | ||
1016 | .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 }, | ||
1017 | }, { | ||
1018 | .clk = { | ||
1019 | .name = "sclk_fimg2d", | ||
1020 | }, | ||
1021 | .sources = &clkset_mout_g2d, | ||
1022 | .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 }, | ||
1023 | .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 }, | ||
1024 | }, { | ||
1025 | .clk = { | ||
1026 | .name = "sclk_mfc", | ||
1027 | .devname = "s5p-mfc", | ||
1028 | }, | ||
1029 | .sources = &clkset_mout_mfc, | ||
1030 | .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 }, | ||
1031 | .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 }, | ||
1032 | }, { | ||
1033 | .clk = { | ||
1034 | .name = "sclk_mmc", | ||
1035 | .devname = "s3c-sdhci.0", | ||
1036 | .parent = &clk_dout_mmc0.clk, | ||
1037 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1038 | .ctrlbit = (1 << 0), | ||
1039 | }, | ||
1040 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 }, | ||
1041 | }, { | ||
1042 | .clk = { | ||
1043 | .name = "sclk_mmc", | ||
1044 | .devname = "s3c-sdhci.1", | ||
1045 | .parent = &clk_dout_mmc1.clk, | ||
1046 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1047 | .ctrlbit = (1 << 4), | ||
1048 | }, | ||
1049 | .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 }, | ||
1050 | }, { | ||
1051 | .clk = { | ||
1052 | .name = "sclk_mmc", | ||
1053 | .devname = "s3c-sdhci.2", | ||
1054 | .parent = &clk_dout_mmc2.clk, | ||
1055 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1056 | .ctrlbit = (1 << 8), | ||
1057 | }, | ||
1058 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 }, | ||
1059 | }, { | ||
1060 | .clk = { | ||
1061 | .name = "sclk_mmc", | ||
1062 | .devname = "s3c-sdhci.3", | ||
1063 | .parent = &clk_dout_mmc3.clk, | ||
1064 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1065 | .ctrlbit = (1 << 12), | ||
1066 | }, | ||
1067 | .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 }, | ||
1068 | }, { | ||
1069 | .clk = { | ||
1070 | .name = "sclk_dwmmc", | ||
1071 | .parent = &clk_dout_mmc4.clk, | ||
1072 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1073 | .ctrlbit = (1 << 16), | ||
1074 | }, | ||
1075 | .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 }, | ||
1076 | } | ||
1077 | }; | ||
1078 | |||
1079 | /* Clock initialization code */ | ||
1080 | static struct clksrc_clk *sysclks[] = { | ||
1081 | &clk_mout_apll, | ||
1082 | &clk_sclk_apll, | ||
1083 | &clk_mout_epll, | ||
1084 | &clk_mout_mpll, | ||
1085 | &clk_moutcore, | ||
1086 | &clk_coreclk, | ||
1087 | &clk_armclk, | ||
1088 | &clk_aclk_corem0, | ||
1089 | &clk_aclk_cores, | ||
1090 | &clk_aclk_corem1, | ||
1091 | &clk_periphclk, | ||
1092 | &clk_mout_corebus, | ||
1093 | &clk_sclk_dmc, | ||
1094 | &clk_aclk_cored, | ||
1095 | &clk_aclk_corep, | ||
1096 | &clk_aclk_acp, | ||
1097 | &clk_pclk_acp, | ||
1098 | &clk_vpllsrc, | ||
1099 | &clk_sclk_vpll, | ||
1100 | &clk_aclk_200, | ||
1101 | &clk_aclk_100, | ||
1102 | &clk_aclk_160, | ||
1103 | &clk_aclk_133, | ||
1104 | &clk_dout_mmc0, | ||
1105 | &clk_dout_mmc1, | ||
1106 | &clk_dout_mmc2, | ||
1107 | &clk_dout_mmc3, | ||
1108 | &clk_dout_mmc4, | ||
1109 | &clk_mout_mfc0, | ||
1110 | &clk_mout_mfc1, | ||
1111 | }; | ||
1112 | |||
1113 | static int xtal_rate; | ||
1114 | |||
1115 | static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) | ||
1116 | { | ||
1117 | return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508); | ||
1118 | } | ||
1119 | |||
1120 | static struct clk_ops exynos4_fout_apll_ops = { | ||
1121 | .get_rate = exynos4_fout_apll_get_rate, | ||
1122 | }; | ||
1123 | |||
1124 | void __init_or_cpufreq exynos4_setup_clocks(void) | ||
1125 | { | ||
1126 | struct clk *xtal_clk; | ||
1127 | unsigned long apll; | ||
1128 | unsigned long mpll; | ||
1129 | unsigned long epll; | ||
1130 | unsigned long vpll; | ||
1131 | unsigned long vpllsrc; | ||
1132 | unsigned long xtal; | ||
1133 | unsigned long armclk; | ||
1134 | unsigned long sclk_dmc; | ||
1135 | unsigned long aclk_200; | ||
1136 | unsigned long aclk_100; | ||
1137 | unsigned long aclk_160; | ||
1138 | unsigned long aclk_133; | ||
1139 | unsigned int ptr; | ||
1140 | |||
1141 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); | ||
1142 | |||
1143 | xtal_clk = clk_get(NULL, "xtal"); | ||
1144 | BUG_ON(IS_ERR(xtal_clk)); | ||
1145 | |||
1146 | xtal = clk_get_rate(xtal_clk); | ||
1147 | |||
1148 | xtal_rate = xtal; | ||
1149 | |||
1150 | clk_put(xtal_clk); | ||
1151 | |||
1152 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | ||
1153 | |||
1154 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508); | ||
1155 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508); | ||
1156 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), | ||
1157 | __raw_readl(S5P_EPLL_CON1), pll_4600); | ||
1158 | |||
1159 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | ||
1160 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | ||
1161 | __raw_readl(S5P_VPLL_CON1), pll_4650c); | ||
1162 | |||
1163 | clk_fout_apll.ops = &exynos4_fout_apll_ops; | ||
1164 | clk_fout_mpll.rate = mpll; | ||
1165 | clk_fout_epll.rate = epll; | ||
1166 | clk_fout_vpll.rate = vpll; | ||
1167 | |||
1168 | printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld", | ||
1169 | apll, mpll, epll, vpll); | ||
1170 | |||
1171 | armclk = clk_get_rate(&clk_armclk.clk); | ||
1172 | sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk); | ||
1173 | |||
1174 | aclk_200 = clk_get_rate(&clk_aclk_200.clk); | ||
1175 | aclk_100 = clk_get_rate(&clk_aclk_100.clk); | ||
1176 | aclk_160 = clk_get_rate(&clk_aclk_160.clk); | ||
1177 | aclk_133 = clk_get_rate(&clk_aclk_133.clk); | ||
1178 | |||
1179 | printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n" | ||
1180 | "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n", | ||
1181 | armclk, sclk_dmc, aclk_200, | ||
1182 | aclk_100, aclk_160, aclk_133); | ||
1183 | |||
1184 | clk_f.rate = armclk; | ||
1185 | clk_h.rate = sclk_dmc; | ||
1186 | clk_p.rate = aclk_100; | ||
1187 | |||
1188 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
1189 | s3c_set_clksrc(&clksrcs[ptr], true); | ||
1190 | } | ||
1191 | |||
1192 | static struct clk *clks[] __initdata = { | ||
1193 | /* Nothing here yet */ | ||
1194 | }; | ||
1195 | |||
1196 | void __init exynos4_register_clocks(void) | ||
1197 | { | ||
1198 | int ptr; | ||
1199 | |||
1200 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
1201 | |||
1202 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
1203 | s3c_register_clksrc(sysclks[ptr], 1); | ||
1204 | |||
1205 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
1206 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
1207 | |||
1208 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
1209 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
1210 | |||
1211 | s3c_pwmclk_init(); | ||
1212 | } | ||
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c new file mode 100644 index 00000000000..746d6fc6d39 --- /dev/null +++ b/arch/arm/mach-exynos4/cpu.c | |||
@@ -0,0 +1,254 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/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 | |||
32 | #include <mach/regs-irq.h> | ||
33 | #include <mach/regs-pmu.h> | ||
34 | |||
35 | extern int combiner_init(unsigned int combiner_nr, void __iomem *base, | ||
36 | unsigned int irq_start); | ||
37 | extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq); | ||
38 | |||
39 | /* Initial IO mappings */ | ||
40 | static struct map_desc exynos4_iodesc[] __initdata = { | ||
41 | { | ||
42 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
43 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER), | ||
44 | .length = SZ_4K, | ||
45 | .type = MT_DEVICE, | ||
46 | }, { | ||
47 | .virtual = (unsigned long)S5P_VA_SYSRAM, | ||
48 | .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM), | ||
49 | .length = SZ_4K, | ||
50 | .type = MT_DEVICE, | ||
51 | }, { | ||
52 | .virtual = (unsigned long)S5P_VA_CMU, | ||
53 | .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), | ||
54 | .length = SZ_128K, | ||
55 | .type = MT_DEVICE, | ||
56 | }, { | ||
57 | .virtual = (unsigned long)S5P_VA_PMU, | ||
58 | .pfn = __phys_to_pfn(EXYNOS4_PA_PMU), | ||
59 | .length = SZ_64K, | ||
60 | .type = MT_DEVICE, | ||
61 | }, { | ||
62 | .virtual = (unsigned long)S5P_VA_COMBINER_BASE, | ||
63 | .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER), | ||
64 | .length = SZ_4K, | ||
65 | .type = MT_DEVICE, | ||
66 | }, { | ||
67 | .virtual = (unsigned long)S5P_VA_COREPERI_BASE, | ||
68 | .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI), | ||
69 | .length = SZ_8K, | ||
70 | .type = MT_DEVICE, | ||
71 | }, { | ||
72 | .virtual = (unsigned long)S5P_VA_L2CC, | ||
73 | .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC), | ||
74 | .length = SZ_4K, | ||
75 | .type = MT_DEVICE, | ||
76 | }, { | ||
77 | .virtual = (unsigned long)S5P_VA_GPIO1, | ||
78 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO1), | ||
79 | .length = SZ_4K, | ||
80 | .type = MT_DEVICE, | ||
81 | }, { | ||
82 | .virtual = (unsigned long)S5P_VA_GPIO2, | ||
83 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO2), | ||
84 | .length = SZ_4K, | ||
85 | .type = MT_DEVICE, | ||
86 | }, { | ||
87 | .virtual = (unsigned long)S5P_VA_GPIO3, | ||
88 | .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO3), | ||
89 | .length = SZ_256, | ||
90 | .type = MT_DEVICE, | ||
91 | }, { | ||
92 | .virtual = (unsigned long)S5P_VA_DMC0, | ||
93 | .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), | ||
94 | .length = SZ_4K, | ||
95 | .type = MT_DEVICE, | ||
96 | }, { | ||
97 | .virtual = (unsigned long)S3C_VA_UART, | ||
98 | .pfn = __phys_to_pfn(S3C_PA_UART), | ||
99 | .length = SZ_512K, | ||
100 | .type = MT_DEVICE, | ||
101 | }, { | ||
102 | .virtual = (unsigned long)S5P_VA_SROMC, | ||
103 | .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC), | ||
104 | .length = SZ_4K, | ||
105 | .type = MT_DEVICE, | ||
106 | }, { | ||
107 | .virtual = (unsigned long)S3C_VA_USB_HSPHY, | ||
108 | .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY), | ||
109 | .length = SZ_4K, | ||
110 | .type = MT_DEVICE, | ||
111 | }, { | ||
112 | .virtual = (unsigned long)S5P_VA_GIC_CPU, | ||
113 | .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU), | ||
114 | .length = SZ_64K, | ||
115 | .type = MT_DEVICE, | ||
116 | }, { | ||
117 | .virtual = (unsigned long)S5P_VA_GIC_DIST, | ||
118 | .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST), | ||
119 | .length = SZ_64K, | ||
120 | .type = MT_DEVICE, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | static void exynos4_idle(void) | ||
125 | { | ||
126 | if (!need_resched()) | ||
127 | cpu_do_idle(); | ||
128 | |||
129 | local_irq_enable(); | ||
130 | } | ||
131 | |||
132 | static void exynos4_sw_reset(void) | ||
133 | { | ||
134 | __raw_writel(0x1, S5P_SWRESET); | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * exynos4_map_io | ||
139 | * | ||
140 | * register the standard cpu IO areas | ||
141 | */ | ||
142 | void __init exynos4_map_io(void) | ||
143 | { | ||
144 | iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); | ||
145 | |||
146 | /* initialize device information early */ | ||
147 | exynos4_default_sdhci0(); | ||
148 | exynos4_default_sdhci1(); | ||
149 | exynos4_default_sdhci2(); | ||
150 | exynos4_default_sdhci3(); | ||
151 | |||
152 | s3c_adc_setname("samsung-adc-v3"); | ||
153 | |||
154 | s3c_fimc_setname(0, "exynos4-fimc"); | ||
155 | s3c_fimc_setname(1, "exynos4-fimc"); | ||
156 | s3c_fimc_setname(2, "exynos4-fimc"); | ||
157 | s3c_fimc_setname(3, "exynos4-fimc"); | ||
158 | |||
159 | /* The I2C bus controllers are directly compatible with s3c2440 */ | ||
160 | s3c_i2c0_setname("s3c2440-i2c"); | ||
161 | s3c_i2c1_setname("s3c2440-i2c"); | ||
162 | s3c_i2c2_setname("s3c2440-i2c"); | ||
163 | |||
164 | s5p_fb_setname(0, "exynos4-fb"); | ||
165 | } | ||
166 | |||
167 | void __init exynos4_init_clocks(int xtal) | ||
168 | { | ||
169 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
170 | |||
171 | s3c24xx_register_baseclocks(xtal); | ||
172 | s5p_register_clocks(xtal); | ||
173 | exynos4_register_clocks(); | ||
174 | exynos4_setup_clocks(); | ||
175 | } | ||
176 | |||
177 | static void exynos4_gic_irq_eoi(struct irq_data *d) | ||
178 | { | ||
179 | struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d); | ||
180 | |||
181 | gic_data->cpu_base = S5P_VA_GIC_CPU + | ||
182 | (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id()); | ||
183 | } | ||
184 | |||
185 | void __init exynos4_init_irq(void) | ||
186 | { | ||
187 | int irq; | ||
188 | |||
189 | gic_init(0, IRQ_SPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); | ||
190 | gic_arch_extn.irq_eoi = exynos4_gic_irq_eoi; | ||
191 | |||
192 | for (irq = 0; irq < MAX_COMBINER_NR; irq++) { | ||
193 | |||
194 | combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), | ||
195 | COMBINER_IRQ(irq, 0)); | ||
196 | combiner_cascade_irq(irq, IRQ_SPI(irq)); | ||
197 | } | ||
198 | |||
199 | /* The parameters of s5p_init_irq() are for VIC init. | ||
200 | * Theses parameters should be NULL and 0 because EXYNOS4 | ||
201 | * uses GIC instead of VIC. | ||
202 | */ | ||
203 | s5p_init_irq(NULL, 0); | ||
204 | } | ||
205 | |||
206 | struct sysdev_class exynos4_sysclass = { | ||
207 | .name = "exynos4-core", | ||
208 | }; | ||
209 | |||
210 | static struct sys_device exynos4_sysdev = { | ||
211 | .cls = &exynos4_sysclass, | ||
212 | }; | ||
213 | |||
214 | static int __init exynos4_core_init(void) | ||
215 | { | ||
216 | return sysdev_class_register(&exynos4_sysclass); | ||
217 | } | ||
218 | |||
219 | core_initcall(exynos4_core_init); | ||
220 | |||
221 | #ifdef CONFIG_CACHE_L2X0 | ||
222 | static int __init exynos4_l2x0_cache_init(void) | ||
223 | { | ||
224 | /* TAG, Data Latency Control: 2cycle */ | ||
225 | __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL); | ||
226 | __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL); | ||
227 | |||
228 | /* L2X0 Prefetch Control */ | ||
229 | __raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL); | ||
230 | |||
231 | /* L2X0 Power Control */ | ||
232 | __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, | ||
233 | S5P_VA_L2CC + L2X0_POWER_CTRL); | ||
234 | |||
235 | l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff); | ||
236 | |||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | early_initcall(exynos4_l2x0_cache_init); | ||
241 | #endif | ||
242 | |||
243 | int __init exynos4_init(void) | ||
244 | { | ||
245 | printk(KERN_INFO "EXYNOS4: Initializing architecture\n"); | ||
246 | |||
247 | /* set idle function */ | ||
248 | pm_idle = exynos4_idle; | ||
249 | |||
250 | /* set sw_reset function */ | ||
251 | s5p_reset_hook = exynos4_sw_reset; | ||
252 | |||
253 | return sysdev_register(&exynos4_sysdev); | ||
254 | } | ||
diff --git a/arch/arm/mach-exynos4/cpuidle.c b/arch/arm/mach-exynos4/cpuidle.c new file mode 100644 index 00000000000..bf7e96f2793 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dev-ahci.c b/arch/arm/mach-exynos4/dev-ahci.c new file mode 100644 index 00000000000..f57a3de8e1d --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dev-audio.c b/arch/arm/mach-exynos4/dev-audio.c new file mode 100644 index 00000000000..5a9f9c2e53b --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dev-dwmci.c b/arch/arm/mach-exynos4/dev-dwmci.c new file mode 100644 index 00000000000..b025db4bf60 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dev-pd.c b/arch/arm/mach-exynos4/dev-pd.c new file mode 100644 index 00000000000..3273f25d6a7 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dev-sysmmu.c b/arch/arm/mach-exynos4/dev-sysmmu.c new file mode 100644 index 00000000000..3b7cae0fe23 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/dma.c b/arch/arm/mach-exynos4/dma.c new file mode 100644 index 00000000000..564bb530f33 --- /dev/null +++ b/arch/arm/mach-exynos4/dma.c | |||
@@ -0,0 +1,172 @@ | |||
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/platform_device.h> | ||
25 | #include <linux/dma-mapping.h> | ||
26 | |||
27 | #include <plat/devs.h> | ||
28 | #include <plat/irqs.h> | ||
29 | |||
30 | #include <mach/map.h> | ||
31 | #include <mach/irqs.h> | ||
32 | |||
33 | #include <plat/s3c-pl330-pdata.h> | ||
34 | |||
35 | static u64 dma_dmamask = DMA_BIT_MASK(32); | ||
36 | |||
37 | static struct resource exynos4_pdma0_resource[] = { | ||
38 | [0] = { | ||
39 | .start = EXYNOS4_PA_PDMA0, | ||
40 | .end = EXYNOS4_PA_PDMA0 + SZ_4K, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, | ||
43 | [1] = { | ||
44 | .start = IRQ_PDMA0, | ||
45 | .end = IRQ_PDMA0, | ||
46 | .flags = IORESOURCE_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | static struct s3c_pl330_platdata exynos4_pdma0_pdata = { | ||
51 | .peri = { | ||
52 | [0] = DMACH_PCM0_RX, | ||
53 | [1] = DMACH_PCM0_TX, | ||
54 | [2] = DMACH_PCM2_RX, | ||
55 | [3] = DMACH_PCM2_TX, | ||
56 | [4] = DMACH_MSM_REQ0, | ||
57 | [5] = DMACH_MSM_REQ2, | ||
58 | [6] = DMACH_SPI0_RX, | ||
59 | [7] = DMACH_SPI0_TX, | ||
60 | [8] = DMACH_SPI2_RX, | ||
61 | [9] = DMACH_SPI2_TX, | ||
62 | [10] = DMACH_I2S0S_TX, | ||
63 | [11] = DMACH_I2S0_RX, | ||
64 | [12] = DMACH_I2S0_TX, | ||
65 | [13] = DMACH_I2S2_RX, | ||
66 | [14] = DMACH_I2S2_TX, | ||
67 | [15] = DMACH_UART0_RX, | ||
68 | [16] = DMACH_UART0_TX, | ||
69 | [17] = DMACH_UART2_RX, | ||
70 | [18] = DMACH_UART2_TX, | ||
71 | [19] = DMACH_UART4_RX, | ||
72 | [20] = DMACH_UART4_TX, | ||
73 | [21] = DMACH_SLIMBUS0_RX, | ||
74 | [22] = DMACH_SLIMBUS0_TX, | ||
75 | [23] = DMACH_SLIMBUS2_RX, | ||
76 | [24] = DMACH_SLIMBUS2_TX, | ||
77 | [25] = DMACH_SLIMBUS4_RX, | ||
78 | [26] = DMACH_SLIMBUS4_TX, | ||
79 | [27] = DMACH_AC97_MICIN, | ||
80 | [28] = DMACH_AC97_PCMIN, | ||
81 | [29] = DMACH_AC97_PCMOUT, | ||
82 | [30] = DMACH_MAX, | ||
83 | [31] = DMACH_MAX, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | static struct platform_device exynos4_device_pdma0 = { | ||
88 | .name = "s3c-pl330", | ||
89 | .id = 0, | ||
90 | .num_resources = ARRAY_SIZE(exynos4_pdma0_resource), | ||
91 | .resource = exynos4_pdma0_resource, | ||
92 | .dev = { | ||
93 | .dma_mask = &dma_dmamask, | ||
94 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
95 | .platform_data = &exynos4_pdma0_pdata, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct resource exynos4_pdma1_resource[] = { | ||
100 | [0] = { | ||
101 | .start = EXYNOS4_PA_PDMA1, | ||
102 | .end = EXYNOS4_PA_PDMA1 + SZ_4K, | ||
103 | .flags = IORESOURCE_MEM, | ||
104 | }, | ||
105 | [1] = { | ||
106 | .start = IRQ_PDMA1, | ||
107 | .end = IRQ_PDMA1, | ||
108 | .flags = IORESOURCE_IRQ, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | static struct s3c_pl330_platdata exynos4_pdma1_pdata = { | ||
113 | .peri = { | ||
114 | [0] = DMACH_PCM0_RX, | ||
115 | [1] = DMACH_PCM0_TX, | ||
116 | [2] = DMACH_PCM1_RX, | ||
117 | [3] = DMACH_PCM1_TX, | ||
118 | [4] = DMACH_MSM_REQ1, | ||
119 | [5] = DMACH_MSM_REQ3, | ||
120 | [6] = DMACH_SPI1_RX, | ||
121 | [7] = DMACH_SPI1_TX, | ||
122 | [8] = DMACH_I2S0S_TX, | ||
123 | [9] = DMACH_I2S0_RX, | ||
124 | [10] = DMACH_I2S0_TX, | ||
125 | [11] = DMACH_I2S1_RX, | ||
126 | [12] = DMACH_I2S1_TX, | ||
127 | [13] = DMACH_UART0_RX, | ||
128 | [14] = DMACH_UART0_TX, | ||
129 | [15] = DMACH_UART1_RX, | ||
130 | [16] = DMACH_UART1_TX, | ||
131 | [17] = DMACH_UART3_RX, | ||
132 | [18] = DMACH_UART3_TX, | ||
133 | [19] = DMACH_SLIMBUS1_RX, | ||
134 | [20] = DMACH_SLIMBUS1_TX, | ||
135 | [21] = DMACH_SLIMBUS3_RX, | ||
136 | [22] = DMACH_SLIMBUS3_TX, | ||
137 | [23] = DMACH_SLIMBUS5_RX, | ||
138 | [24] = DMACH_SLIMBUS5_TX, | ||
139 | [25] = DMACH_SLIMBUS0AUX_RX, | ||
140 | [26] = DMACH_SLIMBUS0AUX_TX, | ||
141 | [27] = DMACH_SPDIF, | ||
142 | [28] = DMACH_MAX, | ||
143 | [29] = DMACH_MAX, | ||
144 | [30] = DMACH_MAX, | ||
145 | [31] = DMACH_MAX, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | static struct platform_device exynos4_device_pdma1 = { | ||
150 | .name = "s3c-pl330", | ||
151 | .id = 1, | ||
152 | .num_resources = ARRAY_SIZE(exynos4_pdma1_resource), | ||
153 | .resource = exynos4_pdma1_resource, | ||
154 | .dev = { | ||
155 | .dma_mask = &dma_dmamask, | ||
156 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
157 | .platform_data = &exynos4_pdma1_pdata, | ||
158 | }, | ||
159 | }; | ||
160 | |||
161 | static struct platform_device *exynos4_dmacs[] __initdata = { | ||
162 | &exynos4_device_pdma0, | ||
163 | &exynos4_device_pdma1, | ||
164 | }; | ||
165 | |||
166 | static int __init exynos4_dma_init(void) | ||
167 | { | ||
168 | platform_add_devices(exynos4_dmacs, ARRAY_SIZE(exynos4_dmacs)); | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | arch_initcall(exynos4_dma_init); | ||
diff --git a/arch/arm/mach-exynos4/headsmp.S b/arch/arm/mach-exynos4/headsmp.S new file mode 100644 index 00000000000..3cdeb364754 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/hotplug.c b/arch/arm/mach-exynos4/hotplug.c new file mode 100644 index 00000000000..7490789784c --- /dev/null +++ b/arch/arm/mach-exynos4/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) { | ||
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-exynos4/include/mach/clkdev.h b/arch/arm/mach-exynos4/include/mach/clkdev.h new file mode 100644 index 00000000000..7dffa83d23f --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/clkdev.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __MACH_CLKDEV_H__ | ||
2 | #define __MACH_CLKDEV_H__ | ||
3 | |||
4 | #define __clk_get(clk) ({ 1; }) | ||
5 | #define __clk_put(clk) do {} while (0) | ||
6 | |||
7 | #endif | ||
diff --git a/arch/arm/mach-exynos4/include/mach/debug-macro.S b/arch/arm/mach-exynos4/include/mach/debug-macro.S new file mode 100644 index 00000000000..a442ef86116 --- /dev/null +++ b/arch/arm/mach-exynos4/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 | ||
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-exynos4/include/mach/dma.h b/arch/arm/mach-exynos4/include/mach/dma.h new file mode 100644 index 00000000000..81209eb1409 --- /dev/null +++ b/arch/arm/mach-exynos4/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 S3C DMA API driver for PL330 */ | ||
24 | #include <plat/s3c-dma-pl330.h> | ||
25 | |||
26 | #endif /* __MACH_DMA_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/dwmci.h b/arch/arm/mach-exynos4/include/mach/dwmci.h new file mode 100644 index 00000000000..7ce657459cc --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/entry-macro.S b/arch/arm/mach-exynos4/include/mach/entry-macro.S new file mode 100644 index 00000000000..d7a1e281ce7 --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/entry-macro.S | |||
@@ -0,0 +1,83 @@ | |||
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 | ldr \base, =gic_cpu_base_addr | ||
21 | ldr \base, [\base] | ||
22 | mrc p15, 0, \tmp, c0, c0, 5 | ||
23 | and \tmp, \tmp, #3 | ||
24 | cmp \tmp, #1 | ||
25 | addeq \base, \base, #EXYNOS4_GIC_BANK_OFFSET | ||
26 | .endm | ||
27 | |||
28 | .macro arch_ret_to_user, tmp1, tmp2 | ||
29 | .endm | ||
30 | |||
31 | /* | ||
32 | * The interrupt numbering scheme is defined in the | ||
33 | * interrupt controller spec. To wit: | ||
34 | * | ||
35 | * Interrupts 0-15 are IPI | ||
36 | * 16-28 are reserved | ||
37 | * 29-31 are local. We allow 30 to be used for the watchdog. | ||
38 | * 32-1020 are global | ||
39 | * 1021-1022 are reserved | ||
40 | * 1023 is "spurious" (no interrupt) | ||
41 | * | ||
42 | * For now, we ignore all local interrupts so only return an interrupt if it's | ||
43 | * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs. | ||
44 | * | ||
45 | * A simple read from the controller will tell us the number of the highest | ||
46 | * priority enabled interrupt. We then just need to check whether it is in the | ||
47 | * valid range for an IRQ (30-1020 inclusive). | ||
48 | */ | ||
49 | |||
50 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
51 | |||
52 | ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */ | ||
53 | |||
54 | ldr \tmp, =1021 | ||
55 | |||
56 | bic \irqnr, \irqstat, #0x1c00 | ||
57 | |||
58 | cmp \irqnr, #29 | ||
59 | cmpcc \irqnr, \irqnr | ||
60 | cmpne \irqnr, \tmp | ||
61 | cmpcs \irqnr, \irqnr | ||
62 | addne \irqnr, \irqnr, #32 | ||
63 | |||
64 | .endm | ||
65 | |||
66 | /* We assume that irqstat (the raw value of the IRQ acknowledge | ||
67 | * register) is preserved from the macro above. | ||
68 | * If there is an IPI, we immediately signal end of interrupt on the | ||
69 | * controller, since this requires the original irqstat value which | ||
70 | * we won't easily be able to recreate later. | ||
71 | */ | ||
72 | |||
73 | .macro test_for_ipi, irqnr, irqstat, base, tmp | ||
74 | bic \irqnr, \irqstat, #0x1c00 | ||
75 | cmp \irqnr, #16 | ||
76 | strcc \irqstat, [\base, #GIC_CPU_EOI] | ||
77 | cmpcs \irqnr, \irqnr | ||
78 | .endm | ||
79 | |||
80 | /* As above, this assumes that irqstat and base are preserved.. */ | ||
81 | |||
82 | .macro test_for_ltirq, irqnr, irqstat, base, tmp | ||
83 | .endm | ||
diff --git a/arch/arm/mach-exynos4/include/mach/gpio.h b/arch/arm/mach-exynos4/include/mach/gpio.h new file mode 100644 index 00000000000..be9266b10fd --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/gpio.h | |||
@@ -0,0 +1,156 @@ | |||
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 | #define gpio_get_value __gpio_get_value | ||
17 | #define gpio_set_value __gpio_set_value | ||
18 | #define gpio_cansleep __gpio_cansleep | ||
19 | #define gpio_to_irq __gpio_to_irq | ||
20 | |||
21 | /* Practically, GPIO banks up to GPZ are the configurable gpio banks */ | ||
22 | |||
23 | /* GPIO bank sizes */ | ||
24 | #define EXYNOS4_GPIO_A0_NR (8) | ||
25 | #define EXYNOS4_GPIO_A1_NR (6) | ||
26 | #define EXYNOS4_GPIO_B_NR (8) | ||
27 | #define EXYNOS4_GPIO_C0_NR (5) | ||
28 | #define EXYNOS4_GPIO_C1_NR (5) | ||
29 | #define EXYNOS4_GPIO_D0_NR (4) | ||
30 | #define EXYNOS4_GPIO_D1_NR (4) | ||
31 | #define EXYNOS4_GPIO_E0_NR (5) | ||
32 | #define EXYNOS4_GPIO_E1_NR (8) | ||
33 | #define EXYNOS4_GPIO_E2_NR (6) | ||
34 | #define EXYNOS4_GPIO_E3_NR (8) | ||
35 | #define EXYNOS4_GPIO_E4_NR (8) | ||
36 | #define EXYNOS4_GPIO_F0_NR (8) | ||
37 | #define EXYNOS4_GPIO_F1_NR (8) | ||
38 | #define EXYNOS4_GPIO_F2_NR (8) | ||
39 | #define EXYNOS4_GPIO_F3_NR (6) | ||
40 | #define EXYNOS4_GPIO_J0_NR (8) | ||
41 | #define EXYNOS4_GPIO_J1_NR (5) | ||
42 | #define EXYNOS4_GPIO_K0_NR (7) | ||
43 | #define EXYNOS4_GPIO_K1_NR (7) | ||
44 | #define EXYNOS4_GPIO_K2_NR (7) | ||
45 | #define EXYNOS4_GPIO_K3_NR (7) | ||
46 | #define EXYNOS4_GPIO_L0_NR (8) | ||
47 | #define EXYNOS4_GPIO_L1_NR (3) | ||
48 | #define EXYNOS4_GPIO_L2_NR (8) | ||
49 | #define EXYNOS4_GPIO_X0_NR (8) | ||
50 | #define EXYNOS4_GPIO_X1_NR (8) | ||
51 | #define EXYNOS4_GPIO_X2_NR (8) | ||
52 | #define EXYNOS4_GPIO_X3_NR (8) | ||
53 | #define EXYNOS4_GPIO_Y0_NR (6) | ||
54 | #define EXYNOS4_GPIO_Y1_NR (4) | ||
55 | #define EXYNOS4_GPIO_Y2_NR (6) | ||
56 | #define EXYNOS4_GPIO_Y3_NR (8) | ||
57 | #define EXYNOS4_GPIO_Y4_NR (8) | ||
58 | #define EXYNOS4_GPIO_Y5_NR (8) | ||
59 | #define EXYNOS4_GPIO_Y6_NR (8) | ||
60 | #define EXYNOS4_GPIO_Z_NR (7) | ||
61 | |||
62 | /* GPIO bank numbers */ | ||
63 | |||
64 | #define EXYNOS4_GPIO_NEXT(__gpio) \ | ||
65 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) | ||
66 | |||
67 | enum s5p_gpio_number { | ||
68 | EXYNOS4_GPIO_A0_START = 0, | ||
69 | EXYNOS4_GPIO_A1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A0), | ||
70 | EXYNOS4_GPIO_B_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A1), | ||
71 | EXYNOS4_GPIO_C0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_B), | ||
72 | EXYNOS4_GPIO_C1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C0), | ||
73 | EXYNOS4_GPIO_D0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C1), | ||
74 | EXYNOS4_GPIO_D1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D0), | ||
75 | EXYNOS4_GPIO_E0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D1), | ||
76 | EXYNOS4_GPIO_E1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E0), | ||
77 | EXYNOS4_GPIO_E2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E1), | ||
78 | EXYNOS4_GPIO_E3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E2), | ||
79 | EXYNOS4_GPIO_E4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E3), | ||
80 | EXYNOS4_GPIO_F0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E4), | ||
81 | EXYNOS4_GPIO_F1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F0), | ||
82 | EXYNOS4_GPIO_F2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F1), | ||
83 | EXYNOS4_GPIO_F3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F2), | ||
84 | EXYNOS4_GPIO_J0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F3), | ||
85 | EXYNOS4_GPIO_J1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J0), | ||
86 | EXYNOS4_GPIO_K0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J1), | ||
87 | EXYNOS4_GPIO_K1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K0), | ||
88 | EXYNOS4_GPIO_K2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K1), | ||
89 | EXYNOS4_GPIO_K3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K2), | ||
90 | EXYNOS4_GPIO_L0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K3), | ||
91 | EXYNOS4_GPIO_L1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L0), | ||
92 | EXYNOS4_GPIO_L2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L1), | ||
93 | EXYNOS4_GPIO_X0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L2), | ||
94 | EXYNOS4_GPIO_X1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X0), | ||
95 | EXYNOS4_GPIO_X2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X1), | ||
96 | EXYNOS4_GPIO_X3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X2), | ||
97 | EXYNOS4_GPIO_Y0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X3), | ||
98 | EXYNOS4_GPIO_Y1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y0), | ||
99 | EXYNOS4_GPIO_Y2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y1), | ||
100 | EXYNOS4_GPIO_Y3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y2), | ||
101 | EXYNOS4_GPIO_Y4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y3), | ||
102 | EXYNOS4_GPIO_Y5_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y4), | ||
103 | EXYNOS4_GPIO_Y6_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y5), | ||
104 | EXYNOS4_GPIO_Z_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y6), | ||
105 | }; | ||
106 | |||
107 | /* EXYNOS4 GPIO number definitions */ | ||
108 | #define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr)) | ||
109 | #define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr)) | ||
110 | #define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr)) | ||
111 | #define EXYNOS4_GPC0(_nr) (EXYNOS4_GPIO_C0_START + (_nr)) | ||
112 | #define EXYNOS4_GPC1(_nr) (EXYNOS4_GPIO_C1_START + (_nr)) | ||
113 | #define EXYNOS4_GPD0(_nr) (EXYNOS4_GPIO_D0_START + (_nr)) | ||
114 | #define EXYNOS4_GPD1(_nr) (EXYNOS4_GPIO_D1_START + (_nr)) | ||
115 | #define EXYNOS4_GPE0(_nr) (EXYNOS4_GPIO_E0_START + (_nr)) | ||
116 | #define EXYNOS4_GPE1(_nr) (EXYNOS4_GPIO_E1_START + (_nr)) | ||
117 | #define EXYNOS4_GPE2(_nr) (EXYNOS4_GPIO_E2_START + (_nr)) | ||
118 | #define EXYNOS4_GPE3(_nr) (EXYNOS4_GPIO_E3_START + (_nr)) | ||
119 | #define EXYNOS4_GPE4(_nr) (EXYNOS4_GPIO_E4_START + (_nr)) | ||
120 | #define EXYNOS4_GPF0(_nr) (EXYNOS4_GPIO_F0_START + (_nr)) | ||
121 | #define EXYNOS4_GPF1(_nr) (EXYNOS4_GPIO_F1_START + (_nr)) | ||
122 | #define EXYNOS4_GPF2(_nr) (EXYNOS4_GPIO_F2_START + (_nr)) | ||
123 | #define EXYNOS4_GPF3(_nr) (EXYNOS4_GPIO_F3_START + (_nr)) | ||
124 | #define EXYNOS4_GPJ0(_nr) (EXYNOS4_GPIO_J0_START + (_nr)) | ||
125 | #define EXYNOS4_GPJ1(_nr) (EXYNOS4_GPIO_J1_START + (_nr)) | ||
126 | #define EXYNOS4_GPK0(_nr) (EXYNOS4_GPIO_K0_START + (_nr)) | ||
127 | #define EXYNOS4_GPK1(_nr) (EXYNOS4_GPIO_K1_START + (_nr)) | ||
128 | #define EXYNOS4_GPK2(_nr) (EXYNOS4_GPIO_K2_START + (_nr)) | ||
129 | #define EXYNOS4_GPK3(_nr) (EXYNOS4_GPIO_K3_START + (_nr)) | ||
130 | #define EXYNOS4_GPL0(_nr) (EXYNOS4_GPIO_L0_START + (_nr)) | ||
131 | #define EXYNOS4_GPL1(_nr) (EXYNOS4_GPIO_L1_START + (_nr)) | ||
132 | #define EXYNOS4_GPL2(_nr) (EXYNOS4_GPIO_L2_START + (_nr)) | ||
133 | #define EXYNOS4_GPX0(_nr) (EXYNOS4_GPIO_X0_START + (_nr)) | ||
134 | #define EXYNOS4_GPX1(_nr) (EXYNOS4_GPIO_X1_START + (_nr)) | ||
135 | #define EXYNOS4_GPX2(_nr) (EXYNOS4_GPIO_X2_START + (_nr)) | ||
136 | #define EXYNOS4_GPX3(_nr) (EXYNOS4_GPIO_X3_START + (_nr)) | ||
137 | #define EXYNOS4_GPY0(_nr) (EXYNOS4_GPIO_Y0_START + (_nr)) | ||
138 | #define EXYNOS4_GPY1(_nr) (EXYNOS4_GPIO_Y1_START + (_nr)) | ||
139 | #define EXYNOS4_GPY2(_nr) (EXYNOS4_GPIO_Y2_START + (_nr)) | ||
140 | #define EXYNOS4_GPY3(_nr) (EXYNOS4_GPIO_Y3_START + (_nr)) | ||
141 | #define EXYNOS4_GPY4(_nr) (EXYNOS4_GPIO_Y4_START + (_nr)) | ||
142 | #define EXYNOS4_GPY5(_nr) (EXYNOS4_GPIO_Y5_START + (_nr)) | ||
143 | #define EXYNOS4_GPY6(_nr) (EXYNOS4_GPIO_Y6_START + (_nr)) | ||
144 | #define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr)) | ||
145 | |||
146 | /* the end of the EXYNOS4 specific gpios */ | ||
147 | #define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1) | ||
148 | #define S3C_GPIO_END EXYNOS4_GPIO_END | ||
149 | |||
150 | /* define the number of gpios we need to the one after the GPZ() range */ | ||
151 | #define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ | ||
152 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) | ||
153 | |||
154 | #include <asm-generic/gpio.h> | ||
155 | |||
156 | #endif /* __ASM_ARCH_GPIO_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/hardware.h b/arch/arm/mach-exynos4/include/mach/hardware.h new file mode 100644 index 00000000000..5109eb232f2 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/io.h b/arch/arm/mach-exynos4/include/mach/io.h new file mode 100644 index 00000000000..d5478d24753 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/irqs.h b/arch/arm/mach-exynos4/include/mach/irqs.h new file mode 100644 index 00000000000..f8952f8f375 --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/irqs.h | |||
@@ -0,0 +1,163 @@ | |||
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 | /* SPI: Shared Peripheral Interrupt */ | ||
23 | |||
24 | #define IRQ_SPI(x) S5P_IRQ(x+32) | ||
25 | |||
26 | #define IRQ_EINT0 IRQ_SPI(16) | ||
27 | #define IRQ_EINT1 IRQ_SPI(17) | ||
28 | #define IRQ_EINT2 IRQ_SPI(18) | ||
29 | #define IRQ_EINT3 IRQ_SPI(19) | ||
30 | #define IRQ_EINT4 IRQ_SPI(20) | ||
31 | #define IRQ_EINT5 IRQ_SPI(21) | ||
32 | #define IRQ_EINT6 IRQ_SPI(22) | ||
33 | #define IRQ_EINT7 IRQ_SPI(23) | ||
34 | #define IRQ_EINT8 IRQ_SPI(24) | ||
35 | #define IRQ_EINT9 IRQ_SPI(25) | ||
36 | #define IRQ_EINT10 IRQ_SPI(26) | ||
37 | #define IRQ_EINT11 IRQ_SPI(27) | ||
38 | #define IRQ_EINT12 IRQ_SPI(28) | ||
39 | #define IRQ_EINT13 IRQ_SPI(29) | ||
40 | #define IRQ_EINT14 IRQ_SPI(30) | ||
41 | #define IRQ_EINT15 IRQ_SPI(31) | ||
42 | #define IRQ_EINT16_31 IRQ_SPI(32) | ||
43 | |||
44 | #define IRQ_PDMA0 IRQ_SPI(35) | ||
45 | #define IRQ_PDMA1 IRQ_SPI(36) | ||
46 | #define IRQ_TIMER0_VIC IRQ_SPI(37) | ||
47 | #define IRQ_TIMER1_VIC IRQ_SPI(38) | ||
48 | #define IRQ_TIMER2_VIC IRQ_SPI(39) | ||
49 | #define IRQ_TIMER3_VIC IRQ_SPI(40) | ||
50 | #define IRQ_TIMER4_VIC IRQ_SPI(41) | ||
51 | #define IRQ_MCT_L0 IRQ_SPI(42) | ||
52 | #define IRQ_WDT IRQ_SPI(43) | ||
53 | #define IRQ_RTC_ALARM IRQ_SPI(44) | ||
54 | #define IRQ_RTC_TIC IRQ_SPI(45) | ||
55 | #define IRQ_GPIO_XB IRQ_SPI(46) | ||
56 | #define IRQ_GPIO_XA IRQ_SPI(47) | ||
57 | #define IRQ_MCT_L1 IRQ_SPI(48) | ||
58 | |||
59 | #define IRQ_UART0 IRQ_SPI(52) | ||
60 | #define IRQ_UART1 IRQ_SPI(53) | ||
61 | #define IRQ_UART2 IRQ_SPI(54) | ||
62 | #define IRQ_UART3 IRQ_SPI(55) | ||
63 | #define IRQ_UART4 IRQ_SPI(56) | ||
64 | #define IRQ_MCT_G0 IRQ_SPI(57) | ||
65 | #define IRQ_IIC IRQ_SPI(58) | ||
66 | #define IRQ_IIC1 IRQ_SPI(59) | ||
67 | #define IRQ_IIC2 IRQ_SPI(60) | ||
68 | #define IRQ_IIC3 IRQ_SPI(61) | ||
69 | #define IRQ_IIC4 IRQ_SPI(62) | ||
70 | #define IRQ_IIC5 IRQ_SPI(63) | ||
71 | #define IRQ_IIC6 IRQ_SPI(64) | ||
72 | #define IRQ_IIC7 IRQ_SPI(65) | ||
73 | |||
74 | #define IRQ_USB_HOST IRQ_SPI(70) | ||
75 | #define IRQ_USB_HSOTG IRQ_SPI(71) | ||
76 | #define IRQ_MODEM_IF IRQ_SPI(72) | ||
77 | #define IRQ_HSMMC0 IRQ_SPI(73) | ||
78 | #define IRQ_HSMMC1 IRQ_SPI(74) | ||
79 | #define IRQ_HSMMC2 IRQ_SPI(75) | ||
80 | #define IRQ_HSMMC3 IRQ_SPI(76) | ||
81 | #define IRQ_DWMCI IRQ_SPI(77) | ||
82 | |||
83 | #define IRQ_MIPI_CSIS0 IRQ_SPI(78) | ||
84 | #define IRQ_MIPI_CSIS1 IRQ_SPI(80) | ||
85 | |||
86 | #define IRQ_ONENAND_AUDI IRQ_SPI(82) | ||
87 | #define IRQ_ROTATOR IRQ_SPI(83) | ||
88 | #define IRQ_FIMC0 IRQ_SPI(84) | ||
89 | #define IRQ_FIMC1 IRQ_SPI(85) | ||
90 | #define IRQ_FIMC2 IRQ_SPI(86) | ||
91 | #define IRQ_FIMC3 IRQ_SPI(87) | ||
92 | #define IRQ_JPEG IRQ_SPI(88) | ||
93 | #define IRQ_2D IRQ_SPI(89) | ||
94 | #define IRQ_PCIE IRQ_SPI(90) | ||
95 | |||
96 | #define IRQ_MFC IRQ_SPI(94) | ||
97 | |||
98 | #define IRQ_AUDIO_SS IRQ_SPI(96) | ||
99 | #define IRQ_I2S0 IRQ_SPI(97) | ||
100 | #define IRQ_I2S1 IRQ_SPI(98) | ||
101 | #define IRQ_I2S2 IRQ_SPI(99) | ||
102 | #define IRQ_AC97 IRQ_SPI(100) | ||
103 | |||
104 | #define IRQ_SPDIF IRQ_SPI(104) | ||
105 | #define IRQ_ADC0 IRQ_SPI(105) | ||
106 | #define IRQ_PEN0 IRQ_SPI(106) | ||
107 | #define IRQ_ADC1 IRQ_SPI(107) | ||
108 | #define IRQ_PEN1 IRQ_SPI(108) | ||
109 | #define IRQ_KEYPAD IRQ_SPI(109) | ||
110 | #define IRQ_PMU IRQ_SPI(110) | ||
111 | #define IRQ_GPS IRQ_SPI(111) | ||
112 | #define IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) | ||
113 | #define IRQ_SLIMBUS IRQ_SPI(113) | ||
114 | |||
115 | #define IRQ_TSI IRQ_SPI(115) | ||
116 | #define IRQ_SATA IRQ_SPI(116) | ||
117 | |||
118 | #define MAX_IRQ_IN_COMBINER 8 | ||
119 | #define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128)) | ||
120 | #define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) | ||
121 | |||
122 | #define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) | ||
123 | #define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1) | ||
124 | #define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2) | ||
125 | #define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3) | ||
126 | #define IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4) | ||
127 | #define IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5) | ||
128 | #define IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6) | ||
129 | #define IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7) | ||
130 | |||
131 | #define IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0) | ||
132 | #define IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1) | ||
133 | #define IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2) | ||
134 | #define IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3) | ||
135 | #define IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4) | ||
136 | #define IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5) | ||
137 | #define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6) | ||
138 | #define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7) | ||
139 | |||
140 | #define IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0) | ||
141 | #define IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) | ||
142 | #define IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) | ||
143 | |||
144 | #define MAX_COMBINER_NR 16 | ||
145 | |||
146 | #define IRQ_ADC IRQ_ADC0 | ||
147 | #define IRQ_TC IRQ_PEN0 | ||
148 | |||
149 | #define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) | ||
150 | |||
151 | #define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE + 0) | ||
152 | #define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE + 16) | ||
153 | |||
154 | /* optional GPIO interrupts */ | ||
155 | #define S5P_GPIOINT_BASE (S5P_IRQ_EINT_BASE + 32) | ||
156 | #define IRQ_GPIO1_NR_GROUPS 16 | ||
157 | #define IRQ_GPIO2_NR_GROUPS 9 | ||
158 | #define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT) | ||
159 | |||
160 | /* Set the default NR_IRQS */ | ||
161 | #define NR_IRQS (IRQ_GPIO_END + 64) | ||
162 | |||
163 | #endif /* __ASM_ARCH_IRQS_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/map.h b/arch/arm/mach-exynos4/include/mach/map.h new file mode 100644 index 00000000000..d32296dc65e --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/map.h | |||
@@ -0,0 +1,179 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/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_SYSRAM 0x02020000 | ||
27 | |||
28 | #define EXYNOS4_PA_FIMC0 0x11800000 | ||
29 | #define EXYNOS4_PA_FIMC1 0x11810000 | ||
30 | #define EXYNOS4_PA_FIMC2 0x11820000 | ||
31 | #define EXYNOS4_PA_FIMC3 0x11830000 | ||
32 | |||
33 | #define EXYNOS4_PA_I2S0 0x03830000 | ||
34 | #define EXYNOS4_PA_I2S1 0xE3100000 | ||
35 | #define EXYNOS4_PA_I2S2 0xE2A00000 | ||
36 | |||
37 | #define EXYNOS4_PA_PCM0 0x03840000 | ||
38 | #define EXYNOS4_PA_PCM1 0x13980000 | ||
39 | #define EXYNOS4_PA_PCM2 0x13990000 | ||
40 | |||
41 | #define EXYNOS4_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000)) | ||
42 | |||
43 | #define EXYNOS4_PA_ONENAND 0x0C000000 | ||
44 | #define EXYNOS4_PA_ONENAND_DMA 0x0C600000 | ||
45 | |||
46 | #define EXYNOS4_PA_CHIPID 0x10000000 | ||
47 | |||
48 | #define EXYNOS4_PA_SYSCON 0x10010000 | ||
49 | #define EXYNOS4_PA_PMU 0x10020000 | ||
50 | #define EXYNOS4_PA_CMU 0x10030000 | ||
51 | |||
52 | #define EXYNOS4_PA_SYSTIMER 0x10050000 | ||
53 | #define EXYNOS4_PA_WATCHDOG 0x10060000 | ||
54 | #define EXYNOS4_PA_RTC 0x10070000 | ||
55 | |||
56 | #define EXYNOS4_PA_KEYPAD 0x100A0000 | ||
57 | |||
58 | #define EXYNOS4_PA_DMC0 0x10400000 | ||
59 | |||
60 | #define EXYNOS4_PA_COMBINER 0x10440000 | ||
61 | |||
62 | #define EXYNOS4_PA_GIC_CPU 0x10480000 | ||
63 | #define EXYNOS4_PA_GIC_DIST 0x10490000 | ||
64 | #define EXYNOS4_GIC_BANK_OFFSET 0x8000 | ||
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_IIC(x) (0x13860000 + ((x) * 0x10000)) | ||
116 | |||
117 | #define EXYNOS4_PA_ADC 0x13910000 | ||
118 | #define EXYNOS4_PA_ADC1 0x13911000 | ||
119 | |||
120 | #define EXYNOS4_PA_AC97 0x139A0000 | ||
121 | |||
122 | #define EXYNOS4_PA_SPDIF 0x139B0000 | ||
123 | |||
124 | #define EXYNOS4_PA_TIMER 0x139D0000 | ||
125 | |||
126 | #define EXYNOS4_PA_SDRAM 0x40000000 | ||
127 | |||
128 | /* Compatibiltiy Defines */ | ||
129 | |||
130 | #define S3C_PA_HSMMC0 EXYNOS4_PA_HSMMC(0) | ||
131 | #define S3C_PA_HSMMC1 EXYNOS4_PA_HSMMC(1) | ||
132 | #define S3C_PA_HSMMC2 EXYNOS4_PA_HSMMC(2) | ||
133 | #define S3C_PA_HSMMC3 EXYNOS4_PA_HSMMC(3) | ||
134 | #define S3C_PA_IIC EXYNOS4_PA_IIC(0) | ||
135 | #define S3C_PA_IIC1 EXYNOS4_PA_IIC(1) | ||
136 | #define S3C_PA_IIC2 EXYNOS4_PA_IIC(2) | ||
137 | #define S3C_PA_IIC3 EXYNOS4_PA_IIC(3) | ||
138 | #define S3C_PA_IIC4 EXYNOS4_PA_IIC(4) | ||
139 | #define S3C_PA_IIC5 EXYNOS4_PA_IIC(5) | ||
140 | #define S3C_PA_IIC6 EXYNOS4_PA_IIC(6) | ||
141 | #define S3C_PA_IIC7 EXYNOS4_PA_IIC(7) | ||
142 | #define SAMSUNG_PA_ADC EXYNOS4_PA_ADC | ||
143 | #define SAMSUNG_PA_ADC1 EXYNOS4_PA_ADC1 | ||
144 | #define S3C_PA_RTC EXYNOS4_PA_RTC | ||
145 | #define S3C_PA_WDT EXYNOS4_PA_WATCHDOG | ||
146 | |||
147 | #define S5P_PA_CHIPID EXYNOS4_PA_CHIPID | ||
148 | #define S5P_PA_FIMC0 EXYNOS4_PA_FIMC0 | ||
149 | #define S5P_PA_FIMC1 EXYNOS4_PA_FIMC1 | ||
150 | #define S5P_PA_FIMC2 EXYNOS4_PA_FIMC2 | ||
151 | #define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3 | ||
152 | #define S5P_PA_MIPI_CSIS0 EXYNOS4_PA_MIPI_CSIS0 | ||
153 | #define S5P_PA_MIPI_CSIS1 EXYNOS4_PA_MIPI_CSIS1 | ||
154 | #define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0 | ||
155 | #define S5P_PA_ONENAND EXYNOS4_PA_ONENAND | ||
156 | #define S5P_PA_ONENAND_DMA EXYNOS4_PA_ONENAND_DMA | ||
157 | #define S5P_PA_SDRAM EXYNOS4_PA_SDRAM | ||
158 | #define S5P_PA_SROMC EXYNOS4_PA_SROMC | ||
159 | #define S5P_PA_MFC EXYNOS4_PA_MFC | ||
160 | #define S5P_PA_SYSCON EXYNOS4_PA_SYSCON | ||
161 | #define S5P_PA_TIMER EXYNOS4_PA_TIMER | ||
162 | #define S5P_PA_EHCI EXYNOS4_PA_EHCI | ||
163 | |||
164 | #define SAMSUNG_PA_KEYPAD EXYNOS4_PA_KEYPAD | ||
165 | |||
166 | /* UART */ | ||
167 | |||
168 | #define S3C_PA_UART EXYNOS4_PA_UART | ||
169 | |||
170 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) | ||
171 | #define S5P_PA_UART0 S5P_PA_UART(0) | ||
172 | #define S5P_PA_UART1 S5P_PA_UART(1) | ||
173 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
174 | #define S5P_PA_UART3 S5P_PA_UART(3) | ||
175 | #define S5P_PA_UART4 S5P_PA_UART(4) | ||
176 | |||
177 | #define S5P_SZ_UART SZ_256 | ||
178 | |||
179 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/memory.h b/arch/arm/mach-exynos4/include/mach/memory.h new file mode 100644 index 00000000000..374ef2cf715 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/pm-core.h b/arch/arm/mach-exynos4/include/mach/pm-core.h new file mode 100644 index 00000000000..1df3b81f96e --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/pm-core.h | |||
@@ -0,0 +1,59 @@ | |||
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 | #include <mach/regs-pmu.h> | ||
18 | |||
19 | static inline void s3c_pm_debug_init_uart(void) | ||
20 | { | ||
21 | /* nothing here yet */ | ||
22 | } | ||
23 | |||
24 | static inline void s3c_pm_arch_prepare_irqs(void) | ||
25 | { | ||
26 | unsigned int tmp; | ||
27 | tmp = __raw_readl(S5P_WAKEUP_MASK); | ||
28 | tmp &= ~(1 << 31); | ||
29 | __raw_writel(tmp, S5P_WAKEUP_MASK); | ||
30 | |||
31 | __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK); | ||
32 | __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK); | ||
33 | } | ||
34 | |||
35 | static inline void s3c_pm_arch_stop_clocks(void) | ||
36 | { | ||
37 | /* nothing here yet */ | ||
38 | } | ||
39 | |||
40 | static inline void s3c_pm_arch_show_resume_irqs(void) | ||
41 | { | ||
42 | /* nothing here yet */ | ||
43 | } | ||
44 | |||
45 | static inline void s3c_pm_arch_update_uart(void __iomem *regs, | ||
46 | struct pm_uart_save *save) | ||
47 | { | ||
48 | /* nothing here yet */ | ||
49 | } | ||
50 | |||
51 | static inline void s3c_pm_restored_gpios(void) | ||
52 | { | ||
53 | /* nothing here yet */ | ||
54 | } | ||
55 | |||
56 | static inline void s3c_pm_saved_gpios(void) | ||
57 | { | ||
58 | /* nothing here yet */ | ||
59 | } | ||
diff --git a/arch/arm/mach-exynos4/include/mach/pmu.h b/arch/arm/mach-exynos4/include/mach/pmu.h new file mode 100644 index 00000000000..a952904b010 --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/pmu.h | |||
@@ -0,0 +1,25 @@ | |||
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 | enum sys_powerdown { | ||
17 | SYS_AFTR, | ||
18 | SYS_LPA, | ||
19 | SYS_SLEEP, | ||
20 | NUM_SYS_POWERDOWN, | ||
21 | }; | ||
22 | |||
23 | extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode); | ||
24 | |||
25 | #endif /* __ASM_ARCH_PMU_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/pwm-clock.h b/arch/arm/mach-exynos4/include/mach/pwm-clock.h new file mode 100644 index 00000000000..8e12090287b --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/pwm-clock.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/pwm-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h | ||
12 | * | ||
13 | * EXYNOS4 - pwm clock and timer support | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_ARCH_PWMCLK_H | ||
21 | #define __ASM_ARCH_PWMCLK_H __FILE__ | ||
22 | |||
23 | /** | ||
24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. | ||
26 | * | ||
27 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
28 | * any of the TDIV clocks. | ||
29 | */ | ||
30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
31 | { | ||
32 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
37 | * @tcfg1: The tcfg1 setting, shifted down. | ||
38 | * | ||
39 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
40 | * caller has already checked to see if this is not a TCLK source. | ||
41 | */ | ||
42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
43 | { | ||
44 | return 1 << tcfg1; | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
49 | * | ||
50 | * Return true if we have a /1 in the tdiv setting. | ||
51 | */ | ||
52 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
53 | { | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
59 | * @div: The divisor to calculate the bit information for. | ||
60 | * | ||
61 | * Turn a divisor into the necessary bit field for TCFG1. | ||
62 | */ | ||
63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
64 | { | ||
65 | return ilog2(div); | ||
66 | } | ||
67 | |||
68 | #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK | ||
69 | |||
70 | #endif /* __ASM_ARCH_PWMCLK_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/regs-audss.h b/arch/arm/mach-exynos4/include/mach/regs-audss.h new file mode 100644 index 00000000000..ca5a8b64218 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/regs-clock.h b/arch/arm/mach-exynos4/include/mach/regs-clock.h new file mode 100644 index 00000000000..d493fdb422f --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/regs-clock.h | |||
@@ -0,0 +1,192 @@ | |||
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 <mach/map.h> | ||
17 | |||
18 | #define S5P_CLKREG(x) (S5P_VA_CMU + (x)) | ||
19 | |||
20 | #define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500) | ||
21 | #define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600) | ||
22 | #define S5P_CLKGATE_IP_LEFTBUS S5P_CLKREG(0x04800) | ||
23 | |||
24 | #define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500) | ||
25 | #define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) | ||
26 | #define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) | ||
27 | |||
28 | #define S5P_EPLL_LOCK S5P_CLKREG(0x0C010) | ||
29 | #define S5P_VPLL_LOCK S5P_CLKREG(0x0C020) | ||
30 | |||
31 | #define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) | ||
32 | #define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) | ||
33 | #define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) | ||
34 | #define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) | ||
35 | |||
36 | #define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) | ||
37 | #define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) | ||
38 | #define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) | ||
39 | #define S5P_CLKSRC_TV S5P_CLKREG(0x0C224) | ||
40 | #define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) | ||
41 | #define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C) | ||
42 | #define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) | ||
43 | #define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) | ||
44 | #define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) | ||
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_CLKDIV_TOP S5P_CLKREG(0x0C510) | ||
51 | #define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520) | ||
52 | #define S5P_CLKDIV_TV S5P_CLKREG(0x0C524) | ||
53 | #define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528) | ||
54 | #define S5P_CLKDIV_G3D S5P_CLKREG(0x0C52C) | ||
55 | #define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530) | ||
56 | #define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534) | ||
57 | #define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538) | ||
58 | #define S5P_CLKDIV_MAUDIO S5P_CLKREG(0x0C53C) | ||
59 | #define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540) | ||
60 | #define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544) | ||
61 | #define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548) | ||
62 | #define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C) | ||
63 | #define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) | ||
64 | #define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) | ||
65 | #define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) | ||
66 | #define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) | ||
67 | #define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) | ||
68 | #define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) | ||
69 | #define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580) | ||
70 | |||
71 | #define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) | ||
72 | #define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) | ||
73 | #define S5P_CLKSRC_MASK_TV S5P_CLKREG(0x0C324) | ||
74 | #define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334) | ||
75 | #define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338) | ||
76 | #define S5P_CLKSRC_MASK_MAUDIO S5P_CLKREG(0x0C33C) | ||
77 | #define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340) | ||
78 | #define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) | ||
79 | #define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) | ||
80 | |||
81 | #define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610) | ||
82 | |||
83 | #define S5P_CLKGATE_SCLKCAM S5P_CLKREG(0x0C820) | ||
84 | #define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) | ||
85 | #define S5P_CLKGATE_IP_TV S5P_CLKREG(0x0C924) | ||
86 | #define S5P_CLKGATE_IP_MFC S5P_CLKREG(0x0C928) | ||
87 | #define S5P_CLKGATE_IP_G3D S5P_CLKREG(0x0C92C) | ||
88 | #define S5P_CLKGATE_IP_IMAGE S5P_CLKREG(0x0C930) | ||
89 | #define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) | ||
90 | #define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938) | ||
91 | #define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940) | ||
92 | #define S5P_CLKGATE_IP_GPS S5P_CLKREG(0x0C94C) | ||
93 | #define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) | ||
94 | #define S5P_CLKGATE_IP_PERIR S5P_CLKREG(0x0C960) | ||
95 | #define S5P_CLKGATE_BLOCK S5P_CLKREG(0x0C970) | ||
96 | |||
97 | #define S5P_CLKSRC_MASK_DMC S5P_CLKREG(0x10300) | ||
98 | #define S5P_CLKSRC_DMC S5P_CLKREG(0x10200) | ||
99 | #define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500) | ||
100 | #define S5P_CLKDIV_DMC1 S5P_CLKREG(0x10504) | ||
101 | #define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600) | ||
102 | #define S5P_CLKGATE_IP_DMC S5P_CLKREG(0x10900) | ||
103 | |||
104 | #define S5P_APLL_LOCK S5P_CLKREG(0x14000) | ||
105 | #define S5P_MPLL_LOCK S5P_CLKREG(0x14004) | ||
106 | #define S5P_APLL_CON0 S5P_CLKREG(0x14100) | ||
107 | #define S5P_APLL_CON1 S5P_CLKREG(0x14104) | ||
108 | #define S5P_MPLL_CON0 S5P_CLKREG(0x14108) | ||
109 | #define S5P_MPLL_CON1 S5P_CLKREG(0x1410C) | ||
110 | |||
111 | #define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) | ||
112 | #define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) | ||
113 | |||
114 | #define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) | ||
115 | #define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504) | ||
116 | #define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) | ||
117 | #define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604) | ||
118 | |||
119 | #define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) | ||
120 | #define S5P_CLKGATE_IP_CPU S5P_CLKREG(0x14900) | ||
121 | |||
122 | #define S5P_APLL_LOCKTIME (0x1C20) /* 300us */ | ||
123 | |||
124 | #define S5P_APLLCON0_ENABLE_SHIFT (31) | ||
125 | #define S5P_APLLCON0_LOCKED_SHIFT (29) | ||
126 | #define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) | ||
127 | #define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) | ||
128 | |||
129 | #define S5P_EPLLCON0_ENABLE_SHIFT (31) | ||
130 | #define S5P_EPLLCON0_LOCKED_SHIFT (29) | ||
131 | |||
132 | #define S5P_VPLLCON0_ENABLE_SHIFT (31) | ||
133 | #define S5P_VPLLCON0_LOCKED_SHIFT (29) | ||
134 | |||
135 | #define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) | ||
136 | #define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) | ||
137 | |||
138 | #define S5P_CLKDIV_CPU0_CORE_SHIFT (0) | ||
139 | #define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT) | ||
140 | #define S5P_CLKDIV_CPU0_COREM0_SHIFT (4) | ||
141 | #define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT) | ||
142 | #define S5P_CLKDIV_CPU0_COREM1_SHIFT (8) | ||
143 | #define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT) | ||
144 | #define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12) | ||
145 | #define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT) | ||
146 | #define S5P_CLKDIV_CPU0_ATB_SHIFT (16) | ||
147 | #define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT) | ||
148 | #define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20) | ||
149 | #define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) | ||
150 | #define S5P_CLKDIV_CPU0_APLL_SHIFT (24) | ||
151 | #define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT) | ||
152 | |||
153 | #define S5P_CLKDIV_DMC0_ACP_SHIFT (0) | ||
154 | #define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT) | ||
155 | #define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4) | ||
156 | #define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) | ||
157 | #define S5P_CLKDIV_DMC0_DPHY_SHIFT (8) | ||
158 | #define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT) | ||
159 | #define S5P_CLKDIV_DMC0_DMC_SHIFT (12) | ||
160 | #define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT) | ||
161 | #define S5P_CLKDIV_DMC0_DMCD_SHIFT (16) | ||
162 | #define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT) | ||
163 | #define S5P_CLKDIV_DMC0_DMCP_SHIFT (20) | ||
164 | #define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT) | ||
165 | #define S5P_CLKDIV_DMC0_COPY2_SHIFT (24) | ||
166 | #define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT) | ||
167 | #define S5P_CLKDIV_DMC0_CORETI_SHIFT (28) | ||
168 | #define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT) | ||
169 | |||
170 | #define S5P_CLKDIV_TOP_ACLK200_SHIFT (0) | ||
171 | #define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT) | ||
172 | #define S5P_CLKDIV_TOP_ACLK100_SHIFT (4) | ||
173 | #define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT) | ||
174 | #define S5P_CLKDIV_TOP_ACLK160_SHIFT (8) | ||
175 | #define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT) | ||
176 | #define S5P_CLKDIV_TOP_ACLK133_SHIFT (12) | ||
177 | #define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT) | ||
178 | #define S5P_CLKDIV_TOP_ONENAND_SHIFT (16) | ||
179 | #define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT) | ||
180 | |||
181 | #define S5P_CLKDIV_BUS_GDLR_SHIFT (0) | ||
182 | #define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT) | ||
183 | #define S5P_CLKDIV_BUS_GPLR_SHIFT (4) | ||
184 | #define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) | ||
185 | |||
186 | /* Compatibility defines and inclusion */ | ||
187 | |||
188 | #include <mach/regs-pmu.h> | ||
189 | |||
190 | #define S5P_EPLL_CON S5P_EPLL_CON0 | ||
191 | |||
192 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/regs-gpio.h b/arch/arm/mach-exynos4/include/mach/regs-gpio.h new file mode 100644 index 00000000000..1401b21663a --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/regs-irq.h b/arch/arm/mach-exynos4/include/mach/regs-irq.h new file mode 100644 index 00000000000..9c7b4bfd546 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/regs-mct.h b/arch/arm/mach-exynos4/include/mach/regs-mct.h new file mode 100644 index 00000000000..ca9c8434b02 --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/regs-mct.h | |||
@@ -0,0 +1,52 @@ | |||
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_L0_BASE EXYNOS4_MCTREG(0x300) | ||
35 | #define EXYNOS4_MCT_L1_BASE EXYNOS4_MCTREG(0x400) | ||
36 | |||
37 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
38 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
39 | #define MCT_L_TCON_OFFSET (0x20) | ||
40 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
41 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
42 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
43 | |||
44 | #define MCT_G_TCON_START (1 << 8) | ||
45 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
46 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
47 | |||
48 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
49 | #define MCT_L_TCON_INT_START (1 << 1) | ||
50 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
51 | |||
52 | #endif /* __ASM_ARCH_REGS_MCT_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/regs-mem.h b/arch/arm/mach-exynos4/include/mach/regs-mem.h new file mode 100644 index 00000000000..0368b5a2725 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/regs-pmu.h b/arch/arm/mach-exynos4/include/mach/regs-pmu.h new file mode 100644 index 00000000000..cdf9b47c303 --- /dev/null +++ b/arch/arm/mach-exynos4/include/mach/regs-pmu.h | |||
@@ -0,0 +1,168 @@ | |||
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_STANDBY_WFE0 (1 << 24) | ||
29 | #define S5P_USE_STANDBY_WFE1 (1 << 25) | ||
30 | #define S5P_USE_MASK ((0x3 << 16) | (0x3 << 24)) | ||
31 | |||
32 | #define S5P_SWRESET S5P_PMUREG(0x0400) | ||
33 | |||
34 | #define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) | ||
35 | #define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) | ||
36 | #define S5P_WAKEUP_MASK S5P_PMUREG(0x0608) | ||
37 | |||
38 | #define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708) | ||
39 | #define S5P_USBHOST_PHY_ENABLE (1 << 0) | ||
40 | |||
41 | #define S5P_MIPI_DPHY_CONTROL(n) S5P_PMUREG(0x0710 + (n) * 4) | ||
42 | #define S5P_MIPI_DPHY_ENABLE (1 << 0) | ||
43 | #define S5P_MIPI_DPHY_SRESETN (1 << 1) | ||
44 | #define S5P_MIPI_DPHY_MRESETN (1 << 2) | ||
45 | |||
46 | #define S5P_PMU_SATA_PHY_CONTROL S5P_PMUREG(0x0720) | ||
47 | #define S5P_INFORM0 S5P_PMUREG(0x0800) | ||
48 | #define S5P_INFORM1 S5P_PMUREG(0x0804) | ||
49 | #define S5P_INFORM2 S5P_PMUREG(0x0808) | ||
50 | #define S5P_INFORM3 S5P_PMUREG(0x080C) | ||
51 | #define S5P_INFORM4 S5P_PMUREG(0x0810) | ||
52 | #define S5P_INFORM5 S5P_PMUREG(0x0814) | ||
53 | #define S5P_INFORM6 S5P_PMUREG(0x0818) | ||
54 | #define S5P_INFORM7 S5P_PMUREG(0x081C) | ||
55 | |||
56 | #define S5P_ARM_CORE0_LOWPWR S5P_PMUREG(0x1000) | ||
57 | #define S5P_DIS_IRQ_CORE0 S5P_PMUREG(0x1004) | ||
58 | #define S5P_DIS_IRQ_CENTRAL0 S5P_PMUREG(0x1008) | ||
59 | #define S5P_ARM_CORE1_LOWPWR S5P_PMUREG(0x1010) | ||
60 | #define S5P_DIS_IRQ_CORE1 S5P_PMUREG(0x1014) | ||
61 | #define S5P_DIS_IRQ_CENTRAL1 S5P_PMUREG(0x1018) | ||
62 | #define S5P_ARM_COMMON_LOWPWR S5P_PMUREG(0x1080) | ||
63 | #define S5P_L2_0_LOWPWR S5P_PMUREG(0x10C0) | ||
64 | #define S5P_L2_1_LOWPWR S5P_PMUREG(0x10C4) | ||
65 | #define S5P_CMU_ACLKSTOP_LOWPWR S5P_PMUREG(0x1100) | ||
66 | #define S5P_CMU_SCLKSTOP_LOWPWR S5P_PMUREG(0x1104) | ||
67 | #define S5P_CMU_RESET_LOWPWR S5P_PMUREG(0x110C) | ||
68 | #define S5P_APLL_SYSCLK_LOWPWR S5P_PMUREG(0x1120) | ||
69 | #define S5P_MPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1124) | ||
70 | #define S5P_VPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1128) | ||
71 | #define S5P_EPLL_SYSCLK_LOWPWR S5P_PMUREG(0x112C) | ||
72 | #define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR S5P_PMUREG(0x1138) | ||
73 | #define S5P_CMU_RESET_GPSALIVE_LOWPWR S5P_PMUREG(0x113C) | ||
74 | #define S5P_CMU_CLKSTOP_CAM_LOWPWR S5P_PMUREG(0x1140) | ||
75 | #define S5P_CMU_CLKSTOP_TV_LOWPWR S5P_PMUREG(0x1144) | ||
76 | #define S5P_CMU_CLKSTOP_MFC_LOWPWR S5P_PMUREG(0x1148) | ||
77 | #define S5P_CMU_CLKSTOP_G3D_LOWPWR S5P_PMUREG(0x114C) | ||
78 | #define S5P_CMU_CLKSTOP_LCD0_LOWPWR S5P_PMUREG(0x1150) | ||
79 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) | ||
80 | #define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR S5P_PMUREG(0x1158) | ||
81 | #define S5P_CMU_CLKSTOP_GPS_LOWPWR S5P_PMUREG(0x115C) | ||
82 | #define S5P_CMU_RESET_CAM_LOWPWR S5P_PMUREG(0x1160) | ||
83 | #define S5P_CMU_RESET_TV_LOWPWR S5P_PMUREG(0x1164) | ||
84 | #define S5P_CMU_RESET_MFC_LOWPWR S5P_PMUREG(0x1168) | ||
85 | #define S5P_CMU_RESET_G3D_LOWPWR S5P_PMUREG(0x116C) | ||
86 | #define S5P_CMU_RESET_LCD0_LOWPWR S5P_PMUREG(0x1170) | ||
87 | #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) | ||
88 | #define S5P_CMU_RESET_MAUDIO_LOWPWR S5P_PMUREG(0x1178) | ||
89 | #define S5P_CMU_RESET_GPS_LOWPWR S5P_PMUREG(0x117C) | ||
90 | #define S5P_TOP_BUS_LOWPWR S5P_PMUREG(0x1180) | ||
91 | #define S5P_TOP_RETENTION_LOWPWR S5P_PMUREG(0x1184) | ||
92 | #define S5P_TOP_PWR_LOWPWR S5P_PMUREG(0x1188) | ||
93 | #define S5P_LOGIC_RESET_LOWPWR S5P_PMUREG(0x11A0) | ||
94 | #define S5P_ONENAND_MEM_LOWPWR S5P_PMUREG(0x11C0) | ||
95 | #define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) | ||
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_PCIE_MEM_LOWPWR S5P_PMUREG(0x11E0) | ||
102 | #define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) | ||
103 | #define S5P_PAD_RETENTION_DRAM_LOWPWR S5P_PMUREG(0x1200) | ||
104 | #define S5P_PAD_RETENTION_MAUDIO_LOWPWR S5P_PMUREG(0x1204) | ||
105 | #define S5P_PAD_RETENTION_GPIO_LOWPWR S5P_PMUREG(0x1220) | ||
106 | #define S5P_PAD_RETENTION_UART_LOWPWR S5P_PMUREG(0x1224) | ||
107 | #define S5P_PAD_RETENTION_MMCA_LOWPWR S5P_PMUREG(0x1228) | ||
108 | #define S5P_PAD_RETENTION_MMCB_LOWPWR S5P_PMUREG(0x122C) | ||
109 | #define S5P_PAD_RETENTION_EBIA_LOWPWR S5P_PMUREG(0x1230) | ||
110 | #define S5P_PAD_RETENTION_EBIB_LOWPWR S5P_PMUREG(0x1234) | ||
111 | #define S5P_PAD_RETENTION_ISOLATION_LOWPWR S5P_PMUREG(0x1240) | ||
112 | #define S5P_PAD_RETENTION_ALV_SEL_LOWPWR S5P_PMUREG(0x1260) | ||
113 | #define S5P_XUSBXTI_LOWPWR S5P_PMUREG(0x1280) | ||
114 | #define S5P_XXTI_LOWPWR S5P_PMUREG(0x1284) | ||
115 | #define S5P_EXT_REGULATOR_LOWPWR S5P_PMUREG(0x12C0) | ||
116 | #define S5P_GPIO_MODE_LOWPWR S5P_PMUREG(0x1300) | ||
117 | #define S5P_GPIO_MODE_MAUDIO_LOWPWR S5P_PMUREG(0x1340) | ||
118 | #define S5P_CAM_LOWPWR S5P_PMUREG(0x1380) | ||
119 | #define S5P_TV_LOWPWR S5P_PMUREG(0x1384) | ||
120 | #define S5P_MFC_LOWPWR S5P_PMUREG(0x1388) | ||
121 | #define S5P_G3D_LOWPWR S5P_PMUREG(0x138C) | ||
122 | #define S5P_LCD0_LOWPWR S5P_PMUREG(0x1390) | ||
123 | #define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) | ||
124 | #define S5P_MAUDIO_LOWPWR S5P_PMUREG(0x1398) | ||
125 | #define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) | ||
126 | #define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) | ||
127 | |||
128 | #define S5P_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) | ||
129 | #define S5P_ARM_CORE0_OPTION S5P_PMUREG(0x2008) | ||
130 | #define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) | ||
131 | #define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) | ||
132 | #define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088) | ||
133 | |||
134 | #define S5P_ARM_COMMON_OPTION S5P_PMUREG(0x2408) | ||
135 | #define S5P_TOP_PWR_OPTION S5P_PMUREG(0x2C48) | ||
136 | #define S5P_CAM_OPTION S5P_PMUREG(0x3C08) | ||
137 | #define S5P_TV_OPTION S5P_PMUREG(0x3C28) | ||
138 | #define S5P_MFC_OPTION S5P_PMUREG(0x3C48) | ||
139 | #define S5P_G3D_OPTION S5P_PMUREG(0x3C68) | ||
140 | #define S5P_LCD0_OPTION S5P_PMUREG(0x3C88) | ||
141 | #define S5P_LCD1_OPTION S5P_PMUREG(0x3CA8) | ||
142 | #define S5P_MAUDIO_OPTION S5P_PMUREG(0x3CC8) | ||
143 | #define S5P_GPS_OPTION S5P_PMUREG(0x3CE8) | ||
144 | #define S5P_GPS_ALIVE_OPTION S5P_PMUREG(0x3D08) | ||
145 | |||
146 | #define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) | ||
147 | #define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) | ||
148 | #define S5P_PAD_RET_UART_OPTION S5P_PMUREG(0x3128) | ||
149 | #define S5P_PAD_RET_MMCA_OPTION S5P_PMUREG(0x3148) | ||
150 | #define S5P_PAD_RET_MMCB_OPTION S5P_PMUREG(0x3168) | ||
151 | #define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) | ||
152 | #define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) | ||
153 | |||
154 | #define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00) | ||
155 | #define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20) | ||
156 | #define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40) | ||
157 | #define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60) | ||
158 | #define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80) | ||
159 | #define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0) | ||
160 | #define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0) | ||
161 | |||
162 | #define S5P_PMU_SATA_PHY_CONTROL_EN 0x1 | ||
163 | #define S5P_CORE_LOCAL_PWR_EN 0x3 | ||
164 | #define S5P_INT_LOCAL_PWR_EN 0x7 | ||
165 | |||
166 | #define S5P_CHECK_SLEEP 0x00000BAD | ||
167 | |||
168 | #endif /* __ASM_ARCH_REGS_PMU_H */ | ||
diff --git a/arch/arm/mach-exynos4/include/mach/regs-sysmmu.h b/arch/arm/mach-exynos4/include/mach/regs-sysmmu.h new file mode 100644 index 00000000000..68ff6ad08a2 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/regs-usb-phy.h b/arch/arm/mach-exynos4/include/mach/regs-usb-phy.h new file mode 100644 index 00000000000..c337cf3a71b --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/sysmmu.h b/arch/arm/mach-exynos4/include/mach/sysmmu.h new file mode 100644 index 00000000000..6a5fbb534e8 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/system.h b/arch/arm/mach-exynos4/include/mach/system.h new file mode 100644 index 00000000000..5e3220c18fc --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/timex.h b/arch/arm/mach-exynos4/include/mach/timex.h new file mode 100644 index 00000000000..6d138750a70 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/uncompress.h b/arch/arm/mach-exynos4/include/mach/uncompress.h new file mode 100644 index 00000000000..21d97bcd9ac --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/include/mach/vmalloc.h b/arch/arm/mach-exynos4/include/mach/vmalloc.h new file mode 100644 index 00000000000..284330e571d --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/init.c b/arch/arm/mach-exynos4/init.c new file mode 100644 index 00000000000..a8a83e3881a --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/irq-combiner.c b/arch/arm/mach-exynos4/irq-combiner.c new file mode 100644 index 00000000000..5a2758ab055 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/irq-eint.c b/arch/arm/mach-exynos4/irq-eint.c new file mode 100644 index 00000000000..badb8c66fc9 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/mach-armlex4210.c b/arch/arm/mach-exynos4/mach-armlex4210.c new file mode 100644 index 00000000000..b482c6285fc --- /dev/null +++ b/arch/arm/mach-exynos4/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 | .boot_params = S5P_PA_SDRAM + 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-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-nuri.c new file mode 100644 index 00000000000..43be71b799c --- /dev/null +++ b/arch/arm/mach-exynos4/mach-nuri.c | |||
@@ -0,0 +1,1161 @@ | |||
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 | |||
31 | #include <asm/mach/arch.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <plat/adc.h> | ||
35 | #include <plat/regs-serial.h> | ||
36 | #include <plat/exynos4.h> | ||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/devs.h> | ||
39 | #include <plat/sdhci.h> | ||
40 | #include <plat/ehci.h> | ||
41 | #include <plat/clock.h> | ||
42 | #include <plat/gpio-cfg.h> | ||
43 | #include <plat/iic.h> | ||
44 | #include <plat/mfc.h> | ||
45 | #include <plat/pd.h> | ||
46 | |||
47 | #include <mach/map.h> | ||
48 | |||
49 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
50 | #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
51 | S3C2410_UCON_RXILEVEL | \ | ||
52 | S3C2410_UCON_TXIRQMODE | \ | ||
53 | S3C2410_UCON_RXIRQMODE | \ | ||
54 | S3C2410_UCON_RXFIFO_TOI | \ | ||
55 | S3C2443_UCON_RXERR_IRQEN) | ||
56 | |||
57 | #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
58 | |||
59 | #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
60 | S5PV210_UFCON_TXTRIG256 | \ | ||
61 | S5PV210_UFCON_RXTRIG256) | ||
62 | |||
63 | enum fixed_regulator_id { | ||
64 | FIXED_REG_ID_MMC = 0, | ||
65 | FIXED_REG_ID_MAX8903, | ||
66 | }; | ||
67 | |||
68 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { | ||
69 | { | ||
70 | .hwport = 0, | ||
71 | .ucon = NURI_UCON_DEFAULT, | ||
72 | .ulcon = NURI_ULCON_DEFAULT, | ||
73 | .ufcon = NURI_UFCON_DEFAULT, | ||
74 | }, | ||
75 | { | ||
76 | .hwport = 1, | ||
77 | .ucon = NURI_UCON_DEFAULT, | ||
78 | .ulcon = NURI_ULCON_DEFAULT, | ||
79 | .ufcon = NURI_UFCON_DEFAULT, | ||
80 | }, | ||
81 | { | ||
82 | .hwport = 2, | ||
83 | .ucon = NURI_UCON_DEFAULT, | ||
84 | .ulcon = NURI_ULCON_DEFAULT, | ||
85 | .ufcon = NURI_UFCON_DEFAULT, | ||
86 | }, | ||
87 | { | ||
88 | .hwport = 3, | ||
89 | .ucon = NURI_UCON_DEFAULT, | ||
90 | .ulcon = NURI_ULCON_DEFAULT, | ||
91 | .ufcon = NURI_UFCON_DEFAULT, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | /* eMMC */ | ||
96 | static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = { | ||
97 | .max_width = 8, | ||
98 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | ||
99 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
100 | MMC_CAP_DISABLE | MMC_CAP_ERASE), | ||
101 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
102 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
103 | }; | ||
104 | |||
105 | static struct regulator_consumer_supply emmc_supplies[] = { | ||
106 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | ||
107 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), | ||
108 | }; | ||
109 | |||
110 | static struct regulator_init_data emmc_fixed_voltage_init_data = { | ||
111 | .constraints = { | ||
112 | .name = "VMEM_VDD_2.8V", | ||
113 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
114 | }, | ||
115 | .num_consumer_supplies = ARRAY_SIZE(emmc_supplies), | ||
116 | .consumer_supplies = emmc_supplies, | ||
117 | }; | ||
118 | |||
119 | static struct fixed_voltage_config emmc_fixed_voltage_config = { | ||
120 | .supply_name = "MASSMEMORY_EN (inverted)", | ||
121 | .microvolts = 2800000, | ||
122 | .gpio = EXYNOS4_GPL1(1), | ||
123 | .enable_high = false, | ||
124 | .init_data = &emmc_fixed_voltage_init_data, | ||
125 | }; | ||
126 | |||
127 | static struct platform_device emmc_fixed_voltage = { | ||
128 | .name = "reg-fixed-voltage", | ||
129 | .id = FIXED_REG_ID_MMC, | ||
130 | .dev = { | ||
131 | .platform_data = &emmc_fixed_voltage_config, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | /* SD */ | ||
136 | static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = { | ||
137 | .max_width = 4, | ||
138 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
139 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
140 | MMC_CAP_DISABLE, | ||
141 | .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */ | ||
142 | .ext_cd_gpio_invert = 1, | ||
143 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
144 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
145 | }; | ||
146 | |||
147 | /* WLAN */ | ||
148 | static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = { | ||
149 | .max_width = 4, | ||
150 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
151 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, | ||
152 | .cd_type = S3C_SDHCI_CD_EXTERNAL, | ||
153 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
154 | }; | ||
155 | |||
156 | static void __init nuri_sdhci_init(void) | ||
157 | { | ||
158 | s3c_sdhci0_set_platdata(&nuri_hsmmc0_data); | ||
159 | s3c_sdhci2_set_platdata(&nuri_hsmmc2_data); | ||
160 | s3c_sdhci3_set_platdata(&nuri_hsmmc3_data); | ||
161 | } | ||
162 | |||
163 | /* GPIO KEYS */ | ||
164 | static struct gpio_keys_button nuri_gpio_keys_tables[] = { | ||
165 | { | ||
166 | .code = KEY_VOLUMEUP, | ||
167 | .gpio = EXYNOS4_GPX2(0), /* XEINT16 */ | ||
168 | .desc = "gpio-keys: KEY_VOLUMEUP", | ||
169 | .type = EV_KEY, | ||
170 | .active_low = 1, | ||
171 | .debounce_interval = 1, | ||
172 | }, { | ||
173 | .code = KEY_VOLUMEDOWN, | ||
174 | .gpio = EXYNOS4_GPX2(1), /* XEINT17 */ | ||
175 | .desc = "gpio-keys: KEY_VOLUMEDOWN", | ||
176 | .type = EV_KEY, | ||
177 | .active_low = 1, | ||
178 | .debounce_interval = 1, | ||
179 | }, { | ||
180 | .code = KEY_POWER, | ||
181 | .gpio = EXYNOS4_GPX2(7), /* XEINT23 */ | ||
182 | .desc = "gpio-keys: KEY_POWER", | ||
183 | .type = EV_KEY, | ||
184 | .active_low = 1, | ||
185 | .wakeup = 1, | ||
186 | .debounce_interval = 1, | ||
187 | }, | ||
188 | }; | ||
189 | |||
190 | static struct gpio_keys_platform_data nuri_gpio_keys_data = { | ||
191 | .buttons = nuri_gpio_keys_tables, | ||
192 | .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables), | ||
193 | }; | ||
194 | |||
195 | static struct platform_device nuri_gpio_keys = { | ||
196 | .name = "gpio-keys", | ||
197 | .dev = { | ||
198 | .platform_data = &nuri_gpio_keys_data, | ||
199 | }, | ||
200 | }; | ||
201 | |||
202 | static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power) | ||
203 | { | ||
204 | int gpio = EXYNOS4_GPE1(5); | ||
205 | |||
206 | gpio_request(gpio, "LVDS_nSHDN"); | ||
207 | gpio_direction_output(gpio, power); | ||
208 | gpio_free(gpio); | ||
209 | } | ||
210 | |||
211 | static int nuri_bl_init(struct device *dev) | ||
212 | { | ||
213 | int ret, gpio = EXYNOS4_GPE2(3); | ||
214 | |||
215 | ret = gpio_request(gpio, "LCD_LDO_EN"); | ||
216 | if (!ret) | ||
217 | gpio_direction_output(gpio, 0); | ||
218 | |||
219 | return ret; | ||
220 | } | ||
221 | |||
222 | static int nuri_bl_notify(struct device *dev, int brightness) | ||
223 | { | ||
224 | if (brightness < 1) | ||
225 | brightness = 0; | ||
226 | |||
227 | gpio_set_value(EXYNOS4_GPE2(3), 1); | ||
228 | |||
229 | return brightness; | ||
230 | } | ||
231 | |||
232 | static void nuri_bl_exit(struct device *dev) | ||
233 | { | ||
234 | gpio_free(EXYNOS4_GPE2(3)); | ||
235 | } | ||
236 | |||
237 | /* nuri pwm backlight */ | ||
238 | static struct platform_pwm_backlight_data nuri_backlight_data = { | ||
239 | .pwm_id = 0, | ||
240 | .pwm_period_ns = 30000, | ||
241 | .max_brightness = 100, | ||
242 | .dft_brightness = 50, | ||
243 | .init = nuri_bl_init, | ||
244 | .notify = nuri_bl_notify, | ||
245 | .exit = nuri_bl_exit, | ||
246 | }; | ||
247 | |||
248 | static struct platform_device nuri_backlight_device = { | ||
249 | .name = "pwm-backlight", | ||
250 | .id = -1, | ||
251 | .dev = { | ||
252 | .parent = &s3c_device_timer[0].dev, | ||
253 | .platform_data = &nuri_backlight_data, | ||
254 | }, | ||
255 | }; | ||
256 | |||
257 | static struct plat_lcd_data nuri_lcd_platform_data = { | ||
258 | .set_power = nuri_lcd_power_on, | ||
259 | }; | ||
260 | |||
261 | static struct platform_device nuri_lcd_device = { | ||
262 | .name = "platform-lcd", | ||
263 | .id = -1, | ||
264 | .dev = { | ||
265 | .platform_data = &nuri_lcd_platform_data, | ||
266 | }, | ||
267 | }; | ||
268 | |||
269 | /* I2C1 */ | ||
270 | static struct i2c_board_info i2c1_devs[] __initdata = { | ||
271 | /* Gyro, To be updated */ | ||
272 | }; | ||
273 | |||
274 | /* TSP */ | ||
275 | static u8 mxt_init_vals[] = { | ||
276 | /* MXT_GEN_COMMAND(6) */ | ||
277 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
278 | /* MXT_GEN_POWER(7) */ | ||
279 | 0x20, 0xff, 0x32, | ||
280 | /* MXT_GEN_ACQUIRE(8) */ | ||
281 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, | ||
282 | /* MXT_TOUCH_MULTI(9) */ | ||
283 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
284 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | ||
285 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
286 | 0x00, | ||
287 | /* MXT_TOUCH_KEYARRAY(15) */ | ||
288 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
289 | 0x00, | ||
290 | /* MXT_SPT_GPIOPWM(19) */ | ||
291 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
293 | /* MXT_PROCI_GRIPFACE(20) */ | ||
294 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, | ||
295 | 0x0f, 0x0a, | ||
296 | /* MXT_PROCG_NOISE(22) */ | ||
297 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, | ||
298 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, | ||
299 | /* MXT_TOUCH_PROXIMITY(23) */ | ||
300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
301 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
302 | /* MXT_PROCI_ONETOUCH(24) */ | ||
303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
304 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
305 | /* MXT_SPT_SELFTEST(25) */ | ||
306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
307 | 0x00, 0x00, 0x00, 0x00, | ||
308 | /* MXT_PROCI_TWOTOUCH(27) */ | ||
309 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
310 | /* MXT_SPT_CTECONFIG(28) */ | ||
311 | 0x00, 0x00, 0x02, 0x08, 0x10, 0x00, | ||
312 | }; | ||
313 | |||
314 | static struct mxt_platform_data mxt_platform_data = { | ||
315 | .config = mxt_init_vals, | ||
316 | .config_length = ARRAY_SIZE(mxt_init_vals), | ||
317 | |||
318 | .x_line = 18, | ||
319 | .y_line = 11, | ||
320 | .x_size = 1024, | ||
321 | .y_size = 600, | ||
322 | .blen = 0x1, | ||
323 | .threshold = 0x28, | ||
324 | .voltage = 2800000, /* 2.8V */ | ||
325 | .orient = MXT_DIAGONAL_COUNTER, | ||
326 | .irqflags = IRQF_TRIGGER_FALLING, | ||
327 | }; | ||
328 | |||
329 | static struct s3c2410_platform_i2c i2c3_data __initdata = { | ||
330 | .flags = 0, | ||
331 | .bus_num = 3, | ||
332 | .slave_addr = 0x10, | ||
333 | .frequency = 400 * 1000, | ||
334 | .sda_delay = 100, | ||
335 | }; | ||
336 | |||
337 | static struct i2c_board_info i2c3_devs[] __initdata = { | ||
338 | { | ||
339 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), | ||
340 | .platform_data = &mxt_platform_data, | ||
341 | .irq = IRQ_EINT(4), | ||
342 | }, | ||
343 | }; | ||
344 | |||
345 | static void __init nuri_tsp_init(void) | ||
346 | { | ||
347 | int gpio; | ||
348 | |||
349 | /* TOUCH_INT: XEINT_4 */ | ||
350 | gpio = EXYNOS4_GPX0(4); | ||
351 | gpio_request(gpio, "TOUCH_INT"); | ||
352 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
353 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
354 | } | ||
355 | |||
356 | static struct regulator_consumer_supply __initdata max8997_ldo1_[] = { | ||
357 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */ | ||
358 | }; | ||
359 | static struct regulator_consumer_supply __initdata max8997_ldo3_[] = { | ||
360 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ | ||
361 | }; | ||
362 | static struct regulator_consumer_supply __initdata max8997_ldo4_[] = { | ||
363 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ | ||
364 | }; | ||
365 | static struct regulator_consumer_supply __initdata max8997_ldo5_[] = { | ||
366 | REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */ | ||
367 | }; | ||
368 | static struct regulator_consumer_supply __initdata max8997_ldo7_[] = { | ||
369 | REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */ | ||
370 | }; | ||
371 | static struct regulator_consumer_supply __initdata max8997_ldo8_[] = { | ||
372 | REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */ | ||
373 | REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */ | ||
374 | }; | ||
375 | static struct regulator_consumer_supply __initdata max8997_ldo11_[] = { | ||
376 | REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */ | ||
377 | }; | ||
378 | static struct regulator_consumer_supply __initdata max8997_ldo12_[] = { | ||
379 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ | ||
380 | }; | ||
381 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { | ||
382 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ | ||
383 | }; | ||
384 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { | ||
385 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), | ||
386 | }; | ||
387 | static struct regulator_consumer_supply __initdata max8997_ldo15_[] = { | ||
388 | REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */ | ||
389 | }; | ||
390 | static struct regulator_consumer_supply __initdata max8997_ldo16_[] = { | ||
391 | REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */ | ||
392 | }; | ||
393 | static struct regulator_consumer_supply __initdata max8997_ldo18_[] = { | ||
394 | REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */ | ||
395 | }; | ||
396 | static struct regulator_consumer_supply __initdata max8997_buck1_[] = { | ||
397 | REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ | ||
398 | }; | ||
399 | static struct regulator_consumer_supply __initdata max8997_buck2_[] = { | ||
400 | REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */ | ||
401 | }; | ||
402 | static struct regulator_consumer_supply __initdata max8997_buck3_[] = { | ||
403 | REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */ | ||
404 | }; | ||
405 | static struct regulator_consumer_supply __initdata max8997_buck4_[] = { | ||
406 | REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */ | ||
407 | }; | ||
408 | static struct regulator_consumer_supply __initdata max8997_buck6_[] = { | ||
409 | REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */ | ||
410 | }; | ||
411 | static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = { | ||
412 | REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */ | ||
413 | }; | ||
414 | static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = { | ||
415 | REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */ | ||
416 | }; | ||
417 | |||
418 | static struct regulator_consumer_supply __initdata max8997_charger_[] = { | ||
419 | REGULATOR_SUPPLY("vinchg1", "charger-manager.0"), | ||
420 | }; | ||
421 | static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = { | ||
422 | REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */ | ||
423 | }; | ||
424 | |||
425 | static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = { | ||
426 | REGULATOR_SUPPLY("gps_clk", "bcm4751"), | ||
427 | REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"), | ||
428 | REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"), | ||
429 | }; | ||
430 | |||
431 | static struct regulator_init_data __initdata max8997_ldo1_data = { | ||
432 | .constraints = { | ||
433 | .name = "VADC_3.3V_C210", | ||
434 | .min_uV = 3300000, | ||
435 | .max_uV = 3300000, | ||
436 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
437 | .apply_uV = 1, | ||
438 | .state_mem = { | ||
439 | .disabled = 1, | ||
440 | }, | ||
441 | }, | ||
442 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_), | ||
443 | .consumer_supplies = max8997_ldo1_, | ||
444 | }; | ||
445 | |||
446 | static struct regulator_init_data __initdata max8997_ldo2_data = { | ||
447 | .constraints = { | ||
448 | .name = "VALIVE_1.1V_C210", | ||
449 | .min_uV = 1100000, | ||
450 | .max_uV = 1100000, | ||
451 | .apply_uV = 1, | ||
452 | .always_on = 1, | ||
453 | .state_mem = { | ||
454 | .enabled = 1, | ||
455 | }, | ||
456 | }, | ||
457 | }; | ||
458 | |||
459 | static struct regulator_init_data __initdata max8997_ldo3_data = { | ||
460 | .constraints = { | ||
461 | .name = "VUSB_1.1V_C210", | ||
462 | .min_uV = 1100000, | ||
463 | .max_uV = 1100000, | ||
464 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
465 | .apply_uV = 1, | ||
466 | .state_mem = { | ||
467 | .disabled = 1, | ||
468 | }, | ||
469 | }, | ||
470 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_), | ||
471 | .consumer_supplies = max8997_ldo3_, | ||
472 | }; | ||
473 | |||
474 | static struct regulator_init_data __initdata max8997_ldo4_data = { | ||
475 | .constraints = { | ||
476 | .name = "VMIPI_1.8V", | ||
477 | .min_uV = 1800000, | ||
478 | .max_uV = 1800000, | ||
479 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
480 | .apply_uV = 1, | ||
481 | .state_mem = { | ||
482 | .disabled = 1, | ||
483 | }, | ||
484 | }, | ||
485 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_), | ||
486 | .consumer_supplies = max8997_ldo4_, | ||
487 | }; | ||
488 | |||
489 | static struct regulator_init_data __initdata max8997_ldo5_data = { | ||
490 | .constraints = { | ||
491 | .name = "VHSIC_1.2V_C210", | ||
492 | .min_uV = 1200000, | ||
493 | .max_uV = 1200000, | ||
494 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
495 | .apply_uV = 1, | ||
496 | .state_mem = { | ||
497 | .disabled = 1, | ||
498 | }, | ||
499 | }, | ||
500 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_), | ||
501 | .consumer_supplies = max8997_ldo5_, | ||
502 | }; | ||
503 | |||
504 | static struct regulator_init_data __initdata max8997_ldo6_data = { | ||
505 | .constraints = { | ||
506 | .name = "VCC_1.8V_PDA", | ||
507 | .min_uV = 1800000, | ||
508 | .max_uV = 1800000, | ||
509 | .apply_uV = 1, | ||
510 | .always_on = 1, | ||
511 | .state_mem = { | ||
512 | .enabled = 1, | ||
513 | }, | ||
514 | }, | ||
515 | }; | ||
516 | |||
517 | static struct regulator_init_data __initdata max8997_ldo7_data = { | ||
518 | .constraints = { | ||
519 | .name = "CAM_ISP_1.8V", | ||
520 | .min_uV = 1800000, | ||
521 | .max_uV = 1800000, | ||
522 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
523 | .apply_uV = 1, | ||
524 | .state_mem = { | ||
525 | .disabled = 1, | ||
526 | }, | ||
527 | }, | ||
528 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_), | ||
529 | .consumer_supplies = max8997_ldo7_, | ||
530 | }; | ||
531 | |||
532 | static struct regulator_init_data __initdata max8997_ldo8_data = { | ||
533 | .constraints = { | ||
534 | .name = "VUSB/VDAC_3.3V_C210", | ||
535 | .min_uV = 3300000, | ||
536 | .max_uV = 3300000, | ||
537 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
538 | .apply_uV = 1, | ||
539 | .state_mem = { | ||
540 | .disabled = 1, | ||
541 | }, | ||
542 | }, | ||
543 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_), | ||
544 | .consumer_supplies = max8997_ldo8_, | ||
545 | }; | ||
546 | |||
547 | static struct regulator_init_data __initdata max8997_ldo9_data = { | ||
548 | .constraints = { | ||
549 | .name = "VCC_2.8V_PDA", | ||
550 | .min_uV = 2800000, | ||
551 | .max_uV = 2800000, | ||
552 | .apply_uV = 1, | ||
553 | .always_on = 1, | ||
554 | .state_mem = { | ||
555 | .enabled = 1, | ||
556 | }, | ||
557 | }, | ||
558 | }; | ||
559 | |||
560 | static struct regulator_init_data __initdata max8997_ldo10_data = { | ||
561 | .constraints = { | ||
562 | .name = "VPLL_1.1V_C210", | ||
563 | .min_uV = 1100000, | ||
564 | .max_uV = 1100000, | ||
565 | .apply_uV = 1, | ||
566 | .always_on = 1, | ||
567 | .state_mem = { | ||
568 | .disabled = 1, | ||
569 | }, | ||
570 | }, | ||
571 | }; | ||
572 | |||
573 | static struct regulator_init_data __initdata max8997_ldo11_data = { | ||
574 | .constraints = { | ||
575 | .name = "LVDS_VDD3.3V", | ||
576 | .min_uV = 3300000, | ||
577 | .max_uV = 3300000, | ||
578 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
579 | .apply_uV = 1, | ||
580 | .boot_on = 1, | ||
581 | .state_mem = { | ||
582 | .disabled = 1, | ||
583 | }, | ||
584 | }, | ||
585 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_), | ||
586 | .consumer_supplies = max8997_ldo11_, | ||
587 | }; | ||
588 | |||
589 | static struct regulator_init_data __initdata max8997_ldo12_data = { | ||
590 | .constraints = { | ||
591 | .name = "VT_CAM_1.8V", | ||
592 | .min_uV = 1800000, | ||
593 | .max_uV = 1800000, | ||
594 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
595 | .apply_uV = 1, | ||
596 | .state_mem = { | ||
597 | .disabled = 1, | ||
598 | }, | ||
599 | }, | ||
600 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_), | ||
601 | .consumer_supplies = max8997_ldo12_, | ||
602 | }; | ||
603 | |||
604 | static struct regulator_init_data __initdata max8997_ldo13_data = { | ||
605 | .constraints = { | ||
606 | .name = "VTF_2.8V", | ||
607 | .min_uV = 2800000, | ||
608 | .max_uV = 2800000, | ||
609 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
610 | .apply_uV = 1, | ||
611 | .state_mem = { | ||
612 | .disabled = 1, | ||
613 | }, | ||
614 | }, | ||
615 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_), | ||
616 | .consumer_supplies = max8997_ldo13_, | ||
617 | }; | ||
618 | |||
619 | static struct regulator_init_data __initdata max8997_ldo14_data = { | ||
620 | .constraints = { | ||
621 | .name = "VCC_3.0V_MOTOR", | ||
622 | .min_uV = 3000000, | ||
623 | .max_uV = 3000000, | ||
624 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
625 | .apply_uV = 1, | ||
626 | .state_mem = { | ||
627 | .disabled = 1, | ||
628 | }, | ||
629 | }, | ||
630 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_), | ||
631 | .consumer_supplies = max8997_ldo14_, | ||
632 | }; | ||
633 | |||
634 | static struct regulator_init_data __initdata max8997_ldo15_data = { | ||
635 | .constraints = { | ||
636 | .name = "VTOUCH_ADVV2.8V", | ||
637 | .min_uV = 2800000, | ||
638 | .max_uV = 2800000, | ||
639 | .apply_uV = 1, | ||
640 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
641 | .state_mem = { | ||
642 | .disabled = 1, | ||
643 | }, | ||
644 | }, | ||
645 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_), | ||
646 | .consumer_supplies = max8997_ldo15_, | ||
647 | }; | ||
648 | |||
649 | static struct regulator_init_data __initdata max8997_ldo16_data = { | ||
650 | .constraints = { | ||
651 | .name = "CAM_SENSOR_IO_1.8V", | ||
652 | .min_uV = 1800000, | ||
653 | .max_uV = 1800000, | ||
654 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
655 | .apply_uV = 1, | ||
656 | .state_mem = { | ||
657 | .disabled = 1, | ||
658 | }, | ||
659 | }, | ||
660 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_), | ||
661 | .consumer_supplies = max8997_ldo16_, | ||
662 | }; | ||
663 | |||
664 | static struct regulator_init_data __initdata max8997_ldo18_data = { | ||
665 | .constraints = { | ||
666 | .name = "VTOUCH_VDD2.8V", | ||
667 | .min_uV = 2800000, | ||
668 | .max_uV = 2800000, | ||
669 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
670 | .apply_uV = 1, | ||
671 | .state_mem = { | ||
672 | .disabled = 1, | ||
673 | }, | ||
674 | }, | ||
675 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_), | ||
676 | .consumer_supplies = max8997_ldo18_, | ||
677 | }; | ||
678 | |||
679 | static struct regulator_init_data __initdata max8997_ldo21_data = { | ||
680 | .constraints = { | ||
681 | .name = "VDDQ_M1M2_1.2V", | ||
682 | .min_uV = 1200000, | ||
683 | .max_uV = 1200000, | ||
684 | .apply_uV = 1, | ||
685 | .always_on = 1, | ||
686 | .state_mem = { | ||
687 | .disabled = 1, | ||
688 | }, | ||
689 | }, | ||
690 | }; | ||
691 | |||
692 | static struct regulator_init_data __initdata max8997_buck1_data = { | ||
693 | .constraints = { | ||
694 | .name = "VARM_1.2V_C210", | ||
695 | .min_uV = 900000, | ||
696 | .max_uV = 1350000, | ||
697 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
698 | .always_on = 1, | ||
699 | .state_mem = { | ||
700 | .disabled = 1, | ||
701 | }, | ||
702 | }, | ||
703 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_), | ||
704 | .consumer_supplies = max8997_buck1_, | ||
705 | }; | ||
706 | |||
707 | static struct regulator_init_data __initdata max8997_buck2_data = { | ||
708 | .constraints = { | ||
709 | .name = "VINT_1.1V_C210", | ||
710 | .min_uV = 900000, | ||
711 | .max_uV = 1100000, | ||
712 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
713 | .always_on = 1, | ||
714 | .state_mem = { | ||
715 | .disabled = 1, | ||
716 | }, | ||
717 | }, | ||
718 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_), | ||
719 | .consumer_supplies = max8997_buck2_, | ||
720 | }; | ||
721 | |||
722 | static struct regulator_init_data __initdata max8997_buck3_data = { | ||
723 | .constraints = { | ||
724 | .name = "VG3D_1.1V_C210", | ||
725 | .min_uV = 900000, | ||
726 | .max_uV = 1100000, | ||
727 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
728 | REGULATOR_CHANGE_STATUS, | ||
729 | .state_mem = { | ||
730 | .disabled = 1, | ||
731 | }, | ||
732 | }, | ||
733 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_), | ||
734 | .consumer_supplies = max8997_buck3_, | ||
735 | }; | ||
736 | |||
737 | static struct regulator_init_data __initdata max8997_buck4_data = { | ||
738 | .constraints = { | ||
739 | .name = "CAM_ISP_CORE_1.2V", | ||
740 | .min_uV = 1200000, | ||
741 | .max_uV = 1200000, | ||
742 | .apply_uV = 1, | ||
743 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
744 | .state_mem = { | ||
745 | .disabled = 1, | ||
746 | }, | ||
747 | }, | ||
748 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_), | ||
749 | .consumer_supplies = max8997_buck4_, | ||
750 | }; | ||
751 | |||
752 | static struct regulator_init_data __initdata max8997_buck5_data = { | ||
753 | .constraints = { | ||
754 | .name = "VMEM_1.2V_C210", | ||
755 | .min_uV = 1200000, | ||
756 | .max_uV = 1200000, | ||
757 | .apply_uV = 1, | ||
758 | .always_on = 1, | ||
759 | .state_mem = { | ||
760 | .enabled = 1, | ||
761 | }, | ||
762 | }, | ||
763 | }; | ||
764 | |||
765 | static struct regulator_init_data __initdata max8997_buck6_data = { | ||
766 | .constraints = { | ||
767 | .name = "CAM_AF_2.8V", | ||
768 | .min_uV = 2800000, | ||
769 | .max_uV = 2800000, | ||
770 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
771 | .state_mem = { | ||
772 | .disabled = 1, | ||
773 | }, | ||
774 | }, | ||
775 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_), | ||
776 | .consumer_supplies = max8997_buck6_, | ||
777 | }; | ||
778 | |||
779 | static struct regulator_init_data __initdata max8997_buck7_data = { | ||
780 | .constraints = { | ||
781 | .name = "VCC_SUB_2.0V", | ||
782 | .min_uV = 2000000, | ||
783 | .max_uV = 2000000, | ||
784 | .apply_uV = 1, | ||
785 | .always_on = 1, | ||
786 | .state_mem = { | ||
787 | .enabled = 1, | ||
788 | }, | ||
789 | }, | ||
790 | }; | ||
791 | |||
792 | static struct regulator_init_data __initdata max8997_32khz_ap_data = { | ||
793 | .constraints = { | ||
794 | .name = "32KHz AP", | ||
795 | .always_on = 1, | ||
796 | .state_mem = { | ||
797 | .enabled = 1, | ||
798 | }, | ||
799 | }, | ||
800 | .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_), | ||
801 | .consumer_supplies = max8997_32khz_ap_, | ||
802 | }; | ||
803 | |||
804 | static struct regulator_init_data __initdata max8997_32khz_cp_data = { | ||
805 | .constraints = { | ||
806 | .name = "32KHz CP", | ||
807 | .state_mem = { | ||
808 | .disabled = 1, | ||
809 | }, | ||
810 | }, | ||
811 | }; | ||
812 | |||
813 | static struct regulator_init_data __initdata max8997_vichg_data = { | ||
814 | .constraints = { | ||
815 | .name = "VICHG", | ||
816 | .state_mem = { | ||
817 | .disabled = 1, | ||
818 | }, | ||
819 | }, | ||
820 | }; | ||
821 | |||
822 | static struct regulator_init_data __initdata max8997_esafeout1_data = { | ||
823 | .constraints = { | ||
824 | .name = "SAFEOUT1", | ||
825 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
826 | .state_mem = { | ||
827 | .disabled = 1, | ||
828 | }, | ||
829 | }, | ||
830 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_), | ||
831 | .consumer_supplies = max8997_esafeout1_, | ||
832 | }; | ||
833 | |||
834 | static struct regulator_init_data __initdata max8997_esafeout2_data = { | ||
835 | .constraints = { | ||
836 | .name = "SAFEOUT2", | ||
837 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
838 | .state_mem = { | ||
839 | .disabled = 1, | ||
840 | }, | ||
841 | }, | ||
842 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_), | ||
843 | .consumer_supplies = max8997_esafeout2_, | ||
844 | }; | ||
845 | |||
846 | static struct regulator_init_data __initdata max8997_charger_cv_data = { | ||
847 | .constraints = { | ||
848 | .name = "CHARGER_CV", | ||
849 | .min_uV = 4200000, | ||
850 | .max_uV = 4200000, | ||
851 | .apply_uV = 1, | ||
852 | }, | ||
853 | }; | ||
854 | |||
855 | static struct regulator_init_data __initdata max8997_charger_data = { | ||
856 | .constraints = { | ||
857 | .name = "CHARGER", | ||
858 | .min_uA = 200000, | ||
859 | .max_uA = 950000, | ||
860 | .boot_on = 1, | ||
861 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | ||
862 | REGULATOR_CHANGE_CURRENT, | ||
863 | }, | ||
864 | .num_consumer_supplies = ARRAY_SIZE(max8997_charger_), | ||
865 | .consumer_supplies = max8997_charger_, | ||
866 | }; | ||
867 | |||
868 | static struct regulator_init_data __initdata max8997_charger_topoff_data = { | ||
869 | .constraints = { | ||
870 | .name = "CHARGER TOPOFF", | ||
871 | .min_uA = 50000, | ||
872 | .max_uA = 200000, | ||
873 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | ||
874 | }, | ||
875 | .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_), | ||
876 | .consumer_supplies = max8997_chg_toff_, | ||
877 | }; | ||
878 | |||
879 | static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = { | ||
880 | { MAX8997_LDO1, &max8997_ldo1_data }, | ||
881 | { MAX8997_LDO2, &max8997_ldo2_data }, | ||
882 | { MAX8997_LDO3, &max8997_ldo3_data }, | ||
883 | { MAX8997_LDO4, &max8997_ldo4_data }, | ||
884 | { MAX8997_LDO5, &max8997_ldo5_data }, | ||
885 | { MAX8997_LDO6, &max8997_ldo6_data }, | ||
886 | { MAX8997_LDO7, &max8997_ldo7_data }, | ||
887 | { MAX8997_LDO8, &max8997_ldo8_data }, | ||
888 | { MAX8997_LDO9, &max8997_ldo9_data }, | ||
889 | { MAX8997_LDO10, &max8997_ldo10_data }, | ||
890 | { MAX8997_LDO11, &max8997_ldo11_data }, | ||
891 | { MAX8997_LDO12, &max8997_ldo12_data }, | ||
892 | { MAX8997_LDO13, &max8997_ldo13_data }, | ||
893 | { MAX8997_LDO14, &max8997_ldo14_data }, | ||
894 | { MAX8997_LDO15, &max8997_ldo15_data }, | ||
895 | { MAX8997_LDO16, &max8997_ldo16_data }, | ||
896 | |||
897 | { MAX8997_LDO18, &max8997_ldo18_data }, | ||
898 | { MAX8997_LDO21, &max8997_ldo21_data }, | ||
899 | |||
900 | { MAX8997_BUCK1, &max8997_buck1_data }, | ||
901 | { MAX8997_BUCK2, &max8997_buck2_data }, | ||
902 | { MAX8997_BUCK3, &max8997_buck3_data }, | ||
903 | { MAX8997_BUCK4, &max8997_buck4_data }, | ||
904 | { MAX8997_BUCK5, &max8997_buck5_data }, | ||
905 | { MAX8997_BUCK6, &max8997_buck6_data }, | ||
906 | { MAX8997_BUCK7, &max8997_buck7_data }, | ||
907 | |||
908 | { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data }, | ||
909 | { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data }, | ||
910 | |||
911 | { MAX8997_ENVICHG, &max8997_vichg_data }, | ||
912 | { MAX8997_ESAFEOUT1, &max8997_esafeout1_data }, | ||
913 | { MAX8997_ESAFEOUT2, &max8997_esafeout2_data }, | ||
914 | { MAX8997_CHARGER_CV, &max8997_charger_cv_data }, | ||
915 | { MAX8997_CHARGER, &max8997_charger_data }, | ||
916 | { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data }, | ||
917 | }; | ||
918 | |||
919 | static struct max8997_platform_data __initdata nuri_max8997_pdata = { | ||
920 | .wakeup = 1, | ||
921 | |||
922 | .num_regulators = ARRAY_SIZE(nuri_max8997_regulators), | ||
923 | .regulators = nuri_max8997_regulators, | ||
924 | |||
925 | .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) }, | ||
926 | .buck2_gpiodvs = true, | ||
927 | |||
928 | .buck1_voltage[0] = 1350000, /* 1.35V */ | ||
929 | .buck1_voltage[1] = 1300000, /* 1.3V */ | ||
930 | .buck1_voltage[2] = 1250000, /* 1.25V */ | ||
931 | .buck1_voltage[3] = 1200000, /* 1.2V */ | ||
932 | .buck1_voltage[4] = 1150000, /* 1.15V */ | ||
933 | .buck1_voltage[5] = 1100000, /* 1.1V */ | ||
934 | .buck1_voltage[6] = 1000000, /* 1.0V */ | ||
935 | .buck1_voltage[7] = 950000, /* 0.95V */ | ||
936 | |||
937 | .buck2_voltage[0] = 1100000, /* 1.1V */ | ||
938 | .buck2_voltage[1] = 1000000, /* 1.0V */ | ||
939 | .buck2_voltage[2] = 950000, /* 0.95V */ | ||
940 | .buck2_voltage[3] = 900000, /* 0.9V */ | ||
941 | .buck2_voltage[4] = 1100000, /* 1.1V */ | ||
942 | .buck2_voltage[5] = 1000000, /* 1.0V */ | ||
943 | .buck2_voltage[6] = 950000, /* 0.95V */ | ||
944 | .buck2_voltage[7] = 900000, /* 0.9V */ | ||
945 | |||
946 | .buck5_voltage[0] = 1200000, /* 1.2V */ | ||
947 | .buck5_voltage[1] = 1200000, /* 1.2V */ | ||
948 | .buck5_voltage[2] = 1200000, /* 1.2V */ | ||
949 | .buck5_voltage[3] = 1200000, /* 1.2V */ | ||
950 | .buck5_voltage[4] = 1200000, /* 1.2V */ | ||
951 | .buck5_voltage[5] = 1200000, /* 1.2V */ | ||
952 | .buck5_voltage[6] = 1200000, /* 1.2V */ | ||
953 | .buck5_voltage[7] = 1200000, /* 1.2V */ | ||
954 | }; | ||
955 | |||
956 | /* GPIO I2C 5 (PMIC) */ | ||
957 | enum { I2C5_MAX8997 }; | ||
958 | static struct i2c_board_info i2c5_devs[] __initdata = { | ||
959 | [I2C5_MAX8997] = { | ||
960 | I2C_BOARD_INFO("max8997", 0xCC >> 1), | ||
961 | .platform_data = &nuri_max8997_pdata, | ||
962 | }, | ||
963 | }; | ||
964 | |||
965 | static struct max17042_platform_data nuri_battery_platform_data = { | ||
966 | }; | ||
967 | |||
968 | /* GPIO I2C 9 (Fuel Gauge) */ | ||
969 | static struct i2c_gpio_platform_data i2c9_gpio_data = { | ||
970 | .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */ | ||
971 | .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */ | ||
972 | }; | ||
973 | static struct platform_device i2c9_gpio = { | ||
974 | .name = "i2c-gpio", | ||
975 | .id = 9, | ||
976 | .dev = { | ||
977 | .platform_data = &i2c9_gpio_data, | ||
978 | }, | ||
979 | }; | ||
980 | enum { I2C9_MAX17042}; | ||
981 | static struct i2c_board_info i2c9_devs[] __initdata = { | ||
982 | [I2C9_MAX17042] = { | ||
983 | I2C_BOARD_INFO("max17042", 0x36), | ||
984 | .platform_data = &nuri_battery_platform_data, | ||
985 | }, | ||
986 | }; | ||
987 | |||
988 | /* MAX8903 Secondary Charger */ | ||
989 | static struct regulator_consumer_supply supplies_max8903[] = { | ||
990 | REGULATOR_SUPPLY("vinchg2", "charger-manager.0"), | ||
991 | }; | ||
992 | |||
993 | static struct regulator_init_data max8903_charger_en_data = { | ||
994 | .constraints = { | ||
995 | .name = "VOUT_CHARGER", | ||
996 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
997 | .boot_on = 1, | ||
998 | }, | ||
999 | .num_consumer_supplies = ARRAY_SIZE(supplies_max8903), | ||
1000 | .consumer_supplies = supplies_max8903, | ||
1001 | }; | ||
1002 | |||
1003 | static struct fixed_voltage_config max8903_charger_en = { | ||
1004 | .supply_name = "VOUT_CHARGER", | ||
1005 | .microvolts = 5000000, /* Assume 5VDC */ | ||
1006 | .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */ | ||
1007 | .enable_high = 0, /* Enable = Low */ | ||
1008 | .enabled_at_boot = 1, | ||
1009 | .init_data = &max8903_charger_en_data, | ||
1010 | }; | ||
1011 | |||
1012 | static struct platform_device max8903_fixed_reg_dev = { | ||
1013 | .name = "reg-fixed-voltage", | ||
1014 | .id = FIXED_REG_ID_MAX8903, | ||
1015 | .dev = { .platform_data = &max8903_charger_en }, | ||
1016 | }; | ||
1017 | |||
1018 | static struct max8903_pdata nuri_max8903 = { | ||
1019 | /* | ||
1020 | * cen: don't control with the driver, let it be | ||
1021 | * controlled by regulator above | ||
1022 | */ | ||
1023 | .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */ | ||
1024 | /* uok, usus: not connected */ | ||
1025 | .chg = EXYNOS4_GPE2(0), /* TA_nCHG */ | ||
1026 | /* flt: vcc_1.8V_pda */ | ||
1027 | .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */ | ||
1028 | |||
1029 | .dc_valid = true, | ||
1030 | .usb_valid = false, /* USB is not wired to MAX8903 */ | ||
1031 | }; | ||
1032 | |||
1033 | static struct platform_device nuri_max8903_device = { | ||
1034 | .name = "max8903-charger", | ||
1035 | .dev = { | ||
1036 | .platform_data = &nuri_max8903, | ||
1037 | }, | ||
1038 | }; | ||
1039 | |||
1040 | static struct device *nuri_cm_devices[] = { | ||
1041 | &s3c_device_i2c5.dev, | ||
1042 | &s3c_device_adc.dev, | ||
1043 | NULL, /* Reserved for UART */ | ||
1044 | NULL, | ||
1045 | }; | ||
1046 | |||
1047 | static void __init nuri_power_init(void) | ||
1048 | { | ||
1049 | int gpio; | ||
1050 | int irq_base = IRQ_GPIO_END + 1; | ||
1051 | int ta_en = 0; | ||
1052 | |||
1053 | nuri_max8997_pdata.irq_base = irq_base; | ||
1054 | irq_base += MAX8997_IRQ_NR; | ||
1055 | |||
1056 | gpio = EXYNOS4_GPX0(7); | ||
1057 | gpio_request(gpio, "AP_PMIC_IRQ"); | ||
1058 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1059 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1060 | |||
1061 | gpio = EXYNOS4_GPX2(3); | ||
1062 | gpio_request(gpio, "FUEL_ALERT"); | ||
1063 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1064 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1065 | |||
1066 | gpio = nuri_max8903.dok; | ||
1067 | gpio_request(gpio, "TA_nCONNECTED"); | ||
1068 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1069 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1070 | ta_en = gpio_get_value(gpio) ? 0 : 1; | ||
1071 | |||
1072 | gpio = nuri_max8903.chg; | ||
1073 | gpio_request(gpio, "TA_nCHG"); | ||
1074 | gpio_direction_input(gpio); | ||
1075 | |||
1076 | gpio = nuri_max8903.dcm; | ||
1077 | gpio_request(gpio, "CURR_ADJ"); | ||
1078 | gpio_direction_output(gpio, ta_en); | ||
1079 | } | ||
1080 | |||
1081 | /* USB EHCI */ | ||
1082 | static struct s5p_ehci_platdata nuri_ehci_pdata; | ||
1083 | |||
1084 | static void __init nuri_ehci_init(void) | ||
1085 | { | ||
1086 | struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata; | ||
1087 | |||
1088 | s5p_ehci_set_platdata(pdata); | ||
1089 | } | ||
1090 | |||
1091 | static struct platform_device *nuri_devices[] __initdata = { | ||
1092 | /* Samsung Platform Devices */ | ||
1093 | &s3c_device_i2c5, /* PMIC should initialize first */ | ||
1094 | &emmc_fixed_voltage, | ||
1095 | &s3c_device_hsmmc0, | ||
1096 | &s3c_device_hsmmc2, | ||
1097 | &s3c_device_hsmmc3, | ||
1098 | &s3c_device_wdt, | ||
1099 | &s3c_device_timer[0], | ||
1100 | &s5p_device_ehci, | ||
1101 | &s3c_device_i2c3, | ||
1102 | &i2c9_gpio, | ||
1103 | &s3c_device_adc, | ||
1104 | &s3c_device_rtc, | ||
1105 | &s5p_device_mfc, | ||
1106 | &s5p_device_mfc_l, | ||
1107 | &s5p_device_mfc_r, | ||
1108 | &exynos4_device_pd[PD_MFC], | ||
1109 | |||
1110 | /* NURI Devices */ | ||
1111 | &nuri_gpio_keys, | ||
1112 | &nuri_lcd_device, | ||
1113 | &nuri_backlight_device, | ||
1114 | &max8903_fixed_reg_dev, | ||
1115 | &nuri_max8903_device, | ||
1116 | }; | ||
1117 | |||
1118 | static void __init nuri_map_io(void) | ||
1119 | { | ||
1120 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
1121 | s3c24xx_init_clocks(24000000); | ||
1122 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); | ||
1123 | } | ||
1124 | |||
1125 | static void __init nuri_reserve(void) | ||
1126 | { | ||
1127 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
1128 | } | ||
1129 | |||
1130 | static void __init nuri_machine_init(void) | ||
1131 | { | ||
1132 | nuri_sdhci_init(); | ||
1133 | nuri_tsp_init(); | ||
1134 | nuri_power_init(); | ||
1135 | |||
1136 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | ||
1137 | s3c_i2c3_set_platdata(&i2c3_data); | ||
1138 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | ||
1139 | s3c_i2c5_set_platdata(NULL); | ||
1140 | i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7)); | ||
1141 | i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); | ||
1142 | i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3)); | ||
1143 | i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs)); | ||
1144 | |||
1145 | nuri_ehci_init(); | ||
1146 | clk_xusbxti.rate = 24000000; | ||
1147 | |||
1148 | /* Last */ | ||
1149 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); | ||
1150 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
1151 | } | ||
1152 | |||
1153 | MACHINE_START(NURI, "NURI") | ||
1154 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | ||
1155 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
1156 | .init_irq = exynos4_init_irq, | ||
1157 | .map_io = nuri_map_io, | ||
1158 | .init_machine = nuri_machine_init, | ||
1159 | .timer = &exynos4_timer, | ||
1160 | .reserve = &nuri_reserve, | ||
1161 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos4/mach-smdkc210.c b/arch/arm/mach-exynos4/mach-smdkc210.c new file mode 100644 index 00000000000..a7c65e05c1e --- /dev/null +++ b/arch/arm/mach-exynos4/mach-smdkc210.c | |||
@@ -0,0 +1,309 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/mach-smdkc210.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/pwm_backlight.h> | ||
21 | |||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach-types.h> | ||
24 | |||
25 | #include <video/platform_lcd.h> | ||
26 | |||
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/sdhci.h> | ||
35 | #include <plat/iic.h> | ||
36 | #include <plat/pd.h> | ||
37 | #include <plat/gpio-cfg.h> | ||
38 | #include <plat/backlight.h> | ||
39 | |||
40 | #include <mach/map.h> | ||
41 | |||
42 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
43 | #define SMDKC210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
44 | S3C2410_UCON_RXILEVEL | \ | ||
45 | S3C2410_UCON_TXIRQMODE | \ | ||
46 | S3C2410_UCON_RXIRQMODE | \ | ||
47 | S3C2410_UCON_RXFIFO_TOI | \ | ||
48 | S3C2443_UCON_RXERR_IRQEN) | ||
49 | |||
50 | #define SMDKC210_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
51 | |||
52 | #define SMDKC210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
53 | S5PV210_UFCON_TXTRIG4 | \ | ||
54 | S5PV210_UFCON_RXTRIG4) | ||
55 | |||
56 | static struct s3c2410_uartcfg smdkc210_uartcfgs[] __initdata = { | ||
57 | [0] = { | ||
58 | .hwport = 0, | ||
59 | .flags = 0, | ||
60 | .ucon = SMDKC210_UCON_DEFAULT, | ||
61 | .ulcon = SMDKC210_ULCON_DEFAULT, | ||
62 | .ufcon = SMDKC210_UFCON_DEFAULT, | ||
63 | }, | ||
64 | [1] = { | ||
65 | .hwport = 1, | ||
66 | .flags = 0, | ||
67 | .ucon = SMDKC210_UCON_DEFAULT, | ||
68 | .ulcon = SMDKC210_ULCON_DEFAULT, | ||
69 | .ufcon = SMDKC210_UFCON_DEFAULT, | ||
70 | }, | ||
71 | [2] = { | ||
72 | .hwport = 2, | ||
73 | .flags = 0, | ||
74 | .ucon = SMDKC210_UCON_DEFAULT, | ||
75 | .ulcon = SMDKC210_ULCON_DEFAULT, | ||
76 | .ufcon = SMDKC210_UFCON_DEFAULT, | ||
77 | }, | ||
78 | [3] = { | ||
79 | .hwport = 3, | ||
80 | .flags = 0, | ||
81 | .ucon = SMDKC210_UCON_DEFAULT, | ||
82 | .ulcon = SMDKC210_ULCON_DEFAULT, | ||
83 | .ufcon = SMDKC210_UFCON_DEFAULT, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | static struct s3c_sdhci_platdata smdkc210_hsmmc0_pdata __initdata = { | ||
88 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
89 | .ext_cd_gpio = EXYNOS4_GPK0(2), | ||
90 | .ext_cd_gpio_invert = 1, | ||
91 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
92 | #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT | ||
93 | .max_width = 8, | ||
94 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
95 | #endif | ||
96 | }; | ||
97 | |||
98 | static struct s3c_sdhci_platdata smdkc210_hsmmc1_pdata __initdata = { | ||
99 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
100 | .ext_cd_gpio = EXYNOS4_GPK0(2), | ||
101 | .ext_cd_gpio_invert = 1, | ||
102 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
103 | }; | ||
104 | |||
105 | static struct s3c_sdhci_platdata smdkc210_hsmmc2_pdata __initdata = { | ||
106 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
107 | .ext_cd_gpio = EXYNOS4_GPK2(2), | ||
108 | .ext_cd_gpio_invert = 1, | ||
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 smdkc210_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 smdkc210_lcd_lte480wv_data = { | ||
153 | .set_power = lcd_lte480wv_set_power, | ||
154 | }; | ||
155 | |||
156 | static struct platform_device smdkc210_lcd_lte480wv = { | ||
157 | .name = "platform-lcd", | ||
158 | .dev.parent = &s5p_device_fimd0.dev, | ||
159 | .dev.platform_data = &smdkc210_lcd_lte480wv_data, | ||
160 | }; | ||
161 | |||
162 | static struct s3c_fb_pd_win smdkc210_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 smdkc210_lcd0_pdata __initdata = { | ||
178 | .win[0] = &smdkc210_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 smdkc210_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 smdkc210_smsc911x = { | ||
206 | .name = "smsc911x", | ||
207 | .id = -1, | ||
208 | .num_resources = ARRAY_SIZE(smdkc210_smsc911x_resources), | ||
209 | .resource = smdkc210_smsc911x_resources, | ||
210 | .dev = { | ||
211 | .platform_data = &smsc9215_config, | ||
212 | }, | ||
213 | }; | ||
214 | |||
215 | static struct i2c_board_info i2c_devs1[] __initdata = { | ||
216 | {I2C_BOARD_INFO("wm8994", 0x1a),}, | ||
217 | }; | ||
218 | |||
219 | static struct platform_device *smdkc210_devices[] __initdata = { | ||
220 | &s3c_device_hsmmc0, | ||
221 | &s3c_device_hsmmc1, | ||
222 | &s3c_device_hsmmc2, | ||
223 | &s3c_device_hsmmc3, | ||
224 | &s3c_device_i2c1, | ||
225 | &s3c_device_rtc, | ||
226 | &s3c_device_wdt, | ||
227 | &exynos4_device_ac97, | ||
228 | &exynos4_device_i2s0, | ||
229 | &exynos4_device_pd[PD_MFC], | ||
230 | &exynos4_device_pd[PD_G3D], | ||
231 | &exynos4_device_pd[PD_LCD0], | ||
232 | &exynos4_device_pd[PD_LCD1], | ||
233 | &exynos4_device_pd[PD_CAM], | ||
234 | &exynos4_device_pd[PD_TV], | ||
235 | &exynos4_device_pd[PD_GPS], | ||
236 | &exynos4_device_sysmmu, | ||
237 | &samsung_asoc_dma, | ||
238 | &s5p_device_fimd0, | ||
239 | &smdkc210_lcd_lte480wv, | ||
240 | &smdkc210_smsc911x, | ||
241 | }; | ||
242 | |||
243 | static void __init smdkc210_smsc911x_init(void) | ||
244 | { | ||
245 | u32 cs1; | ||
246 | |||
247 | /* configure nCS1 width to 16 bits */ | ||
248 | cs1 = __raw_readl(S5P_SROM_BW) & | ||
249 | ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT); | ||
250 | cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) | | ||
251 | (1 << S5P_SROM_BW__WAITENABLE__SHIFT) | | ||
252 | (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << | ||
253 | S5P_SROM_BW__NCS1__SHIFT; | ||
254 | __raw_writel(cs1, S5P_SROM_BW); | ||
255 | |||
256 | /* set timing for nCS1 suitable for ethernet chip */ | ||
257 | __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) | | ||
258 | (0x9 << S5P_SROM_BCX__TACP__SHIFT) | | ||
259 | (0xc << S5P_SROM_BCX__TCAH__SHIFT) | | ||
260 | (0x1 << S5P_SROM_BCX__TCOH__SHIFT) | | ||
261 | (0x6 << S5P_SROM_BCX__TACC__SHIFT) | | ||
262 | (0x1 << S5P_SROM_BCX__TCOS__SHIFT) | | ||
263 | (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); | ||
264 | } | ||
265 | |||
266 | /* LCD Backlight data */ | ||
267 | static struct samsung_bl_gpio_info smdkc210_bl_gpio_info = { | ||
268 | .no = EXYNOS4_GPD0(1), | ||
269 | .func = S3C_GPIO_SFN(2), | ||
270 | }; | ||
271 | |||
272 | static struct platform_pwm_backlight_data smdkc210_bl_data = { | ||
273 | .pwm_id = 1, | ||
274 | .pwm_period_ns = 1000, | ||
275 | }; | ||
276 | |||
277 | static void __init smdkc210_map_io(void) | ||
278 | { | ||
279 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
280 | s3c24xx_init_clocks(24000000); | ||
281 | s3c24xx_init_uarts(smdkc210_uartcfgs, ARRAY_SIZE(smdkc210_uartcfgs)); | ||
282 | } | ||
283 | |||
284 | static void __init smdkc210_machine_init(void) | ||
285 | { | ||
286 | s3c_i2c1_set_platdata(NULL); | ||
287 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | ||
288 | |||
289 | smdkc210_smsc911x_init(); | ||
290 | |||
291 | s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata); | ||
292 | s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata); | ||
293 | s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata); | ||
294 | s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata); | ||
295 | |||
296 | samsung_bl_set(&smdkc210_bl_gpio_info, &smdkc210_bl_data); | ||
297 | s5p_fimd0_set_platdata(&smdkc210_lcd0_pdata); | ||
298 | |||
299 | platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices)); | ||
300 | } | ||
301 | |||
302 | MACHINE_START(SMDKC210, "SMDKC210") | ||
303 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
304 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
305 | .init_irq = exynos4_init_irq, | ||
306 | .map_io = smdkc210_map_io, | ||
307 | .init_machine = smdkc210_machine_init, | ||
308 | .timer = &exynos4_timer, | ||
309 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c b/arch/arm/mach-exynos4/mach-smdkv310.c new file mode 100644 index 00000000000..ea414955686 --- /dev/null +++ b/arch/arm/mach-exynos4/mach-smdkv310.c | |||
@@ -0,0 +1,263 @@ | |||
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/gpio.h> | ||
13 | #include <linux/mmc/host.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/smsc911x.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/i2c.h> | ||
18 | #include <linux/input.h> | ||
19 | #include <linux/pwm_backlight.h> | ||
20 | |||
21 | #include <asm/mach/arch.h> | ||
22 | #include <asm/mach-types.h> | ||
23 | |||
24 | #include <plat/regs-serial.h> | ||
25 | #include <plat/regs-srom.h> | ||
26 | #include <plat/exynos4.h> | ||
27 | #include <plat/cpu.h> | ||
28 | #include <plat/devs.h> | ||
29 | #include <plat/keypad.h> | ||
30 | #include <plat/sdhci.h> | ||
31 | #include <plat/iic.h> | ||
32 | #include <plat/pd.h> | ||
33 | #include <plat/gpio-cfg.h> | ||
34 | #include <plat/backlight.h> | ||
35 | |||
36 | #include <mach/map.h> | ||
37 | |||
38 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
39 | #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
40 | S3C2410_UCON_RXILEVEL | \ | ||
41 | S3C2410_UCON_TXIRQMODE | \ | ||
42 | S3C2410_UCON_RXIRQMODE | \ | ||
43 | S3C2410_UCON_RXFIFO_TOI | \ | ||
44 | S3C2443_UCON_RXERR_IRQEN) | ||
45 | |||
46 | #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
47 | |||
48 | #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
49 | S5PV210_UFCON_TXTRIG4 | \ | ||
50 | S5PV210_UFCON_RXTRIG4) | ||
51 | |||
52 | static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = { | ||
53 | [0] = { | ||
54 | .hwport = 0, | ||
55 | .flags = 0, | ||
56 | .ucon = SMDKV310_UCON_DEFAULT, | ||
57 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
58 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
59 | }, | ||
60 | [1] = { | ||
61 | .hwport = 1, | ||
62 | .flags = 0, | ||
63 | .ucon = SMDKV310_UCON_DEFAULT, | ||
64 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
65 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
66 | }, | ||
67 | [2] = { | ||
68 | .hwport = 2, | ||
69 | .flags = 0, | ||
70 | .ucon = SMDKV310_UCON_DEFAULT, | ||
71 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
72 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
73 | }, | ||
74 | [3] = { | ||
75 | .hwport = 3, | ||
76 | .flags = 0, | ||
77 | .ucon = SMDKV310_UCON_DEFAULT, | ||
78 | .ulcon = SMDKV310_ULCON_DEFAULT, | ||
79 | .ufcon = SMDKV310_UFCON_DEFAULT, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = { | ||
84 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
85 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
86 | #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT | ||
87 | .max_width = 8, | ||
88 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
89 | #endif | ||
90 | }; | ||
91 | |||
92 | static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = { | ||
93 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
94 | .ext_cd_gpio = EXYNOS4_GPK0(2), | ||
95 | .ext_cd_gpio_invert = 1, | ||
96 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
97 | }; | ||
98 | |||
99 | static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = { | ||
100 | .cd_type = S3C_SDHCI_CD_INTERNAL, | ||
101 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
102 | #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT | ||
103 | .max_width = 8, | ||
104 | .host_caps = MMC_CAP_8_BIT_DATA, | ||
105 | #endif | ||
106 | }; | ||
107 | |||
108 | static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = { | ||
109 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
110 | .ext_cd_gpio = EXYNOS4_GPK2(2), | ||
111 | .ext_cd_gpio_invert = 1, | ||
112 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
113 | }; | ||
114 | |||
115 | static struct resource smdkv310_smsc911x_resources[] = { | ||
116 | [0] = { | ||
117 | .start = EXYNOS4_PA_SROM_BANK(1), | ||
118 | .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1, | ||
119 | .flags = IORESOURCE_MEM, | ||
120 | }, | ||
121 | [1] = { | ||
122 | .start = IRQ_EINT(5), | ||
123 | .end = IRQ_EINT(5), | ||
124 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static struct smsc911x_platform_config smsc9215_config = { | ||
129 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
130 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
131 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | ||
132 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
133 | .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67}, | ||
134 | }; | ||
135 | |||
136 | static struct platform_device smdkv310_smsc911x = { | ||
137 | .name = "smsc911x", | ||
138 | .id = -1, | ||
139 | .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources), | ||
140 | .resource = smdkv310_smsc911x_resources, | ||
141 | .dev = { | ||
142 | .platform_data = &smsc9215_config, | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | static uint32_t smdkv310_keymap[] __initdata = { | ||
147 | /* KEY(row, col, keycode) */ | ||
148 | KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3), | ||
149 | KEY(0, 6, KEY_4), KEY(0, 7, KEY_5), | ||
150 | KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C), | ||
151 | KEY(1, 6, KEY_D), KEY(1, 7, KEY_E) | ||
152 | }; | ||
153 | |||
154 | static struct matrix_keymap_data smdkv310_keymap_data __initdata = { | ||
155 | .keymap = smdkv310_keymap, | ||
156 | .keymap_size = ARRAY_SIZE(smdkv310_keymap), | ||
157 | }; | ||
158 | |||
159 | static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = { | ||
160 | .keymap_data = &smdkv310_keymap_data, | ||
161 | .rows = 2, | ||
162 | .cols = 8, | ||
163 | }; | ||
164 | |||
165 | static struct i2c_board_info i2c_devs1[] __initdata = { | ||
166 | {I2C_BOARD_INFO("wm8994", 0x1a),}, | ||
167 | }; | ||
168 | |||
169 | static struct platform_device *smdkv310_devices[] __initdata = { | ||
170 | &s3c_device_hsmmc0, | ||
171 | &s3c_device_hsmmc1, | ||
172 | &s3c_device_hsmmc2, | ||
173 | &s3c_device_hsmmc3, | ||
174 | &s3c_device_i2c1, | ||
175 | &s3c_device_rtc, | ||
176 | &s3c_device_wdt, | ||
177 | &exynos4_device_ac97, | ||
178 | &exynos4_device_i2s0, | ||
179 | &samsung_device_keypad, | ||
180 | &exynos4_device_pd[PD_MFC], | ||
181 | &exynos4_device_pd[PD_G3D], | ||
182 | &exynos4_device_pd[PD_LCD0], | ||
183 | &exynos4_device_pd[PD_LCD1], | ||
184 | &exynos4_device_pd[PD_CAM], | ||
185 | &exynos4_device_pd[PD_TV], | ||
186 | &exynos4_device_pd[PD_GPS], | ||
187 | &exynos4_device_spdif, | ||
188 | &exynos4_device_sysmmu, | ||
189 | &samsung_asoc_dma, | ||
190 | &samsung_asoc_idma, | ||
191 | &smdkv310_smsc911x, | ||
192 | &exynos4_device_ahci, | ||
193 | }; | ||
194 | |||
195 | static void __init smdkv310_smsc911x_init(void) | ||
196 | { | ||
197 | u32 cs1; | ||
198 | |||
199 | /* configure nCS1 width to 16 bits */ | ||
200 | cs1 = __raw_readl(S5P_SROM_BW) & | ||
201 | ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT); | ||
202 | cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) | | ||
203 | (1 << S5P_SROM_BW__WAITENABLE__SHIFT) | | ||
204 | (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << | ||
205 | S5P_SROM_BW__NCS1__SHIFT; | ||
206 | __raw_writel(cs1, S5P_SROM_BW); | ||
207 | |||
208 | /* set timing for nCS1 suitable for ethernet chip */ | ||
209 | __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) | | ||
210 | (0x9 << S5P_SROM_BCX__TACP__SHIFT) | | ||
211 | (0xc << S5P_SROM_BCX__TCAH__SHIFT) | | ||
212 | (0x1 << S5P_SROM_BCX__TCOH__SHIFT) | | ||
213 | (0x6 << S5P_SROM_BCX__TACC__SHIFT) | | ||
214 | (0x1 << S5P_SROM_BCX__TCOS__SHIFT) | | ||
215 | (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); | ||
216 | } | ||
217 | |||
218 | /* LCD Backlight data */ | ||
219 | static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = { | ||
220 | .no = EXYNOS4_GPD0(1), | ||
221 | .func = S3C_GPIO_SFN(2), | ||
222 | }; | ||
223 | |||
224 | static struct platform_pwm_backlight_data smdkv310_bl_data = { | ||
225 | .pwm_id = 1, | ||
226 | .pwm_period_ns = 1000, | ||
227 | }; | ||
228 | |||
229 | static void __init smdkv310_map_io(void) | ||
230 | { | ||
231 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
232 | s3c24xx_init_clocks(24000000); | ||
233 | s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); | ||
234 | } | ||
235 | |||
236 | static void __init smdkv310_machine_init(void) | ||
237 | { | ||
238 | s3c_i2c1_set_platdata(NULL); | ||
239 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | ||
240 | |||
241 | smdkv310_smsc911x_init(); | ||
242 | |||
243 | s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata); | ||
244 | s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata); | ||
245 | s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata); | ||
246 | s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata); | ||
247 | |||
248 | samsung_keypad_set_platdata(&smdkv310_keypad_data); | ||
249 | |||
250 | samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data); | ||
251 | |||
252 | platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices)); | ||
253 | } | ||
254 | |||
255 | MACHINE_START(SMDKV310, "SMDKV310") | ||
256 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
257 | /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ | ||
258 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
259 | .init_irq = exynos4_init_irq, | ||
260 | .map_io = smdkv310_map_io, | ||
261 | .init_machine = smdkv310_machine_init, | ||
262 | .timer = &exynos4_timer, | ||
263 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c b/arch/arm/mach-exynos4/mach-universal_c210.c new file mode 100644 index 00000000000..b3b5d891100 --- /dev/null +++ b/arch/arm/mach-exynos4/mach-universal_c210.c | |||
@@ -0,0 +1,771 @@ | |||
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/mfd/max8998.h> | ||
17 | #include <linux/regulator/machine.h> | ||
18 | #include <linux/regulator/fixed.h> | ||
19 | #include <linux/regulator/max8952.h> | ||
20 | #include <linux/mmc/host.h> | ||
21 | #include <linux/i2c-gpio.h> | ||
22 | #include <linux/i2c/mcs.h> | ||
23 | #include <linux/i2c/atmel_mxt_ts.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | |||
28 | #include <plat/regs-serial.h> | ||
29 | #include <plat/exynos4.h> | ||
30 | #include <plat/cpu.h> | ||
31 | #include <plat/devs.h> | ||
32 | #include <plat/iic.h> | ||
33 | #include <plat/gpio-cfg.h> | ||
34 | #include <plat/mfc.h> | ||
35 | #include <plat/sdhci.h> | ||
36 | #include <plat/pd.h> | ||
37 | |||
38 | #include <mach/map.h> | ||
39 | |||
40 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
41 | #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
42 | S3C2410_UCON_RXILEVEL | \ | ||
43 | S3C2410_UCON_TXIRQMODE | \ | ||
44 | S3C2410_UCON_RXIRQMODE | \ | ||
45 | S3C2410_UCON_RXFIFO_TOI | \ | ||
46 | S3C2443_UCON_RXERR_IRQEN) | ||
47 | |||
48 | #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
49 | |||
50 | #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
51 | S5PV210_UFCON_TXTRIG256 | \ | ||
52 | S5PV210_UFCON_RXTRIG256) | ||
53 | |||
54 | static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = { | ||
55 | [0] = { | ||
56 | .hwport = 0, | ||
57 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
58 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
59 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
60 | }, | ||
61 | [1] = { | ||
62 | .hwport = 1, | ||
63 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
64 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
65 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
66 | }, | ||
67 | [2] = { | ||
68 | .hwport = 2, | ||
69 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
70 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
71 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
72 | }, | ||
73 | [3] = { | ||
74 | .hwport = 3, | ||
75 | .ucon = UNIVERSAL_UCON_DEFAULT, | ||
76 | .ulcon = UNIVERSAL_ULCON_DEFAULT, | ||
77 | .ufcon = UNIVERSAL_UFCON_DEFAULT, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | static struct regulator_consumer_supply max8952_consumer = | ||
82 | REGULATOR_SUPPLY("vdd_arm", NULL); | ||
83 | |||
84 | static struct max8952_platform_data universal_max8952_pdata __initdata = { | ||
85 | .gpio_vid0 = EXYNOS4_GPX0(3), | ||
86 | .gpio_vid1 = EXYNOS4_GPX0(4), | ||
87 | .gpio_en = -1, /* Not controllable, set "Always High" */ | ||
88 | .default_mode = 0, /* vid0 = 0, vid1 = 0 */ | ||
89 | .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */ | ||
90 | .sync_freq = 0, /* default: fastest */ | ||
91 | .ramp_speed = 0, /* default: fastest */ | ||
92 | |||
93 | .reg_data = { | ||
94 | .constraints = { | ||
95 | .name = "VARM_1.2V", | ||
96 | .min_uV = 770000, | ||
97 | .max_uV = 1400000, | ||
98 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
99 | .always_on = 1, | ||
100 | .boot_on = 1, | ||
101 | }, | ||
102 | .num_consumer_supplies = 1, | ||
103 | .consumer_supplies = &max8952_consumer, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static struct regulator_consumer_supply lp3974_buck1_consumer = | ||
108 | REGULATOR_SUPPLY("vdd_int", NULL); | ||
109 | |||
110 | static struct regulator_consumer_supply lp3974_buck2_consumer = | ||
111 | REGULATOR_SUPPLY("vddg3d", NULL); | ||
112 | |||
113 | static struct regulator_init_data lp3974_buck1_data = { | ||
114 | .constraints = { | ||
115 | .name = "VINT_1.1V", | ||
116 | .min_uV = 750000, | ||
117 | .max_uV = 1500000, | ||
118 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
119 | REGULATOR_CHANGE_STATUS, | ||
120 | .boot_on = 1, | ||
121 | .state_mem = { | ||
122 | .disabled = 1, | ||
123 | }, | ||
124 | }, | ||
125 | .num_consumer_supplies = 1, | ||
126 | .consumer_supplies = &lp3974_buck1_consumer, | ||
127 | }; | ||
128 | |||
129 | static struct regulator_init_data lp3974_buck2_data = { | ||
130 | .constraints = { | ||
131 | .name = "VG3D_1.1V", | ||
132 | .min_uV = 750000, | ||
133 | .max_uV = 1500000, | ||
134 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
135 | REGULATOR_CHANGE_STATUS, | ||
136 | .boot_on = 1, | ||
137 | .state_mem = { | ||
138 | .disabled = 1, | ||
139 | }, | ||
140 | }, | ||
141 | .num_consumer_supplies = 1, | ||
142 | .consumer_supplies = &lp3974_buck2_consumer, | ||
143 | }; | ||
144 | |||
145 | static struct regulator_init_data lp3974_buck3_data = { | ||
146 | .constraints = { | ||
147 | .name = "VCC_1.8V", | ||
148 | .min_uV = 1800000, | ||
149 | .max_uV = 1800000, | ||
150 | .apply_uV = 1, | ||
151 | .always_on = 1, | ||
152 | .state_mem = { | ||
153 | .enabled = 1, | ||
154 | }, | ||
155 | }, | ||
156 | }; | ||
157 | |||
158 | static struct regulator_init_data lp3974_buck4_data = { | ||
159 | .constraints = { | ||
160 | .name = "VMEM_1.2V", | ||
161 | .min_uV = 1200000, | ||
162 | .max_uV = 1200000, | ||
163 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
164 | .apply_uV = 1, | ||
165 | .state_mem = { | ||
166 | .disabled = 1, | ||
167 | }, | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | static struct regulator_init_data lp3974_ldo2_data = { | ||
172 | .constraints = { | ||
173 | .name = "VALIVE_1.2V", | ||
174 | .min_uV = 1200000, | ||
175 | .max_uV = 1200000, | ||
176 | .apply_uV = 1, | ||
177 | .always_on = 1, | ||
178 | .state_mem = { | ||
179 | .enabled = 1, | ||
180 | }, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static struct regulator_init_data lp3974_ldo3_data = { | ||
185 | .constraints = { | ||
186 | .name = "VUSB+MIPI_1.1V", | ||
187 | .min_uV = 1100000, | ||
188 | .max_uV = 1100000, | ||
189 | .apply_uV = 1, | ||
190 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
191 | .state_mem = { | ||
192 | .disabled = 1, | ||
193 | }, | ||
194 | }, | ||
195 | }; | ||
196 | |||
197 | static struct regulator_init_data lp3974_ldo4_data = { | ||
198 | .constraints = { | ||
199 | .name = "VADC_3.3V", | ||
200 | .min_uV = 3300000, | ||
201 | .max_uV = 3300000, | ||
202 | .apply_uV = 1, | ||
203 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
204 | .state_mem = { | ||
205 | .disabled = 1, | ||
206 | }, | ||
207 | }, | ||
208 | }; | ||
209 | |||
210 | static struct regulator_init_data lp3974_ldo5_data = { | ||
211 | .constraints = { | ||
212 | .name = "VTF_2.8V", | ||
213 | .min_uV = 2800000, | ||
214 | .max_uV = 2800000, | ||
215 | .apply_uV = 1, | ||
216 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
217 | .state_mem = { | ||
218 | .disabled = 1, | ||
219 | }, | ||
220 | }, | ||
221 | }; | ||
222 | |||
223 | static struct regulator_init_data lp3974_ldo6_data = { | ||
224 | .constraints = { | ||
225 | .name = "LDO6", | ||
226 | .min_uV = 2000000, | ||
227 | .max_uV = 2000000, | ||
228 | .apply_uV = 1, | ||
229 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
230 | .state_mem = { | ||
231 | .disabled = 1, | ||
232 | }, | ||
233 | }, | ||
234 | }; | ||
235 | |||
236 | static struct regulator_init_data lp3974_ldo7_data = { | ||
237 | .constraints = { | ||
238 | .name = "VLCD+VMIPI_1.8V", | ||
239 | .min_uV = 1800000, | ||
240 | .max_uV = 1800000, | ||
241 | .apply_uV = 1, | ||
242 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
243 | .state_mem = { | ||
244 | .disabled = 1, | ||
245 | }, | ||
246 | }, | ||
247 | }; | ||
248 | |||
249 | static struct regulator_init_data lp3974_ldo8_data = { | ||
250 | .constraints = { | ||
251 | .name = "VUSB+VDAC_3.3V", | ||
252 | .min_uV = 3300000, | ||
253 | .max_uV = 3300000, | ||
254 | .apply_uV = 1, | ||
255 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
256 | .state_mem = { | ||
257 | .disabled = 1, | ||
258 | }, | ||
259 | }, | ||
260 | }; | ||
261 | |||
262 | static struct regulator_init_data lp3974_ldo9_data = { | ||
263 | .constraints = { | ||
264 | .name = "VCC_2.8V", | ||
265 | .min_uV = 2800000, | ||
266 | .max_uV = 2800000, | ||
267 | .apply_uV = 1, | ||
268 | .always_on = 1, | ||
269 | .state_mem = { | ||
270 | .enabled = 1, | ||
271 | }, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | static struct regulator_init_data lp3974_ldo10_data = { | ||
276 | .constraints = { | ||
277 | .name = "VPLL_1.1V", | ||
278 | .min_uV = 1100000, | ||
279 | .max_uV = 1100000, | ||
280 | .boot_on = 1, | ||
281 | .apply_uV = 1, | ||
282 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
283 | .state_mem = { | ||
284 | .disabled = 1, | ||
285 | }, | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | static struct regulator_init_data lp3974_ldo11_data = { | ||
290 | .constraints = { | ||
291 | .name = "CAM_AF_3.3V", | ||
292 | .min_uV = 3300000, | ||
293 | .max_uV = 3300000, | ||
294 | .apply_uV = 1, | ||
295 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
296 | .state_mem = { | ||
297 | .disabled = 1, | ||
298 | }, | ||
299 | }, | ||
300 | }; | ||
301 | |||
302 | static struct regulator_init_data lp3974_ldo12_data = { | ||
303 | .constraints = { | ||
304 | .name = "PS_2.8V", | ||
305 | .min_uV = 2800000, | ||
306 | .max_uV = 2800000, | ||
307 | .apply_uV = 1, | ||
308 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
309 | .state_mem = { | ||
310 | .disabled = 1, | ||
311 | }, | ||
312 | }, | ||
313 | }; | ||
314 | |||
315 | static struct regulator_init_data lp3974_ldo13_data = { | ||
316 | .constraints = { | ||
317 | .name = "VHIC_1.2V", | ||
318 | .min_uV = 1200000, | ||
319 | .max_uV = 1200000, | ||
320 | .apply_uV = 1, | ||
321 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
322 | .state_mem = { | ||
323 | .disabled = 1, | ||
324 | }, | ||
325 | }, | ||
326 | }; | ||
327 | |||
328 | static struct regulator_init_data lp3974_ldo14_data = { | ||
329 | .constraints = { | ||
330 | .name = "CAM_I_HOST_1.8V", | ||
331 | .min_uV = 1800000, | ||
332 | .max_uV = 1800000, | ||
333 | .apply_uV = 1, | ||
334 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
335 | .state_mem = { | ||
336 | .disabled = 1, | ||
337 | }, | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct regulator_init_data lp3974_ldo15_data = { | ||
342 | .constraints = { | ||
343 | .name = "CAM_S_DIG+FM33_CORE_1.2V", | ||
344 | .min_uV = 1200000, | ||
345 | .max_uV = 1200000, | ||
346 | .apply_uV = 1, | ||
347 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
348 | .state_mem = { | ||
349 | .disabled = 1, | ||
350 | }, | ||
351 | }, | ||
352 | }; | ||
353 | |||
354 | static struct regulator_init_data lp3974_ldo16_data = { | ||
355 | .constraints = { | ||
356 | .name = "CAM_S_ANA_2.8V", | ||
357 | .min_uV = 2800000, | ||
358 | .max_uV = 2800000, | ||
359 | .apply_uV = 1, | ||
360 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
361 | .state_mem = { | ||
362 | .disabled = 1, | ||
363 | }, | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static struct regulator_init_data lp3974_ldo17_data = { | ||
368 | .constraints = { | ||
369 | .name = "VCC_3.0V_LCD", | ||
370 | .min_uV = 3000000, | ||
371 | .max_uV = 3000000, | ||
372 | .apply_uV = 1, | ||
373 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
374 | .boot_on = 1, | ||
375 | .state_mem = { | ||
376 | .disabled = 1, | ||
377 | }, | ||
378 | }, | ||
379 | }; | ||
380 | |||
381 | static struct regulator_init_data lp3974_32khz_ap_data = { | ||
382 | .constraints = { | ||
383 | .name = "32KHz AP", | ||
384 | .always_on = 1, | ||
385 | .state_mem = { | ||
386 | .enabled = 1, | ||
387 | }, | ||
388 | }, | ||
389 | }; | ||
390 | |||
391 | static struct regulator_init_data lp3974_32khz_cp_data = { | ||
392 | .constraints = { | ||
393 | .name = "32KHz CP", | ||
394 | .state_mem = { | ||
395 | .disabled = 1, | ||
396 | }, | ||
397 | }, | ||
398 | }; | ||
399 | |||
400 | static struct regulator_init_data lp3974_vichg_data = { | ||
401 | .constraints = { | ||
402 | .name = "VICHG", | ||
403 | .state_mem = { | ||
404 | .disabled = 1, | ||
405 | }, | ||
406 | }, | ||
407 | }; | ||
408 | |||
409 | static struct regulator_init_data lp3974_esafeout1_data = { | ||
410 | .constraints = { | ||
411 | .name = "SAFEOUT1", | ||
412 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
413 | .state_mem = { | ||
414 | .enabled = 1, | ||
415 | }, | ||
416 | }, | ||
417 | }; | ||
418 | |||
419 | static struct regulator_init_data lp3974_esafeout2_data = { | ||
420 | .constraints = { | ||
421 | .name = "SAFEOUT2", | ||
422 | .boot_on = 1, | ||
423 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
424 | .state_mem = { | ||
425 | .enabled = 1, | ||
426 | }, | ||
427 | }, | ||
428 | }; | ||
429 | |||
430 | static struct max8998_regulator_data lp3974_regulators[] = { | ||
431 | { MAX8998_LDO2, &lp3974_ldo2_data }, | ||
432 | { MAX8998_LDO3, &lp3974_ldo3_data }, | ||
433 | { MAX8998_LDO4, &lp3974_ldo4_data }, | ||
434 | { MAX8998_LDO5, &lp3974_ldo5_data }, | ||
435 | { MAX8998_LDO6, &lp3974_ldo6_data }, | ||
436 | { MAX8998_LDO7, &lp3974_ldo7_data }, | ||
437 | { MAX8998_LDO8, &lp3974_ldo8_data }, | ||
438 | { MAX8998_LDO9, &lp3974_ldo9_data }, | ||
439 | { MAX8998_LDO10, &lp3974_ldo10_data }, | ||
440 | { MAX8998_LDO11, &lp3974_ldo11_data }, | ||
441 | { MAX8998_LDO12, &lp3974_ldo12_data }, | ||
442 | { MAX8998_LDO13, &lp3974_ldo13_data }, | ||
443 | { MAX8998_LDO14, &lp3974_ldo14_data }, | ||
444 | { MAX8998_LDO15, &lp3974_ldo15_data }, | ||
445 | { MAX8998_LDO16, &lp3974_ldo16_data }, | ||
446 | { MAX8998_LDO17, &lp3974_ldo17_data }, | ||
447 | { MAX8998_BUCK1, &lp3974_buck1_data }, | ||
448 | { MAX8998_BUCK2, &lp3974_buck2_data }, | ||
449 | { MAX8998_BUCK3, &lp3974_buck3_data }, | ||
450 | { MAX8998_BUCK4, &lp3974_buck4_data }, | ||
451 | { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data }, | ||
452 | { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data }, | ||
453 | { MAX8998_ENVICHG, &lp3974_vichg_data }, | ||
454 | { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data }, | ||
455 | { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data }, | ||
456 | }; | ||
457 | |||
458 | static struct max8998_platform_data universal_lp3974_pdata = { | ||
459 | .num_regulators = ARRAY_SIZE(lp3974_regulators), | ||
460 | .regulators = lp3974_regulators, | ||
461 | .buck1_voltage1 = 1100000, /* INT */ | ||
462 | .buck1_voltage2 = 1000000, | ||
463 | .buck1_voltage3 = 1100000, | ||
464 | .buck1_voltage4 = 1000000, | ||
465 | .buck1_set1 = EXYNOS4_GPX0(5), | ||
466 | .buck1_set2 = EXYNOS4_GPX0(6), | ||
467 | .buck2_voltage1 = 1200000, /* G3D */ | ||
468 | .buck2_voltage2 = 1100000, | ||
469 | .buck1_default_idx = 0, | ||
470 | .buck2_set3 = EXYNOS4_GPE2(0), | ||
471 | .buck2_default_idx = 0, | ||
472 | .wakeup = true, | ||
473 | }; | ||
474 | |||
475 | /* GPIO I2C 5 (PMIC) */ | ||
476 | static struct i2c_board_info i2c5_devs[] __initdata = { | ||
477 | { | ||
478 | I2C_BOARD_INFO("max8952", 0xC0 >> 1), | ||
479 | .platform_data = &universal_max8952_pdata, | ||
480 | }, { | ||
481 | I2C_BOARD_INFO("lp3974", 0xCC >> 1), | ||
482 | .platform_data = &universal_lp3974_pdata, | ||
483 | }, | ||
484 | }; | ||
485 | |||
486 | /* I2C3 (TSP) */ | ||
487 | static struct mxt_platform_data qt602240_platform_data = { | ||
488 | .x_line = 19, | ||
489 | .y_line = 11, | ||
490 | .x_size = 800, | ||
491 | .y_size = 480, | ||
492 | .blen = 0x11, | ||
493 | .threshold = 0x28, | ||
494 | .voltage = 2800000, /* 2.8V */ | ||
495 | .orient = MXT_DIAGONAL, | ||
496 | }; | ||
497 | |||
498 | static struct i2c_board_info i2c3_devs[] __initdata = { | ||
499 | { | ||
500 | I2C_BOARD_INFO("qt602240_ts", 0x4a), | ||
501 | .platform_data = &qt602240_platform_data, | ||
502 | }, | ||
503 | }; | ||
504 | |||
505 | static void __init universal_tsp_init(void) | ||
506 | { | ||
507 | int gpio; | ||
508 | |||
509 | /* TSP_LDO_ON: XMDMADDR_11 */ | ||
510 | gpio = EXYNOS4_GPE2(3); | ||
511 | gpio_request(gpio, "TSP_LDO_ON"); | ||
512 | gpio_direction_output(gpio, 1); | ||
513 | gpio_export(gpio, 0); | ||
514 | |||
515 | /* TSP_INT: XMDMADDR_7 */ | ||
516 | gpio = EXYNOS4_GPE1(7); | ||
517 | gpio_request(gpio, "TSP_INT"); | ||
518 | |||
519 | s5p_register_gpio_interrupt(gpio); | ||
520 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
521 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | ||
522 | i2c3_devs[0].irq = gpio_to_irq(gpio); | ||
523 | } | ||
524 | |||
525 | |||
526 | /* GPIO I2C 12 (3 Touchkey) */ | ||
527 | static uint32_t touchkey_keymap[] = { | ||
528 | /* MCS_KEY_MAP(value, keycode) */ | ||
529 | MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */ | ||
530 | MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */ | ||
531 | }; | ||
532 | |||
533 | static struct mcs_platform_data touchkey_data = { | ||
534 | .keymap = touchkey_keymap, | ||
535 | .keymap_size = ARRAY_SIZE(touchkey_keymap), | ||
536 | .key_maxval = 2, | ||
537 | }; | ||
538 | |||
539 | /* GPIO I2C 3_TOUCH 2.8V */ | ||
540 | #define I2C_GPIO_BUS_12 12 | ||
541 | static struct i2c_gpio_platform_data i2c_gpio12_data = { | ||
542 | .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */ | ||
543 | .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */ | ||
544 | }; | ||
545 | |||
546 | static struct platform_device i2c_gpio12 = { | ||
547 | .name = "i2c-gpio", | ||
548 | .id = I2C_GPIO_BUS_12, | ||
549 | .dev = { | ||
550 | .platform_data = &i2c_gpio12_data, | ||
551 | }, | ||
552 | }; | ||
553 | |||
554 | static struct i2c_board_info i2c_gpio12_devs[] __initdata = { | ||
555 | { | ||
556 | I2C_BOARD_INFO("mcs5080_touchkey", 0x20), | ||
557 | .platform_data = &touchkey_data, | ||
558 | }, | ||
559 | }; | ||
560 | |||
561 | static void __init universal_touchkey_init(void) | ||
562 | { | ||
563 | int gpio; | ||
564 | |||
565 | gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */ | ||
566 | gpio_request(gpio, "3_TOUCH_INT"); | ||
567 | s5p_register_gpio_interrupt(gpio); | ||
568 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
569 | i2c_gpio12_devs[0].irq = gpio_to_irq(gpio); | ||
570 | |||
571 | gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */ | ||
572 | gpio_request(gpio, "3_TOUCH_EN"); | ||
573 | gpio_direction_output(gpio, 1); | ||
574 | } | ||
575 | |||
576 | /* GPIO KEYS */ | ||
577 | static struct gpio_keys_button universal_gpio_keys_tables[] = { | ||
578 | { | ||
579 | .code = KEY_VOLUMEUP, | ||
580 | .gpio = EXYNOS4_GPX2(0), /* XEINT16 */ | ||
581 | .desc = "gpio-keys: KEY_VOLUMEUP", | ||
582 | .type = EV_KEY, | ||
583 | .active_low = 1, | ||
584 | .debounce_interval = 1, | ||
585 | }, { | ||
586 | .code = KEY_VOLUMEDOWN, | ||
587 | .gpio = EXYNOS4_GPX2(1), /* XEINT17 */ | ||
588 | .desc = "gpio-keys: KEY_VOLUMEDOWN", | ||
589 | .type = EV_KEY, | ||
590 | .active_low = 1, | ||
591 | .debounce_interval = 1, | ||
592 | }, { | ||
593 | .code = KEY_CONFIG, | ||
594 | .gpio = EXYNOS4_GPX2(2), /* XEINT18 */ | ||
595 | .desc = "gpio-keys: KEY_CONFIG", | ||
596 | .type = EV_KEY, | ||
597 | .active_low = 1, | ||
598 | .debounce_interval = 1, | ||
599 | }, { | ||
600 | .code = KEY_CAMERA, | ||
601 | .gpio = EXYNOS4_GPX2(3), /* XEINT19 */ | ||
602 | .desc = "gpio-keys: KEY_CAMERA", | ||
603 | .type = EV_KEY, | ||
604 | .active_low = 1, | ||
605 | .debounce_interval = 1, | ||
606 | }, { | ||
607 | .code = KEY_OK, | ||
608 | .gpio = EXYNOS4_GPX3(5), /* XEINT29 */ | ||
609 | .desc = "gpio-keys: KEY_OK", | ||
610 | .type = EV_KEY, | ||
611 | .active_low = 1, | ||
612 | .debounce_interval = 1, | ||
613 | }, | ||
614 | }; | ||
615 | |||
616 | static struct gpio_keys_platform_data universal_gpio_keys_data = { | ||
617 | .buttons = universal_gpio_keys_tables, | ||
618 | .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables), | ||
619 | }; | ||
620 | |||
621 | static struct platform_device universal_gpio_keys = { | ||
622 | .name = "gpio-keys", | ||
623 | .dev = { | ||
624 | .platform_data = &universal_gpio_keys_data, | ||
625 | }, | ||
626 | }; | ||
627 | |||
628 | /* eMMC */ | ||
629 | static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { | ||
630 | .max_width = 8, | ||
631 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | ||
632 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
633 | MMC_CAP_DISABLE), | ||
634 | .cd_type = S3C_SDHCI_CD_PERMANENT, | ||
635 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
636 | }; | ||
637 | |||
638 | static struct regulator_consumer_supply mmc0_supplies[] = { | ||
639 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | ||
640 | }; | ||
641 | |||
642 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { | ||
643 | .constraints = { | ||
644 | .name = "VMEM_VDD_2.8V", | ||
645 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
646 | }, | ||
647 | .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies), | ||
648 | .consumer_supplies = mmc0_supplies, | ||
649 | }; | ||
650 | |||
651 | static struct fixed_voltage_config mmc0_fixed_voltage_config = { | ||
652 | .supply_name = "MASSMEMORY_EN", | ||
653 | .microvolts = 2800000, | ||
654 | .gpio = EXYNOS4_GPE1(3), | ||
655 | .enable_high = true, | ||
656 | .init_data = &mmc0_fixed_voltage_init_data, | ||
657 | }; | ||
658 | |||
659 | static struct platform_device mmc0_fixed_voltage = { | ||
660 | .name = "reg-fixed-voltage", | ||
661 | .id = 0, | ||
662 | .dev = { | ||
663 | .platform_data = &mmc0_fixed_voltage_config, | ||
664 | }, | ||
665 | }; | ||
666 | |||
667 | /* SD */ | ||
668 | static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = { | ||
669 | .max_width = 4, | ||
670 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
671 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
672 | MMC_CAP_DISABLE, | ||
673 | .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */ | ||
674 | .ext_cd_gpio_invert = 1, | ||
675 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
676 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | ||
677 | }; | ||
678 | |||
679 | /* WiFi */ | ||
680 | static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = { | ||
681 | .max_width = 4, | ||
682 | .host_caps = MMC_CAP_4_BIT_DATA | | ||
683 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | ||
684 | MMC_CAP_DISABLE, | ||
685 | .cd_type = S3C_SDHCI_CD_EXTERNAL, | ||
686 | }; | ||
687 | |||
688 | static void __init universal_sdhci_init(void) | ||
689 | { | ||
690 | s3c_sdhci0_set_platdata(&universal_hsmmc0_data); | ||
691 | s3c_sdhci2_set_platdata(&universal_hsmmc2_data); | ||
692 | s3c_sdhci3_set_platdata(&universal_hsmmc3_data); | ||
693 | } | ||
694 | |||
695 | /* I2C0 */ | ||
696 | static struct i2c_board_info i2c0_devs[] __initdata = { | ||
697 | /* Camera, To be updated */ | ||
698 | }; | ||
699 | |||
700 | /* I2C1 */ | ||
701 | static struct i2c_board_info i2c1_devs[] __initdata = { | ||
702 | /* Gyro, To be updated */ | ||
703 | }; | ||
704 | |||
705 | static struct platform_device *universal_devices[] __initdata = { | ||
706 | /* Samsung Platform Devices */ | ||
707 | &s5p_device_fimc0, | ||
708 | &s5p_device_fimc1, | ||
709 | &s5p_device_fimc2, | ||
710 | &s5p_device_fimc3, | ||
711 | &mmc0_fixed_voltage, | ||
712 | &s3c_device_hsmmc0, | ||
713 | &s3c_device_hsmmc2, | ||
714 | &s3c_device_hsmmc3, | ||
715 | &s3c_device_i2c3, | ||
716 | &s3c_device_i2c5, | ||
717 | |||
718 | /* Universal Devices */ | ||
719 | &i2c_gpio12, | ||
720 | &universal_gpio_keys, | ||
721 | &s5p_device_onenand, | ||
722 | &s5p_device_mfc, | ||
723 | &s5p_device_mfc_l, | ||
724 | &s5p_device_mfc_r, | ||
725 | &exynos4_device_pd[PD_MFC], | ||
726 | }; | ||
727 | |||
728 | static void __init universal_map_io(void) | ||
729 | { | ||
730 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
731 | s3c24xx_init_clocks(24000000); | ||
732 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | ||
733 | } | ||
734 | |||
735 | static void __init universal_reserve(void) | ||
736 | { | ||
737 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
738 | } | ||
739 | |||
740 | static void __init universal_machine_init(void) | ||
741 | { | ||
742 | universal_sdhci_init(); | ||
743 | |||
744 | i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); | ||
745 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | ||
746 | |||
747 | universal_tsp_init(); | ||
748 | s3c_i2c3_set_platdata(NULL); | ||
749 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | ||
750 | |||
751 | s3c_i2c5_set_platdata(NULL); | ||
752 | i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); | ||
753 | |||
754 | universal_touchkey_init(); | ||
755 | i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs, | ||
756 | ARRAY_SIZE(i2c_gpio12_devs)); | ||
757 | |||
758 | /* Last */ | ||
759 | platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); | ||
760 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
761 | } | ||
762 | |||
763 | MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") | ||
764 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | ||
765 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
766 | .init_irq = exynos4_init_irq, | ||
767 | .map_io = universal_map_io, | ||
768 | .init_machine = universal_machine_init, | ||
769 | .timer = &exynos4_timer, | ||
770 | .reserve = &universal_reserve, | ||
771 | MACHINE_END | ||
diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c new file mode 100644 index 00000000000..ddd86864fb8 --- /dev/null +++ b/arch/arm/mach-exynos4/mct.c | |||
@@ -0,0 +1,429 @@ | |||
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 <mach/map.h> | ||
24 | #include <mach/regs-mct.h> | ||
25 | #include <asm/mach/time.h> | ||
26 | |||
27 | static unsigned long clk_cnt_per_tick; | ||
28 | static unsigned long clk_rate; | ||
29 | |||
30 | struct mct_clock_event_device { | ||
31 | struct clock_event_device *evt; | ||
32 | void __iomem *base; | ||
33 | }; | ||
34 | |||
35 | struct mct_clock_event_device mct_tick[2]; | ||
36 | |||
37 | static void exynos4_mct_write(unsigned int value, void *addr) | ||
38 | { | ||
39 | void __iomem *stat_addr; | ||
40 | u32 mask; | ||
41 | u32 i; | ||
42 | |||
43 | __raw_writel(value, addr); | ||
44 | |||
45 | switch ((u32) addr) { | ||
46 | case (u32) EXYNOS4_MCT_G_TCON: | ||
47 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
48 | mask = 1 << 16; /* G_TCON write status */ | ||
49 | break; | ||
50 | case (u32) EXYNOS4_MCT_G_COMP0_L: | ||
51 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
52 | mask = 1 << 0; /* G_COMP0_L write status */ | ||
53 | break; | ||
54 | case (u32) EXYNOS4_MCT_G_COMP0_U: | ||
55 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
56 | mask = 1 << 1; /* G_COMP0_U write status */ | ||
57 | break; | ||
58 | case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR: | ||
59 | stat_addr = EXYNOS4_MCT_G_WSTAT; | ||
60 | mask = 1 << 2; /* G_COMP0_ADD_INCR write status */ | ||
61 | break; | ||
62 | case (u32) EXYNOS4_MCT_G_CNT_L: | ||
63 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | ||
64 | mask = 1 << 0; /* G_CNT_L write status */ | ||
65 | break; | ||
66 | case (u32) EXYNOS4_MCT_G_CNT_U: | ||
67 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | ||
68 | mask = 1 << 1; /* G_CNT_U write status */ | ||
69 | break; | ||
70 | case (u32)(EXYNOS4_MCT_L0_BASE + MCT_L_TCON_OFFSET): | ||
71 | stat_addr = EXYNOS4_MCT_L0_BASE + MCT_L_WSTAT_OFFSET; | ||
72 | mask = 1 << 3; /* L0_TCON write status */ | ||
73 | break; | ||
74 | case (u32)(EXYNOS4_MCT_L1_BASE + MCT_L_TCON_OFFSET): | ||
75 | stat_addr = EXYNOS4_MCT_L1_BASE + MCT_L_WSTAT_OFFSET; | ||
76 | mask = 1 << 3; /* L1_TCON write status */ | ||
77 | break; | ||
78 | case (u32)(EXYNOS4_MCT_L0_BASE + MCT_L_TCNTB_OFFSET): | ||
79 | stat_addr = EXYNOS4_MCT_L0_BASE + MCT_L_WSTAT_OFFSET; | ||
80 | mask = 1 << 0; /* L0_TCNTB write status */ | ||
81 | break; | ||
82 | case (u32)(EXYNOS4_MCT_L1_BASE + MCT_L_TCNTB_OFFSET): | ||
83 | stat_addr = EXYNOS4_MCT_L1_BASE + MCT_L_WSTAT_OFFSET; | ||
84 | mask = 1 << 0; /* L1_TCNTB write status */ | ||
85 | break; | ||
86 | case (u32)(EXYNOS4_MCT_L0_BASE + MCT_L_ICNTB_OFFSET): | ||
87 | stat_addr = EXYNOS4_MCT_L0_BASE + MCT_L_WSTAT_OFFSET; | ||
88 | mask = 1 << 1; /* L0_ICNTB write status */ | ||
89 | break; | ||
90 | case (u32)(EXYNOS4_MCT_L1_BASE + MCT_L_ICNTB_OFFSET): | ||
91 | stat_addr = EXYNOS4_MCT_L1_BASE + MCT_L_WSTAT_OFFSET; | ||
92 | mask = 1 << 1; /* L1_ICNTB write status */ | ||
93 | break; | ||
94 | default: | ||
95 | return; | ||
96 | } | ||
97 | |||
98 | /* Wait maximum 1 ms until written values are applied */ | ||
99 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) | ||
100 | if (__raw_readl(stat_addr) & mask) { | ||
101 | __raw_writel(mask, stat_addr); | ||
102 | return; | ||
103 | } | ||
104 | |||
105 | panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr); | ||
106 | } | ||
107 | |||
108 | /* Clocksource handling */ | ||
109 | static void exynos4_mct_frc_start(u32 hi, u32 lo) | ||
110 | { | ||
111 | u32 reg; | ||
112 | |||
113 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | ||
114 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | ||
115 | |||
116 | reg = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
117 | reg |= MCT_G_TCON_START; | ||
118 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | ||
119 | } | ||
120 | |||
121 | static cycle_t exynos4_frc_read(struct clocksource *cs) | ||
122 | { | ||
123 | unsigned int lo, hi; | ||
124 | u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | ||
125 | |||
126 | do { | ||
127 | hi = hi2; | ||
128 | lo = __raw_readl(EXYNOS4_MCT_G_CNT_L); | ||
129 | hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | ||
130 | } while (hi != hi2); | ||
131 | |||
132 | return ((cycle_t)hi << 32) | lo; | ||
133 | } | ||
134 | |||
135 | static void exynos4_frc_resume(struct clocksource *cs) | ||
136 | { | ||
137 | exynos4_mct_frc_start(0, 0); | ||
138 | } | ||
139 | |||
140 | struct clocksource mct_frc = { | ||
141 | .name = "mct-frc", | ||
142 | .rating = 400, | ||
143 | .read = exynos4_frc_read, | ||
144 | .mask = CLOCKSOURCE_MASK(64), | ||
145 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
146 | .resume = exynos4_frc_resume, | ||
147 | }; | ||
148 | |||
149 | static void __init exynos4_clocksource_init(void) | ||
150 | { | ||
151 | exynos4_mct_frc_start(0, 0); | ||
152 | |||
153 | if (clocksource_register_hz(&mct_frc, clk_rate)) | ||
154 | panic("%s: can't register clocksource\n", mct_frc.name); | ||
155 | } | ||
156 | |||
157 | static void exynos4_mct_comp0_stop(void) | ||
158 | { | ||
159 | unsigned int tcon; | ||
160 | |||
161 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
162 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); | ||
163 | |||
164 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); | ||
165 | exynos4_mct_write(0, EXYNOS4_MCT_G_INT_ENB); | ||
166 | } | ||
167 | |||
168 | static void exynos4_mct_comp0_start(enum clock_event_mode mode, | ||
169 | unsigned long cycles) | ||
170 | { | ||
171 | unsigned int tcon; | ||
172 | cycle_t comp_cycle; | ||
173 | |||
174 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | ||
175 | |||
176 | if (mode == CLOCK_EVT_MODE_PERIODIC) { | ||
177 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; | ||
178 | exynos4_mct_write(cycles, EXYNOS4_MCT_G_COMP0_ADD_INCR); | ||
179 | } | ||
180 | |||
181 | comp_cycle = exynos4_frc_read(&mct_frc) + cycles; | ||
182 | exynos4_mct_write((u32)comp_cycle, EXYNOS4_MCT_G_COMP0_L); | ||
183 | exynos4_mct_write((u32)(comp_cycle >> 32), EXYNOS4_MCT_G_COMP0_U); | ||
184 | |||
185 | exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_ENB); | ||
186 | |||
187 | tcon |= MCT_G_TCON_COMP0_ENABLE; | ||
188 | exynos4_mct_write(tcon , EXYNOS4_MCT_G_TCON); | ||
189 | } | ||
190 | |||
191 | static int exynos4_comp_set_next_event(unsigned long cycles, | ||
192 | struct clock_event_device *evt) | ||
193 | { | ||
194 | exynos4_mct_comp0_start(evt->mode, cycles); | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static void exynos4_comp_set_mode(enum clock_event_mode mode, | ||
200 | struct clock_event_device *evt) | ||
201 | { | ||
202 | exynos4_mct_comp0_stop(); | ||
203 | |||
204 | switch (mode) { | ||
205 | case CLOCK_EVT_MODE_PERIODIC: | ||
206 | exynos4_mct_comp0_start(mode, clk_cnt_per_tick); | ||
207 | break; | ||
208 | |||
209 | case CLOCK_EVT_MODE_ONESHOT: | ||
210 | case CLOCK_EVT_MODE_UNUSED: | ||
211 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
212 | case CLOCK_EVT_MODE_RESUME: | ||
213 | break; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | static struct clock_event_device mct_comp_device = { | ||
218 | .name = "mct-comp", | ||
219 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
220 | .rating = 250, | ||
221 | .set_next_event = exynos4_comp_set_next_event, | ||
222 | .set_mode = exynos4_comp_set_mode, | ||
223 | }; | ||
224 | |||
225 | static irqreturn_t exynos4_mct_comp_isr(int irq, void *dev_id) | ||
226 | { | ||
227 | struct clock_event_device *evt = dev_id; | ||
228 | |||
229 | exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_CSTAT); | ||
230 | |||
231 | evt->event_handler(evt); | ||
232 | |||
233 | return IRQ_HANDLED; | ||
234 | } | ||
235 | |||
236 | static struct irqaction mct_comp_event_irq = { | ||
237 | .name = "mct_comp_irq", | ||
238 | .flags = IRQF_TIMER | IRQF_IRQPOLL, | ||
239 | .handler = exynos4_mct_comp_isr, | ||
240 | .dev_id = &mct_comp_device, | ||
241 | }; | ||
242 | |||
243 | static void exynos4_clockevent_init(void) | ||
244 | { | ||
245 | clk_cnt_per_tick = clk_rate / 2 / HZ; | ||
246 | |||
247 | clockevents_calc_mult_shift(&mct_comp_device, clk_rate / 2, 5); | ||
248 | mct_comp_device.max_delta_ns = | ||
249 | clockevent_delta2ns(0xffffffff, &mct_comp_device); | ||
250 | mct_comp_device.min_delta_ns = | ||
251 | clockevent_delta2ns(0xf, &mct_comp_device); | ||
252 | mct_comp_device.cpumask = cpumask_of(0); | ||
253 | clockevents_register_device(&mct_comp_device); | ||
254 | |||
255 | setup_irq(IRQ_MCT_G0, &mct_comp_event_irq); | ||
256 | } | ||
257 | |||
258 | #ifdef CONFIG_LOCAL_TIMERS | ||
259 | /* Clock event handling */ | ||
260 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | ||
261 | { | ||
262 | unsigned long tmp; | ||
263 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; | ||
264 | void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET; | ||
265 | |||
266 | tmp = __raw_readl(addr); | ||
267 | if (tmp & mask) { | ||
268 | tmp &= ~mask; | ||
269 | exynos4_mct_write(tmp, addr); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | static void exynos4_mct_tick_start(unsigned long cycles, | ||
274 | struct mct_clock_event_device *mevt) | ||
275 | { | ||
276 | unsigned long tmp; | ||
277 | |||
278 | exynos4_mct_tick_stop(mevt); | ||
279 | |||
280 | tmp = (1 << 31) | cycles; /* MCT_L_UPDATE_ICNTB */ | ||
281 | |||
282 | /* update interrupt count buffer */ | ||
283 | exynos4_mct_write(tmp, mevt->base + MCT_L_ICNTB_OFFSET); | ||
284 | |||
285 | /* enable MCT tick interrupt */ | ||
286 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); | ||
287 | |||
288 | tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); | ||
289 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | | ||
290 | MCT_L_TCON_INTERVAL_MODE; | ||
291 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); | ||
292 | } | ||
293 | |||
294 | static int exynos4_tick_set_next_event(unsigned long cycles, | ||
295 | struct clock_event_device *evt) | ||
296 | { | ||
297 | struct mct_clock_event_device *mevt = &mct_tick[smp_processor_id()]; | ||
298 | |||
299 | exynos4_mct_tick_start(cycles, mevt); | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static inline void exynos4_tick_set_mode(enum clock_event_mode mode, | ||
305 | struct clock_event_device *evt) | ||
306 | { | ||
307 | struct mct_clock_event_device *mevt = &mct_tick[smp_processor_id()]; | ||
308 | |||
309 | exynos4_mct_tick_stop(mevt); | ||
310 | |||
311 | switch (mode) { | ||
312 | case CLOCK_EVT_MODE_PERIODIC: | ||
313 | exynos4_mct_tick_start(clk_cnt_per_tick, mevt); | ||
314 | break; | ||
315 | |||
316 | case CLOCK_EVT_MODE_ONESHOT: | ||
317 | case CLOCK_EVT_MODE_UNUSED: | ||
318 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
319 | case CLOCK_EVT_MODE_RESUME: | ||
320 | break; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id) | ||
325 | { | ||
326 | struct mct_clock_event_device *mevt = dev_id; | ||
327 | struct clock_event_device *evt = mevt->evt; | ||
328 | |||
329 | /* | ||
330 | * This is for supporting oneshot mode. | ||
331 | * Mct would generate interrupt periodically | ||
332 | * without explicit stopping. | ||
333 | */ | ||
334 | if (evt->mode != CLOCK_EVT_MODE_PERIODIC) | ||
335 | exynos4_mct_tick_stop(mevt); | ||
336 | |||
337 | /* Clear the MCT tick interrupt */ | ||
338 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); | ||
339 | |||
340 | evt->event_handler(evt); | ||
341 | |||
342 | return IRQ_HANDLED; | ||
343 | } | ||
344 | |||
345 | static struct irqaction mct_tick0_event_irq = { | ||
346 | .name = "mct_tick0_irq", | ||
347 | .flags = IRQF_TIMER | IRQF_NOBALANCING, | ||
348 | .handler = exynos4_mct_tick_isr, | ||
349 | }; | ||
350 | |||
351 | static struct irqaction mct_tick1_event_irq = { | ||
352 | .name = "mct_tick1_irq", | ||
353 | .flags = IRQF_TIMER | IRQF_NOBALANCING, | ||
354 | .handler = exynos4_mct_tick_isr, | ||
355 | }; | ||
356 | |||
357 | static void exynos4_mct_tick_init(struct clock_event_device *evt) | ||
358 | { | ||
359 | unsigned int cpu = smp_processor_id(); | ||
360 | |||
361 | mct_tick[cpu].evt = evt; | ||
362 | |||
363 | if (cpu == 0) { | ||
364 | mct_tick[cpu].base = EXYNOS4_MCT_L0_BASE; | ||
365 | evt->name = "mct_tick0"; | ||
366 | } else { | ||
367 | mct_tick[cpu].base = EXYNOS4_MCT_L1_BASE; | ||
368 | evt->name = "mct_tick1"; | ||
369 | } | ||
370 | |||
371 | evt->cpumask = cpumask_of(cpu); | ||
372 | evt->set_next_event = exynos4_tick_set_next_event; | ||
373 | evt->set_mode = exynos4_tick_set_mode; | ||
374 | evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
375 | evt->rating = 450; | ||
376 | |||
377 | clockevents_calc_mult_shift(evt, clk_rate / 2, 5); | ||
378 | evt->max_delta_ns = | ||
379 | clockevent_delta2ns(0x7fffffff, evt); | ||
380 | evt->min_delta_ns = | ||
381 | clockevent_delta2ns(0xf, evt); | ||
382 | |||
383 | clockevents_register_device(evt); | ||
384 | |||
385 | exynos4_mct_write(0x1, mct_tick[cpu].base + MCT_L_TCNTB_OFFSET); | ||
386 | |||
387 | if (cpu == 0) { | ||
388 | mct_tick0_event_irq.dev_id = &mct_tick[cpu]; | ||
389 | setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq); | ||
390 | } else { | ||
391 | mct_tick1_event_irq.dev_id = &mct_tick[cpu]; | ||
392 | setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq); | ||
393 | irq_set_affinity(IRQ_MCT_L1, cpumask_of(1)); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | /* Setup the local clock events for a CPU */ | ||
398 | int __cpuinit local_timer_setup(struct clock_event_device *evt) | ||
399 | { | ||
400 | exynos4_mct_tick_init(evt); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | int local_timer_ack(void) | ||
406 | { | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | #endif /* CONFIG_LOCAL_TIMERS */ | ||
411 | |||
412 | static void __init exynos4_timer_resources(void) | ||
413 | { | ||
414 | struct clk *mct_clk; | ||
415 | mct_clk = clk_get(NULL, "xtal"); | ||
416 | |||
417 | clk_rate = clk_get_rate(mct_clk); | ||
418 | } | ||
419 | |||
420 | static void __init exynos4_timer_init(void) | ||
421 | { | ||
422 | exynos4_timer_resources(); | ||
423 | exynos4_clocksource_init(); | ||
424 | exynos4_clockevent_init(); | ||
425 | } | ||
426 | |||
427 | struct sys_timer exynos4_timer = { | ||
428 | .init = exynos4_timer_init, | ||
429 | }; | ||
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c new file mode 100644 index 00000000000..0c90896ad9a --- /dev/null +++ b/arch/arm/mach-exynos4/platsmp.c | |||
@@ -0,0 +1,220 @@ | |||
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 | extern void exynos4_secondary_startup(void); | ||
34 | |||
35 | #define CPU1_BOOT_REG S5P_VA_SYSRAM | ||
36 | |||
37 | /* | ||
38 | * control for which core is the next to come out of the secondary | ||
39 | * boot "holding pen" | ||
40 | */ | ||
41 | |||
42 | volatile int __cpuinitdata pen_release = -1; | ||
43 | |||
44 | /* | ||
45 | * Write pen_release in a way that is guaranteed to be visible to all | ||
46 | * observers, irrespective of whether they're taking part in coherency | ||
47 | * or not. This is necessary for the hotplug code to work reliably. | ||
48 | */ | ||
49 | static void write_pen_release(int val) | ||
50 | { | ||
51 | pen_release = val; | ||
52 | smp_wmb(); | ||
53 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | ||
54 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
55 | } | ||
56 | |||
57 | static void __iomem *scu_base_addr(void) | ||
58 | { | ||
59 | return (void __iomem *)(S5P_VA_SCU); | ||
60 | } | ||
61 | |||
62 | static DEFINE_SPINLOCK(boot_lock); | ||
63 | |||
64 | static void __cpuinit exynos4_gic_secondary_init(void) | ||
65 | { | ||
66 | void __iomem *dist_base = S5P_VA_GIC_DIST + | ||
67 | (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id()); | ||
68 | void __iomem *cpu_base = S5P_VA_GIC_CPU + | ||
69 | (EXYNOS4_GIC_BANK_OFFSET * smp_processor_id()); | ||
70 | int i; | ||
71 | |||
72 | /* | ||
73 | * Deal with the banked PPI and SGI interrupts - disable all | ||
74 | * PPI interrupts, ensure all SGI interrupts are enabled. | ||
75 | */ | ||
76 | __raw_writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR); | ||
77 | __raw_writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET); | ||
78 | |||
79 | /* | ||
80 | * Set priority on PPI and SGI interrupts | ||
81 | */ | ||
82 | for (i = 0; i < 32; i += 4) | ||
83 | __raw_writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4); | ||
84 | |||
85 | __raw_writel(0xf0, cpu_base + GIC_CPU_PRIMASK); | ||
86 | __raw_writel(1, cpu_base + GIC_CPU_CTRL); | ||
87 | } | ||
88 | |||
89 | void __cpuinit platform_secondary_init(unsigned int cpu) | ||
90 | { | ||
91 | /* | ||
92 | * if any interrupts are already enabled for the primary | ||
93 | * core (e.g. timer irq), then they will not have been enabled | ||
94 | * for us: do so | ||
95 | */ | ||
96 | exynos4_gic_secondary_init(); | ||
97 | |||
98 | /* | ||
99 | * let the primary processor know we're out of the | ||
100 | * pen, then head off into the C entry point | ||
101 | */ | ||
102 | write_pen_release(-1); | ||
103 | |||
104 | /* | ||
105 | * Synchronise with the boot thread. | ||
106 | */ | ||
107 | spin_lock(&boot_lock); | ||
108 | spin_unlock(&boot_lock); | ||
109 | |||
110 | set_cpu_online(cpu, true); | ||
111 | } | ||
112 | |||
113 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
114 | { | ||
115 | unsigned long timeout; | ||
116 | |||
117 | /* | ||
118 | * Set synchronisation state between this boot processor | ||
119 | * and the secondary one | ||
120 | */ | ||
121 | spin_lock(&boot_lock); | ||
122 | |||
123 | /* | ||
124 | * The secondary processor is waiting to be released from | ||
125 | * the holding pen - release it, then wait for it to flag | ||
126 | * that it has been released by resetting pen_release. | ||
127 | * | ||
128 | * Note that "pen_release" is the hardware CPU ID, whereas | ||
129 | * "cpu" is Linux's internal ID. | ||
130 | */ | ||
131 | write_pen_release(cpu); | ||
132 | |||
133 | if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) { | ||
134 | __raw_writel(S5P_CORE_LOCAL_PWR_EN, | ||
135 | S5P_ARM_CORE1_CONFIGURATION); | ||
136 | |||
137 | timeout = 10; | ||
138 | |||
139 | /* wait max 10 ms until cpu1 is on */ | ||
140 | while ((__raw_readl(S5P_ARM_CORE1_STATUS) | ||
141 | & S5P_CORE_LOCAL_PWR_EN) != S5P_CORE_LOCAL_PWR_EN) { | ||
142 | if (timeout-- == 0) | ||
143 | break; | ||
144 | |||
145 | mdelay(1); | ||
146 | } | ||
147 | |||
148 | if (timeout == 0) { | ||
149 | printk(KERN_ERR "cpu1 power enable failed"); | ||
150 | spin_unlock(&boot_lock); | ||
151 | return -ETIMEDOUT; | ||
152 | } | ||
153 | } | ||
154 | /* | ||
155 | * Send the secondary CPU a soft interrupt, thereby causing | ||
156 | * the boot monitor to read the system wide flags register, | ||
157 | * and branch to the address found there. | ||
158 | */ | ||
159 | |||
160 | timeout = jiffies + (1 * HZ); | ||
161 | while (time_before(jiffies, timeout)) { | ||
162 | smp_rmb(); | ||
163 | |||
164 | __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)), | ||
165 | CPU1_BOOT_REG); | ||
166 | gic_raise_softirq(cpumask_of(cpu), 1); | ||
167 | |||
168 | if (pen_release == -1) | ||
169 | break; | ||
170 | |||
171 | udelay(10); | ||
172 | } | ||
173 | |||
174 | /* | ||
175 | * now the secondary core is starting up let it run its | ||
176 | * calibrations, then wait for it to finish | ||
177 | */ | ||
178 | spin_unlock(&boot_lock); | ||
179 | |||
180 | return pen_release != -1 ? -ENOSYS : 0; | ||
181 | } | ||
182 | |||
183 | /* | ||
184 | * Initialise the CPU possible map early - this describes the CPUs | ||
185 | * which may be present or become present in the system. | ||
186 | */ | ||
187 | |||
188 | void __init smp_init_cpus(void) | ||
189 | { | ||
190 | void __iomem *scu_base = scu_base_addr(); | ||
191 | unsigned int i, ncores; | ||
192 | |||
193 | ncores = scu_base ? scu_get_core_count(scu_base) : 1; | ||
194 | |||
195 | /* sanity check */ | ||
196 | if (ncores > nr_cpu_ids) { | ||
197 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", | ||
198 | ncores, nr_cpu_ids); | ||
199 | ncores = nr_cpu_ids; | ||
200 | } | ||
201 | |||
202 | for (i = 0; i < ncores; i++) | ||
203 | set_cpu_possible(i, true); | ||
204 | |||
205 | set_smp_cross_call(gic_raise_softirq); | ||
206 | } | ||
207 | |||
208 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | ||
209 | { | ||
210 | |||
211 | scu_enable(scu_base_addr()); | ||
212 | |||
213 | /* | ||
214 | * Write the address of secondary startup into the | ||
215 | * system-wide flags register. The boot monitor waits | ||
216 | * until it receives a soft interrupt, and then the | ||
217 | * secondary CPU branches to this address. | ||
218 | */ | ||
219 | __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)), S5P_VA_SYSRAM); | ||
220 | } | ||
diff --git a/arch/arm/mach-exynos4/pm.c b/arch/arm/mach-exynos4/pm.c new file mode 100644 index 00000000000..bc6ca9482de --- /dev/null +++ b/arch/arm/mach-exynos4/pm.c | |||
@@ -0,0 +1,486 @@ | |||
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_LCD1 , .val = 0x00001111, }, | ||
45 | { .reg = S5P_CLKSRC_MASK_MAUDIO , .val = 0x00000001, }, | ||
46 | { .reg = S5P_CLKSRC_MASK_FSYS , .val = 0x01011111, }, | ||
47 | { .reg = S5P_CLKSRC_MASK_PERIL0 , .val = 0x01111111, }, | ||
48 | { .reg = S5P_CLKSRC_MASK_PERIL1 , .val = 0x01110111, }, | ||
49 | { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, | ||
50 | }; | ||
51 | |||
52 | static struct sleep_save exynos4_epll_save[] = { | ||
53 | SAVE_ITEM(S5P_EPLL_CON0), | ||
54 | SAVE_ITEM(S5P_EPLL_CON1), | ||
55 | }; | ||
56 | |||
57 | static struct sleep_save exynos4_vpll_save[] = { | ||
58 | SAVE_ITEM(S5P_VPLL_CON0), | ||
59 | SAVE_ITEM(S5P_VPLL_CON1), | ||
60 | }; | ||
61 | |||
62 | static struct sleep_save exynos4_core_save[] = { | ||
63 | /* CMU side */ | ||
64 | SAVE_ITEM(S5P_CLKDIV_LEFTBUS), | ||
65 | SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), | ||
66 | SAVE_ITEM(S5P_CLKDIV_RIGHTBUS), | ||
67 | SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS), | ||
68 | SAVE_ITEM(S5P_CLKSRC_TOP0), | ||
69 | SAVE_ITEM(S5P_CLKSRC_TOP1), | ||
70 | SAVE_ITEM(S5P_CLKSRC_CAM), | ||
71 | SAVE_ITEM(S5P_CLKSRC_TV), | ||
72 | SAVE_ITEM(S5P_CLKSRC_MFC), | ||
73 | SAVE_ITEM(S5P_CLKSRC_G3D), | ||
74 | SAVE_ITEM(S5P_CLKSRC_IMAGE), | ||
75 | SAVE_ITEM(S5P_CLKSRC_LCD0), | ||
76 | SAVE_ITEM(S5P_CLKSRC_LCD1), | ||
77 | SAVE_ITEM(S5P_CLKSRC_MAUDIO), | ||
78 | SAVE_ITEM(S5P_CLKSRC_FSYS), | ||
79 | SAVE_ITEM(S5P_CLKSRC_PERIL0), | ||
80 | SAVE_ITEM(S5P_CLKSRC_PERIL1), | ||
81 | SAVE_ITEM(S5P_CLKDIV_CAM), | ||
82 | SAVE_ITEM(S5P_CLKDIV_TV), | ||
83 | SAVE_ITEM(S5P_CLKDIV_MFC), | ||
84 | SAVE_ITEM(S5P_CLKDIV_G3D), | ||
85 | SAVE_ITEM(S5P_CLKDIV_IMAGE), | ||
86 | SAVE_ITEM(S5P_CLKDIV_LCD0), | ||
87 | SAVE_ITEM(S5P_CLKDIV_LCD1), | ||
88 | SAVE_ITEM(S5P_CLKDIV_MAUDIO), | ||
89 | SAVE_ITEM(S5P_CLKDIV_FSYS0), | ||
90 | SAVE_ITEM(S5P_CLKDIV_FSYS1), | ||
91 | SAVE_ITEM(S5P_CLKDIV_FSYS2), | ||
92 | SAVE_ITEM(S5P_CLKDIV_FSYS3), | ||
93 | SAVE_ITEM(S5P_CLKDIV_PERIL0), | ||
94 | SAVE_ITEM(S5P_CLKDIV_PERIL1), | ||
95 | SAVE_ITEM(S5P_CLKDIV_PERIL2), | ||
96 | SAVE_ITEM(S5P_CLKDIV_PERIL3), | ||
97 | SAVE_ITEM(S5P_CLKDIV_PERIL4), | ||
98 | SAVE_ITEM(S5P_CLKDIV_PERIL5), | ||
99 | SAVE_ITEM(S5P_CLKDIV_TOP), | ||
100 | SAVE_ITEM(S5P_CLKSRC_MASK_TOP), | ||
101 | SAVE_ITEM(S5P_CLKSRC_MASK_CAM), | ||
102 | SAVE_ITEM(S5P_CLKSRC_MASK_TV), | ||
103 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD0), | ||
104 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD1), | ||
105 | SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO), | ||
106 | SAVE_ITEM(S5P_CLKSRC_MASK_FSYS), | ||
107 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0), | ||
108 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1), | ||
109 | SAVE_ITEM(S5P_CLKDIV2_RATIO), | ||
110 | SAVE_ITEM(S5P_CLKGATE_SCLKCAM), | ||
111 | SAVE_ITEM(S5P_CLKGATE_IP_CAM), | ||
112 | SAVE_ITEM(S5P_CLKGATE_IP_TV), | ||
113 | SAVE_ITEM(S5P_CLKGATE_IP_MFC), | ||
114 | SAVE_ITEM(S5P_CLKGATE_IP_G3D), | ||
115 | SAVE_ITEM(S5P_CLKGATE_IP_IMAGE), | ||
116 | SAVE_ITEM(S5P_CLKGATE_IP_LCD0), | ||
117 | SAVE_ITEM(S5P_CLKGATE_IP_LCD1), | ||
118 | SAVE_ITEM(S5P_CLKGATE_IP_FSYS), | ||
119 | SAVE_ITEM(S5P_CLKGATE_IP_GPS), | ||
120 | SAVE_ITEM(S5P_CLKGATE_IP_PERIL), | ||
121 | SAVE_ITEM(S5P_CLKGATE_IP_PERIR), | ||
122 | SAVE_ITEM(S5P_CLKGATE_BLOCK), | ||
123 | SAVE_ITEM(S5P_CLKSRC_MASK_DMC), | ||
124 | SAVE_ITEM(S5P_CLKSRC_DMC), | ||
125 | SAVE_ITEM(S5P_CLKDIV_DMC0), | ||
126 | SAVE_ITEM(S5P_CLKDIV_DMC1), | ||
127 | SAVE_ITEM(S5P_CLKGATE_IP_DMC), | ||
128 | SAVE_ITEM(S5P_CLKSRC_CPU), | ||
129 | SAVE_ITEM(S5P_CLKDIV_CPU), | ||
130 | SAVE_ITEM(S5P_CLKDIV_CPU + 0x4), | ||
131 | SAVE_ITEM(S5P_CLKGATE_SCLKCPU), | ||
132 | SAVE_ITEM(S5P_CLKGATE_IP_CPU), | ||
133 | |||
134 | /* GIC side */ | ||
135 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x000), | ||
136 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x004), | ||
137 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x008), | ||
138 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x00C), | ||
139 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x014), | ||
140 | SAVE_ITEM(S5P_VA_GIC_CPU + 0x018), | ||
141 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x000), | ||
142 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x004), | ||
143 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x100), | ||
144 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x104), | ||
145 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x108), | ||
146 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x300), | ||
147 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x304), | ||
148 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x308), | ||
149 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x400), | ||
150 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x404), | ||
151 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x408), | ||
152 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x40C), | ||
153 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x410), | ||
154 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x414), | ||
155 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x418), | ||
156 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x41C), | ||
157 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x420), | ||
158 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x424), | ||
159 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x428), | ||
160 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x42C), | ||
161 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x430), | ||
162 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x434), | ||
163 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x438), | ||
164 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x43C), | ||
165 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x440), | ||
166 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x444), | ||
167 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x448), | ||
168 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x44C), | ||
169 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x450), | ||
170 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x454), | ||
171 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x458), | ||
172 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x45C), | ||
173 | |||
174 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x800), | ||
175 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x804), | ||
176 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x808), | ||
177 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x80C), | ||
178 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x810), | ||
179 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x814), | ||
180 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x818), | ||
181 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x81C), | ||
182 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x820), | ||
183 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x824), | ||
184 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x828), | ||
185 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x82C), | ||
186 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x830), | ||
187 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x834), | ||
188 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x838), | ||
189 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x83C), | ||
190 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x840), | ||
191 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x844), | ||
192 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x848), | ||
193 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x84C), | ||
194 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x850), | ||
195 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x854), | ||
196 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x858), | ||
197 | SAVE_ITEM(S5P_VA_GIC_DIST + 0x85C), | ||
198 | |||
199 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC00), | ||
200 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC04), | ||
201 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC08), | ||
202 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC0C), | ||
203 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC10), | ||
204 | SAVE_ITEM(S5P_VA_GIC_DIST + 0xC14), | ||
205 | |||
206 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x000), | ||
207 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x010), | ||
208 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x020), | ||
209 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x030), | ||
210 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x040), | ||
211 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x050), | ||
212 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x060), | ||
213 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x070), | ||
214 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x080), | ||
215 | SAVE_ITEM(S5P_VA_COMBINER_BASE + 0x090), | ||
216 | |||
217 | /* SROM side */ | ||
218 | SAVE_ITEM(S5P_SROM_BW), | ||
219 | SAVE_ITEM(S5P_SROM_BC0), | ||
220 | SAVE_ITEM(S5P_SROM_BC1), | ||
221 | SAVE_ITEM(S5P_SROM_BC2), | ||
222 | SAVE_ITEM(S5P_SROM_BC3), | ||
223 | }; | ||
224 | |||
225 | static struct sleep_save exynos4_l2cc_save[] = { | ||
226 | SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL), | ||
227 | SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL), | ||
228 | SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL), | ||
229 | SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL), | ||
230 | SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL), | ||
231 | }; | ||
232 | |||
233 | /* For Cortex-A9 Diagnostic and Power control register */ | ||
234 | static unsigned int save_arm_register[2]; | ||
235 | |||
236 | static int exynos4_cpu_suspend(unsigned long arg) | ||
237 | { | ||
238 | outer_flush_all(); | ||
239 | |||
240 | /* issue the standby signal into the pm unit. */ | ||
241 | cpu_do_idle(); | ||
242 | |||
243 | /* we should never get past here */ | ||
244 | panic("sleep resumed to originator?"); | ||
245 | } | ||
246 | |||
247 | static void exynos4_pm_prepare(void) | ||
248 | { | ||
249 | u32 tmp; | ||
250 | |||
251 | s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); | ||
252 | s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); | ||
253 | s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save)); | ||
254 | s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save)); | ||
255 | |||
256 | tmp = __raw_readl(S5P_INFORM1); | ||
257 | |||
258 | /* Set value of power down register for sleep mode */ | ||
259 | |||
260 | exynos4_sys_powerdown_conf(SYS_SLEEP); | ||
261 | __raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1); | ||
262 | |||
263 | /* ensure at least INFORM0 has the resume address */ | ||
264 | |||
265 | __raw_writel(virt_to_phys(s3c_cpu_resume), S5P_INFORM0); | ||
266 | |||
267 | /* Before enter central sequence mode, clock src register have to set */ | ||
268 | |||
269 | s3c_pm_do_restore_core(exynos4_set_clksrc, ARRAY_SIZE(exynos4_set_clksrc)); | ||
270 | |||
271 | } | ||
272 | |||
273 | static int exynos4_pm_add(struct sys_device *sysdev) | ||
274 | { | ||
275 | pm_cpu_prep = exynos4_pm_prepare; | ||
276 | pm_cpu_sleep = exynos4_cpu_suspend; | ||
277 | |||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | /* This function copy from linux/arch/arm/kernel/smp_scu.c */ | ||
282 | |||
283 | void exynos4_scu_enable(void __iomem *scu_base) | ||
284 | { | ||
285 | u32 scu_ctrl; | ||
286 | |||
287 | scu_ctrl = __raw_readl(scu_base); | ||
288 | /* already enabled? */ | ||
289 | if (scu_ctrl & 1) | ||
290 | return; | ||
291 | |||
292 | scu_ctrl |= 1; | ||
293 | __raw_writel(scu_ctrl, scu_base); | ||
294 | |||
295 | /* | ||
296 | * Ensure that the data accessed by CPU0 before the SCU was | ||
297 | * initialised is visible to the other CPUs. | ||
298 | */ | ||
299 | flush_cache_all(); | ||
300 | } | ||
301 | |||
302 | static unsigned long pll_base_rate; | ||
303 | |||
304 | static void exynos4_restore_pll(void) | ||
305 | { | ||
306 | unsigned long pll_con, locktime, lockcnt; | ||
307 | unsigned long pll_in_rate; | ||
308 | unsigned int p_div, epll_wait = 0, vpll_wait = 0; | ||
309 | |||
310 | if (pll_base_rate == 0) | ||
311 | return; | ||
312 | |||
313 | pll_in_rate = pll_base_rate; | ||
314 | |||
315 | /* EPLL */ | ||
316 | pll_con = exynos4_epll_save[0].val; | ||
317 | |||
318 | if (pll_con & (1 << 31)) { | ||
319 | pll_con &= (PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT); | ||
320 | p_div = (pll_con >> PLL46XX_PDIV_SHIFT); | ||
321 | |||
322 | pll_in_rate /= 1000000; | ||
323 | |||
324 | locktime = (3000 / pll_in_rate) * p_div; | ||
325 | lockcnt = locktime * 10000 / (10000 / pll_in_rate); | ||
326 | |||
327 | __raw_writel(lockcnt, S5P_EPLL_LOCK); | ||
328 | |||
329 | s3c_pm_do_restore_core(exynos4_epll_save, | ||
330 | ARRAY_SIZE(exynos4_epll_save)); | ||
331 | epll_wait = 1; | ||
332 | } | ||
333 | |||
334 | pll_in_rate = pll_base_rate; | ||
335 | |||
336 | /* VPLL */ | ||
337 | pll_con = exynos4_vpll_save[0].val; | ||
338 | |||
339 | if (pll_con & (1 << 31)) { | ||
340 | pll_in_rate /= 1000000; | ||
341 | /* 750us */ | ||
342 | locktime = 750; | ||
343 | lockcnt = locktime * 10000 / (10000 / pll_in_rate); | ||
344 | |||
345 | __raw_writel(lockcnt, S5P_VPLL_LOCK); | ||
346 | |||
347 | s3c_pm_do_restore_core(exynos4_vpll_save, | ||
348 | ARRAY_SIZE(exynos4_vpll_save)); | ||
349 | vpll_wait = 1; | ||
350 | } | ||
351 | |||
352 | /* Wait PLL locking */ | ||
353 | |||
354 | do { | ||
355 | if (epll_wait) { | ||
356 | pll_con = __raw_readl(S5P_EPLL_CON0); | ||
357 | if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT)) | ||
358 | epll_wait = 0; | ||
359 | } | ||
360 | |||
361 | if (vpll_wait) { | ||
362 | pll_con = __raw_readl(S5P_VPLL_CON0); | ||
363 | if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT)) | ||
364 | vpll_wait = 0; | ||
365 | } | ||
366 | } while (epll_wait || vpll_wait); | ||
367 | } | ||
368 | |||
369 | static struct sysdev_driver exynos4_pm_driver = { | ||
370 | .add = exynos4_pm_add, | ||
371 | }; | ||
372 | |||
373 | static __init int exynos4_pm_drvinit(void) | ||
374 | { | ||
375 | struct clk *pll_base; | ||
376 | unsigned int tmp; | ||
377 | |||
378 | s3c_pm_init(); | ||
379 | |||
380 | /* All wakeup disable */ | ||
381 | |||
382 | tmp = __raw_readl(S5P_WAKEUP_MASK); | ||
383 | tmp |= ((0xFF << 8) | (0x1F << 1)); | ||
384 | __raw_writel(tmp, S5P_WAKEUP_MASK); | ||
385 | |||
386 | pll_base = clk_get(NULL, "xtal"); | ||
387 | |||
388 | if (!IS_ERR(pll_base)) { | ||
389 | pll_base_rate = clk_get_rate(pll_base); | ||
390 | clk_put(pll_base); | ||
391 | } | ||
392 | |||
393 | return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver); | ||
394 | } | ||
395 | arch_initcall(exynos4_pm_drvinit); | ||
396 | |||
397 | static int exynos4_pm_suspend(void) | ||
398 | { | ||
399 | unsigned long tmp; | ||
400 | |||
401 | /* Setting Central Sequence Register for power down mode */ | ||
402 | |||
403 | tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); | ||
404 | tmp &= ~S5P_CENTRAL_LOWPWR_CFG; | ||
405 | __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); | ||
406 | |||
407 | /* Save Power control register */ | ||
408 | asm ("mrc p15, 0, %0, c15, c0, 0" | ||
409 | : "=r" (tmp) : : "cc"); | ||
410 | save_arm_register[0] = tmp; | ||
411 | |||
412 | /* Save Diagnostic register */ | ||
413 | asm ("mrc p15, 0, %0, c15, c0, 1" | ||
414 | : "=r" (tmp) : : "cc"); | ||
415 | save_arm_register[1] = tmp; | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | static void exynos4_pm_resume(void) | ||
421 | { | ||
422 | unsigned long tmp; | ||
423 | |||
424 | /* | ||
425 | * If PMU failed while entering sleep mode, WFI will be | ||
426 | * ignored by PMU and then exiting cpu_do_idle(). | ||
427 | * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically | ||
428 | * in this situation. | ||
429 | */ | ||
430 | tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); | ||
431 | if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) { | ||
432 | tmp |= S5P_CENTRAL_LOWPWR_CFG; | ||
433 | __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); | ||
434 | /* No need to perform below restore code */ | ||
435 | goto early_wakeup; | ||
436 | } | ||
437 | /* Restore Power control register */ | ||
438 | tmp = save_arm_register[0]; | ||
439 | asm volatile ("mcr p15, 0, %0, c15, c0, 0" | ||
440 | : : "r" (tmp) | ||
441 | : "cc"); | ||
442 | |||
443 | /* Restore Diagnostic register */ | ||
444 | tmp = save_arm_register[1]; | ||
445 | asm volatile ("mcr p15, 0, %0, c15, c0, 1" | ||
446 | : : "r" (tmp) | ||
447 | : "cc"); | ||
448 | |||
449 | /* For release retention */ | ||
450 | |||
451 | __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION); | ||
452 | __raw_writel((1 << 28), S5P_PAD_RET_GPIO_OPTION); | ||
453 | __raw_writel((1 << 28), S5P_PAD_RET_UART_OPTION); | ||
454 | __raw_writel((1 << 28), S5P_PAD_RET_MMCA_OPTION); | ||
455 | __raw_writel((1 << 28), S5P_PAD_RET_MMCB_OPTION); | ||
456 | __raw_writel((1 << 28), S5P_PAD_RET_EBIA_OPTION); | ||
457 | __raw_writel((1 << 28), S5P_PAD_RET_EBIB_OPTION); | ||
458 | |||
459 | s3c_pm_do_restore_core(exynos4_core_save, ARRAY_SIZE(exynos4_core_save)); | ||
460 | |||
461 | exynos4_restore_pll(); | ||
462 | |||
463 | exynos4_scu_enable(S5P_VA_SCU); | ||
464 | |||
465 | #ifdef CONFIG_CACHE_L2X0 | ||
466 | s3c_pm_do_restore_core(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); | ||
467 | outer_inv_all(); | ||
468 | /* enable L2X0*/ | ||
469 | writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL); | ||
470 | #endif | ||
471 | |||
472 | early_wakeup: | ||
473 | return; | ||
474 | } | ||
475 | |||
476 | static struct syscore_ops exynos4_pm_syscore_ops = { | ||
477 | .suspend = exynos4_pm_suspend, | ||
478 | .resume = exynos4_pm_resume, | ||
479 | }; | ||
480 | |||
481 | static __init int exynos4_pm_syscore_init(void) | ||
482 | { | ||
483 | register_syscore_ops(&exynos4_pm_syscore_ops); | ||
484 | return 0; | ||
485 | } | ||
486 | arch_initcall(exynos4_pm_syscore_init); | ||
diff --git a/arch/arm/mach-exynos4/pmu.c b/arch/arm/mach-exynos4/pmu.c new file mode 100644 index 00000000000..7ea9eb2a20d --- /dev/null +++ b/arch/arm/mach-exynos4/pmu.c | |||
@@ -0,0 +1,175 @@ | |||
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 void __iomem *sys_powerdown_reg[] = { | ||
20 | S5P_ARM_CORE0_LOWPWR, | ||
21 | S5P_DIS_IRQ_CORE0, | ||
22 | S5P_DIS_IRQ_CENTRAL0, | ||
23 | S5P_ARM_CORE1_LOWPWR, | ||
24 | S5P_DIS_IRQ_CORE1, | ||
25 | S5P_DIS_IRQ_CENTRAL1, | ||
26 | S5P_ARM_COMMON_LOWPWR, | ||
27 | S5P_L2_0_LOWPWR, | ||
28 | S5P_L2_1_LOWPWR, | ||
29 | S5P_CMU_ACLKSTOP_LOWPWR, | ||
30 | S5P_CMU_SCLKSTOP_LOWPWR, | ||
31 | S5P_CMU_RESET_LOWPWR, | ||
32 | S5P_APLL_SYSCLK_LOWPWR, | ||
33 | S5P_MPLL_SYSCLK_LOWPWR, | ||
34 | S5P_VPLL_SYSCLK_LOWPWR, | ||
35 | S5P_EPLL_SYSCLK_LOWPWR, | ||
36 | S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, | ||
37 | S5P_CMU_RESET_GPSALIVE_LOWPWR, | ||
38 | S5P_CMU_CLKSTOP_CAM_LOWPWR, | ||
39 | S5P_CMU_CLKSTOP_TV_LOWPWR, | ||
40 | S5P_CMU_CLKSTOP_MFC_LOWPWR, | ||
41 | S5P_CMU_CLKSTOP_G3D_LOWPWR, | ||
42 | S5P_CMU_CLKSTOP_LCD0_LOWPWR, | ||
43 | S5P_CMU_CLKSTOP_LCD1_LOWPWR, | ||
44 | S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, | ||
45 | S5P_CMU_CLKSTOP_GPS_LOWPWR, | ||
46 | S5P_CMU_RESET_CAM_LOWPWR, | ||
47 | S5P_CMU_RESET_TV_LOWPWR, | ||
48 | S5P_CMU_RESET_MFC_LOWPWR, | ||
49 | S5P_CMU_RESET_G3D_LOWPWR, | ||
50 | S5P_CMU_RESET_LCD0_LOWPWR, | ||
51 | S5P_CMU_RESET_LCD1_LOWPWR, | ||
52 | S5P_CMU_RESET_MAUDIO_LOWPWR, | ||
53 | S5P_CMU_RESET_GPS_LOWPWR, | ||
54 | S5P_TOP_BUS_LOWPWR, | ||
55 | S5P_TOP_RETENTION_LOWPWR, | ||
56 | S5P_TOP_PWR_LOWPWR, | ||
57 | S5P_LOGIC_RESET_LOWPWR, | ||
58 | S5P_ONENAND_MEM_LOWPWR, | ||
59 | S5P_MODIMIF_MEM_LOWPWR, | ||
60 | S5P_G2D_ACP_MEM_LOWPWR, | ||
61 | S5P_USBOTG_MEM_LOWPWR, | ||
62 | S5P_HSMMC_MEM_LOWPWR, | ||
63 | S5P_CSSYS_MEM_LOWPWR, | ||
64 | S5P_SECSS_MEM_LOWPWR, | ||
65 | S5P_PCIE_MEM_LOWPWR, | ||
66 | S5P_SATA_MEM_LOWPWR, | ||
67 | S5P_PAD_RETENTION_DRAM_LOWPWR, | ||
68 | S5P_PAD_RETENTION_MAUDIO_LOWPWR, | ||
69 | S5P_PAD_RETENTION_GPIO_LOWPWR, | ||
70 | S5P_PAD_RETENTION_UART_LOWPWR, | ||
71 | S5P_PAD_RETENTION_MMCA_LOWPWR, | ||
72 | S5P_PAD_RETENTION_MMCB_LOWPWR, | ||
73 | S5P_PAD_RETENTION_EBIA_LOWPWR, | ||
74 | S5P_PAD_RETENTION_EBIB_LOWPWR, | ||
75 | S5P_PAD_RETENTION_ISOLATION_LOWPWR, | ||
76 | S5P_PAD_RETENTION_ALV_SEL_LOWPWR, | ||
77 | S5P_XUSBXTI_LOWPWR, | ||
78 | S5P_XXTI_LOWPWR, | ||
79 | S5P_EXT_REGULATOR_LOWPWR, | ||
80 | S5P_GPIO_MODE_LOWPWR, | ||
81 | S5P_GPIO_MODE_MAUDIO_LOWPWR, | ||
82 | S5P_CAM_LOWPWR, | ||
83 | S5P_TV_LOWPWR, | ||
84 | S5P_MFC_LOWPWR, | ||
85 | S5P_G3D_LOWPWR, | ||
86 | S5P_LCD0_LOWPWR, | ||
87 | S5P_LCD1_LOWPWR, | ||
88 | S5P_MAUDIO_LOWPWR, | ||
89 | S5P_GPS_LOWPWR, | ||
90 | S5P_GPS_ALIVE_LOWPWR, | ||
91 | }; | ||
92 | |||
93 | static const unsigned int sys_powerdown_val[][NUM_SYS_POWERDOWN] = { | ||
94 | /* { AFTR, LPA, SLEEP }*/ | ||
95 | { 0, 0, 2 }, /* ARM_CORE0 */ | ||
96 | { 0, 0, 0 }, /* ARM_DIS_IRQ_CORE0 */ | ||
97 | { 0, 0, 0 }, /* ARM_DIS_IRQ_CENTRAL0 */ | ||
98 | { 0, 0, 2 }, /* ARM_CORE1 */ | ||
99 | { 0, 0, 0 }, /* ARM_DIS_IRQ_CORE1 */ | ||
100 | { 0, 0, 0 }, /* ARM_DIS_IRQ_CENTRAL1 */ | ||
101 | { 0, 0, 2 }, /* ARM_COMMON */ | ||
102 | { 2, 2, 3 }, /* ARM_CPU_L2_0 */ | ||
103 | { 2, 2, 3 }, /* ARM_CPU_L2_1 */ | ||
104 | { 1, 0, 0 }, /* CMU_ACLKSTOP */ | ||
105 | { 1, 0, 0 }, /* CMU_SCLKSTOP */ | ||
106 | { 1, 1, 0 }, /* CMU_RESET */ | ||
107 | { 1, 0, 0 }, /* APLL_SYSCLK */ | ||
108 | { 1, 0, 0 }, /* MPLL_SYSCLK */ | ||
109 | { 1, 0, 0 }, /* VPLL_SYSCLK */ | ||
110 | { 1, 1, 0 }, /* EPLL_SYSCLK */ | ||
111 | { 1, 1, 0 }, /* CMU_CLKSTOP_GPS_ALIVE */ | ||
112 | { 1, 1, 0 }, /* CMU_RESET_GPS_ALIVE */ | ||
113 | { 1, 1, 0 }, /* CMU_CLKSTOP_CAM */ | ||
114 | { 1, 1, 0 }, /* CMU_CLKSTOP_TV */ | ||
115 | { 1, 1, 0 }, /* CMU_CLKSTOP_MFC */ | ||
116 | { 1, 1, 0 }, /* CMU_CLKSTOP_G3D */ | ||
117 | { 1, 1, 0 }, /* CMU_CLKSTOP_LCD0 */ | ||
118 | { 1, 1, 0 }, /* CMU_CLKSTOP_LCD1 */ | ||
119 | { 1, 1, 0 }, /* CMU_CLKSTOP_MAUDIO */ | ||
120 | { 1, 1, 0 }, /* CMU_CLKSTOP_GPS */ | ||
121 | { 1, 1, 0 }, /* CMU_RESET_CAM */ | ||
122 | { 1, 1, 0 }, /* CMU_RESET_TV */ | ||
123 | { 1, 1, 0 }, /* CMU_RESET_MFC */ | ||
124 | { 1, 1, 0 }, /* CMU_RESET_G3D */ | ||
125 | { 1, 1, 0 }, /* CMU_RESET_LCD0 */ | ||
126 | { 1, 1, 0 }, /* CMU_RESET_LCD1 */ | ||
127 | { 1, 1, 0 }, /* CMU_RESET_MAUDIO */ | ||
128 | { 1, 1, 0 }, /* CMU_RESET_GPS */ | ||
129 | { 3, 0, 0 }, /* TOP_BUS */ | ||
130 | { 1, 0, 1 }, /* TOP_RETENTION */ | ||
131 | { 3, 0, 3 }, /* TOP_PWR */ | ||
132 | { 1, 1, 0 }, /* LOGIC_RESET */ | ||
133 | { 3, 0, 0 }, /* ONENAND_MEM */ | ||
134 | { 3, 0, 0 }, /* MODIMIF_MEM */ | ||
135 | { 3, 0, 0 }, /* G2D_ACP_MEM */ | ||
136 | { 3, 0, 0 }, /* USBOTG_MEM */ | ||
137 | { 3, 0, 0 }, /* HSMMC_MEM */ | ||
138 | { 3, 0, 0 }, /* CSSYS_MEM */ | ||
139 | { 3, 0, 0 }, /* SECSS_MEM */ | ||
140 | { 3, 0, 0 }, /* PCIE_MEM */ | ||
141 | { 3, 0, 0 }, /* SATA_MEM */ | ||
142 | { 1, 0, 0 }, /* PAD_RETENTION_DRAM */ | ||
143 | { 1, 1, 0 }, /* PAD_RETENTION_MAUDIO */ | ||
144 | { 1, 0, 0 }, /* PAD_RETENTION_GPIO */ | ||
145 | { 1, 0, 0 }, /* PAD_RETENTION_UART */ | ||
146 | { 1, 0, 0 }, /* PAD_RETENTION_MMCA */ | ||
147 | { 1, 0, 0 }, /* PAD_RETENTION_MMCB */ | ||
148 | { 1, 0, 0 }, /* PAD_RETENTION_EBIA */ | ||
149 | { 1, 0, 0 }, /* PAD_RETENTION_EBIB */ | ||
150 | { 1, 0, 0 }, /* PAD_RETENTION_ISOLATION */ | ||
151 | { 1, 0, 0 }, /* PAD_RETENTION_ALV_SEL */ | ||
152 | { 1, 1, 0 }, /* XUSBXTI */ | ||
153 | { 1, 1, 0 }, /* XXTI */ | ||
154 | { 1, 1, 0 }, /* EXT_REGULATOR */ | ||
155 | { 1, 0, 0 }, /* GPIO_MODE */ | ||
156 | { 1, 1, 0 }, /* GPIO_MODE_MAUDIO */ | ||
157 | { 7, 0, 0 }, /* CAM */ | ||
158 | { 7, 0, 0 }, /* TV */ | ||
159 | { 7, 0, 0 }, /* MFC */ | ||
160 | { 7, 0, 0 }, /* G3D */ | ||
161 | { 7, 0, 0 }, /* LCD0 */ | ||
162 | { 7, 0, 0 }, /* LCD1 */ | ||
163 | { 7, 7, 0 }, /* MAUDIO */ | ||
164 | { 7, 0, 0 }, /* GPS */ | ||
165 | { 7, 0, 0 }, /* GPS_ALIVE */ | ||
166 | }; | ||
167 | |||
168 | void exynos4_sys_powerdown_conf(enum sys_powerdown mode) | ||
169 | { | ||
170 | unsigned int count = ARRAY_SIZE(sys_powerdown_reg); | ||
171 | |||
172 | for (; count > 0; count--) | ||
173 | __raw_writel(sys_powerdown_val[count - 1][mode], | ||
174 | sys_powerdown_reg[count - 1]); | ||
175 | } | ||
diff --git a/arch/arm/mach-exynos4/setup-fimc.c b/arch/arm/mach-exynos4/setup-fimc.c new file mode 100644 index 00000000000..6a45078d9d1 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-fimd0.c b/arch/arm/mach-exynos4/setup-fimd0.c new file mode 100644 index 00000000000..07a6dbeecdd --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c0.c b/arch/arm/mach-exynos4/setup-i2c0.c new file mode 100644 index 00000000000..d395bd17c38 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c1.c b/arch/arm/mach-exynos4/setup-i2c1.c new file mode 100644 index 00000000000..fd7235a43f6 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c2.c b/arch/arm/mach-exynos4/setup-i2c2.c new file mode 100644 index 00000000000..2694b19e8b3 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c3.c b/arch/arm/mach-exynos4/setup-i2c3.c new file mode 100644 index 00000000000..379bd306993 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c4.c b/arch/arm/mach-exynos4/setup-i2c4.c new file mode 100644 index 00000000000..9f3c04855b7 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c5.c b/arch/arm/mach-exynos4/setup-i2c5.c new file mode 100644 index 00000000000..77e1a1e57c7 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c6.c b/arch/arm/mach-exynos4/setup-i2c6.c new file mode 100644 index 00000000000..284d12b7af0 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-i2c7.c b/arch/arm/mach-exynos4/setup-i2c7.c new file mode 100644 index 00000000000..b7611ee359a --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-keypad.c b/arch/arm/mach-exynos4/setup-keypad.c new file mode 100644 index 00000000000..7862bfb5933 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-sdhci-gpio.c b/arch/arm/mach-exynos4/setup-sdhci-gpio.c new file mode 100644 index 00000000000..e8d08bf8965 --- /dev/null +++ b/arch/arm/mach-exynos4/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-exynos4/setup-sdhci.c b/arch/arm/mach-exynos4/setup-sdhci.c new file mode 100644 index 00000000000..1e83f8cf236 --- /dev/null +++ b/arch/arm/mach-exynos4/setup-sdhci.c | |||
@@ -0,0 +1,69 @@ | |||
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/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <linux/mmc/card.h> | ||
20 | #include <linux/mmc/host.h> | ||
21 | |||
22 | #include <plat/regs-sdhci.h> | ||
23 | |||
24 | /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ | ||
25 | |||
26 | char *exynos4_hsmmc_clksrcs[4] = { | ||
27 | [0] = NULL, | ||
28 | [1] = NULL, | ||
29 | [2] = "sclk_mmc", /* mmc_bus */ | ||
30 | [3] = NULL, | ||
31 | }; | ||
32 | |||
33 | void exynos4_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r, | ||
34 | struct mmc_ios *ios, struct mmc_card *card) | ||
35 | { | ||
36 | u32 ctrl2, ctrl3; | ||
37 | |||
38 | /* don't need to alter anything according to card-type */ | ||
39 | |||
40 | ctrl2 = readl(r + S3C_SDHCI_CONTROL2); | ||
41 | |||
42 | /* select base clock source to HCLK */ | ||
43 | |||
44 | ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK; | ||
45 | |||
46 | /* | ||
47 | * clear async mode, enable conflict mask, rx feedback ctrl, SD | ||
48 | * clk hold and no use debounce count | ||
49 | */ | ||
50 | |||
51 | ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR | | ||
52 | S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK | | ||
53 | S3C_SDHCI_CTRL2_ENFBCLKRX | | ||
54 | S3C_SDHCI_CTRL2_DFCNT_NONE | | ||
55 | S3C_SDHCI_CTRL2_ENCLKOUTHOLD); | ||
56 | |||
57 | /* Tx and Rx feedback clock delay control */ | ||
58 | |||
59 | if (ios->clock < 25 * 1000000) | ||
60 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 | | ||
61 | S3C_SDHCI_CTRL3_FCSEL2 | | ||
62 | S3C_SDHCI_CTRL3_FCSEL1 | | ||
63 | S3C_SDHCI_CTRL3_FCSEL0); | ||
64 | else | ||
65 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); | ||
66 | |||
67 | writel(ctrl2, r + S3C_SDHCI_CONTROL2); | ||
68 | writel(ctrl3, r + S3C_SDHCI_CONTROL3); | ||
69 | } | ||
diff --git a/arch/arm/mach-exynos4/setup-usb-phy.c b/arch/arm/mach-exynos4/setup-usb-phy.c new file mode 100644 index 00000000000..39aca045f66 --- /dev/null +++ b/arch/arm/mach-exynos4/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 | } | ||
diff --git a/arch/arm/mach-exynos4/sleep.S b/arch/arm/mach-exynos4/sleep.S new file mode 100644 index 00000000000..0984078f1eb --- /dev/null +++ b/arch/arm/mach-exynos4/sleep.S | |||
@@ -0,0 +1,54 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/sleep.S | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4210 power Manager (Suspend-To-RAM) support | ||
7 | * Based on S3C2410 sleep code by: | ||
8 | * Ben Dooks, (c) 2004 Simtec Electronics | ||
9 | * | ||
10 | * Based on PXA/SA1100 sleep code by: | ||
11 | * Nicolas Pitre, (c) 2002 Monta Vista Software Inc | ||
12 | * Cliff Brake, (c) 2001 | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | */ | ||
28 | |||
29 | #include <linux/linkage.h> | ||
30 | #include <asm/assembler.h> | ||
31 | #include <asm/memory.h> | ||
32 | |||
33 | .text | ||
34 | |||
35 | /* | ||
36 | * sleep magic, to allow the bootloader to check for an valid | ||
37 | * image to resume to. Must be the first word before the | ||
38 | * s3c_cpu_resume entry. | ||
39 | */ | ||
40 | |||
41 | .word 0x2bedf00d | ||
42 | |||
43 | /* | ||
44 | * s3c_cpu_resume | ||
45 | * | ||
46 | * resume code entry for bootloader to call | ||
47 | * | ||
48 | * we must put this code here in the data segment as we have no | ||
49 | * other way of restoring the stack pointer after sleep, and we | ||
50 | * must not write to the code segment (code is read-only) | ||
51 | */ | ||
52 | |||
53 | ENTRY(s3c_cpu_resume) | ||
54 | b cpu_resume | ||