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
17extern unsigned long samsung_cpu_id;
18
19#define S3C6400_CPU_ID 0x36400000
20#define S3C6410_CPU_ID 0x36410000
21#define S3C64XX_CPU_MASK 0xFFFFF000
22
23#define S5PV210_CPU_ID 0x43110000
24#define S5PV210_CPU_MASK 0xFFFFF000
25
26#define IS_SAMSUNG_CPU(name, id, mask) \
27static inline int is_samsung_##name(void) \
28{ \
29 return ((samsung_cpu_id & mask) == (id & mask)); \
30}
31
32IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
33IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
34
35#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
36# define soc_is_s3c6400() is_samsung_s3c6400()
37# define soc_is_s3c6410() is_samsung_s3c6410()
38# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
39#else
40# define soc_is_s3c6400() 0
41# define soc_is_s3c6410() 0
42# define soc_is_s3c64xx() 0
43#endif
44
45#ifndef MHZ
46#define MHZ (1000*1000)
47#endif
48
49#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
50
51/* forward declaration */
52struct s3c24xx_uart_resources;
53struct platform_device;
54struct s3c2410_uartcfg;
55struct map_desc;
56
57/* per-cpu initialisation function table. */
58
59struct cpu_table {
60 unsigned long idcode;
61 unsigned long idmask;
62 void (*map_io)(void);
63 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
64 int (*init)(void);
65 const char *name;
66};
67
68extern void s3c_init_cpu(unsigned long idcode,
69 struct cpu_table *cpus, unsigned int cputab_size);
70
71/* core initialisation functions */
72extern void s3c64xx_init_cpu(void);
73
74extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
75extern void s3c24xx_init_uartdevs(char *name,
76 struct s3c24xx_uart_resources *res,
77 struct s3c2410_uartcfg *cfg, int no);
78
79extern const struct bus_type s3c6410_subsys;
80
81#endif
82

source code of linux/arch/arm/mach-s3c/cpu.h