Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / plat-samsung / include / plat / cpu.h
blob5a237db9f9eb299742528140e91a0da904b376f9
1 /* linux/arch/arm/plat-samsung/include/plat/cpu.h
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * Copyright (c) 2004-2005 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
9 * Header file for Samsung CPU support
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.
16 /* todo - fix when rmk changes iodescs to use `void __iomem *` */
18 #ifndef __SAMSUNG_PLAT_CPU_H
19 #define __SAMSUNG_PLAT_CPU_H
21 extern unsigned long samsung_cpu_id;
23 #define S3C2410_CPU_ID 0x32410000
24 #define S3C2410_CPU_MASK 0xFFFFFFFF
26 #define S3C24XX_CPU_ID 0x32400000
27 #define S3C24XX_CPU_MASK 0xFFF00000
29 #define S3C2412_CPU_ID 0x32412000
30 #define S3C2412_CPU_MASK 0xFFFFF000
32 #define S3C6400_CPU_ID 0x36400000
33 #define S3C6410_CPU_ID 0x36410000
34 #define S3C64XX_CPU_MASK 0xFFFFF000
36 #define S5P6440_CPU_ID 0x56440000
37 #define S5P6450_CPU_ID 0x36450000
38 #define S5P64XX_CPU_MASK 0xFFFFF000
40 #define S5PC100_CPU_ID 0x43100000
41 #define S5PC100_CPU_MASK 0xFFFFF000
43 #define S5PV210_CPU_ID 0x43110000
44 #define S5PV210_CPU_MASK 0xFFFFF000
46 #define IS_SAMSUNG_CPU(name, id, mask) \
47 static inline int is_samsung_##name(void) \
48 { \
49 return ((samsung_cpu_id & mask) == (id & mask)); \
52 IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
53 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
54 IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
55 IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
56 IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
57 IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
58 IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
59 IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
60 IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
62 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
63 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
64 defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
65 defined(CONFIG_CPU_S3C2443)
66 # define soc_is_s3c24xx() is_samsung_s3c24xx()
67 # define soc_is_s3c2410() is_samsung_s3c2410()
68 #else
69 # define soc_is_s3c24xx() 0
70 # define soc_is_s3c2410() 0
71 #endif
73 #if defined(CONFIG_CPU_S3C2412)
74 # define soc_is_s3c2412() is_samsung_s3c2412()
75 #else
76 # define soc_is_s3c2412() 0
77 #endif
79 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
80 # define soc_is_s3c6400() is_samsung_s3c6400()
81 # define soc_is_s3c6410() is_samsung_s3c6410()
82 # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
83 #else
84 # define soc_is_s3c6400() 0
85 # define soc_is_s3c6410() 0
86 # define soc_is_s3c64xx() 0
87 #endif
89 #if defined(CONFIG_CPU_S5P6440)
90 # define soc_is_s5p6440() is_samsung_s5p6440()
91 #else
92 # define soc_is_s5p6440() 0
93 #endif
95 #if defined(CONFIG_CPU_S5P6450)
96 # define soc_is_s5p6450() is_samsung_s5p6450()
97 #else
98 # define soc_is_s5p6450() 0
99 #endif
101 #if defined(CONFIG_CPU_S5PC100)
102 # define soc_is_s5pc100() is_samsung_s5pc100()
103 #else
104 # define soc_is_s5pc100() 0
105 #endif
107 #if defined(CONFIG_CPU_S5PV210)
108 # define soc_is_s5pv210() is_samsung_s5pv210()
109 #else
110 # define soc_is_s5pv210() 0
111 #endif
113 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
115 #ifndef KHZ
116 #define KHZ (1000)
117 #endif
119 #ifndef MHZ
120 #define MHZ (1000*1000)
121 #endif
123 #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
125 /* forward declaration */
126 struct s3c24xx_uart_resources;
127 struct platform_device;
128 struct s3c2410_uartcfg;
129 struct map_desc;
131 /* per-cpu initialisation function table. */
133 struct cpu_table {
134 unsigned long idcode;
135 unsigned long idmask;
136 void (*map_io)(void);
137 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
138 void (*init_clocks)(int xtal);
139 int (*init)(void);
140 const char *name;
143 extern void s3c_init_cpu(unsigned long idcode,
144 struct cpu_table *cpus, unsigned int cputab_size);
146 /* core initialisation functions */
148 extern void s5p_init_irq(u32 *vic, u32 num_vic);
150 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
152 extern void s3c64xx_init_cpu(void);
153 extern void s5p_init_cpu(void __iomem *cpuid_addr);
155 extern unsigned int samsung_rev(void);
157 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
159 extern void s3c24xx_init_clocks(int xtal);
161 extern void s3c24xx_init_uartdevs(char *name,
162 struct s3c24xx_uart_resources *res,
163 struct s3c2410_uartcfg *cfg, int no);
165 extern struct syscore_ops s3c2410_pm_syscore_ops;
166 extern struct syscore_ops s3c2412_pm_syscore_ops;
167 extern struct syscore_ops s3c2416_pm_syscore_ops;
168 extern struct syscore_ops s3c244x_pm_syscore_ops;
170 /* system device subsystems */
172 extern struct bus_type s3c2410_subsys;
173 extern struct bus_type s3c2410a_subsys;
174 extern struct bus_type s3c2412_subsys;
175 extern struct bus_type s3c2416_subsys;
176 extern struct bus_type s3c2440_subsys;
177 extern struct bus_type s3c2442_subsys;
178 extern struct bus_type s3c2443_subsys;
179 extern struct bus_type s3c6410_subsys;
180 extern struct bus_type s5p64x0_subsys;
181 extern struct bus_type s5pv210_subsys;
183 extern void (*s5pc1xx_idle)(void);
185 #endif