xref: /openbmc/linux/arch/arm/mach-s3c/cpu.h (revision 4c1ca831)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4  *		http://www.samsung.com/
5  *
6  * Copyright (c) 2004-2005 Simtec Electronics
7  *	Ben Dooks <ben@simtec.co.uk>
8  *
9  * Header file for Samsung CPU support
10  */
11 
12 /* todo - fix when rmk changes iodescs to use `void __iomem *` */
13 
14 #ifndef __SAMSUNG_PLAT_CPU_H
15 #define __SAMSUNG_PLAT_CPU_H
16 
17 extern unsigned long samsung_cpu_id;
18 
19 #define S3C2410_CPU_ID		0x32410000
20 #define S3C2410_CPU_MASK	0xFFFFFFFF
21 
22 #define S3C24XX_CPU_ID		0x32400000
23 #define S3C24XX_CPU_MASK	0xFFF00000
24 
25 #define S3C2412_CPU_ID		0x32412000
26 #define S3C2412_CPU_MASK	0xFFFFF000
27 
28 #define S3C6400_CPU_ID		0x36400000
29 #define S3C6410_CPU_ID		0x36410000
30 #define S3C64XX_CPU_MASK	0xFFFFF000
31 
32 #define S5PV210_CPU_ID		0x43110000
33 #define S5PV210_CPU_MASK	0xFFFFF000
34 
35 #define IS_SAMSUNG_CPU(name, id, mask)		\
36 static inline int is_samsung_##name(void)	\
37 {						\
38 	return ((samsung_cpu_id & mask) == (id & mask));	\
39 }
40 
41 IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
42 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
43 IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
44 IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
45 IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
46 
47 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
48     defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
49     defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
50     defined(CONFIG_CPU_S3C2443)
51 # define soc_is_s3c24xx()	is_samsung_s3c24xx()
52 # define soc_is_s3c2410()	is_samsung_s3c2410()
53 #else
54 # define soc_is_s3c24xx()	0
55 # define soc_is_s3c2410()	0
56 #endif
57 
58 #if defined(CONFIG_CPU_S3C2412)
59 # define soc_is_s3c2412()	is_samsung_s3c2412()
60 #else
61 # define soc_is_s3c2412()	0
62 #endif
63 
64 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
65 # define soc_is_s3c6400()	is_samsung_s3c6400()
66 # define soc_is_s3c6410()	is_samsung_s3c6410()
67 # define soc_is_s3c64xx()	(is_samsung_s3c6400() || is_samsung_s3c6410())
68 #else
69 # define soc_is_s3c6400()	0
70 # define soc_is_s3c6410()	0
71 # define soc_is_s3c64xx()	0
72 #endif
73 
74 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
75 
76 #ifndef KHZ
77 #define KHZ (1000)
78 #endif
79 
80 #ifndef MHZ
81 #define MHZ (1000*1000)
82 #endif
83 
84 #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
85 
86 /* forward declaration */
87 struct s3c24xx_uart_resources;
88 struct platform_device;
89 struct s3c2410_uartcfg;
90 struct map_desc;
91 
92 /* per-cpu initialisation function table. */
93 
94 struct cpu_table {
95 	unsigned long	idcode;
96 	unsigned long	idmask;
97 	void		(*map_io)(void);
98 	void		(*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
99 	void		(*init_clocks)(int xtal);
100 	int		(*init)(void);
101 	const char	*name;
102 };
103 
104 extern void s3c_init_cpu(unsigned long idcode,
105 			 struct cpu_table *cpus, unsigned int cputab_size);
106 
107 /* core initialisation functions */
108 
109 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
110 
111 extern void s3c64xx_init_cpu(void);
112 
113 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
114 
115 extern void s3c24xx_init_clocks(int xtal);
116 
117 extern void s3c24xx_init_uartdevs(char *name,
118 				  struct s3c24xx_uart_resources *res,
119 				  struct s3c2410_uartcfg *cfg, int no);
120 
121 extern struct syscore_ops s3c2410_pm_syscore_ops;
122 extern struct syscore_ops s3c2412_pm_syscore_ops;
123 extern struct syscore_ops s3c2416_pm_syscore_ops;
124 extern struct syscore_ops s3c244x_pm_syscore_ops;
125 
126 extern struct bus_type s3c6410_subsys;
127 
128 #endif
129