1/* linux/arch/arm/plat-samsung/include/plat/cpu.h 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 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation. 14*/ 15 16/* todo - fix when rmk changes iodescs to use `void __iomem *` */ 17 18#ifndef __SAMSUNG_PLAT_CPU_H 19#define __SAMSUNG_PLAT_CPU_H 20 21extern unsigned long samsung_cpu_id; 22 23#define S3C2410_CPU_ID 0x32410000 24#define S3C2410_CPU_MASK 0xFFFFFFFF 25 26#define S3C24XX_CPU_ID 0x32400000 27#define S3C24XX_CPU_MASK 0xFFF00000 28 29#define S3C2412_CPU_ID 0x32412000 30#define S3C2412_CPU_MASK 0xFFFFF000 31 32#define S3C6400_CPU_ID 0x36400000 33#define S3C6410_CPU_ID 0x36410000 34#define S3C64XX_CPU_MASK 0xFFFFF000 35 36#define S5PV210_CPU_ID 0x43110000 37#define S5PV210_CPU_MASK 0xFFFFF000 38 39#define IS_SAMSUNG_CPU(name, id, mask) \ 40static inline int is_samsung_##name(void) \ 41{ \ 42 return ((samsung_cpu_id & mask) == (id & mask)); \ 43} 44 45IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK) 46IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) 47IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) 48IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 49IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 50 51#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 52 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 53 defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \ 54 defined(CONFIG_CPU_S3C2443) 55# define soc_is_s3c24xx() is_samsung_s3c24xx() 56# define soc_is_s3c2410() is_samsung_s3c2410() 57#else 58# define soc_is_s3c24xx() 0 59# define soc_is_s3c2410() 0 60#endif 61 62#if defined(CONFIG_CPU_S3C2412) 63# define soc_is_s3c2412() is_samsung_s3c2412() 64#else 65# define soc_is_s3c2412() 0 66#endif 67 68#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 69# define soc_is_s3c6400() is_samsung_s3c6400() 70# define soc_is_s3c6410() is_samsung_s3c6410() 71# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) 72#else 73# define soc_is_s3c6400() 0 74# define soc_is_s3c6410() 0 75# define soc_is_s3c64xx() 0 76#endif 77 78#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 79 80#ifndef KHZ 81#define KHZ (1000) 82#endif 83 84#ifndef MHZ 85#define MHZ (1000*1000) 86#endif 87 88#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) 89 90/* forward declaration */ 91struct s3c24xx_uart_resources; 92struct platform_device; 93struct s3c2410_uartcfg; 94struct map_desc; 95 96/* per-cpu initialisation function table. */ 97 98struct cpu_table { 99 unsigned long idcode; 100 unsigned long idmask; 101 void (*map_io)(void); 102 void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); 103 void (*init_clocks)(int xtal); 104 int (*init)(void); 105 const char *name; 106}; 107 108extern void s3c_init_cpu(unsigned long idcode, 109 struct cpu_table *cpus, unsigned int cputab_size); 110 111/* core initialisation functions */ 112 113extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); 114 115extern void s3c64xx_init_cpu(void); 116 117extern unsigned int samsung_rev(void); 118 119extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); 120 121extern void s3c24xx_init_clocks(int xtal); 122 123extern void s3c24xx_init_uartdevs(char *name, 124 struct s3c24xx_uart_resources *res, 125 struct s3c2410_uartcfg *cfg, int no); 126 127extern struct syscore_ops s3c2410_pm_syscore_ops; 128extern struct syscore_ops s3c2412_pm_syscore_ops; 129extern struct syscore_ops s3c2416_pm_syscore_ops; 130extern struct syscore_ops s3c244x_pm_syscore_ops; 131 132/* system device subsystems */ 133 134extern struct bus_type s3c2410_subsys; 135extern struct bus_type s3c2410a_subsys; 136extern struct bus_type s3c2412_subsys; 137extern struct bus_type s3c2416_subsys; 138extern struct bus_type s3c2440_subsys; 139extern struct bus_type s3c2442_subsys; 140extern struct bus_type s3c2443_subsys; 141extern struct bus_type s3c6410_subsys; 142 143#endif 144