blob: 20ff98d05c537a5b39bf7a36e8eefc5931a4c9af [file] [log] [blame]
Krzysztof Kozlowski4490e3c2017-12-25 20:54:35 +01001/* SPDX-License-Identifier: GPL-2.0 */
2/*
Kukjin Kimc06af3c2011-08-20 02:18:18 +09003 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Copyright (c) 2004-2005 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
8 *
Kukjin Kimc06af3c2011-08-20 02:18:18 +09009 * Header file for Samsung CPU support
Krzysztof Kozlowski4490e3c2017-12-25 20:54:35 +010010 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12/* todo - fix when rmk changes iodescs to use `void __iomem *` */
13
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010014#ifndef __SAMSUNG_PLAT_CPU_H
15#define __SAMSUNG_PLAT_CPU_H
16
Kukjin Kimc06af3c2011-08-20 02:18:18 +090017extern unsigned long samsung_cpu_id;
18
Tomasz Figa04241062014-03-18 07:28:09 +090019#define S3C2410_CPU_ID 0x32410000
20#define S3C2410_CPU_MASK 0xFFFFFFFF
21
Kukjin Kimc06af3c2011-08-20 02:18:18 +090022#define S3C24XX_CPU_ID 0x32400000
23#define S3C24XX_CPU_MASK 0xFFF00000
24
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080025#define S3C2412_CPU_ID 0x32412000
26#define S3C2412_CPU_MASK 0xFFFFF000
27
Kukjin Kimc06af3c2011-08-20 02:18:18 +090028#define S3C6400_CPU_ID 0x36400000
29#define S3C6410_CPU_ID 0x36410000
Mark Brown2747f5e562011-09-05 19:11:40 +090030#define S3C64XX_CPU_MASK 0xFFFFF000
Kukjin Kimc06af3c2011-08-20 02:18:18 +090031
Kukjin Kimc06af3c2011-08-20 02:18:18 +090032#define S5PV210_CPU_ID 0x43110000
33#define S5PV210_CPU_MASK 0xFFFFF000
34
Kukjin Kimc06af3c2011-08-20 02:18:18 +090035#define IS_SAMSUNG_CPU(name, id, mask) \
36static inline int is_samsung_##name(void) \
37{ \
38 return ((samsung_cpu_id & mask) == (id & mask)); \
39}
40
Tomasz Figa04241062014-03-18 07:28:09 +090041IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
Kukjin Kimc06af3c2011-08-20 02:18:18 +090042IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080043IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
Mark Brown0f4e54c2011-10-18 08:39:57 +090044IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
45IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
Kukjin Kimc06af3c2011-08-20 02:18:18 +090046
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()
Tomasz Figa04241062014-03-18 07:28:09 +090052# define soc_is_s3c2410() is_samsung_s3c2410()
Kukjin Kimc06af3c2011-08-20 02:18:18 +090053#else
54# define soc_is_s3c24xx() 0
Tomasz Figa04241062014-03-18 07:28:09 +090055# define soc_is_s3c2410() 0
Kukjin Kimc06af3c2011-08-20 02:18:18 +090056#endif
57
Heiko Stuebner9eecbe52013-02-12 10:12:06 -080058#if defined(CONFIG_CPU_S3C2412)
59# define soc_is_s3c2412() is_samsung_s3c2412()
60#else
61# define soc_is_s3c2412() 0
62#endif
63
Kukjin Kimc06af3c2011-08-20 02:18:18 +090064#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
Tomasz Figa57a23122013-08-26 02:00:37 +090065# define soc_is_s3c6400() is_samsung_s3c6400()
66# define soc_is_s3c6410() is_samsung_s3c6410()
Mark Brown0f4e54c2011-10-18 08:39:57 +090067# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
Kukjin Kimc06af3c2011-08-20 02:18:18 +090068#else
Tomasz Figa57a23122013-08-26 02:00:37 +090069# define soc_is_s3c6400() 0
70# define soc_is_s3c6410() 0
Kukjin Kimc06af3c2011-08-20 02:18:18 +090071# define soc_is_s3c64xx() 0
72#endif
73
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +000074#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Sachin Kamatc4c71352012-06-20 16:34:25 +090076#ifndef KHZ
77#define KHZ (1000)
78#endif
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080#ifndef MHZ
81#define MHZ (1000*1000)
82#endif
83
Ben Dooksa5030592008-10-21 14:06:43 +010084#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86/* forward declaration */
Ben Dooks66a9b492006-06-18 23:04:05 +010087struct s3c24xx_uart_resources;
88struct platform_device;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089struct s3c2410_uartcfg;
90struct map_desc;
91
Ben Dooks74b265d2008-10-21 14:06:31 +010092/* per-cpu initialisation function table. */
93
94struct 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
104extern void s3c_init_cpu(unsigned long idcode,
105 struct cpu_table *cpus, unsigned int cputab_size);
106
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107/* core initialisation functions */
108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
110
Kukjin Kime6d1cb92011-08-20 12:18:07 +0900111extern void s3c64xx_init_cpu(void);
Kukjin Kim56b20922011-08-20 13:41:21 +0900112
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
114
115extern void s3c24xx_init_clocks(int xtal);
116
Ben Dooks66a9b492006-06-18 23:04:05 +0100117extern void s3c24xx_init_uartdevs(char *name,
118 struct s3c24xx_uart_resources *res,
119 struct s3c2410_uartcfg *cfg, int no);
120
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200121extern struct syscore_ops s3c2410_pm_syscore_ops;
122extern struct syscore_ops s3c2412_pm_syscore_ops;
123extern struct syscore_ops s3c2416_pm_syscore_ops;
124extern struct syscore_ops s3c244x_pm_syscore_ops;
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200125
Kay Sievers4a858cf2011-12-21 16:01:38 -0800126extern struct bus_type s3c6410_subsys;
Ben Dooks1deb5072008-12-12 00:24:31 +0000127
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +0100128#endif