cpu.h 5.0 KB
Newer Older
1
/* linux/arch/arm/plat-samsung/include/plat/cpu.h
2 3 4
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
L
Linus Torvalds 已提交
5 6 7 8
 *
 * Copyright (c) 2004-2005 Simtec Electronics
 *	Ben Dooks <ben@simtec.co.uk>
 *
9
 * Header file for Samsung CPU support
L
Linus Torvalds 已提交
10 11 12 13 14 15 16 17
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

/* todo - fix when rmk changes iodescs to use `void __iomem *` */

18 19 20
#ifndef __SAMSUNG_PLAT_CPU_H
#define __SAMSUNG_PLAT_CPU_H

21 22
extern unsigned long samsung_cpu_id;

23 24 25
#define S3C2410_CPU_ID		0x32410000
#define S3C2410_CPU_MASK	0xFFFFFFFF

26 27 28
#define S3C24XX_CPU_ID		0x32400000
#define S3C24XX_CPU_MASK	0xFFF00000

29 30 31
#define S3C2412_CPU_ID		0x32412000
#define S3C2412_CPU_MASK	0xFFFFF000

32 33
#define S3C6400_CPU_ID		0x36400000
#define S3C6410_CPU_ID		0x36410000
34
#define S3C64XX_CPU_MASK	0xFFFFF000
35 36 37

#define S5P6440_CPU_ID		0x56440000
#define S5P6450_CPU_ID		0x36450000
38
#define S5P64XX_CPU_MASK	0xFFFFF000
39 40 41 42 43 44 45 46 47 48 49 50 51

#define S5PC100_CPU_ID		0x43100000
#define S5PC100_CPU_MASK	0xFFFFF000

#define S5PV210_CPU_ID		0x43110000
#define S5PV210_CPU_MASK	0xFFFFF000

#define IS_SAMSUNG_CPU(name, id, mask)		\
static inline int is_samsung_##name(void)	\
{						\
	return ((samsung_cpu_id & mask) == (id & mask));	\
}

52
IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
53
IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
54
IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
55 56
IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
57 58 59 60 61 62 63 64 65 66
IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)

#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
    defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
    defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
    defined(CONFIG_CPU_S3C2443)
# define soc_is_s3c24xx()	is_samsung_s3c24xx()
67
# define soc_is_s3c2410()	is_samsung_s3c2410()
68 69
#else
# define soc_is_s3c24xx()	0
70
# define soc_is_s3c2410()	0
71 72
#endif

73 74 75 76 77 78
#if defined(CONFIG_CPU_S3C2412)
# define soc_is_s3c2412()	is_samsung_s3c2412()
#else
# define soc_is_s3c2412()	0
#endif

79
#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
80 81
# define soc_is_s3c6400()	is_samsung_s3c6400()
# define soc_is_s3c6410()	is_samsung_s3c6410()
82
# define soc_is_s3c64xx()	(is_samsung_s3c6400() || is_samsung_s3c6410())
83
#else
84 85
# define soc_is_s3c6400()	0
# define soc_is_s3c6410()	0
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
# define soc_is_s3c64xx()	0
#endif

#if defined(CONFIG_CPU_S5P6440)
# define soc_is_s5p6440()	is_samsung_s5p6440()
#else
# define soc_is_s5p6440()	0
#endif

#if defined(CONFIG_CPU_S5P6450)
# define soc_is_s5p6450()	is_samsung_s5p6450()
#else
# define soc_is_s5p6450()	0
#endif

#if defined(CONFIG_CPU_S5PC100)
# define soc_is_s5pc100()	is_samsung_s5pc100()
#else
# define soc_is_s5pc100()	0
#endif

#if defined(CONFIG_CPU_S5PV210)
# define soc_is_s5pv210()	is_samsung_s5pv210()
#else
# define soc_is_s5pv210()	0
#endif

113
#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
L
Linus Torvalds 已提交
114

115 116 117 118
#ifndef KHZ
#define KHZ (1000)
#endif

L
Linus Torvalds 已提交
119 120 121 122
#ifndef MHZ
#define MHZ (1000*1000)
#endif

123
#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
L
Linus Torvalds 已提交
124 125

/* forward declaration */
126 127
struct s3c24xx_uart_resources;
struct platform_device;
L
Linus Torvalds 已提交
128 129 130
struct s3c2410_uartcfg;
struct map_desc;

131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
/* per-cpu initialisation function table. */

struct cpu_table {
	unsigned long	idcode;
	unsigned long	idmask;
	void		(*map_io)(void);
	void		(*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
	void		(*init_clocks)(int xtal);
	int		(*init)(void);
	const char	*name;
};

extern void s3c_init_cpu(unsigned long idcode,
			 struct cpu_table *cpus, unsigned int cputab_size);

L
Linus Torvalds 已提交
146 147
/* core initialisation functions */

148
extern void s5p_init_irq(u32 *vic, u32 num_vic);
L
Linus Torvalds 已提交
149 150 151

extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);

152 153 154
extern void s3c64xx_init_cpu(void);
extern void s5p_init_cpu(void __iomem *cpuid_addr);

155 156
extern unsigned int samsung_rev(void);

L
Linus Torvalds 已提交
157 158 159 160
extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);

extern void s3c24xx_init_clocks(int xtal);

161 162 163 164
extern void s3c24xx_init_uartdevs(char *name,
				  struct s3c24xx_uart_resources *res,
				  struct s3c2410_uartcfg *cfg, int no);

165 166 167 168 169
extern struct syscore_ops s3c2410_pm_syscore_ops;
extern struct syscore_ops s3c2412_pm_syscore_ops;
extern struct syscore_ops s3c2416_pm_syscore_ops;
extern struct syscore_ops s3c244x_pm_syscore_ops;

170 171 172 173 174 175 176 177 178 179 180 181
/* system device subsystems */

extern struct bus_type s3c2410_subsys;
extern struct bus_type s3c2410a_subsys;
extern struct bus_type s3c2412_subsys;
extern struct bus_type s3c2416_subsys;
extern struct bus_type s3c2440_subsys;
extern struct bus_type s3c2442_subsys;
extern struct bus_type s3c2443_subsys;
extern struct bus_type s3c6410_subsys;
extern struct bus_type s5p64x0_subsys;
extern struct bus_type s5pv210_subsys;
182

183 184 185
extern void (*s5pc1xx_idle)(void);

#endif