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 | ||
26 | #define S3C6400_CPU_ID 0x36400000 | |
27 | #define S3C6410_CPU_ID 0x36410000 | |
28 | #define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID) | |
29 | #define S3C64XX_CPU_MASK 0x1FF40000 | |
30 | ||
31 | #define S5P6440_CPU_ID 0x56440000 | |
32 | #define S5P6450_CPU_ID 0x36450000 | |
33 | #define S5P64XX_CPU_MASK 0x1FF40000 | |
34 | ||
35 | #define S5PC100_CPU_ID 0x43100000 | |
36 | #define S5PC100_CPU_MASK 0xFFFFF000 | |
37 | ||
38 | #define S5PV210_CPU_ID 0x43110000 | |
39 | #define S5PV210_CPU_MASK 0xFFFFF000 | |
40 | ||
41 | #define EXYNOS4210_CPU_ID 0x43210000 | |
42 | #define EXYNOS4_CPU_MASK 0xFFFE0000 | |
43 | ||
44 | #define IS_SAMSUNG_CPU(name, id, mask) \ | |
45 | static inline int is_samsung_##name(void) \ | |
46 | { \ | |
47 | return ((samsung_cpu_id & mask) == (id & mask)); \ | |
48 | } | |
49 | ||
50 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | |
51 | IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK) | |
52 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) | |
53 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) | |
54 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) | |
55 | IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) | |
56 | IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) | |
57 | ||
58 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ | |
59 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ | |
60 | defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \ | |
61 | defined(CONFIG_CPU_S3C2443) | |
62 | # define soc_is_s3c24xx() is_samsung_s3c24xx() | |
63 | #else | |
64 | # define soc_is_s3c24xx() 0 | |
65 | #endif | |
66 | ||
67 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) | |
68 | # define soc_is_s3c64xx() is_samsung_s3c64xx() | |
69 | #else | |
70 | # define soc_is_s3c64xx() 0 | |
71 | #endif | |
72 | ||
73 | #if defined(CONFIG_CPU_S5P6440) | |
74 | # define soc_is_s5p6440() is_samsung_s5p6440() | |
75 | #else | |
76 | # define soc_is_s5p6440() 0 | |
77 | #endif | |
78 | ||
79 | #if defined(CONFIG_CPU_S5P6450) | |
80 | # define soc_is_s5p6450() is_samsung_s5p6450() | |
81 | #else | |
82 | # define soc_is_s5p6450() 0 | |
83 | #endif | |
84 | ||
85 | #if defined(CONFIG_CPU_S5PC100) | |
86 | # define soc_is_s5pc100() is_samsung_s5pc100() | |
87 | #else | |
88 | # define soc_is_s5pc100() 0 | |
89 | #endif | |
90 | ||
91 | #if defined(CONFIG_CPU_S5PV210) | |
92 | # define soc_is_s5pv210() is_samsung_s5pv210() | |
93 | #else | |
94 | # define soc_is_s5pv210() 0 | |
95 | #endif | |
96 | ||
97 | #if defined(CONFIG_CPU_EXYNOS4210) | |
98 | # define soc_is_exynos4210() is_samsung_exynos4210() | |
99 | #else | |
100 | # define soc_is_exynos4210() 0 | |
101 | #endif | |
102 | ||
0367a8d3 | 103 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
1da177e4 LT |
104 | |
105 | #ifndef MHZ | |
106 | #define MHZ (1000*1000) | |
107 | #endif | |
108 | ||
a503059c | 109 | #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) |
1da177e4 LT |
110 | |
111 | /* forward declaration */ | |
66a9b49a BD |
112 | struct s3c24xx_uart_resources; |
113 | struct platform_device; | |
1da177e4 LT |
114 | struct s3c2410_uartcfg; |
115 | struct map_desc; | |
116 | ||
74b265d4 BD |
117 | /* per-cpu initialisation function table. */ |
118 | ||
119 | struct cpu_table { | |
120 | unsigned long idcode; | |
121 | unsigned long idmask; | |
122 | void (*map_io)(void); | |
123 | void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); | |
124 | void (*init_clocks)(int xtal); | |
125 | int (*init)(void); | |
126 | const char *name; | |
127 | }; | |
128 | ||
129 | extern void s3c_init_cpu(unsigned long idcode, | |
130 | struct cpu_table *cpus, unsigned int cputab_size); | |
131 | ||
1da177e4 LT |
132 | /* core initialisation functions */ |
133 | ||
134 | extern void s3c24xx_init_irq(void); | |
d9b79fb5 | 135 | extern void s3c64xx_init_irq(u32 vic0, u32 vic1); |
209fecd1 | 136 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
1da177e4 LT |
137 | |
138 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); | |
6a5f4b85 | 139 | extern void s3c64xx_init_io(struct map_desc *mach_desc, int size); |
209fecd1 KK |
140 | extern void s5p_init_io(struct map_desc *mach_desc, |
141 | int size, void __iomem *cpuid_addr); | |
1da177e4 | 142 | |
e6d1cb9f KK |
143 | extern void s3c24xx_init_cpu(void); |
144 | extern void s3c64xx_init_cpu(void); | |
145 | extern void s5p_init_cpu(void __iomem *cpuid_addr); | |
146 | ||
1da177e4 LT |
147 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
148 | ||
149 | extern void s3c24xx_init_clocks(int xtal); | |
150 | ||
66a9b49a BD |
151 | extern void s3c24xx_init_uartdevs(char *name, |
152 | struct s3c24xx_uart_resources *res, | |
153 | struct s3c2410_uartcfg *cfg, int no); | |
154 | ||
1da177e4 LT |
155 | /* timer for 2410/2440 */ |
156 | ||
157 | struct sys_timer; | |
158 | extern struct sys_timer s3c24xx_timer; | |
159 | ||
bb072c3c RW |
160 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
161 | extern struct syscore_ops s3c2412_pm_syscore_ops; | |
162 | extern struct syscore_ops s3c2416_pm_syscore_ops; | |
163 | extern struct syscore_ops s3c244x_pm_syscore_ops; | |
164 | extern struct syscore_ops s3c64xx_irq_syscore_ops; | |
165 | ||
1da177e4 LT |
166 | /* system device classes */ |
167 | ||
a341305e | 168 | extern struct sysdev_class s3c2410_sysclass; |
f0176794 | 169 | extern struct sysdev_class s3c2410a_sysclass; |
68d9ab39 | 170 | extern struct sysdev_class s3c2412_sysclass; |
f1290a49 | 171 | extern struct sysdev_class s3c2416_sysclass; |
1da177e4 | 172 | extern struct sysdev_class s3c2440_sysclass; |
96ce2385 | 173 | extern struct sysdev_class s3c2442_sysclass; |
e4d06e39 | 174 | extern struct sysdev_class s3c2443_sysclass; |
0abfe9aa | 175 | extern struct sysdev_class s3c6410_sysclass; |
1deb507d | 176 | extern struct sysdev_class s3c64xx_sysclass; |
d7297612 | 177 | extern struct sysdev_class s5p64x0_sysclass; |
0ad73cef | 178 | extern struct sysdev_class s5pv210_sysclass; |
1663895c | 179 | extern struct sysdev_class exynos4_sysclass; |
1deb507d | 180 | |
c3fcf5d1 KP |
181 | extern void (*s5pc1xx_idle)(void); |
182 | ||
183 | #endif |