Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
0004  *      http://www.samsung.com/
0005  *
0006  * Copyright (c) 2004-2005 Simtec Electronics
0007  *  Ben Dooks <ben@simtec.co.uk>
0008  *
0009  * Header file for Samsung CPU support
0010  */
0011 
0012 /* todo - fix when rmk changes iodescs to use `void __iomem *` */
0013 
0014 #ifndef __SAMSUNG_PLAT_CPU_H
0015 #define __SAMSUNG_PLAT_CPU_H
0016 
0017 extern unsigned long samsung_cpu_id;
0018 
0019 #define S3C2410_CPU_ID      0x32410000
0020 #define S3C2410_CPU_MASK    0xFFFFFFFF
0021 
0022 #define S3C24XX_CPU_ID      0x32400000
0023 #define S3C24XX_CPU_MASK    0xFFF00000
0024 
0025 #define S3C2412_CPU_ID      0x32412000
0026 #define S3C2412_CPU_MASK    0xFFFFF000
0027 
0028 #define S3C6400_CPU_ID      0x36400000
0029 #define S3C6410_CPU_ID      0x36410000
0030 #define S3C64XX_CPU_MASK    0xFFFFF000
0031 
0032 #define S5PV210_CPU_ID      0x43110000
0033 #define S5PV210_CPU_MASK    0xFFFFF000
0034 
0035 #define IS_SAMSUNG_CPU(name, id, mask)      \
0036 static inline int is_samsung_##name(void)   \
0037 {                       \
0038     return ((samsung_cpu_id & mask) == (id & mask));    \
0039 }
0040 
0041 IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
0042 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
0043 IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
0044 IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
0045 IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
0046 
0047 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
0048     defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
0049     defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
0050     defined(CONFIG_CPU_S3C2443)
0051 # define soc_is_s3c24xx()   is_samsung_s3c24xx()
0052 # define soc_is_s3c2410()   is_samsung_s3c2410()
0053 #else
0054 # define soc_is_s3c24xx()   0
0055 # define soc_is_s3c2410()   0
0056 #endif
0057 
0058 #if defined(CONFIG_CPU_S3C2412)
0059 # define soc_is_s3c2412()   is_samsung_s3c2412()
0060 #else
0061 # define soc_is_s3c2412()   0
0062 #endif
0063 
0064 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
0065 # define soc_is_s3c6400()   is_samsung_s3c6400()
0066 # define soc_is_s3c6410()   is_samsung_s3c6410()
0067 # define soc_is_s3c64xx()   (is_samsung_s3c6400() || is_samsung_s3c6410())
0068 #else
0069 # define soc_is_s3c6400()   0
0070 # define soc_is_s3c6410()   0
0071 # define soc_is_s3c64xx()   0
0072 #endif
0073 
0074 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
0075 
0076 #ifndef KHZ
0077 #define KHZ (1000)
0078 #endif
0079 
0080 #ifndef MHZ
0081 #define MHZ (1000*1000)
0082 #endif
0083 
0084 #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
0085 
0086 /* forward declaration */
0087 struct s3c24xx_uart_resources;
0088 struct platform_device;
0089 struct s3c2410_uartcfg;
0090 struct map_desc;
0091 
0092 /* per-cpu initialisation function table. */
0093 
0094 struct cpu_table {
0095     unsigned long   idcode;
0096     unsigned long   idmask;
0097     void        (*map_io)(void);
0098     void        (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
0099     void        (*init_clocks)(int xtal);
0100     int     (*init)(void);
0101     const char  *name;
0102 };
0103 
0104 extern void s3c_init_cpu(unsigned long idcode,
0105              struct cpu_table *cpus, unsigned int cputab_size);
0106 
0107 /* core initialisation functions */
0108 
0109 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
0110 
0111 extern void s3c64xx_init_cpu(void);
0112 
0113 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
0114 
0115 extern void s3c24xx_init_clocks(int xtal);
0116 
0117 extern void s3c24xx_init_uartdevs(char *name,
0118                   struct s3c24xx_uart_resources *res,
0119                   struct s3c2410_uartcfg *cfg, int no);
0120 
0121 extern struct syscore_ops s3c2410_pm_syscore_ops;
0122 extern struct syscore_ops s3c2412_pm_syscore_ops;
0123 extern struct syscore_ops s3c2416_pm_syscore_ops;
0124 extern struct syscore_ops s3c244x_pm_syscore_ops;
0125 
0126 extern struct bus_type s3c6410_subsys;
0127 
0128 #endif