2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
5 * Common Header for EXYNOS machines
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13 #define __ARCH_ARM_MACH_EXYNOS_COMMON_H
15 #include <linux/reboot.h>
18 #define EXYNOS3250_SOC_ID 0xE3472000
19 #define EXYNOS3_SOC_MASK 0xFFFFF000
21 #define EXYNOS4210_CPU_ID 0x43210000
22 #define EXYNOS4212_CPU_ID 0x43220000
23 #define EXYNOS4412_CPU_ID 0xE4412200
24 #define EXYNOS4_CPU_MASK 0xFFFE0000
26 #define EXYNOS5250_SOC_ID 0x43520000
27 #define EXYNOS5410_SOC_ID 0xE5410000
28 #define EXYNOS5420_SOC_ID 0xE5420000
29 #define EXYNOS5440_SOC_ID 0xE5440000
30 #define EXYNOS5800_SOC_ID 0xE5422000
31 #define EXYNOS5_SOC_MASK 0xFFFFF000
33 extern unsigned long samsung_cpu_id
;
35 #define IS_SAMSUNG_CPU(name, id, mask) \
36 static inline int is_samsung_##name(void) \
38 return ((samsung_cpu_id & mask) == (id & mask)); \
41 IS_SAMSUNG_CPU(exynos3250
, EXYNOS3250_SOC_ID
, EXYNOS3_SOC_MASK
)
42 IS_SAMSUNG_CPU(exynos4210
, EXYNOS4210_CPU_ID
, EXYNOS4_CPU_MASK
)
43 IS_SAMSUNG_CPU(exynos4212
, EXYNOS4212_CPU_ID
, EXYNOS4_CPU_MASK
)
44 IS_SAMSUNG_CPU(exynos4412
, EXYNOS4412_CPU_ID
, EXYNOS4_CPU_MASK
)
45 IS_SAMSUNG_CPU(exynos5250
, EXYNOS5250_SOC_ID
, EXYNOS5_SOC_MASK
)
46 IS_SAMSUNG_CPU(exynos5410
, EXYNOS5410_SOC_ID
, EXYNOS5_SOC_MASK
)
47 IS_SAMSUNG_CPU(exynos5420
, EXYNOS5420_SOC_ID
, EXYNOS5_SOC_MASK
)
48 IS_SAMSUNG_CPU(exynos5440
, EXYNOS5440_SOC_ID
, EXYNOS5_SOC_MASK
)
49 IS_SAMSUNG_CPU(exynos5800
, EXYNOS5800_SOC_ID
, EXYNOS5_SOC_MASK
)
51 #if defined(CONFIG_SOC_EXYNOS3250)
52 # define soc_is_exynos3250() is_samsung_exynos3250()
54 # define soc_is_exynos3250() 0
57 #if defined(CONFIG_CPU_EXYNOS4210)
58 # define soc_is_exynos4210() is_samsung_exynos4210()
60 # define soc_is_exynos4210() 0
63 #if defined(CONFIG_SOC_EXYNOS4212)
64 # define soc_is_exynos4212() is_samsung_exynos4212()
66 # define soc_is_exynos4212() 0
69 #if defined(CONFIG_SOC_EXYNOS4412)
70 # define soc_is_exynos4412() is_samsung_exynos4412()
72 # define soc_is_exynos4412() 0
75 #define EXYNOS4210_REV_0 (0x0)
76 #define EXYNOS4210_REV_1_0 (0x10)
77 #define EXYNOS4210_REV_1_1 (0x11)
79 #if defined(CONFIG_SOC_EXYNOS5250)
80 # define soc_is_exynos5250() is_samsung_exynos5250()
82 # define soc_is_exynos5250() 0
85 #if defined(CONFIG_SOC_EXYNOS5410)
86 # define soc_is_exynos5410() is_samsung_exynos5410()
88 # define soc_is_exynos5410() 0
91 #if defined(CONFIG_SOC_EXYNOS5420)
92 # define soc_is_exynos5420() is_samsung_exynos5420()
94 # define soc_is_exynos5420() 0
97 #if defined(CONFIG_SOC_EXYNOS5440)
98 # define soc_is_exynos5440() is_samsung_exynos5440()
100 # define soc_is_exynos5440() 0
103 #if defined(CONFIG_SOC_EXYNOS5800)
104 # define soc_is_exynos5800() is_samsung_exynos5800()
106 # define soc_is_exynos5800() 0
109 #define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
111 #define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
112 soc_is_exynos5420() || soc_is_exynos5800())
114 extern void __iomem
*sysram_ns_base_addr
;
115 extern void __iomem
*sysram_base_addr
;
116 extern void __iomem
*pmu_base_addr
;
117 void exynos_sysram_init(void);
119 void exynos_firmware_init(void);
121 extern u32
exynos_get_eint_wake_mask(void);
123 #ifdef CONFIG_PM_SLEEP
124 extern void __init
exynos_pm_init(void);
126 static inline void exynos_pm_init(void) {}
129 extern void exynos_cpu_resume(void);
131 extern struct smp_operations exynos_smp_ops
;
133 extern void exynos_cpu_die(unsigned int cpu
);
135 /* PMU(Power Management Unit) support */
137 #define PMU_TABLE_END (-1U)
146 struct exynos_pmu_conf
{
148 unsigned int val
[NUM_SYS_POWERDOWN
];
151 extern void exynos_sys_powerdown_conf(enum sys_powerdown mode
);
152 extern void exynos_cpu_power_down(int cpu
);
153 extern void exynos_cpu_power_up(int cpu
);
154 extern int exynos_cpu_power_state(int cpu
);
155 extern void exynos_cluster_power_down(int cluster
);
156 extern void exynos_cluster_power_up(int cluster
);
157 extern int exynos_cluster_power_state(int cluster
);
158 extern void exynos_enter_aftr(void);
160 extern void s5p_init_cpu(void __iomem
*cpuid_addr
);
161 extern unsigned int samsung_rev(void);
163 static inline void pmu_raw_writel(u32 val
, u32 offset
)
165 __raw_writel(val
, pmu_base_addr
+ offset
);
168 static inline u32
pmu_raw_readl(u32 offset
)
170 return __raw_readl(pmu_base_addr
+ offset
);
173 #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */