Commit | Line | Data |
---|---|---|
c116c1d7 | 1 | /* linux/arch/arm/plat-samsung/include/plat/cpu.h |
c06af3cc KK |
2 | * |
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | |
4 | * http://www.samsung.com/ | |
1da177e4 LT |
5 | * |
6 | * Copyright (c) 2004-2005 Simtec Electronics | |
7 | * Ben Dooks <ben@simtec.co.uk> | |
8 | * | |
c06af3cc | 9 | * Header file for Samsung CPU support |
1da177e4 LT |
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. | |
1da177e4 LT |
14 | */ |
15 | ||
16 | /* todo - fix when rmk changes iodescs to use `void __iomem *` */ | |
17 | ||
c3fcf5d1 KP |
18 | #ifndef __SAMSUNG_PLAT_CPU_H |
19 | #define __SAMSUNG_PLAT_CPU_H | |
20 | ||
c06af3cc KK |
21 | extern unsigned long samsung_cpu_id; |
22 | ||
23 | #define S3C24XX_CPU_ID 0x32400000 | |
24 | #define S3C24XX_CPU_MASK 0xFFF00000 | |
25 | ||
9eecbe50 HS |
26 | #define S3C2412_CPU_ID 0x32412000 |
27 | #define S3C2412_CPU_MASK 0xFFFFF000 | |
28 | ||
c06af3cc KK |
29 | #define S3C6400_CPU_ID 0x36400000 |
30 | #define S3C6410_CPU_ID 0x36410000 | |
2747f5e5 | 31 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
c06af3cc KK |
32 | |
33 | #define S5P6440_CPU_ID 0x56440000 | |
34 | #define S5P6450_CPU_ID 0x36450000 | |
b02b5da4 | 35 | #define S5P64XX_CPU_MASK 0xFFFFF000 |
c06af3cc KK |
36 | |
37 | #define S5PC100_CPU_ID 0x43100000 | |
38 | #define S5PC100_CPU_MASK 0xFFFFF000 | |
39 | ||
40 | #define S5PV210_CPU_ID 0x43110000 | |
41 | #define S5PV210_CPU_MASK 0xFFFFF000 | |
42 | ||
43 | #define EXYNOS4210_CPU_ID 0x43210000 | |
68465384 | 44 | #define EXYNOS4212_CPU_ID 0x43220000 |
e6a275a8 | 45 | #define EXYNOS4412_CPU_ID 0xE4412200 |
c06af3cc KK |
46 | #define EXYNOS4_CPU_MASK 0xFFFE0000 |
47 | ||
94c7ca71 | 48 | #define EXYNOS5250_SOC_ID 0x43520000 |
191d754f | 49 | #define EXYNOS5420_SOC_ID 0xE5420000 |
93f37789 | 50 | #define EXYNOS5440_SOC_ID 0xE5440000 |
94c7ca71 KK |
51 | #define EXYNOS5_SOC_MASK 0xFFFFF000 |
52 | ||
c06af3cc KK |
53 | #define IS_SAMSUNG_CPU(name, id, mask) \ |
54 | static inline int is_samsung_##name(void) \ | |
55 | { \ | |
56 | return ((samsung_cpu_id & mask) == (id & mask)); \ | |
57 | } | |
58 | ||
59 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | |
9eecbe50 | 60 | IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) |
0f4e54c6 MB |
61 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
62 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | |
c06af3cc KK |
63 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
64 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) | |
65 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) | |
66 | IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) | |
67 | IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) | |
68465384 | 68 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) |
e6a275a8 | 69 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) |
94c7ca71 | 70 | IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) |
191d754f | 71 | IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK) |
2edb36c4 | 72 | IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) |
c06af3cc KK |
73 | |
74 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ | |
75 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ | |
76 | defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \ | |
77 | defined(CONFIG_CPU_S3C2443) | |
78 | # define soc_is_s3c24xx() is_samsung_s3c24xx() | |
79 | #else | |
80 | # define soc_is_s3c24xx() 0 | |
81 | #endif | |
82 | ||
9eecbe50 HS |
83 | #if defined(CONFIG_CPU_S3C2412) |
84 | # define soc_is_s3c2412() is_samsung_s3c2412() | |
85 | #else | |
86 | # define soc_is_s3c2412() 0 | |
87 | #endif | |
88 | ||
c06af3cc | 89 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
57a23126 TF |
90 | # define soc_is_s3c6400() is_samsung_s3c6400() |
91 | # define soc_is_s3c6410() is_samsung_s3c6410() | |
0f4e54c6 | 92 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
c06af3cc | 93 | #else |
57a23126 TF |
94 | # define soc_is_s3c6400() 0 |
95 | # define soc_is_s3c6410() 0 | |
c06af3cc KK |
96 | # define soc_is_s3c64xx() 0 |
97 | #endif | |
98 | ||
99 | #if defined(CONFIG_CPU_S5P6440) | |
100 | # define soc_is_s5p6440() is_samsung_s5p6440() | |
101 | #else | |
102 | # define soc_is_s5p6440() 0 | |
103 | #endif | |
104 | ||
105 | #if defined(CONFIG_CPU_S5P6450) | |
106 | # define soc_is_s5p6450() is_samsung_s5p6450() | |
107 | #else | |
108 | # define soc_is_s5p6450() 0 | |
109 | #endif | |
110 | ||
111 | #if defined(CONFIG_CPU_S5PC100) | |
112 | # define soc_is_s5pc100() is_samsung_s5pc100() | |
113 | #else | |
114 | # define soc_is_s5pc100() 0 | |
115 | #endif | |
116 | ||
117 | #if defined(CONFIG_CPU_S5PV210) | |
118 | # define soc_is_s5pv210() is_samsung_s5pv210() | |
119 | #else | |
120 | # define soc_is_s5pv210() 0 | |
121 | #endif | |
122 | ||
123 | #if defined(CONFIG_CPU_EXYNOS4210) | |
124 | # define soc_is_exynos4210() is_samsung_exynos4210() | |
125 | #else | |
126 | # define soc_is_exynos4210() 0 | |
127 | #endif | |
128 | ||
68465384 KK |
129 | #if defined(CONFIG_SOC_EXYNOS4212) |
130 | # define soc_is_exynos4212() is_samsung_exynos4212() | |
131 | #else | |
132 | # define soc_is_exynos4212() 0 | |
133 | #endif | |
134 | ||
e6a275a8 CY |
135 | #if defined(CONFIG_SOC_EXYNOS4412) |
136 | # define soc_is_exynos4412() is_samsung_exynos4412() | |
137 | #else | |
138 | # define soc_is_exynos4412() 0 | |
139 | #endif | |
140 | ||
56b20922 KK |
141 | #define EXYNOS4210_REV_0 (0x0) |
142 | #define EXYNOS4210_REV_1_0 (0x10) | |
143 | #define EXYNOS4210_REV_1_1 (0x11) | |
144 | ||
94c7ca71 KK |
145 | #if defined(CONFIG_SOC_EXYNOS5250) |
146 | # define soc_is_exynos5250() is_samsung_exynos5250() | |
147 | #else | |
148 | # define soc_is_exynos5250() 0 | |
149 | #endif | |
150 | ||
191d754f CK |
151 | #if defined(CONFIG_SOC_EXYNOS5420) |
152 | # define soc_is_exynos5420() is_samsung_exynos5420() | |
153 | #else | |
154 | # define soc_is_exynos5420() 0 | |
155 | #endif | |
156 | ||
2edb36c4 KK |
157 | #if defined(CONFIG_SOC_EXYNOS5440) |
158 | # define soc_is_exynos5440() is_samsung_exynos5440() | |
159 | #else | |
160 | # define soc_is_exynos5440() 0 | |
161 | #endif | |
162 | ||
0367a8d3 | 163 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
1da177e4 | 164 | |
c4c71355 SK |
165 | #ifndef KHZ |
166 | #define KHZ (1000) | |
167 | #endif | |
168 | ||
1da177e4 LT |
169 | #ifndef MHZ |
170 | #define MHZ (1000*1000) | |
171 | #endif | |
172 | ||
a503059c | 173 | #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) |
1da177e4 LT |
174 | |
175 | /* forward declaration */ | |
66a9b49a BD |
176 | struct s3c24xx_uart_resources; |
177 | struct platform_device; | |
1da177e4 LT |
178 | struct s3c2410_uartcfg; |
179 | struct map_desc; | |
180 | ||
74b265d4 BD |
181 | /* per-cpu initialisation function table. */ |
182 | ||
183 | struct cpu_table { | |
184 | unsigned long idcode; | |
185 | unsigned long idmask; | |
186 | void (*map_io)(void); | |
187 | void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); | |
188 | void (*init_clocks)(int xtal); | |
189 | int (*init)(void); | |
190 | const char *name; | |
191 | }; | |
192 | ||
193 | extern void s3c_init_cpu(unsigned long idcode, | |
194 | struct cpu_table *cpus, unsigned int cputab_size); | |
195 | ||
1da177e4 LT |
196 | /* core initialisation functions */ |
197 | ||
209fecd1 | 198 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
1da177e4 LT |
199 | |
200 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); | |
201 | ||
e6d1cb9f KK |
202 | extern void s3c64xx_init_cpu(void); |
203 | extern void s5p_init_cpu(void __iomem *cpuid_addr); | |
204 | ||
56b20922 KK |
205 | extern unsigned int samsung_rev(void); |
206 | ||
1da177e4 LT |
207 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
208 | ||
209 | extern void s3c24xx_init_clocks(int xtal); | |
210 | ||
66a9b49a BD |
211 | extern void s3c24xx_init_uartdevs(char *name, |
212 | struct s3c24xx_uart_resources *res, | |
213 | struct s3c2410_uartcfg *cfg, int no); | |
214 | ||
bb072c3c RW |
215 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
216 | extern struct syscore_ops s3c2412_pm_syscore_ops; | |
217 | extern struct syscore_ops s3c2416_pm_syscore_ops; | |
218 | extern struct syscore_ops s3c244x_pm_syscore_ops; | |
bb072c3c | 219 | |
4a858cfc KS |
220 | /* system device subsystems */ |
221 | ||
222 | extern struct bus_type s3c2410_subsys; | |
223 | extern struct bus_type s3c2410a_subsys; | |
224 | extern struct bus_type s3c2412_subsys; | |
225 | extern struct bus_type s3c2416_subsys; | |
226 | extern struct bus_type s3c2440_subsys; | |
227 | extern struct bus_type s3c2442_subsys; | |
228 | extern struct bus_type s3c2443_subsys; | |
229 | extern struct bus_type s3c6410_subsys; | |
4a858cfc KS |
230 | extern struct bus_type s5p64x0_subsys; |
231 | extern struct bus_type s5pv210_subsys; | |
9ee6af9c | 232 | extern struct bus_type exynos_subsys; |
1deb507d | 233 | |
c3fcf5d1 KP |
234 | extern void (*s5pc1xx_idle)(void); |
235 | ||
236 | #endif |