Ben Dooks | c116c1d | 2010-01-29 09:02:12 +0000 | [diff] [blame] | 1 | /* linux/arch/arm/plat-samsung/include/plat/cpu.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Copyright (c) 2004-2005 Simtec Electronics |
| 7 | * Ben Dooks <ben@simtec.co.uk> |
| 8 | * |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 9 | * Header file for Samsung CPU support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* todo - fix when rmk changes iodescs to use `void __iomem *` */ |
| 17 | |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 18 | #ifndef __SAMSUNG_PLAT_CPU_H |
| 19 | #define __SAMSUNG_PLAT_CPU_H |
| 20 | |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 21 | extern unsigned long samsung_cpu_id; |
| 22 | |
Tomasz Figa | 0424106 | 2014-03-18 07:28:09 +0900 | [diff] [blame^] | 23 | #define S3C2410_CPU_ID 0x32410000 |
| 24 | #define S3C2410_CPU_MASK 0xFFFFFFFF |
| 25 | |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 26 | #define S3C24XX_CPU_ID 0x32400000 |
| 27 | #define S3C24XX_CPU_MASK 0xFFF00000 |
| 28 | |
Heiko Stuebner | 9eecbe5 | 2013-02-12 10:12:06 -0800 | [diff] [blame] | 29 | #define S3C2412_CPU_ID 0x32412000 |
| 30 | #define S3C2412_CPU_MASK 0xFFFFF000 |
| 31 | |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 32 | #define S3C6400_CPU_ID 0x36400000 |
| 33 | #define S3C6410_CPU_ID 0x36410000 |
Mark Brown | 2747f5e56 | 2011-09-05 19:11:40 +0900 | [diff] [blame] | 34 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 35 | |
| 36 | #define S5P6440_CPU_ID 0x56440000 |
| 37 | #define S5P6450_CPU_ID 0x36450000 |
Ajay Kumar | b02b5da | 2011-09-05 19:12:47 +0900 | [diff] [blame] | 38 | #define S5P64XX_CPU_MASK 0xFFFFF000 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 39 | |
| 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 Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 47 | #define EXYNOS4212_CPU_ID 0x43220000 |
Changhwan Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 48 | #define EXYNOS4412_CPU_ID 0xE4412200 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 49 | #define EXYNOS4_CPU_MASK 0xFFFE0000 |
| 50 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 51 | #define EXYNOS5250_SOC_ID 0x43520000 |
Chander Kashyap | 191d754 | 2013-06-19 00:29:34 +0900 | [diff] [blame] | 52 | #define EXYNOS5420_SOC_ID 0xE5420000 |
Kukjin Kim | 93f3778 | 2012-12-25 17:25:08 -0800 | [diff] [blame] | 53 | #define EXYNOS5440_SOC_ID 0xE5440000 |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 54 | #define EXYNOS5_SOC_MASK 0xFFFFF000 |
| 55 | |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 56 | #define IS_SAMSUNG_CPU(name, id, mask) \ |
| 57 | static inline int is_samsung_##name(void) \ |
| 58 | { \ |
| 59 | return ((samsung_cpu_id & mask) == (id & mask)); \ |
| 60 | } |
| 61 | |
Tomasz Figa | 0424106 | 2014-03-18 07:28:09 +0900 | [diff] [blame^] | 62 | IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 63 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
Heiko Stuebner | 9eecbe5 | 2013-02-12 10:12:06 -0800 | [diff] [blame] | 64 | IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) |
Mark Brown | 0f4e54c | 2011-10-18 08:39:57 +0900 | [diff] [blame] | 65 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
| 66 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 67 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
| 68 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) |
| 69 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) |
| 70 | IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) |
| 71 | IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) |
Kukjin Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 72 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) |
Changhwan Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 73 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 74 | IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) |
Chander Kashyap | 191d754 | 2013-06-19 00:29:34 +0900 | [diff] [blame] | 75 | IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK) |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 76 | IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 77 | |
| 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 Figa | 0424106 | 2014-03-18 07:28:09 +0900 | [diff] [blame^] | 83 | # define soc_is_s3c2410() is_samsung_s3c2410() |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 84 | #else |
| 85 | # define soc_is_s3c24xx() 0 |
Tomasz Figa | 0424106 | 2014-03-18 07:28:09 +0900 | [diff] [blame^] | 86 | # define soc_is_s3c2410() 0 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 87 | #endif |
| 88 | |
Heiko Stuebner | 9eecbe5 | 2013-02-12 10:12:06 -0800 | [diff] [blame] | 89 | #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 Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 95 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
Tomasz Figa | 57a2312 | 2013-08-26 02:00:37 +0900 | [diff] [blame] | 96 | # define soc_is_s3c6400() is_samsung_s3c6400() |
| 97 | # define soc_is_s3c6410() is_samsung_s3c6410() |
Mark Brown | 0f4e54c | 2011-10-18 08:39:57 +0900 | [diff] [blame] | 98 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 99 | #else |
Tomasz Figa | 57a2312 | 2013-08-26 02:00:37 +0900 | [diff] [blame] | 100 | # define soc_is_s3c6400() 0 |
| 101 | # define soc_is_s3c6410() 0 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 102 | # 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 Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 135 | #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 Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 141 | #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 Kim | 56b2092 | 2011-08-20 13:41:21 +0900 | [diff] [blame] | 147 | #define EXYNOS4210_REV_0 (0x0) |
| 148 | #define EXYNOS4210_REV_1_0 (0x10) |
| 149 | #define EXYNOS4210_REV_1_1 (0x11) |
| 150 | |
Kukjin Kim | 94c7ca7 | 2012-02-11 22:15:45 +0900 | [diff] [blame] | 151 | #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 Kashyap | 191d754 | 2013-06-19 00:29:34 +0900 | [diff] [blame] | 157 | #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 Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 163 | #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 Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 169 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
Sachin Kamat | c4c7135 | 2012-06-20 16:34:25 +0900 | [diff] [blame] | 171 | #ifndef KHZ |
| 172 | #define KHZ (1000) |
| 173 | #endif |
| 174 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | #ifndef MHZ |
| 176 | #define MHZ (1000*1000) |
| 177 | #endif |
| 178 | |
Ben Dooks | a503059 | 2008-10-21 14:06:43 +0100 | [diff] [blame] | 179 | #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | |
| 181 | /* forward declaration */ |
Ben Dooks | 66a9b49 | 2006-06-18 23:04:05 +0100 | [diff] [blame] | 182 | struct s3c24xx_uart_resources; |
| 183 | struct platform_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | struct s3c2410_uartcfg; |
| 185 | struct map_desc; |
| 186 | |
Ben Dooks | 74b265d | 2008-10-21 14:06:31 +0100 | [diff] [blame] | 187 | /* per-cpu initialisation function table. */ |
| 188 | |
| 189 | struct 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 | |
| 199 | extern void s3c_init_cpu(unsigned long idcode, |
| 200 | struct cpu_table *cpus, unsigned int cputab_size); |
| 201 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | /* core initialisation functions */ |
| 203 | |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 204 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); |
| 207 | |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 208 | extern void s3c64xx_init_cpu(void); |
| 209 | extern void s5p_init_cpu(void __iomem *cpuid_addr); |
| 210 | |
Kukjin Kim | 56b2092 | 2011-08-20 13:41:21 +0900 | [diff] [blame] | 211 | extern unsigned int samsung_rev(void); |
| 212 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
| 214 | |
| 215 | extern void s3c24xx_init_clocks(int xtal); |
| 216 | |
Ben Dooks | 66a9b49 | 2006-06-18 23:04:05 +0100 | [diff] [blame] | 217 | extern void s3c24xx_init_uartdevs(char *name, |
| 218 | struct s3c24xx_uart_resources *res, |
| 219 | struct s3c2410_uartcfg *cfg, int no); |
| 220 | |
Rafael J. Wysocki | bb072c3 | 2011-04-22 22:03:21 +0200 | [diff] [blame] | 221 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
| 222 | extern struct syscore_ops s3c2412_pm_syscore_ops; |
| 223 | extern struct syscore_ops s3c2416_pm_syscore_ops; |
| 224 | extern struct syscore_ops s3c244x_pm_syscore_ops; |
Rafael J. Wysocki | bb072c3 | 2011-04-22 22:03:21 +0200 | [diff] [blame] | 225 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 226 | /* system device subsystems */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 228 | extern struct bus_type s3c2410_subsys; |
| 229 | extern struct bus_type s3c2410a_subsys; |
| 230 | extern struct bus_type s3c2412_subsys; |
| 231 | extern struct bus_type s3c2416_subsys; |
| 232 | extern struct bus_type s3c2440_subsys; |
| 233 | extern struct bus_type s3c2442_subsys; |
| 234 | extern struct bus_type s3c2443_subsys; |
| 235 | extern struct bus_type s3c6410_subsys; |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 236 | extern struct bus_type s5p64x0_subsys; |
| 237 | extern struct bus_type s5pv210_subsys; |
Thomas Abraham | 9ee6af9 | 2012-05-15 15:47:40 +0900 | [diff] [blame] | 238 | extern struct bus_type exynos_subsys; |
Ben Dooks | 1deb507 | 2008-12-12 00:24:31 +0000 | [diff] [blame] | 239 | |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 240 | extern void (*s5pc1xx_idle)(void); |
| 241 | |
| 242 | #endif |