Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cpu.h
Go to the documentation of this file.
1 /* linux/arch/arm/plat-samsung/include/plat/cpu.h
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4  * http://www.samsung.com/
5  *
6  * Copyright (c) 2004-2005 Simtec Electronics
7  * Ben Dooks <[email protected]>
8  *
9  * Header file for Samsung CPU support
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 /* todo - fix when rmk changes iodescs to use `void __iomem *` */
17 
18 #ifndef __SAMSUNG_PLAT_CPU_H
19 #define __SAMSUNG_PLAT_CPU_H
20 
21 extern unsigned long samsung_cpu_id;
22 
23 #define S3C24XX_CPU_ID 0x32400000
24 #define S3C24XX_CPU_MASK 0xFFF00000
25 
26 #define S3C6400_CPU_ID 0x36400000
27 #define S3C6410_CPU_ID 0x36410000
28 #define S3C64XX_CPU_MASK 0xFFFFF000
29 
30 #define S5P6440_CPU_ID 0x56440000
31 #define S5P6450_CPU_ID 0x36450000
32 #define S5P64XX_CPU_MASK 0xFFFFF000
33 
34 #define S5PC100_CPU_ID 0x43100000
35 #define S5PC100_CPU_MASK 0xFFFFF000
36 
37 #define S5PV210_CPU_ID 0x43110000
38 #define S5PV210_CPU_MASK 0xFFFFF000
39 
40 #define EXYNOS4210_CPU_ID 0x43210000
41 #define EXYNOS4212_CPU_ID 0x43220000
42 #define EXYNOS4412_CPU_ID 0xE4412200
43 #define EXYNOS4_CPU_MASK 0xFFFE0000
44 
45 #define EXYNOS5250_SOC_ID 0x43520000
46 #define EXYNOS5_SOC_MASK 0xFFFFF000
47 
48 #define IS_SAMSUNG_CPU(name, id, mask) \
49 static inline int is_samsung_##name(void) \
50 { \
51  return ((samsung_cpu_id & mask) == (id & mask)); \
52 }
53 
65 
66 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
67  defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
68  defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
69  defined(CONFIG_CPU_S3C2443)
70 # define soc_is_s3c24xx() is_samsung_s3c24xx()
71 #else
72 # define soc_is_s3c24xx() 0
73 #endif
74 
75 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
76 # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
77 #else
78 # define soc_is_s3c64xx() 0
79 #endif
80 
81 #if defined(CONFIG_CPU_S5P6440)
82 # define soc_is_s5p6440() is_samsung_s5p6440()
83 #else
84 # define soc_is_s5p6440() 0
85 #endif
86 
87 #if defined(CONFIG_CPU_S5P6450)
88 # define soc_is_s5p6450() is_samsung_s5p6450()
89 #else
90 # define soc_is_s5p6450() 0
91 #endif
92 
93 #if defined(CONFIG_CPU_S5PC100)
94 # define soc_is_s5pc100() is_samsung_s5pc100()
95 #else
96 # define soc_is_s5pc100() 0
97 #endif
98 
99 #if defined(CONFIG_CPU_S5PV210)
100 # define soc_is_s5pv210() is_samsung_s5pv210()
101 #else
102 # define soc_is_s5pv210() 0
103 #endif
104 
105 #if defined(CONFIG_CPU_EXYNOS4210)
106 # define soc_is_exynos4210() is_samsung_exynos4210()
107 #else
108 # define soc_is_exynos4210() 0
109 #endif
110 
111 #if defined(CONFIG_SOC_EXYNOS4212)
112 # define soc_is_exynos4212() is_samsung_exynos4212()
113 #else
114 # define soc_is_exynos4212() 0
115 #endif
116 
117 #if defined(CONFIG_SOC_EXYNOS4412)
118 # define soc_is_exynos4412() is_samsung_exynos4412()
119 #else
120 # define soc_is_exynos4412() 0
121 #endif
122 
123 #define EXYNOS4210_REV_0 (0x0)
124 #define EXYNOS4210_REV_1_0 (0x10)
125 #define EXYNOS4210_REV_1_1 (0x11)
126 
127 #if defined(CONFIG_SOC_EXYNOS5250)
128 # define soc_is_exynos5250() is_samsung_exynos5250()
129 #else
130 # define soc_is_exynos5250() 0
131 #endif
132 
133 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
134 
135 #ifndef KHZ
136 #define KHZ (1000)
137 #endif
138 
139 #ifndef MHZ
140 #define MHZ (1000*1000)
141 #endif
142 
143 #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
144 
145 /* forward declaration */
147 struct platform_device;
148 struct s3c2410_uartcfg;
149 struct map_desc;
150 
151 /* per-cpu initialisation function table. */
152 
153 struct cpu_table {
154  unsigned long idcode;
155  unsigned long idmask;
159  int (*init)(void);
160  const char *name;
161 };
162 
163 extern void s3c_init_cpu(unsigned long idcode,
164  struct cpu_table *cpus, unsigned int cputab_size);
165 
166 /* core initialisation functions */
167 
168 extern void s3c24xx_init_irq(void);
169 extern void s5p_init_irq(u32 *vic, u32 num_vic);
170 
171 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
172 
173 extern void s3c24xx_init_cpu(void);
174 extern void s3c64xx_init_cpu(void);
175 extern void s5p_init_cpu(void __iomem *cpuid_addr);
176 
177 extern unsigned int samsung_rev(void);
178 
179 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
180 
181 extern void s3c24xx_init_clocks(int xtal);
182 
183 extern void s3c24xx_init_uartdevs(char *name,
184  struct s3c24xx_uart_resources *res,
185  struct s3c2410_uartcfg *cfg, int no);
186 
187 /* timer for 2410/2440 */
188 
189 struct sys_timer;
190 extern struct sys_timer s3c24xx_timer;
191 
192 extern struct syscore_ops s3c2410_pm_syscore_ops;
193 extern struct syscore_ops s3c2412_pm_syscore_ops;
194 extern struct syscore_ops s3c2416_pm_syscore_ops;
195 extern struct syscore_ops s3c244x_pm_syscore_ops;
196 
197 /* system device subsystems */
198 
199 extern struct bus_type s3c2410_subsys;
200 extern struct bus_type s3c2410a_subsys;
201 extern struct bus_type s3c2412_subsys;
202 extern struct bus_type s3c2416_subsys;
203 extern struct bus_type s3c2440_subsys;
204 extern struct bus_type s3c2442_subsys;
205 extern struct bus_type s3c2443_subsys;
206 extern struct bus_type s3c6410_subsys;
207 extern struct bus_type s5p64x0_subsys;
208 extern struct bus_type s5pv210_subsys;
209 extern struct bus_type exynos_subsys;
210 
211 extern void (*s5pc1xx_idle)(void);
212 
213 #endif