blob: d762533b856f52082f548415a80d3173754ede40 [file] [log] [blame]
Ben Dooksc116c1d2010-01-29 09:02:12 +00001/* linux/arch/arm/plat-samsung/include/plat/cpu.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
Kukjin Kimc06af3c2011-08-20 02:18:18 +09003 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Copyright (c) 2004-2005 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
8 *
Kukjin Kimc06af3c2011-08-20 02:18:18 +09009 * Header file for Samsung CPU support
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070014*/
15
16/* todo - fix when rmk changes iodescs to use `void __iomem *` */
17
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010018#ifndef __SAMSUNG_PLAT_CPU_H
19#define __SAMSUNG_PLAT_CPU_H
20
Kukjin Kimc06af3c2011-08-20 02:18:18 +090021extern unsigned long samsung_cpu_id;
22
Tomasz Figa04241062014-03-18 07:28:09 +090023#define S3C2410_CPU_ID 0x32410000
24#define S3C2410_CPU_MASK 0xFFFFFFFF
25
Kukjin Kimc06af3c2011-08-20 02:18:18 +090026#define S3C24XX_CPU_ID 0x32400000
27#define S3C24XX_CPU_MASK 0xFFF00000
28
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080029#define S3C2412_CPU_ID 0x32412000
30#define S3C2412_CPU_MASK 0xFFFFF000
31
Kukjin Kimc06af3c2011-08-20 02:18:18 +090032#define S3C6400_CPU_ID 0x36400000
33#define S3C6410_CPU_ID 0x36410000
Mark Brown2747f5e562011-09-05 19:11:40 +090034#define S3C64XX_CPU_MASK 0xFFFFF000
Kukjin Kimc06af3c2011-08-20 02:18:18 +090035
36#define S5P6440_CPU_ID 0x56440000
37#define S5P6450_CPU_ID 0x36450000
Ajay Kumarb02b5da2011-09-05 19:12:47 +090038#define S5P64XX_CPU_MASK 0xFFFFF000
Kukjin Kimc06af3c2011-08-20 02:18:18 +090039
40#define S5PC100_CPU_ID 0x43100000
41#define S5PC100_CPU_MASK 0xFFFFF000
42
43#define S5PV210_CPU_ID 0x43110000
44#define S5PV210_CPU_MASK 0xFFFFF000
45
46#define EXYNOS4210_CPU_ID 0x43210000
Kukjin Kim68465382011-08-24 17:25:09 +090047#define EXYNOS4212_CPU_ID 0x43220000
Changhwan Youne6a275a2011-10-04 17:08:56 +090048#define EXYNOS4412_CPU_ID 0xE4412200
Kukjin Kimc06af3c2011-08-20 02:18:18 +090049#define EXYNOS4_CPU_MASK 0xFFFE0000
50
Kukjin Kim94c7ca72012-02-11 22:15:45 +090051#define EXYNOS5250_SOC_ID 0x43520000
Chander Kashyap191d7542013-06-19 00:29:34 +090052#define EXYNOS5420_SOC_ID 0xE5420000
Kukjin Kim93f37782012-12-25 17:25:08 -080053#define EXYNOS5440_SOC_ID 0xE5440000
Kukjin Kim94c7ca72012-02-11 22:15:45 +090054#define EXYNOS5_SOC_MASK 0xFFFFF000
55
Kukjin Kimc06af3c2011-08-20 02:18:18 +090056#define IS_SAMSUNG_CPU(name, id, mask) \
57static inline int is_samsung_##name(void) \
58{ \
59 return ((samsung_cpu_id & mask) == (id & mask)); \
60}
61
Tomasz Figa04241062014-03-18 07:28:09 +090062IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
Kukjin Kimc06af3c2011-08-20 02:18:18 +090063IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080064IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
Mark Brown0f4e54c2011-10-18 08:39:57 +090065IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
66IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
Kukjin Kimc06af3c2011-08-20 02:18:18 +090067IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
68IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
69IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
70IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
71IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
Kukjin Kim68465382011-08-24 17:25:09 +090072IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
Changhwan Youne6a275a2011-10-04 17:08:56 +090073IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
Kukjin Kim94c7ca72012-02-11 22:15:45 +090074IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
Chander Kashyap191d7542013-06-19 00:29:34 +090075IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
Kukjin Kim2edb36c2012-11-15 15:48:56 +090076IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
Kukjin Kimc06af3c2011-08-20 02:18:18 +090077
78#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
79 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
80 defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
81 defined(CONFIG_CPU_S3C2443)
82# define soc_is_s3c24xx() is_samsung_s3c24xx()
Tomasz Figa04241062014-03-18 07:28:09 +090083# define soc_is_s3c2410() is_samsung_s3c2410()
Kukjin Kimc06af3c2011-08-20 02:18:18 +090084#else
85# define soc_is_s3c24xx() 0
Tomasz Figa04241062014-03-18 07:28:09 +090086# define soc_is_s3c2410() 0
Kukjin Kimc06af3c2011-08-20 02:18:18 +090087#endif
88
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080089#if defined(CONFIG_CPU_S3C2412)
90# define soc_is_s3c2412() is_samsung_s3c2412()
91#else
92# define soc_is_s3c2412() 0
93#endif
94
Kukjin Kimc06af3c2011-08-20 02:18:18 +090095#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
Tomasz Figa57a23122013-08-26 02:00:37 +090096# define soc_is_s3c6400() is_samsung_s3c6400()
97# define soc_is_s3c6410() is_samsung_s3c6410()
Mark Brown0f4e54c2011-10-18 08:39:57 +090098# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
Kukjin Kimc06af3c2011-08-20 02:18:18 +090099#else
Tomasz Figa57a23122013-08-26 02:00:37 +0900100# define soc_is_s3c6400() 0
101# define soc_is_s3c6410() 0
Kukjin Kimc06af3c2011-08-20 02:18:18 +0900102# define soc_is_s3c64xx() 0
103#endif
104
105#if defined(CONFIG_CPU_S5P6440)
106# define soc_is_s5p6440() is_samsung_s5p6440()
107#else
108# define soc_is_s5p6440() 0
109#endif
110
111#if defined(CONFIG_CPU_S5P6450)
112# define soc_is_s5p6450() is_samsung_s5p6450()
113#else
114# define soc_is_s5p6450() 0
115#endif
116
117#if defined(CONFIG_CPU_S5PC100)
118# define soc_is_s5pc100() is_samsung_s5pc100()
119#else
120# define soc_is_s5pc100() 0
121#endif
122
123#if defined(CONFIG_CPU_S5PV210)
124# define soc_is_s5pv210() is_samsung_s5pv210()
125#else
126# define soc_is_s5pv210() 0
127#endif
128
129#if defined(CONFIG_CPU_EXYNOS4210)
130# define soc_is_exynos4210() is_samsung_exynos4210()
131#else
132# define soc_is_exynos4210() 0
133#endif
134
Kukjin Kim68465382011-08-24 17:25:09 +0900135#if defined(CONFIG_SOC_EXYNOS4212)
136# define soc_is_exynos4212() is_samsung_exynos4212()
137#else
138# define soc_is_exynos4212() 0
139#endif
140
Changhwan Youne6a275a2011-10-04 17:08:56 +0900141#if defined(CONFIG_SOC_EXYNOS4412)
142# define soc_is_exynos4412() is_samsung_exynos4412()
143#else
144# define soc_is_exynos4412() 0
145#endif
146
Kukjin Kim56b20922011-08-20 13:41:21 +0900147#define EXYNOS4210_REV_0 (0x0)
148#define EXYNOS4210_REV_1_0 (0x10)
149#define EXYNOS4210_REV_1_1 (0x11)
150
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900151#if defined(CONFIG_SOC_EXYNOS5250)
152# define soc_is_exynos5250() is_samsung_exynos5250()
153#else
154# define soc_is_exynos5250() 0
155#endif
156
Chander Kashyap191d7542013-06-19 00:29:34 +0900157#if defined(CONFIG_SOC_EXYNOS5420)
158# define soc_is_exynos5420() is_samsung_exynos5420()
159#else
160# define soc_is_exynos5420() 0
161#endif
162
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900163#if defined(CONFIG_SOC_EXYNOS5440)
164# define soc_is_exynos5440() is_samsung_exynos5440()
165#else
166# define soc_is_exynos5440() 0
167#endif
168
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000169#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
Sachin Kamatc4c71352012-06-20 16:34:25 +0900171#ifndef KHZ
172#define KHZ (1000)
173#endif
174
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175#ifndef MHZ
176#define MHZ (1000*1000)
177#endif
178
Ben Dooksa5030592008-10-21 14:06:43 +0100179#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
181/* forward declaration */
Ben Dooks66a9b492006-06-18 23:04:05 +0100182struct s3c24xx_uart_resources;
183struct platform_device;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184struct s3c2410_uartcfg;
185struct map_desc;
186
Ben Dooks74b265d2008-10-21 14:06:31 +0100187/* per-cpu initialisation function table. */
188
189struct cpu_table {
190 unsigned long idcode;
191 unsigned long idmask;
192 void (*map_io)(void);
193 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
194 void (*init_clocks)(int xtal);
195 int (*init)(void);
196 const char *name;
197};
198
199extern void s3c_init_cpu(unsigned long idcode,
200 struct cpu_table *cpus, unsigned int cputab_size);
201
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202/* core initialisation functions */
203
Kukjin Kim209fecd2010-01-14 15:29:17 +0900204extern void s5p_init_irq(u32 *vic, u32 num_vic);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
206extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
207
Kukjin Kime6d1cb92011-08-20 12:18:07 +0900208extern void s3c64xx_init_cpu(void);
209extern void s5p_init_cpu(void __iomem *cpuid_addr);
210
Kukjin Kim56b20922011-08-20 13:41:21 +0900211extern unsigned int samsung_rev(void);
212
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
214
215extern void s3c24xx_init_clocks(int xtal);
216
Ben Dooks66a9b492006-06-18 23:04:05 +0100217extern void s3c24xx_init_uartdevs(char *name,
218 struct s3c24xx_uart_resources *res,
219 struct s3c2410_uartcfg *cfg, int no);
220
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200221extern struct syscore_ops s3c2410_pm_syscore_ops;
222extern struct syscore_ops s3c2412_pm_syscore_ops;
223extern struct syscore_ops s3c2416_pm_syscore_ops;
224extern struct syscore_ops s3c244x_pm_syscore_ops;
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200225
Kay Sievers4a858cf2011-12-21 16:01:38 -0800226/* system device subsystems */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
Kay Sievers4a858cf2011-12-21 16:01:38 -0800228extern struct bus_type s3c2410_subsys;
229extern struct bus_type s3c2410a_subsys;
230extern struct bus_type s3c2412_subsys;
231extern struct bus_type s3c2416_subsys;
232extern struct bus_type s3c2440_subsys;
233extern struct bus_type s3c2442_subsys;
234extern struct bus_type s3c2443_subsys;
235extern struct bus_type s3c6410_subsys;
Kay Sievers4a858cf2011-12-21 16:01:38 -0800236extern struct bus_type s5p64x0_subsys;
237extern struct bus_type s5pv210_subsys;
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900238extern struct bus_type exynos_subsys;
Ben Dooks1deb5072008-12-12 00:24:31 +0000239
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +0100240extern void (*s5pc1xx_idle)(void);
241
242#endif