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 | ||
04241069 TF |
23 | #define S3C2410_CPU_ID 0x32410000 |
24 | #define S3C2410_CPU_MASK 0xFFFFFFFF | |
25 | ||
c06af3cc KK |
26 | #define S3C24XX_CPU_ID 0x32400000 |
27 | #define S3C24XX_CPU_MASK 0xFFF00000 | |
28 | ||
9eecbe50 HS |
29 | #define S3C2412_CPU_ID 0x32412000 |
30 | #define S3C2412_CPU_MASK 0xFFFFF000 | |
31 | ||
c06af3cc KK |
32 | #define S3C6400_CPU_ID 0x36400000 |
33 | #define S3C6410_CPU_ID 0x36410000 | |
2747f5e5 | 34 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
c06af3cc | 35 | |
c06af3cc KK |
36 | #define S5PV210_CPU_ID 0x43110000 |
37 | #define S5PV210_CPU_MASK 0xFFFFF000 | |
38 | ||
c06af3cc KK |
39 | #define IS_SAMSUNG_CPU(name, id, mask) \ |
40 | static inline int is_samsung_##name(void) \ | |
41 | { \ | |
42 | return ((samsung_cpu_id & mask) == (id & mask)); \ | |
43 | } | |
44 | ||
04241069 | 45 | IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK) |
c06af3cc | 46 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
9eecbe50 | 47 | IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) |
0f4e54c6 MB |
48 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
49 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | |
c06af3cc KK |
50 | |
51 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ | |
52 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ | |
53 | defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \ | |
54 | defined(CONFIG_CPU_S3C2443) | |
55 | # define soc_is_s3c24xx() is_samsung_s3c24xx() | |
04241069 | 56 | # define soc_is_s3c2410() is_samsung_s3c2410() |
c06af3cc KK |
57 | #else |
58 | # define soc_is_s3c24xx() 0 | |
04241069 | 59 | # define soc_is_s3c2410() 0 |
c06af3cc KK |
60 | #endif |
61 | ||
9eecbe50 HS |
62 | #if defined(CONFIG_CPU_S3C2412) |
63 | # define soc_is_s3c2412() is_samsung_s3c2412() | |
64 | #else | |
65 | # define soc_is_s3c2412() 0 | |
66 | #endif | |
67 | ||
c06af3cc | 68 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
57a23126 TF |
69 | # define soc_is_s3c6400() is_samsung_s3c6400() |
70 | # define soc_is_s3c6410() is_samsung_s3c6410() | |
0f4e54c6 | 71 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
c06af3cc | 72 | #else |
57a23126 TF |
73 | # define soc_is_s3c6400() 0 |
74 | # define soc_is_s3c6410() 0 | |
c06af3cc KK |
75 | # define soc_is_s3c64xx() 0 |
76 | #endif | |
77 | ||
0367a8d3 | 78 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
1da177e4 | 79 | |
c4c71355 SK |
80 | #ifndef KHZ |
81 | #define KHZ (1000) | |
82 | #endif | |
83 | ||
1da177e4 LT |
84 | #ifndef MHZ |
85 | #define MHZ (1000*1000) | |
86 | #endif | |
87 | ||
a503059c | 88 | #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) |
1da177e4 LT |
89 | |
90 | /* forward declaration */ | |
66a9b49a BD |
91 | struct s3c24xx_uart_resources; |
92 | struct platform_device; | |
1da177e4 LT |
93 | struct s3c2410_uartcfg; |
94 | struct map_desc; | |
95 | ||
74b265d4 BD |
96 | /* per-cpu initialisation function table. */ |
97 | ||
98 | struct cpu_table { | |
99 | unsigned long idcode; | |
100 | unsigned long idmask; | |
101 | void (*map_io)(void); | |
102 | void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); | |
103 | void (*init_clocks)(int xtal); | |
104 | int (*init)(void); | |
105 | const char *name; | |
106 | }; | |
107 | ||
108 | extern void s3c_init_cpu(unsigned long idcode, | |
109 | struct cpu_table *cpus, unsigned int cputab_size); | |
110 | ||
1da177e4 LT |
111 | /* core initialisation functions */ |
112 | ||
1da177e4 LT |
113 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); |
114 | ||
e6d1cb9f | 115 | extern void s3c64xx_init_cpu(void); |
e6d1cb9f | 116 | |
56b20922 KK |
117 | extern unsigned int samsung_rev(void); |
118 | ||
1da177e4 LT |
119 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
120 | ||
121 | extern void s3c24xx_init_clocks(int xtal); | |
122 | ||
66a9b49a BD |
123 | extern void s3c24xx_init_uartdevs(char *name, |
124 | struct s3c24xx_uart_resources *res, | |
125 | struct s3c2410_uartcfg *cfg, int no); | |
126 | ||
bb072c3c RW |
127 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
128 | extern struct syscore_ops s3c2412_pm_syscore_ops; | |
129 | extern struct syscore_ops s3c2416_pm_syscore_ops; | |
130 | extern struct syscore_ops s3c244x_pm_syscore_ops; | |
bb072c3c | 131 | |
4a858cfc KS |
132 | /* system device subsystems */ |
133 | ||
134 | extern struct bus_type s3c2410_subsys; | |
135 | extern struct bus_type s3c2410a_subsys; | |
136 | extern struct bus_type s3c2412_subsys; | |
137 | extern struct bus_type s3c2416_subsys; | |
138 | extern struct bus_type s3c2440_subsys; | |
139 | extern struct bus_type s3c2442_subsys; | |
140 | extern struct bus_type s3c2443_subsys; | |
141 | extern struct bus_type s3c6410_subsys; | |
1deb507d | 142 | |
c3fcf5d1 | 143 | #endif |