blob: 26218e76bb2f34e5a2cf4a932fe4190a9d9a6f6c [file] [log] [blame]
Kukjin Kimcc511b82011-12-27 08:18:36 +01001/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for EXYNOS machines
6 *
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.
10 */
11
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14
Robin Holt7b6d8642013-07-08 16:01:40 -070015#include <linux/reboot.h>
Thomas Abraham6e6aac72013-03-09 17:03:05 +090016#include <linux/of.h>
17
Chanwoo Choi940bc582014-05-26 04:12:26 +090018#define EXYNOS3250_SOC_ID 0xE3472000
19#define EXYNOS3_SOC_MASK 0xFFFFF000
20
Sachin Kamat7cb2ded2014-05-13 07:11:57 +090021#define EXYNOS4210_CPU_ID 0x43210000
22#define EXYNOS4212_CPU_ID 0x43220000
23#define EXYNOS4412_CPU_ID 0xE4412200
24#define EXYNOS4_CPU_MASK 0xFFFE0000
25
26#define EXYNOS5250_SOC_ID 0x43520000
27#define EXYNOS5420_SOC_ID 0xE5420000
28#define EXYNOS5440_SOC_ID 0xE5440000
Arun Kumar K86c6f142014-05-26 04:16:11 +090029#define EXYNOS5800_SOC_ID 0xE5422000
Sachin Kamat7cb2ded2014-05-13 07:11:57 +090030#define EXYNOS5_SOC_MASK 0xFFFFF000
31
32extern unsigned long samsung_cpu_id;
33
34#define IS_SAMSUNG_CPU(name, id, mask) \
35static inline int is_samsung_##name(void) \
36{ \
37 return ((samsung_cpu_id & mask) == (id & mask)); \
38}
39
Chanwoo Choi940bc582014-05-26 04:12:26 +090040IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
Sachin Kamat7cb2ded2014-05-13 07:11:57 +090041IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
42IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
43IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
44IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
45IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
46IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
Arun Kumar K86c6f142014-05-26 04:16:11 +090047IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
Sachin Kamat7cb2ded2014-05-13 07:11:57 +090048
Chanwoo Choi940bc582014-05-26 04:12:26 +090049#if defined(CONFIG_SOC_EXYNOS3250)
50# define soc_is_exynos3250() is_samsung_exynos3250()
51#else
52# define soc_is_exynos3250() 0
53#endif
54
Sachin Kamat7cb2ded2014-05-13 07:11:57 +090055#if defined(CONFIG_CPU_EXYNOS4210)
56# define soc_is_exynos4210() is_samsung_exynos4210()
57#else
58# define soc_is_exynos4210() 0
59#endif
60
61#if defined(CONFIG_SOC_EXYNOS4212)
62# define soc_is_exynos4212() is_samsung_exynos4212()
63#else
64# define soc_is_exynos4212() 0
65#endif
66
67#if defined(CONFIG_SOC_EXYNOS4412)
68# define soc_is_exynos4412() is_samsung_exynos4412()
69#else
70# define soc_is_exynos4412() 0
71#endif
72
73#define EXYNOS4210_REV_0 (0x0)
74#define EXYNOS4210_REV_1_0 (0x10)
75#define EXYNOS4210_REV_1_1 (0x11)
76
77#if defined(CONFIG_SOC_EXYNOS5250)
78# define soc_is_exynos5250() is_samsung_exynos5250()
79#else
80# define soc_is_exynos5250() 0
81#endif
82
83#if defined(CONFIG_SOC_EXYNOS5420)
84# define soc_is_exynos5420() is_samsung_exynos5420()
85#else
86# define soc_is_exynos5420() 0
87#endif
88
89#if defined(CONFIG_SOC_EXYNOS5440)
90# define soc_is_exynos5440() is_samsung_exynos5440()
91#else
92# define soc_is_exynos5440() 0
93#endif
94
Arun Kumar K86c6f142014-05-26 04:16:11 +090095#if defined(CONFIG_SOC_EXYNOS5800)
96# define soc_is_exynos5800() is_samsung_exynos5800()
97#else
98# define soc_is_exynos5800() 0
99#endif
100
Sachin Kamat7cb2ded2014-05-13 07:11:57 +0900101#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
102 soc_is_exynos4412())
Arun Kumar K86c6f142014-05-26 04:16:11 +0900103#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420() || \
104 soc_is_exynos5800())
Sachin Kamat7cb2ded2014-05-13 07:11:57 +0900105
Arnd Bergmann034c0972013-04-10 11:35:29 +0200106void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
Kukjin Kim906c7892012-02-11 21:27:08 +0900107
Marc Zyngier06853ae2011-09-08 13:15:22 +0100108struct map_desc;
Arnd Bergmann0e2238e2013-06-19 01:36:47 +0900109void exynos_init_io(void);
Sachin Kamatcbf08b92014-03-21 02:14:30 +0900110void exynos_restart(enum reboot_mode mode, const char *cmd);
Bartlomiej Zolnierkiewicz35baa332013-08-30 12:15:04 +0200111void exynos_cpuidle_init(void);
Lukasz Majewskid568b6f2013-11-28 13:42:42 +0100112void exynos_cpufreq_init(void);
Shawn Guobb13fab2012-04-26 10:35:40 +0800113void exynos_init_late(void);
114
Tomasz Figabca28f82012-12-11 13:58:43 +0900115void exynos_firmware_init(void);
116
Tomasz Figad710aa32014-03-18 07:28:27 +0900117#ifdef CONFIG_PINCTRL_EXYNOS
118extern u32 exynos_get_eint_wake_mask(void);
119#else
120static inline u32 exynos_get_eint_wake_mask(void) { return 0xffffffff; }
121#endif
122
Tomasz Figa559ba232014-03-18 07:28:22 +0900123#ifdef CONFIG_PM_SLEEP
124extern void __init exynos_pm_init(void);
125#else
126static inline void exynos_pm_init(void) {}
127#endif
128
Tomasz Figad710aa32014-03-18 07:28:27 +0900129extern void exynos_cpu_resume(void);
130
Marc Zyngier06853ae2011-09-08 13:15:22 +0100131extern struct smp_operations exynos_smp_ops;
132
133extern void exynos_cpu_die(unsigned int cpu);
134
Kukjin Kimccd458c2012-12-31 10:06:48 -0800135/* PMU(Power Management Unit) support */
136
137#define PMU_TABLE_END NULL
138
139enum sys_powerdown {
140 SYS_AFTR,
141 SYS_LPA,
142 SYS_SLEEP,
143 NUM_SYS_POWERDOWN,
144};
145
146extern unsigned long l2x0_regs_phys;
147struct exynos_pmu_conf {
148 void __iomem *reg;
149 unsigned int val[NUM_SYS_POWERDOWN];
150};
151
152extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
Kukjin Kimccd458c2012-12-31 10:06:48 -0800153
Sachin Kamat7cb2ded2014-05-13 07:11:57 +0900154extern void s5p_init_cpu(void __iomem *cpuid_addr);
155extern unsigned int samsung_rev(void);
156
Kukjin Kimcc511b82011-12-27 08:18:36 +0100157#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */