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 | |
| 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 |
Mark Brown | 2747f5e56 | 2011-09-05 19:11:40 +0900 | [diff] [blame] | 28 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 29 | |
| 30 | #define S5P6440_CPU_ID 0x56440000 |
| 31 | #define S5P6450_CPU_ID 0x36450000 |
Ajay Kumar | b02b5da | 2011-09-05 19:12:47 +0900 | [diff] [blame] | 32 | #define S5P64XX_CPU_MASK 0xFFFFF000 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 33 | |
| 34 | #define S5PC100_CPU_ID 0x43100000 |
| 35 | #define S5PC100_CPU_MASK 0xFFFFF000 |
| 36 | |
| 37 | #define S5PV210_CPU_ID 0x43110000 |
| 38 | #define S5PV210_CPU_MASK 0xFFFFF000 |
| 39 | |
| 40 | #define EXYNOS4210_CPU_ID 0x43210000 |
Kukjin Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 41 | #define EXYNOS4212_CPU_ID 0x43220000 |
Changhwan Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 42 | #define EXYNOS4412_CPU_ID 0xE4412200 |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 43 | #define EXYNOS4_CPU_MASK 0xFFFE0000 |
| 44 | |
| 45 | #define IS_SAMSUNG_CPU(name, id, mask) \ |
| 46 | static inline int is_samsung_##name(void) \ |
| 47 | { \ |
| 48 | return ((samsung_cpu_id & mask) == (id & mask)); \ |
| 49 | } |
| 50 | |
| 51 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
Mark Brown | 0f4e54c | 2011-10-18 08:39:57 +0900 | [diff] [blame] | 52 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
| 53 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 54 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
| 55 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) |
| 56 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) |
| 57 | IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) |
| 58 | IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) |
Kukjin Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 59 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) |
Changhwan Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 60 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 61 | |
| 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 | #else |
| 68 | # define soc_is_s3c24xx() 0 |
| 69 | #endif |
| 70 | |
| 71 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
Mark Brown | 0f4e54c | 2011-10-18 08:39:57 +0900 | [diff] [blame] | 72 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
Kukjin Kim | c06af3c | 2011-08-20 02:18:18 +0900 | [diff] [blame] | 73 | #else |
| 74 | # define soc_is_s3c64xx() 0 |
| 75 | #endif |
| 76 | |
| 77 | #if defined(CONFIG_CPU_S5P6440) |
| 78 | # define soc_is_s5p6440() is_samsung_s5p6440() |
| 79 | #else |
| 80 | # define soc_is_s5p6440() 0 |
| 81 | #endif |
| 82 | |
| 83 | #if defined(CONFIG_CPU_S5P6450) |
| 84 | # define soc_is_s5p6450() is_samsung_s5p6450() |
| 85 | #else |
| 86 | # define soc_is_s5p6450() 0 |
| 87 | #endif |
| 88 | |
| 89 | #if defined(CONFIG_CPU_S5PC100) |
| 90 | # define soc_is_s5pc100() is_samsung_s5pc100() |
| 91 | #else |
| 92 | # define soc_is_s5pc100() 0 |
| 93 | #endif |
| 94 | |
| 95 | #if defined(CONFIG_CPU_S5PV210) |
| 96 | # define soc_is_s5pv210() is_samsung_s5pv210() |
| 97 | #else |
| 98 | # define soc_is_s5pv210() 0 |
| 99 | #endif |
| 100 | |
| 101 | #if defined(CONFIG_CPU_EXYNOS4210) |
| 102 | # define soc_is_exynos4210() is_samsung_exynos4210() |
| 103 | #else |
| 104 | # define soc_is_exynos4210() 0 |
| 105 | #endif |
| 106 | |
Kukjin Kim | 6846538 | 2011-08-24 17:25:09 +0900 | [diff] [blame] | 107 | #if defined(CONFIG_SOC_EXYNOS4212) |
| 108 | # define soc_is_exynos4212() is_samsung_exynos4212() |
| 109 | #else |
| 110 | # define soc_is_exynos4212() 0 |
| 111 | #endif |
| 112 | |
Changhwan Youn | e6a275a | 2011-10-04 17:08:56 +0900 | [diff] [blame] | 113 | #if defined(CONFIG_SOC_EXYNOS4412) |
| 114 | # define soc_is_exynos4412() is_samsung_exynos4412() |
| 115 | #else |
| 116 | # define soc_is_exynos4412() 0 |
| 117 | #endif |
| 118 | |
Kukjin Kim | 56b2092 | 2011-08-20 13:41:21 +0900 | [diff] [blame] | 119 | #define EXYNOS4210_REV_0 (0x0) |
| 120 | #define EXYNOS4210_REV_1_0 (0x10) |
| 121 | #define EXYNOS4210_REV_1_1 (0x11) |
| 122 | |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 123 | #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] | 124 | |
| 125 | #ifndef MHZ |
| 126 | #define MHZ (1000*1000) |
| 127 | #endif |
| 128 | |
Ben Dooks | a503059 | 2008-10-21 14:06:43 +0100 | [diff] [blame] | 129 | #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | |
| 131 | /* forward declaration */ |
Ben Dooks | 66a9b49 | 2006-06-18 23:04:05 +0100 | [diff] [blame] | 132 | struct s3c24xx_uart_resources; |
| 133 | struct platform_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | struct s3c2410_uartcfg; |
| 135 | struct map_desc; |
| 136 | |
Ben Dooks | 74b265d | 2008-10-21 14:06:31 +0100 | [diff] [blame] | 137 | /* per-cpu initialisation function table. */ |
| 138 | |
| 139 | struct cpu_table { |
| 140 | unsigned long idcode; |
| 141 | unsigned long idmask; |
| 142 | void (*map_io)(void); |
| 143 | void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); |
| 144 | void (*init_clocks)(int xtal); |
| 145 | int (*init)(void); |
| 146 | const char *name; |
| 147 | }; |
| 148 | |
| 149 | extern void s3c_init_cpu(unsigned long idcode, |
| 150 | struct cpu_table *cpus, unsigned int cputab_size); |
| 151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | /* core initialisation functions */ |
| 153 | |
| 154 | extern void s3c24xx_init_irq(void); |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 155 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
| 157 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); |
| 158 | |
Kukjin Kim | e6d1cb9 | 2011-08-20 12:18:07 +0900 | [diff] [blame] | 159 | extern void s3c24xx_init_cpu(void); |
| 160 | extern void s3c64xx_init_cpu(void); |
| 161 | extern void s5p_init_cpu(void __iomem *cpuid_addr); |
| 162 | |
Kukjin Kim | 56b2092 | 2011-08-20 13:41:21 +0900 | [diff] [blame] | 163 | extern unsigned int samsung_rev(void); |
| 164 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
| 166 | |
| 167 | extern void s3c24xx_init_clocks(int xtal); |
| 168 | |
Ben Dooks | 66a9b49 | 2006-06-18 23:04:05 +0100 | [diff] [blame] | 169 | extern void s3c24xx_init_uartdevs(char *name, |
| 170 | struct s3c24xx_uart_resources *res, |
| 171 | struct s3c2410_uartcfg *cfg, int no); |
| 172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | /* timer for 2410/2440 */ |
| 174 | |
| 175 | struct sys_timer; |
| 176 | extern struct sys_timer s3c24xx_timer; |
| 177 | |
Rafael J. Wysocki | bb072c3 | 2011-04-22 22:03:21 +0200 | [diff] [blame] | 178 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
| 179 | extern struct syscore_ops s3c2412_pm_syscore_ops; |
| 180 | extern struct syscore_ops s3c2416_pm_syscore_ops; |
| 181 | extern struct syscore_ops s3c244x_pm_syscore_ops; |
Rafael J. Wysocki | bb072c3 | 2011-04-22 22:03:21 +0200 | [diff] [blame] | 182 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 183 | /* system device subsystems */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 185 | extern struct bus_type s3c2410_subsys; |
| 186 | extern struct bus_type s3c2410a_subsys; |
| 187 | extern struct bus_type s3c2412_subsys; |
| 188 | extern struct bus_type s3c2416_subsys; |
| 189 | extern struct bus_type s3c2440_subsys; |
| 190 | extern struct bus_type s3c2442_subsys; |
| 191 | extern struct bus_type s3c2443_subsys; |
| 192 | extern struct bus_type s3c6410_subsys; |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 193 | extern struct bus_type s5p64x0_subsys; |
| 194 | extern struct bus_type s5pv210_subsys; |
| 195 | extern struct bus_type exynos4_subsys; |
Ben Dooks | 1deb507 | 2008-12-12 00:24:31 +0000 | [diff] [blame] | 196 | |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 197 | extern void (*s5pc1xx_idle)(void); |
| 198 | |
| 199 | #endif |